Fixed unrecognized application/json and velocity template.
Change-Id: I2c718fbdba86fcdc20fd20893c3c8f803809f460
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/MailService.java b/full/src/main/java/de/ids_mannheim/korap/service/MailService.java
index 75d5176..ff05bbe 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/MailService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/MailService.java
@@ -45,7 +45,7 @@
MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
message.setTo(new InternetAddress(invitee.getEmail()));
message.setFrom(sender);
- message.setSubject("Invitation to join group");
+ message.setSubject("Invitation to join "+groupName);
message.setText(prepareText(inviteeName, groupName, inviter),
true);
}
@@ -62,12 +62,8 @@
context.put("inviter", inviter);
StringWriter stringWriter = new StringWriter();
-// URL url = getClass().getClassLoader().getResource("notification.vm");
-// System.out.println(url);
-// Template t = velocityEngine.getTemplate(url.toString());
-// System.out.println(t);
- velocityEngine.mergeTemplate("notification.vm",
+ velocityEngine.mergeTemplate("templates/notification.vm",
StandardCharsets.UTF_8.name(), context, stringWriter);
String message = stringWriter.toString();
diff --git a/full/src/main/resources/WEB-INF/web.xml b/full/src/main/resources/WEB-INF/web.xml
deleted file mode 100644
index 4c2a254..0000000
--- a/full/src/main/resources/WEB-INF/web.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resource-ref>
- <res-ref-name>mail/Session</res-ref-name>
- <res-type>javax.mail.Session</res-type>
- <res-auth>Container</res-auth>
-</resource-ref>
\ No newline at end of file
diff --git a/full/src/main/resources/log4j.properties b/full/src/main/resources/log4j.properties
index e688b81..c747b68 100644
--- a/full/src/main/resources/log4j.properties
+++ b/full/src/main/resources/log4j.properties
@@ -4,9 +4,10 @@
log4j.rootLogger=ERROR, stdout, debugLog
log4j.logger.log=ERROR, errorLog
-#log4j.logger.de.ids_mannheim.korap.service.VirtualCorpusService = error, debugLog
#log4j.logger.de.ids_mannheim.korap.web.controller.AuthenticationController = debug, debugLog, stdout
-#log4j.logger.de.ids_mannheim.korap.service.UserGroupService= stdout, debugLog
+#log4j.logger.de.ids_mannheim.korap.service.UserGroupService= debug, stdout, debugLog
+#log4j.logger.de.ids_mannheim.korap.rewrite.CollectionRewrite= debug, stdout, debugLog
+#log4j.logger.de.ids_mannheim.korap.service.MailService= debug, stdout, debugLog
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
diff --git a/full/src/main/resources/templates/notification.vm b/full/src/main/resources/templates/notification.vm
new file mode 100644
index 0000000..254ad83
--- /dev/null
+++ b/full/src/main/resources/templates/notification.vm
@@ -0,0 +1,12 @@
+<html>
+ <body>
+ <h3>Hi $username,</h3>
+ <p> you have been invited to group $group by $inviter! </p>
+ <p> Please login to <a href="https://korap.ids-mannheim.de/kalamar">KorAP</a> with your
+ account to accept or reject this invitation within 30 minutes. </p>
+ <p>After joining a group, you will be able to access virtual corpora shared with members of
+ the group. If you would like share your virtual corpus to a group, please contact the
+ group admin.</p>
+ <p> This is an automated generated email. Please do not reply directly to this e-mail. </p>
+ </body>
+</html>
\ No newline at end of file
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
index f5f44cb..be39d02 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
@@ -445,8 +445,10 @@
assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals(StatusCodes.GROUP_MEMBER_EXISTS,
node.at("/errors/0/0").asInt());
- assertEquals("Username marlin with status PENDING exists in the user-group "
- + "dory group", node.at("/errors/0/1").asText());
+ assertEquals(
+ "Username marlin with status PENDING exists in the user-group "
+ + "dory group",
+ node.at("/errors/0/1").asText());
assertEquals("[marlin, PENDING, dory group]",
node.at("/errors/0/2").asText());
}
@@ -470,8 +472,7 @@
"pass"))
.entity(userGroup).post(ClientResponse.class);
- String entity = response.getEntity(String.class);
- System.out.println(entity);
+ String entity = response.getEntity(String.class);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
// check member
@@ -653,7 +654,7 @@
node.at("/errors/0/1").asText());
assertEquals("[pearl, dory group]", node.at("/errors/0/2").asText());
}
-
+
@Test
public void testUnsubscribePendingMember ()
throws UniformInterfaceException, ClientHandlerException,
@@ -661,7 +662,7 @@
JsonNode node = retrieveUserGroups("marlin");
assertEquals(2, node.size());
-
+
MultivaluedMap<String, String> form = new MultivaluedMapImpl();
// dory group
form.add("groupId", "2");
@@ -678,9 +679,9 @@
// System.out.println(entity);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
- node = retrieveUserGroups("marlin");
+ node = retrieveUserGroups("marlin");
assertEquals(1, node.size());
-
+
// invite marlin to dory group to set back the GroupMemberStatus.PENDING
testInviteDeletedMember();
}