You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/28 15:34:23 UTC
svn commit: r1439425 - in /syncope/trunk:
client/src/main/java/org/apache/syncope/client/services/proxy/
core/src/main/java/org/apache/syncope/core/services/
core/src/test/java/org/apache/syncope/core/rest/
Author: jbernhardt
Date: Mon Jan 28 14:34:22 2013
New Revision: 1439425
URL: http://svn.apache.org/viewvc?rev=1439425&view=rev
Log:
[SYNCOPE-231] Fixing Notification CXF Test
Modified:
syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java?rev=1439425&r1=1439424&r2=1439425&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java Mon Jan 28 14:34:22 2013
@@ -24,6 +24,7 @@ import java.util.List;
import javax.ws.rs.core.Response;
+import org.apache.syncope.common.SyncopeConstants;
import org.apache.syncope.common.services.NotificationService;
import org.apache.syncope.common.to.NotificationTO;
import org.springframework.web.client.RestTemplate;
@@ -51,7 +52,7 @@ public class NotificationServiceProxy ex
NotificationTO notification = getRestTemplate().postForObject(baseUrl + "notification/create.json", notificationTO,
NotificationTO.class);
URI location = URI.create(baseUrl + "notification/read/" + notification.getId() + ".json");
- return Response.created(location).entity(notification.getId()).build();
+ return Response.created(location).header(SyncopeConstants.REST_HEADER_ID, notification.getId()).build();
}
@Override
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java?rev=1439425&r1=1439424&r2=1439425&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java Mon Jan 28 14:34:22 2013
@@ -21,7 +21,6 @@ package org.apache.syncope.core.services
import java.net.URI;
import java.util.List;
-import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
@@ -37,11 +36,11 @@ public class NotificationServiceImpl imp
@Autowired
private NotificationController notificationController;
-
+
private UriInfo uriInfo;
@Override
- public Response create(NotificationTO notificationTO) {
+ public Response create(final NotificationTO notificationTO) {
try {
NotificationTO createdNotificationTO = notificationController.createInternal(notificationTO);
URI location = uriInfo.getAbsolutePathBuilder().path("" + createdNotificationTO.getId()).build();
@@ -52,7 +51,7 @@ public class NotificationServiceImpl imp
}
@Override
- public NotificationTO read(@PathParam("notificationId") Long notificationId) throws javax.ws.rs.NotFoundException {
+ public NotificationTO read(final Long notificationId) {
try {
return notificationController.read(notificationId);
} catch (NotFoundException e) {
@@ -66,8 +65,8 @@ public class NotificationServiceImpl imp
}
@Override
- public NotificationTO update(@PathParam("notificationId") Long notificationId,
- NotificationTO notificationTO) {
+ public NotificationTO update(final Long notificationId,
+ final NotificationTO notificationTO) {
try {
return notificationController.update(notificationTO);
} catch (NotFoundException e) {
@@ -76,7 +75,7 @@ public class NotificationServiceImpl imp
}
@Override
- public NotificationTO delete(@PathParam("notificationId") Long notificationId) {
+ public NotificationTO delete(final Long notificationId) {
try {
return notificationController.delete(notificationId);
} catch (NotFoundException e) {
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java?rev=1439425&r1=1439424&r2=1439425&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java Mon Jan 28 14:34:22 2013
@@ -69,8 +69,7 @@ public class NotificationTestITCase exte
notificationTO.setRecipients(recipients);
Response response = notificationService.create(notificationTO);
- Long notificationId = (Long) response.getEntity();
- NotificationTO actual = notificationService.read(notificationId);
+ NotificationTO actual = getObject(response, NotificationTO.class, notificationService);
assertNotNull(actual);
assertNotNull(actual.getId());
@@ -106,7 +105,7 @@ public class NotificationTestITCase exte
@Test
public void delete() {
- NotificationTO notification = buildNotificationTO();
+ NotificationTO notification = buildNotificationTO();
notification.setSelfAsRecipient(true);
Response response = notificationService.create(notification);
notification = getObject(response, NotificationTO.class, notificationService);
@@ -132,8 +131,7 @@ public class NotificationTestITCase exte
SyncopeClientException exception = null;
try {
Response response = notificationService.create(notificationTO);
- Long notificationId = (Long) response.getEntity();
- actual = notificationService.read(notificationId);
+ actual = getObject(response, NotificationTO.class, notificationService);
} catch (SyncopeClientCompositeErrorException e) {
exception = e.getException(SyncopeClientExceptionType.InvalidNotification);
}
@@ -144,7 +142,7 @@ public class NotificationTestITCase exte
assertEquals(actual, notificationTO);
}
- private NotificationTO buildNotificationTO() {
+ private NotificationTO buildNotificationTO() {
NotificationTO notificationTO = new NotificationTO();
notificationTO.setTraceLevel(TraceLevel.SUMMARY);
notificationTO.addEvent("create");
@@ -166,6 +164,6 @@ public class NotificationTestITCase exte
notificationTO.setSender("syncope@syncope.apache.org");
notificationTO.setSubject("Test notification");
notificationTO.setTemplate("test");
- return notificationTO;
- }
+ return notificationTO;
+ }
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1439425&r1=1439424&r2=1439425&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Mon Jan 28 14:34:22 2013
@@ -528,8 +528,7 @@ public class TaskTestITCase extends Abst
notification.setTemplate("optin");
Response response = notificationService.create(notification);
- Long notificationId = (Long) response.getEntity();
- notification = notificationService.read(notificationId);
+ notification = getObject(response, NotificationTO.class, notificationService);
assertNotNull(notification);
// 2. create user