You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by cs...@apache.org on 2013/02/01 18:52:57 UTC
svn commit: r1441557 - in
/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest:
AbstractTest.java ResourceTestITCase.java
Author: cschneider
Date: Fri Feb 1 17:52:57 2013
New Revision: 1441557
URL: http://svn.apache.org/viewvc?rev=1441557&view=rev
Log:
SYNCOPE-231 Fix for create issue in ResourceTest
Modified:
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1441557&r1=1441556&r2=1441557&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java Fri Feb 1 17:52:57 2013
@@ -71,6 +71,7 @@ import org.apache.syncope.common.service
import org.apache.syncope.common.to.AbstractSchemaTO;
import org.apache.syncope.common.to.AttributeTO;
import org.apache.syncope.common.to.PolicyTO;
+import org.apache.syncope.common.to.ResourceTO;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
@@ -388,4 +389,15 @@ public abstract class AbstractTest {
}
return response;
}
+
+ protected Response createResource(ResourceService resourceService, ResourceTO resourceTO) {
+ Response response = resourceService.create(resourceTO);
+ if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
+ Exception ex = clientExceptionMapper.fromResponse(response);
+ if (ex != null) {
+ throw (RuntimeException) ex;
+ }
+ }
+ return response;
+ }
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java?rev=1441557&r1=1441556&r2=1441557&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java Fri Feb 1 17:52:57 2013
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.core.rest;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -182,12 +183,10 @@ public class ResourceTestITCase extends
resourceTO.setUmapping(mapping);
- Throwable t = null;
try {
- resourceService.create(resourceTO);
+ createResource(resourceService,resourceTO);
+ fail("Create should not have worked");
} catch (SyncopeClientCompositeErrorException e) {
- t = e;
-
SyncopeClientException requiredValueMissing = e
.getException(SyncopeClientExceptionType.RequiredValuesMissing);
assertNotNull(requiredValueMissing);
@@ -195,7 +194,6 @@ public class ResourceTestITCase extends
assertEquals(1, requiredValueMissing.getElements().size());
assertEquals("intAttrName", requiredValueMissing.getElements().iterator().next());
}
- assertNotNull(t);
}
@Test(expected = SyncopeClientCompositeErrorException.class)
@@ -220,7 +218,7 @@ public class ResourceTestITCase extends
resourceTO.setUmapping(mapping);
- resourceService.create(resourceTO);
+ createResource(resourceService, resourceTO);
}
@Test