You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by as...@apache.org on 2013/01/24 13:07:22 UTC

svn commit: r1437970 - in /syncope/trunk/core/src: main/java/org/apache/syncope/core/rest/utils/ test/java/org/apache/syncope/core/rest/ test/resources/

Author: ashakirin
Date: Thu Jan 24 12:07:22 2013
New Revision: 1437970

URL: http://svn.apache.org/viewvc?rev=1437970&view=rev
Log:
[SYNCOPE-289] Prepared client configuration and abstract test class

Modified:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java
    syncope/trunk/core/src/test/resources/restClientContext.xml

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java Thu Jan 24 12:07:22 2013
@@ -186,7 +186,10 @@ public class RestServiceExceptionMapper 
         Response response = null;
         ResponseBuilder responseBuilder = Response.status(Response.Status.NOT_FOUND);
 
-        if (ex instanceof NotFoundException) {
+        if (ex instanceof javax.ws.rs.NotFoundException) {
+            response = buildResponse(responseBuilder, SyncopeClientExceptionType.NotFound, ex, null);
+
+        } else if (ex instanceof NotFoundException) {
             response = buildResponse(responseBuilder, SyncopeClientExceptionType.NotFound, ex, null);
 
         } else if (ex instanceof MissingConfKeyException) {
@@ -201,7 +204,10 @@ public class RestServiceExceptionMapper 
         Response response = null;
         ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
 
-        if (ex instanceof InvalidEntityException) {
+        if (ex instanceof javax.ws.rs.BadRequestException) {
+            response = buildResponse(responseBuilder, SyncopeClientExceptionType.Unknown, ex, null);
+        
+        } else if (ex instanceof InvalidEntityException) {
             SyncopeClientExceptionType exType = SyncopeClientExceptionType.valueOf("Invalid"
                     + ((InvalidEntityException) ex).getEntityClassSimpleName());
 

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=1437970&r1=1437969&r2=1437970&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 Thu Jan 24 12:07:22 2013
@@ -21,10 +21,16 @@ package org.apache.syncope.core.rest;
 import static org.junit.Assert.assertNotNull;
 
 import java.net.URI;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.UUID;
 
 import javax.sql.DataSource;
+import javax.ws.rs.core.MediaType;
 
+import org.apache.cxf.jaxrs.client.Client;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.syncope.client.http.PreemptiveAuthHttpRequestFactory;
@@ -48,6 +54,7 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.services.EntitlementService;
 import org.apache.syncope.common.services.LoggerService;
 import org.apache.syncope.common.services.NotificationService;
+import org.apache.syncope.common.services.PolicyService;
 import org.apache.syncope.common.services.ReportService;
 import org.apache.syncope.common.services.ResourceService;
 import org.apache.syncope.common.services.RoleService;
@@ -59,14 +66,16 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.to.AttributeTO;
 import org.junit.Before;
 import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.TestContextManager;
 import org.springframework.web.client.RestTemplate;
 
-@RunWith(SpringJUnit4ClassRunner.class)
+@RunWith(Parameterized.class)
 @ContextConfiguration(locations = {"classpath:restClientContext.xml", "classpath:testJDBCContext.xml"})
 public abstract class AbstractTest {
 
@@ -81,9 +90,18 @@ public abstract class AbstractTest {
 
     protected static final String ADMIN_PWD = "password";
 
+    protected boolean activatedCXF;
+    
     @Autowired
     private RestTemplate restTemplate;
 
+    protected String contentType;
+    
+    private TestContextManager testContextManager;
+    
+    @Autowired
+    protected JAXRSClientFactoryBean restClientFactory;
+
     @Autowired
     protected DataSource testDataSource;
 
@@ -113,26 +131,28 @@ public abstract class AbstractTest {
 
     protected UserRequestService userRequestService;
 
-    protected PolicyServiceProxy policyService;
-
-    protected static String getUUIDString() {
-        return UUID.randomUUID().toString().substring(0, 8);
+    protected PolicyService policyService;
+    
+    private void setupContext() throws Exception {
+        this.testContextManager = new TestContextManager(getClass());
+        this.testContextManager.prepareTestInstance(this);
     }
 
-    protected static AttributeTO attributeTO(final String schema, final String value) {
-        AttributeTO attr = new AttributeTO();
-        attr.setSchema(schema);
-        attr.addValue(value);
-        return attr;
+    protected void activateCXF() {
+        activatedCXF = true;
     }
-
-    protected static AttributeMod attributeMod(final String schema, final String valueToBeAdded) {
-        AttributeMod attr = new AttributeMod();
-        attr.setSchema(schema);
-        attr.addValueToBeAdded(valueToBeAdded);
-        return attr;
+    
+    @Before
+    public void setup() throws Exception {
+        setupContext();
+        if (!activatedCXF) {
+            resetRestTemplate(); 
+        } else {
+            setupCXFServices();
+        }
     }
-
+    
+    // BEGIN Spring MVC Initialization
     protected void setupRestTemplate(final String uid, final String pwd) {
         PreemptiveAuthHttpRequestFactory requestFactory = ((PreemptiveAuthHttpRequestFactory) restTemplate
                 .getRequestFactory());
@@ -145,8 +165,7 @@ public abstract class AbstractTest {
         return new RestTemplate();
     }
 
-    @Before
-    public void resetRestTemplate() {
+    protected void resetRestTemplate() {
         setupRestTemplate(ADMIN_UID, ADMIN_PWD);
         userService = new UserServiceProxy(BASE_URL, restTemplate);
         roleService = new RoleServiceProxy(BASE_URL, restTemplate);
@@ -163,9 +182,98 @@ public abstract class AbstractTest {
         schemaService = new SchemaServiceProxy(BASE_URL, restTemplate);
         userRequestService = new UserRequestServiceProxy(BASE_URL, restTemplate);
     }
+    // END Spring MVC Initialization
+
+    // BEGIN CXF Initialization
+    public void setupCXFServices() throws Exception { 
+        setupContext();
+        restClientFactory.setUsername(ADMIN_UID);
+        userService = createServiceInstance(UserService.class);
+        roleService = createServiceInstance(RoleService.class);
+        resourceService = createServiceInstance(ResourceService.class);
+        entitlementService = createServiceInstance(EntitlementService.class);
+        configurationService = createServiceInstance(ConfigurationService.class);
+        connectorService = createServiceInstance(ConnectorService.class);
+        loggerService = createServiceInstance(LoggerService.class);
+        reportService = createServiceInstance(ReportService.class);
+        taskService = createServiceInstance(TaskService.class);
+        policyService = createServiceInstance(PolicyService.class);
+        workflowService = createServiceInstance(WorkflowService.class);
+        notificationService = createServiceInstance(NotificationService.class);
+        schemaService = createServiceInstance(SchemaService.class);
+        userRequestService = createServiceInstance(UserRequestService.class);
+    }
+
+    public void setupConentType(Client restClient) {
+        restClient.type(contentType).accept(contentType);
+    }
+
+    protected <T> T createServiceInstance(Class<T> serviceClass) {
+        return createServiceInstance(serviceClass, ADMIN_UID);
+    }
+    
+    protected <T> T createServiceInstance(Class<T> serviceClass, String username) {
+        return createServiceInstance(serviceClass, username, null);
+    }
+
+    protected <T> T createServiceInstance(Class<T> serviceClass, String username, String password) {
+        restClientFactory.setUsername(username);
+        restClientFactory.setPassword(password);
+        restClientFactory.setServiceClass(serviceClass);
+        T serviceProxy = restClientFactory.create(serviceClass);
+        setupConentType(WebClient.client(serviceProxy));
+        return serviceProxy;
+    }
+
+    public WebClient createWebClient(String path) {
+        WebClient wc = restClientFactory.createWebClient().to(BASE_URL, false);
+        wc.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE);
+        wc.path(path);
+        return wc;
+    }
+    // END CXF Initialization
 
-    public <T> T getObject(final URI location, final Class<T> type) {
+    public <T> T getObject(final URI location, final Class<T> type, final Object serviceProxy) {
+        if (!activatedCXF) {
+            return getObjectSpring(location, type);
+        } else {
+            return resolveObjectCXF(location, type, serviceProxy);
+        }
+    }
+
+    public <T> T getObjectSpring(final URI location, final Class<T> type) {
         assertNotNull(location);
         return restTemplate.getForEntity(location, type).getBody();
     }
+    
+    public static <T> T resolveObjectCXF(final URI location, final Class<T> type, final Object serviceProxy) {
+        WebClient webClient = WebClient.fromClient(WebClient.client(serviceProxy));
+        webClient.to(location.toString(), false);
+
+        return webClient.get(type);
+    }
+
+    protected static String getUUIDString() {
+        return UUID.randomUUID().toString().substring(0, 8);
+    }
+
+    protected static AttributeTO attributeTO(final String schema, final String value) {
+        AttributeTO attr = new AttributeTO();
+        attr.setSchema(schema);
+        attr.addValue(value);
+        return attr;
+    }
+
+    protected static AttributeMod attributeMod(final String schema, final String valueToBeAdded) {
+        AttributeMod attr = new AttributeMod();
+        attr.setSchema(schema);
+        attr.addValueToBeAdded(valueToBeAdded);
+        return attr;
+    }
+
+    @Parameters
+    public static Collection<Object[]> data() {
+      Object[][] data = new Object[][]{};
+      return Arrays.asList(data);
+    }
 }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java Thu Jan 24 12:07:22 2013
@@ -34,7 +34,6 @@ import org.apache.syncope.common.search.
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.SchemaService;
 import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.ConfigurationTO;
 import org.apache.syncope.common.to.EntitlementTO;
 import org.apache.syncope.common.to.MembershipTO;
 import org.apache.syncope.common.to.RoleTO;
@@ -88,7 +87,7 @@ public class AuthenticationTestITCase ex
 
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(response);
-        SchemaTO newSchemaTO = getObject(response.getLocation(), SchemaTO.class);
+        SchemaTO newSchemaTO = getObject(response.getLocation(), SchemaTO.class, entitlementService);
         assertEquals(schemaTO, newSchemaTO);
 
         // 2. create an user with the role created above (as admin)

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java Thu Jan 24 12:07:22 2013
@@ -20,7 +20,6 @@ package org.apache.syncope.core.rest;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.UnsupportedEncodingException;
 import java.util.List;
@@ -28,7 +27,6 @@ import java.util.List;
 import javax.ws.rs.core.Response;
 
 import org.apache.syncope.common.to.ConfigurationTO;
-import org.apache.syncope.common.to.ConnInstanceTO;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -47,7 +45,7 @@ public class ConfigurationTestITCase ext
         Response response = configurationService.create(configurationTO);
         assertNotNull(response);
         assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
-        ConfigurationTO newConfigurationTO = getObject(response.getLocation(), ConfigurationTO.class);
+        ConfigurationTO newConfigurationTO = getObject(response.getLocation(), ConfigurationTO.class, configurationService);
         assertEquals(configurationTO, newConfigurationTO);
     }
 
@@ -72,7 +70,7 @@ public class ConfigurationTestITCase ext
         Response response = configurationService.create(tokenLengthTO);
         assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
         assertNotNull(response);
-        ConfigurationTO newConfigurationTO = getObject(response.getLocation(), ConfigurationTO.class);
+        ConfigurationTO newConfigurationTO = getObject(response.getLocation(), ConfigurationTO.class, configurationService);
         assertEquals(tokenLengthTO, newConfigurationTO);
     }
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java Thu Jan 24 12:07:22 2013
@@ -135,7 +135,7 @@ public class ConnInstanceTestITCase exte
 
         Response response = connectorService.create(connectorTO);
         assertNotNull(response);
-        ConnInstanceTO actual = getObject(response.getLocation(), ConnInstanceTO.class);
+        ConnInstanceTO actual = getObject(response.getLocation(), ConnInstanceTO.class, connectorService);
 
         assertNotNull(actual);
 
@@ -271,7 +271,7 @@ public class ConnInstanceTestITCase exte
         // ----------------------------------
         Response response = connectorService.create(connInstanceTO);
         assertNotNull(response);
-        connInstanceTO = getObject(response.getLocation(), ConnInstanceTO.class);
+        connInstanceTO = getObject(response.getLocation(), ConnInstanceTO.class, connectorService);
 
         assertNotNull(connInstanceTO);
         assertTrue(connInstanceTO.getCapabilities().isEmpty());
@@ -581,7 +581,7 @@ public class ConnInstanceTestITCase exte
 
             Response response = connectorService.create(connectorTO);
             assertNotNull(response);
-            connectorTO = getObject(response.getLocation(), ConnInstanceTO.class);
+            connectorTO = getObject(response.getLocation(), ConnInstanceTO.class, configurationService);
             assertNotNull(connectorTO);
             // ----------------------------------------
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java Thu Jan 24 12:07:22 2013
@@ -65,7 +65,7 @@ public class DerivedSchemaTestITCase ext
 
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.DERIVED, schema);
         assertNotNull(response);
-        DerivedSchemaTO actual = getObject(response.getLocation(), DerivedSchemaTO.class);
+        DerivedSchemaTO actual = getObject(response.getLocation(), DerivedSchemaTO.class, schemaService);
         assertNotNull(actual);
 
         actual = schemaService.read(AttributableType.USER, SchemaService.SchemaType.DERIVED, actual.getName());

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java Thu Jan 24 12:07:22 2013
@@ -29,7 +29,6 @@ import javax.ws.rs.core.Response;
 
 import org.apache.syncope.common.to.AccountPolicyTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
-import org.apache.syncope.common.to.PolicyTO;
 import org.apache.syncope.common.to.SyncPolicyTO;
 import org.apache.syncope.common.types.PasswordPolicySpec;
 import org.apache.syncope.common.types.PolicyType;
@@ -113,7 +112,7 @@ public class PolicyTestITCase extends Ab
 
         Response response = policyService.create(PolicyType.SYNC, policy);
         assertNotNull(response);
-        SyncPolicyTO policyTO = getObject(response.getLocation(), SyncPolicyTO.class);
+        SyncPolicyTO policyTO = getObject(response.getLocation(), SyncPolicyTO.class, policyService);
 
         assertNotNull(policyTO);
         assertEquals(PolicyType.SYNC, policyTO.getType());
@@ -131,7 +130,7 @@ public class PolicyTestITCase extends Ab
         // create a new password policy using global password as a template
         Response response = policyService.create(PolicyType.PASSWORD, policy);
         assertNotNull(response);
-        policy = getObject(response.getLocation(), PasswordPolicyTO.class);
+        policy = getObject(response.getLocation(), PasswordPolicyTO.class, policyService);
 
         // read new password policy
         policy = policyService.read(PolicyType.PASSWORD, policy.getId());
@@ -157,7 +156,7 @@ public class PolicyTestITCase extends Ab
         SyncPolicyTO policy = buildSyncPolicyTO();
         Response response = policyService.create(PolicyType.SYNC, policy);
         assertNotNull(response);
-        SyncPolicyTO policyTO = getObject(response.getLocation(), SyncPolicyTO.class);
+        SyncPolicyTO policyTO = getObject(response.getLocation(), SyncPolicyTO.class, policyService);
         assertNotNull(policyTO);
 
         policyService.delete(PolicyType.SYNC, policyTO.getId());

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java Thu Jan 24 12:07:22 2013
@@ -59,14 +59,14 @@ public class SchemaTestITCase extends Ab
         assertNotNull(response);
         assertNotNull(response.getLocation());
 
-        SchemaTO newSchemaTO = getObject(response.getLocation(), SchemaTO.class);
+        SchemaTO newSchemaTO = getObject(response.getLocation(), SchemaTO.class, schemaService);
         assertEquals(schemaTO, newSchemaTO);
 
         response = schemaService.create(AttributableType.MEMBERSHIP, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(response);
         assertNotNull(response.getLocation());
 
-        newSchemaTO = getObject(response.getLocation(), SchemaTO.class);
+        newSchemaTO = getObject(response.getLocation(), SchemaTO.class, schemaService);
         assertEquals(schemaTO, newSchemaTO);
     }
 
@@ -194,7 +194,7 @@ public class SchemaTestITCase extends Ab
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(response);
         assertNotNull(response.getLocation());
-        schemaTO = getObject(response.getLocation(), SchemaTO.class);
+        schemaTO = getObject(response.getLocation(), SchemaTO.class, schemaService);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue258@syncope.apache.org");
@@ -221,7 +221,7 @@ public class SchemaTestITCase extends Ab
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(response);
         assertNotNull(response.getLocation());
-        schemaTO = getObject(response.getLocation(), SchemaTO.class);
+        schemaTO = getObject(response.getLocation(), SchemaTO.class, schemaService);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue259@syncope.apache.org");
@@ -248,7 +248,7 @@ public class SchemaTestITCase extends Ab
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.NORMAL, schemaTO);
         assertNotNull(response);
         assertNotNull(response.getLocation());
-        schemaTO = getObject(response.getLocation(), SchemaTO.class);
+        schemaTO = getObject(response.getLocation(), SchemaTO.class, schemaService);
         assertNotNull(schemaTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("issue260@syncope.apache.org");

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java Thu Jan 24 12:07:22 2013
@@ -56,7 +56,7 @@ public class UserRequestTestITCase exten
         Response response = configurationService.create(configurationTO);
         assertNotNull(response);
         assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
-        configurationTO = getObject(response.getLocation(), ConfigurationTO.class);
+        configurationTO = getObject(response.getLocation(), ConfigurationTO.class, configurationService);
         assertNotNull(configurationTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("selfcreate@syncope.apache.org");
@@ -77,7 +77,7 @@ public class UserRequestTestITCase exten
         response = configurationService.create(configurationTO);
         assertNotNull(response);
         assertEquals(org.apache.http.HttpStatus.SC_CREATED, response.getStatus());
-        configurationTO = getObject(response.getLocation(), ConfigurationTO.class);
+        configurationTO = getObject(response.getLocation(), ConfigurationTO.class, configurationService);
         assertNotNull(configurationTO);
 
         // 4. as anonymous, request user create works

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Thu Jan 24 12:07:22 2013
@@ -182,7 +182,7 @@ public class UserTestITCase extends Abst
             for (PasswordPolicyTO policyTO : policies) {
                 Response response = policyService.create(PolicyType.GLOBAL_PASSWORD, policyTO);
                 assertNotNull(response);
-                PolicyTO cPolicyTO = getObject(response.getLocation(), PasswordPolicyTO.class);
+                PolicyTO cPolicyTO = getObject(response.getLocation(), PasswordPolicyTO.class, policyService);
                 assertNotNull(cPolicyTO);
             }
         }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java Thu Jan 24 12:07:22 2013
@@ -62,7 +62,7 @@ public class VirtualSchemaTestITCase ext
         Response response = schemaService.create(AttributableType.USER, SchemaService.SchemaType.VIRTUAL, schema);
         assertNotNull(response);
         assertNotNull(response.getLocation());
-        VirtualSchemaTO actual = getObject(response.getLocation(), VirtualSchemaTO.class);
+        VirtualSchemaTO actual = getObject(response.getLocation(), VirtualSchemaTO.class, schemaService);
         assertNotNull(actual);
 
         actual = schemaService.read(AttributableType.USER, SchemaService.SchemaType.VIRTUAL, actual.getName());

Modified: syncope/trunk/core/src/test/resources/restClientContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/restClientContext.xml?rev=1437970&r1=1437969&r2=1437970&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/restClientContext.xml (original)
+++ syncope/trunk/core/src/test/resources/restClientContext.xml Thu Jan 24 12:07:22 2013
@@ -18,60 +18,117 @@ specific language governing permissions 
 under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-                           http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-  <bean id="httpClientConnManager" class="org.apache.http.impl.conn.PoolingClientConnectionManager"/>
-
-  <bean id="httpClientParams" class="org.apache.syncope.client.http.HttpClientParams">
-    <property name="parameterMap">
-      <map key-type="java.lang.String">
-        <entry>
-          <key>
-            <value>http.protocol.handle-authentication</value>
-          </key>
-          <value type="java.lang.Boolean">
-            false
-          </value>
-        </entry>
-      </map>
-    </property>
-  </bean>
-
-  <bean id="httpClientFactory" class="org.apache.syncope.client.http.PreemptiveAuthHttpRequestFactory">
-    <constructor-arg value="localhost"/>
-    <constructor-arg value="9080"/>
-    <constructor-arg value="http"/>
-    <constructor-arg ref="httpClientConnManager"/>
-    <constructor-arg ref="httpClientParams"/>
-  </bean>
-
-  <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
-    <constructor-arg ref="httpClientFactory"/>
-    <property name="messageConverters">
-      <list>
-        <ref bean="mappingJacksonHttpMessageConverter"/>
-        <ref bean="mappingXstreamHttpMessageConverter"/>
-      </list>
-    </property>
-    <property name="errorHandler">
-      <bean id="syncopeClientErrorHandler" class="org.apache.syncope.common.validation.SyncopeClientErrorHandler"/>
-    </property>
-  </bean>
-   
-  <!-- JSON (via Jackson) -->
-  <bean id="jacksonObjectMapper" class="org.apache.syncope.core.rest.data.UnwrappedObjectMapper"/>
-  <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
-    <property name="objectMapper" ref="jacksonObjectMapper"/>
-  </bean>
-   
-  <!-- XML (via XStream) -->
-  <bean id="xStreamXmlMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
-    <property name="autodetectAnnotations" value="true"/>
-  </bean>
-  <bean id="mappingXstreamHttpMessageConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
-    <constructor-arg ref="xStreamXmlMarshaller"/>
-  </bean>
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+	xmlns:util="http://www.springframework.org/schema/util"
+	xmlns:cxf="http://cxf.apache.org/core"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://cxf.apache.org/jaxrs
+        http://cxf.apache.org/schemas/jaxrs.xsd
+        http://cxf.apache.org/core 
+        http://cxf.apache.org/schemas/core.xsd
+        http://www.springframework.org/schema/util 
+        http://www.springframework.org/schema/util/spring-util.xsd">
+
+	<bean id="httpClientConnManager"
+		class="org.apache.http.impl.conn.PoolingClientConnectionManager" />
+
+	<bean id="httpClientParams" class="org.apache.syncope.client.http.HttpClientParams">
+		<property name="parameterMap">
+			<map key-type="java.lang.String">
+				<entry>
+					<key>
+						<value>http.protocol.handle-authentication</value>
+					</key>
+					<value type="java.lang.Boolean">
+						false
+					</value>
+				</entry>
+			</map>
+		</property>
+	</bean>
+
+	<bean id="httpClientFactory"
+		class="org.apache.syncope.client.http.PreemptiveAuthHttpRequestFactory">
+		<constructor-arg value="localhost" />
+		<constructor-arg value="9080" />
+		<constructor-arg value="http" />
+		<constructor-arg ref="httpClientConnManager" />
+		<constructor-arg ref="httpClientParams" />
+	</bean>
+
+	<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
+		<constructor-arg ref="httpClientFactory" />
+		<property name="messageConverters">
+			<list>
+				<ref bean="mappingJacksonHttpMessageConverter" />
+				<ref bean="mappingXstreamHttpMessageConverter" />
+			</list>
+		</property>
+		<property name="errorHandler">
+			<bean id="syncopeClientErrorHandler"
+				class="org.apache.syncope.common.validation.SyncopeClientErrorHandler" />
+		</property>
+	</bean>
+
+	<!-- JSON (via Jackson) -->
+	<bean id="jacksonObjectMapper" class="org.apache.syncope.core.rest.data.UnwrappedObjectMapper" />
+	<bean id="mappingJacksonHttpMessageConverter"
+		class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
+		<property name="objectMapper" ref="jacksonObjectMapper" />
+	</bean>
+
+	<!-- XML (via XStream) -->
+	<bean id="xStreamXmlMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
+		<property name="autodetectAnnotations" value="true" />
+	</bean>
+	<bean id="mappingXstreamHttpMessageConverter"
+		class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
+		<constructor-arg ref="xStreamXmlMarshaller" />
+	</bean>
+
+	<!-- CXF Configuration - BEGIN -->
+	<bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+		<property name="depthProperties">
+			<bean id="depthProperties" class="org.apache.cxf.staxutils.DocumentDepthProperties">
+				<property name="innerElementCountThreshold" value="500" />
+			</bean>
+		</property>
+		<property name="marshallerProperties">
+			<map>
+				<entry key="jaxb.formatted.output">
+					<value type="java.lang.Boolean">true</value>
+				</entry>
+			</map>
+		</property>
+	</bean>
+
+	<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider">
+		<property name="mapper" ref="jacksonObjectMapper" />
+	</bean>
+
+   <bean id="exceptionMapper" class="org.apache.syncope.client.rest.utils.RestClientExceptionMapper" />
+
+   <bean id="restClientFactory" class="org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean">
+      <property name="address" value="http://localhost:9080/syncope/cxf" />
+      <property name="threadSafe" value="true" />
+      <property name="username" value="admin" />
+      <property name="password" value="password" />
+      <property name="inheritHeaders" value="true" />
+      <property name="features">
+         <list>
+            <cxf:logging/>
+         </list>
+      </property>
+      <property name="providers">
+         <list>
+            <ref bean="jaxbProvider" />
+            <ref bean="jsonProvider" />
+            <ref bean="exceptionMapper" />
+         </list>
+      </property>
+   </bean>
+  <!-- CXF Configuration - END -->
 
 </beans>