]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-901: Initialize HTTPClient-based clients only within test methods annotated...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 15 Apr 2010 03:47:45 +0000 (03:47 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 15 Apr 2010 03:47:45 +0000 (03:47 +0000)
18 files changed:
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java
services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java

index beb92420a3e6502b5cc2c691edef09cc89ecf38d..a42427af94f8c89010ed4065002ecdeda540ce86 100644 (file)
@@ -56,7 +56,6 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
     private final Logger logger =
             LoggerFactory.getLogger(AccountServiceTest.class);
     // Instance variables specific to this test.
-    private AccountClient client = new AccountClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
     boolean addTenant = true;
@@ -66,7 +65,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
 
     @Override
     protected String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new AccountClient().getServicePathComponent();
     }
 
     // ---------------------------------------------------------------
@@ -86,6 +85,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("barney", "barney", "hithere08", "barney@dinoland.com",
                 true, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
 
@@ -120,6 +120,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("barney1", "barney", "hithere08", "barney@dinoland.com",
                 true, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
 
@@ -141,6 +142,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("barney", "otherUser", "hithere08", "barney@dinoland.com",
                 true, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
 
@@ -162,6 +164,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
                 true, true, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -184,6 +187,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
                 true, false, false, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -205,6 +209,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("babybop", "babybop", "hithere08", "babybop.dinoland.com",
                 true, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -226,6 +231,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
                 false, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -247,6 +253,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account =
                 createAccountInstance("babybop", "babybop", "hithere08", "babybop/dinoland.com",
                 false, true, false, false);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -269,6 +276,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         AccountsCommon account1 =
                 createAccountInstance("curious", "curious", "hithere08", "curious@george.com",
                 true, false, true, true);
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.create(account1);
         int statusCode = res.getStatus();
         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
@@ -327,6 +335,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -353,6 +362,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        AccountClient client = new AccountClient();
         ClientResponse<AccountsCommon> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -379,6 +389,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        AccountClient client = new AccountClient();
         ClientResponse<AccountsCommonList> res = client.readList();
         AccountsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -407,7 +418,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
-        ClientResponse<AccountsCommonList> res = client.readSearchList("tom", null, null);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommonList> res =
+            client.readSearchList("tom", null, null);
         AccountsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
@@ -435,7 +448,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
-        ClientResponse<AccountsCommonList> res = client.readSearchList(null, "tom", null);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommonList> res =
+            client.readSearchList(null, "tom", null);
         AccountsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
@@ -463,7 +478,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
-        ClientResponse<AccountsCommonList> res = client.readSearchList(null, null, "dinoland");
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommonList> res =
+            client.readSearchList(null, null, "dinoland");
         AccountsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
@@ -491,7 +508,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
-        ClientResponse<AccountsCommonList> res = client.readSearchList("tom", null, "jerry");
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommonList> res =
+            client.readSearchList("tom", null, "jerry");
         AccountsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
@@ -525,9 +544,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-
-        ClientResponse<AccountsCommon> res =
-                client.read(knownResourceId);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -575,8 +593,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-        ClientResponse<AccountsCommon> res =
-                client.read(knownResourceId);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -624,8 +642,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-        ClientResponse<AccountsCommon> res =
-                client.read(knownResourceId);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -667,8 +685,8 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-        ClientResponse<AccountsCommon> res =
-                client.read(knownResourceId);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -737,11 +755,12 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         //
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in updateAccount(), below.
+        AccountClient client = new AccountClient();
         AccountsCommon account =
                 createAccountInstance("simba", "simba", "tiger", "simba@lionking.com",
                 true, false, true, true);
         ClientResponse<AccountsCommon> res =
-                client.update(NON_EXISTENT_ID, account);
+            client.update(NON_EXISTENT_ID, account);
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -759,12 +778,13 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
     public void updateWrongUser(String testName) throws Exception {
 
         setupUpdate();
+
         // Submit the request to the service and store the response.
         //
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in updateAccount(), below.
-        ClientResponse<AccountsCommon> res =
-                client.read(knownResourceId);
+        AccountClient client = new AccountClient();
+        ClientResponse<AccountsCommon> res = client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -810,6 +830,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -833,6 +854,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        AccountClient client = new AccountClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -950,6 +972,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        AccountClient client = new AccountClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
index 43aabc68e561aa1097ad971ceb5b57138f9f50f8..69c62876005b3444bc63b9324b0f15e0869504cd 100644 (file)
@@ -63,8 +63,6 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
        LoggerFactory.getLogger(AcquisitionAuthRefsTest.class);
 
     // Instance variables specific to this test.
-    private AcquisitionClient acquisitionClient = new AcquisitionClient();
-    private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
     final String SERVICE_PATH_COMPONENT = "acquisitions";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
@@ -101,6 +99,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
                                                                acquisitionFundingSourceRefName,
                                                                fieldCollectorRefName );
 
+        AcquisitionClient acquisitionClient = new AcquisitionClient();
         ClientResponse<Response> res = acquisitionClient.create(multipart);
 
         int statusCode = res.getStatus();
@@ -135,6 +134,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
     protected void createPersonRefs(){
        String authRefName = 
                PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                        PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
@@ -163,6 +163,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        MultipartOutput multipart = 
                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                                refName, personInfo, personAuthClient.getItemCommonPartName());
@@ -184,6 +185,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
         testSetup(OK_STATUS, ServiceRequestType.READ,testName);
 
         // Submit the request to the service and store the response.
+        AcquisitionClient acquisitionClient = new AcquisitionClient();
         ClientResponse<MultipartInput> res = acquisitionClient.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -205,7 +207,8 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
         Assert.assertEquals(acquisition.getFieldCollector(), fieldCollectorRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = acquisitionClient.getAuthorityRefs(knownResourceId);
+        ClientResponse<AuthorityRefList> res2 =
+            acquisitionClient.getAuthorityRefs(knownResourceId);
         statusCode = res2.getStatus();
 
         if(logger.isDebugEnabled()){
@@ -252,13 +255,18 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
      */
     // @AfterClass(alwaysRun=true)
     public void cleanUp() {
+
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+
+        AcquisitionClient acquisitionClient = new AcquisitionClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : acquisitionIdsCreated) {
             ClientResponse<Response> res = acquisitionClient.delete(resourceId);
         }
+
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete persons before PersonAuth
         for (String resourceId : personIdsCreated) {
             ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
@@ -287,6 +295,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(acquisition, MediaType.APPLICATION_XML_TYPE);
+        AcquisitionClient acquisitionClient = new AcquisitionClient();
         commonPart.getHeaders().add("label", acquisitionClient.getCommonPartName());
 
         if(logger.isDebugEnabled()){
index 8ff593eddd167b2908556662a7bfd69e9918cfc6..cda330726d75230f060b55286b8378cbcbfa9698 100644 (file)
@@ -57,7 +57,6 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         LoggerFactory.getLogger(AcquisitionServiceTest.class);
 
     // Instance variables specific to this test.
-    private AcquisitionClient client = new AcquisitionClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
 
@@ -77,6 +76,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         String identifier = createIdentifier();
 
+        AcquisitionClient client = new AcquisitionClient();
         MultipartOutput multipart = createAcquisitionInstance(identifier);
         ClientResponse<Response> res = client.create(multipart);
 
@@ -197,6 +197,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupRead(testName);
 
+        AcquisitionClient client = new AcquisitionClient();
+
         // Submit the request to the service and store the response.
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
@@ -227,6 +229,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        AcquisitionClient client = new AcquisitionClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -253,6 +256,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        AcquisitionClient client = new AcquisitionClient();
         ClientResponse<AcquisitionsCommonList> res = client.readList();
         AcquisitionsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -301,8 +305,9 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-        ClientResponse<MultipartInput> res =
-                client.read(knownResourceId);
+        // Retrieve the contents of a resource to update.
+        AcquisitionClient client = new AcquisitionClient();
+        ClientResponse<MultipartInput> res = client.read(knownResourceId);
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": read status = " + res.getStatus());
         }
@@ -312,6 +317,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
             logger.debug("got object to update with ID: " + knownResourceId);
         }
         MultipartInput input = (MultipartInput) res.getEntity();
+
         AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
                 client.getCommonPartName(), AcquisitionsCommon.class);
         Assert.assertNotNull(acquisition);
@@ -478,9 +484,10 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
+        AcquisitionClient client = new AcquisitionClient();
         MultipartOutput multipart = createAcquisitionInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
-                client.update(NON_EXISTENT_ID, multipart);
+            client.update(NON_EXISTENT_ID, multipart);
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -506,6 +513,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        AcquisitionClient client = new AcquisitionClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -529,6 +537,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        AcquisitionClient client = new AcquisitionClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -587,6 +596,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        AcquisitionClient client = new AcquisitionClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
@@ -598,7 +608,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
     // ---------------------------------------------------------------
     @Override
     public String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new AcquisitionClient().getServicePathComponent();
     }
 
 
@@ -614,7 +624,7 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart = multipart.addPart(acquisition,
             MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", new AcquisitionClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, acquisition common");
index 5db336dc75017fa0ad5dec8c6abb1ee3e322ab96..99358d09786daaea70a456597584db029cccb3e2 100644 (file)
@@ -59,7 +59,6 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
     private final Logger logger =
             LoggerFactory.getLogger(PermissionRoleServiceTest.class);
     // Instance variables specific to this test.
-    private PermissionRoleClient client = new PermissionRoleClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
     private Hashtable<String, String> permIds = new Hashtable<String, String>();
@@ -70,7 +69,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
 
     @Override
     protected String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new PermissionRoleClient().getServicePathComponent();
     }
 
     @BeforeClass(alwaysRun = true)
@@ -107,6 +106,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         PermissionRole permRole = createPermissionRoleInstance(permIds.get("accounts"),
                 roleIds.values().toArray(new String[0]), true, true);
+        PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<Response> res = client.create(permIds.get("accounts"), permRole);
         int statusCode = res.getStatus();
 
@@ -134,6 +134,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
 
         setupCreate(testName);
         // Submit the request to the service and store the response.
+        PermissionRoleClient client = new PermissionRoleClient();
         PermissionRole permRole = createPermissionRoleInstance(permIds.get("collectionobjects"),
                 roleIds.values().toArray(new String[0]), true, true);
         ClientResponse<Response> res = client.create(permIds.get("collectionobjects"), permRole);
@@ -184,6 +185,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<PermissionRole> res = client.read(permIds.get("accounts"), "123");
         int statusCode = res.getStatus();
 
@@ -209,6 +211,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<PermissionRole> res = client.read(NON_EXISTENT_ID, "123");
         int statusCode = res.getStatus();
 
@@ -278,6 +281,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<Response> res = client.delete(permIds.get("accounts"), "123");
         int statusCode = res.getStatus();
 
@@ -301,6 +305,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PermissionRoleClient client = new PermissionRoleClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID, "123");
         int statusCode = res.getStatus();
 
@@ -388,6 +393,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        PermissionRoleClient client = new PermissionRoleClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId, "123");
index 486e4f381b6f2df02ecfc977ac83549d7a4d7e97..ecd22aed90776d8fb166bbd6371a0fedd37927fe 100644 (file)
@@ -55,7 +55,6 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
     static private final Logger logger =
             LoggerFactory.getLogger(PermissionServiceTest.class);
     // Instance variables specific to this test.
-    private PermissionClient client = new PermissionClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
     boolean addTenant = true;
@@ -65,7 +64,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
 
     @Override
     protected String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new PermissionClient().getServicePathComponent();
     }
 
     // ---------------------------------------------------------------
@@ -90,6 +89,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
                 true,
                 true,
                 true);
+        PermissionClient client = new PermissionClient();
         ClientResponse<Response> res = client.create(permission);
         int statusCode = res.getStatus();
 
@@ -129,6 +129,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
                 false,
                 true,
                 true);
+        PermissionClient client = new PermissionClient();
         ClientResponse<Response> res = client.create(permission);
         int statusCode = res.getStatus();
         // Does it exactly match the expected status code?
@@ -156,6 +157,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
                 true,
                 true,
                 true);
+        PermissionClient client = new PermissionClient();
         ClientResponse<Response> res = client.create(permission1);
         int statusCode = res.getStatus();
         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
@@ -220,6 +222,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<Permission> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -246,6 +249,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<Permission> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -272,6 +276,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<PermissionsList> res = client.readList();
         PermissionsList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -300,6 +305,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
         PermissionsList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -338,7 +344,8 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-
+        // Retrieve the contents of a resource to update.
+        PermissionClient client = new PermissionClient();
         ClientResponse<Permission> res =
                 client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
@@ -408,6 +415,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         //
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in updatePermission(), below.
+        PermissionClient client = new PermissionClient();
         List<PermissionAction> actions = getDefaultActions();
         Permission permission = createPermissionInstance("acquisitions",
                 "default permissions for acquisitions",
@@ -443,6 +451,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -466,6 +475,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PermissionClient client = new PermissionClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -543,7 +553,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, permission common");
-            logger.debug(objectAsXmlString(permission, Permission.class));
+        logger.debug(objectAsXmlString(permission, Permission.class));
         }
         return permission;
     }
@@ -579,6 +589,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        PermissionClient client = new PermissionClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
index 6616b18b61e766ab1ffc0faa89e80b6563ebcfd4..bb609762fe2ddddfbbe156ea2e0e3bc8ab06d0eb 100644 (file)
@@ -52,7 +52,6 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     static private final Logger logger =
             LoggerFactory.getLogger(RoleServiceTest.class);
     // Instance variables specific to this test.
-    private RoleClient client = new RoleClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
     boolean addTenant = true;
@@ -62,7 +61,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
 
     @Override
     protected String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new RoleClient().getServicePathComponent();
     }
 
     // ---------------------------------------------------------------
@@ -79,6 +78,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         Role role = createRoleInstance("ROLE_USERS_TEST",
                 "all users are required to be in this role",
                 true);
@@ -113,6 +113,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         Role role = createRoleInstance("ROLE_USERS",
                 "role users",
                 true);
@@ -134,6 +135,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         Role role = createRoleInstance("ROLE_USERS",
                 "role for users",
                 false);
@@ -155,8 +157,10 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
     public void createList(String testName) throws Exception {
 
         setupCreate(testName);
+
         // Submit the request to the service and store the response.
-        Role role1 = createRoleInstance("ROLE_COLLECTIONS_MANGER_TEST",
+         RoleClient client = new RoleClient();
+       Role role1 = createRoleInstance("ROLE_COLLECTIONS_MANGER_TEST",
                 "collection manager",
                 true);
         ClientResponse<Response> res = client.create(role1);
@@ -217,6 +221,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<Role> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -243,6 +248,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -269,6 +275,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<RolesList> res = client.readList();
         RolesList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -297,6 +304,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<RolesList> res = client.readSearchList("movingImage");
         RolesList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -335,7 +343,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
-
+        RoleClient client = new RoleClient();
         ClientResponse<Role> res =
                 client.read(knownResourceId);
         if (logger.isDebugEnabled()) {
@@ -405,6 +413,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         //
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in updateRole(), below.
+        RoleClient client = new RoleClient();
         Role role = createRoleInstance("ROLE_XXX",
                 "xxx",
                 true);
@@ -435,6 +444,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -458,6 +468,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        RoleClient client = new RoleClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -532,6 +543,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        RoleClient client = new RoleClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
index 970bbbe0312788d2d52f19e8b416b15381136c31..479484d7b1e54f0dabfced542b81117621dd6450 100644 (file)
@@ -63,8 +63,6 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
        LoggerFactory.getLogger(CollectionObjectAuthRefsTest.class);
 
     // Instance variables specific to this test.
-    private CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-    private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
     final String SERVICE_PATH_COMPONENT = "collectionobjects";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
@@ -94,6 +92,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         // Create all the person refs and entities
         createPersonRefs();
         
+        CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         MultipartOutput multipart = createCollectionObjectInstance(
                                                        "Obj Title",
                                                        "ObjNum-1234",
@@ -136,6 +135,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
     protected void createPersonRefs(){
        String authRefName = 
                PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                        PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
@@ -167,6 +167,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        MultipartOutput multipart = 
                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                                refName, personInfo, personAuthClient.getItemCommonPartName());
@@ -188,6 +189,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         testSetup(OK_STATUS, ServiceRequestType.READ,testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -259,10 +261,12 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
-        // Note: Any non-success responses are ignored and not reported.
+        CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
+       // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : collectionObjectIdsCreated) {
             ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
         }
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete persons before PersonAuth
         for (String resourceId : personIdsCreated) {
             ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
@@ -295,7 +299,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", collectionObjectClient.getCommonPartName());
+        commonPart.getHeaders().add("label", new CollectionObjectClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, collectionObject common");
index b9f7bcd8048b1a8415acf0621bbf15d42c66dca6..77ecb474650db8bd9716570ee9cb24f2cc38d32e 100644 (file)
@@ -56,7 +56,6 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
     private final Logger logger =
             LoggerFactory.getLogger(CollectionObjectServiceTest.class);
     // Instance variables specific to this test.
-    private CollectionObjectClient client = new CollectionObjectClient();
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
     private boolean multivalue; //toggle
@@ -66,7 +65,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
      */
     @Override
     protected String getServicePathComponent() {
-        return client.getServicePathComponent();
+        return new CollectionObjectClient().getServicePathComponent();
     }
 
     // ---------------------------------------------------------------
@@ -83,6 +82,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         String identifier = createIdentifier();
         MultipartOutput multipart =
                 createCollectionObjectInstance(client.getCommonPartName(), identifier);
@@ -325,6 +325,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         collectionObject.setObjectName("some name");
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         MultipartOutput multipart =
                 createCollectionObjectInstance(client.getCommonPartName(), collectionObject, null);
         ClientResponse<Response> res = client.create(multipart);
@@ -378,6 +379,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -419,6 +421,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -445,6 +448,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<CollectionobjectsCommonList> res = client.readList();
         CollectionobjectsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -496,6 +500,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
 
         // Extract its common part.
+        CollectionObjectClient client = new CollectionObjectClient();
         MultipartInput input = (MultipartInput) res.getEntity();
         CollectionobjectsCommon collectionObject =
                 (CollectionobjectsCommon) extractPart(input,
@@ -536,6 +541,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
     private ClientResponse<MultipartInput> updateRetrieve(String testName, String id) {
         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<MultipartInput> res = client.read(id);
         if (logger.isDebugEnabled()) {
             logger.debug("read in updateRetrieve for " + testName + " status = " + res.getStatus());
@@ -551,6 +557,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
             CollectionobjectsCommon collectionObject) {
         MultipartOutput output = new MultipartOutput();
         OutputPart commonPart = output.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
+        CollectionObjectClient client = new CollectionObjectClient();
         commonPart.getHeaders().add("label", client.getCommonPartName());
         ClientResponse<MultipartInput> res = client.update(knownResourceId, output);
         return res;
@@ -677,6 +684,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         //
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in updateCollectionObject(), below.
+        CollectionObjectClient client = new CollectionObjectClient();
         MultipartOutput multipart =
                 createCollectionObjectInstance(client.getCommonPartName(),
                 NON_EXISTENT_ID);
@@ -719,6 +727,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         // Read an existing record for updating.
         ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
 
+        CollectionObjectClient client = new CollectionObjectClient();
         MultipartInput input = (MultipartInput) res.getEntity();
         CollectionobjectsCommon collectionObject =
                 (CollectionobjectsCommon) extractPart(input,
@@ -760,6 +769,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -783,6 +793,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        CollectionObjectClient client = new CollectionObjectClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -845,7 +856,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
-        for (String resourceId : allResourceIdsCreated) {
+       CollectionObjectClient client = new CollectionObjectClient();
+       for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
         }
@@ -986,6 +998,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
         MultipartOutput multipart = null;
 
+        CollectionObjectClient client = new CollectionObjectClient();
         if (useJaxb) {
             multipart = createCollectionObjectInstanceFromXml(testName,
                     client.getCommonPartName(), fileName);
index 17ab7ffc8226bd8d9e73c2b792438d08328faeee..c6316ad9d41933a8d70506fae1e0036a662509ba 100644 (file)
@@ -57,7 +57,6 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
        LoggerFactory.getLogger(ContactServiceTest.class);
 
     // Instance variables specific to this test.
-    private ContactClient client = new ContactClient();
     final String SERVICE_PATH_COMPONENT = "contacts";
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
@@ -76,8 +75,8 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         String identifier = createIdentifier();
-
         MultipartOutput multipart =
             ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
         ClientResponse<Response> res = client.create(multipart);
@@ -228,6 +227,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -256,6 +256,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -282,6 +283,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<ContactsCommonList> res = client.readList();
         ContactsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -328,6 +330,8 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -483,8 +487,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        ContactClient client = new ContactClient();
         MultipartOutput multipart =
                 ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
         ClientResponse<MultipartInput> res =
@@ -514,6 +517,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -537,6 +541,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        ContactClient client = new ContactClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -595,6 +600,7 @@ public class ContactServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        ContactClient client = new ContactClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
index 6c8ba602344307ec3a4f49cede011302fb8b6fe2..575a9e758b4eeba9e8c41a6eaa5558a134b44b79 100644 (file)
@@ -56,7 +56,6 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
        LoggerFactory.getLogger(DimensionServiceTest.class);
 
     // Instance variables specific to this test.
-    private DimensionClient client = new DimensionClient();
     final String SERVICE_PATH_COMPONENT = "dimensions";
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
@@ -75,8 +74,8 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         String identifier = createIdentifier();
-
         MultipartOutput multipart = createDimensionInstance(identifier);
         ClientResponse<Response> res = client.create(multipart);
 
@@ -226,6 +225,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -254,6 +254,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -280,6 +281,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         ClientResponse<DimensionsCommonList> res = client.readList();
         DimensionsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -326,6 +328,8 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        DimensionClient client = new DimensionClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -341,7 +345,6 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
                 client.getCommonPartName(), DimensionsCommon.class);
         Assert.assertNotNull(dimension);
 
-        // Update the content of this resource.
         // Update the content of this resource.
         dimension.setValue("updated-" + dimension.getValue());
         dimension.setValueDate("updated-" + dimension.getValueDate());
@@ -481,8 +484,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        DimensionClient client = new DimensionClient();
         MultipartOutput multipart = createDimensionInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
@@ -511,6 +513,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -534,6 +537,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        DimensionClient client = new DimensionClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -592,6 +596,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        DimensionClient client = new DimensionClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
@@ -621,7 +626,7 @@ public class DimensionServiceTest extends AbstractServiceTestImpl {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", new DimensionClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, dimension common");
index 6efbcc25dfe0417eee082bebf11e3e4d451b7f85..2eebbc8d5c04bd79a816bb55233acc890613465b 100644 (file)
@@ -63,8 +63,6 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
        LoggerFactory.getLogger(IntakeAuthRefsTest.class);
 
     // Instance variables specific to this test.
-    private IntakeClient intakeClient = new IntakeClient();
-    private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
     final String SERVICE_PATH_COMPONENT = "intakes";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
@@ -96,16 +94,17 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         // Create all the person refs and entities
         createPersonRefs();
         
+        // Submit the request to the service and store the response.
+        IntakeClient intakeClient = new IntakeClient();
         MultipartOutput multipart = createIntakeInstance(
                 "entryNumber-" + identifier,
                 "entryDate-" + identifier,
-                                                               currentOwnerRefName,
-                                                               depositorRefName,
-                                                               conditionCheckAssesorRefName,
-                                                               insurerRefName,
-                                                               fieldCollectorRefName,
-                                                               valuerRefName );
-
+                currentOwnerRefName,
+                depositorRefName,
+                conditionCheckAssesorRefName,
+                insurerRefName,
+                fieldCollectorRefName,
+                valuerRefName );
         ClientResponse<Response> res = intakeClient.create(multipart);
 
         int statusCode = res.getStatus();
@@ -138,6 +137,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
     }
     
     protected void createPersonRefs(){
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
        String authRefName = 
                PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
@@ -178,6 +178,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
     }
     
     protected String createPerson(String firstName, String surName, String refName ) {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
@@ -202,6 +203,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         testSetup(OK_STATUS, ServiceRequestType.READ,testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient intakeClient = new IntakeClient();
         ClientResponse<MultipartInput> res = intakeClient.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -273,10 +275,12 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        IntakeClient intakeClient = new IntakeClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : intakeIdsCreated) {
             ClientResponse<Response> res = intakeClient.delete(resourceId);
         }
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete persons before PersonAuth
         for (String resourceId : personIdsCreated) {
             ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
@@ -312,7 +316,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", intakeClient.getCommonPartName());
+        commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, intake common");
index cc7403d82ad82dea6edc87c55f777e10638db333..c46cd9cbb9a6ae9c6c4bd53af6f58f0a62ea79d1 100644 (file)
@@ -56,7 +56,6 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
        LoggerFactory.getLogger(IntakeServiceTest.class);
 
     // Instance variables specific to this test.
-    private IntakeClient client = new IntakeClient();
     final String SERVICE_PATH_COMPONENT = "intakes";
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
@@ -75,8 +74,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         String identifier = createIdentifier();
-
         MultipartOutput multipart = createIntakeInstance(identifier);
         ClientResponse<Response> res = client.create(multipart);
 
@@ -226,6 +225,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -254,6 +254,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -280,6 +281,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         ClientResponse<IntakesCommonList> res = client.readList();
         IntakesCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -326,6 +328,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        IntakeClient client = new IntakeClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -481,8 +485,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        IntakeClient client = new IntakeClient();
         MultipartOutput multipart = createIntakeInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
@@ -511,6 +514,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -534,6 +538,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        IntakeClient client = new IntakeClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -592,6 +597,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        IntakeClient client = new IntakeClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
@@ -623,7 +629,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, intake common");
index 7485d5a11422867f4cadf98cb9d8dfbd71fce335..c5d1c82e96e6a600e8269a05eaae7ff99f4ee664 100644 (file)
@@ -64,8 +64,6 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
        LoggerFactory.getLogger(LoaninAuthRefsTest.class);
 
     // Instance variables specific to this test.
-    private LoaninClient loaninClient = new LoaninClient();
-    private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
     final String SERVICE_PATH_COMPONENT = "loansin";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownResourceId = null;
@@ -100,15 +98,14 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         //
         // One or more fields in this resource will be PersonAuthority
         // references, and will refer to Person resources by their refNames.
+        LoaninClient loaninClient = new LoaninClient();
         MultipartOutput multipart = createLoaninInstance(
                 "loanInNumber-" + identifier,
                 "returnDate-" + identifier,
                 lendersAuthorizerRefName,
                 lendersContactRefName,
                 loanInContactRefName);
-
         ClientResponse<Response> res = loaninClient.create(multipart);
-
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -140,6 +137,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     
     protected void createPersonRefs(){
 
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Create a temporary PersonAuthority resource, and its corresponding
         // refName by which it can be identified.
        String authRefName = 
@@ -175,6 +173,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     }
     
     protected String createPerson(String firstName, String surName, String refName ) {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
@@ -199,6 +198,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         testSetup(OK_STATUS, ServiceRequestType.READ,testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient loaninClient = new LoaninClient();
         ClientResponse<MultipartInput> res = loaninClient.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -278,6 +278,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         }
         // Note: Any non-success responses are ignored and not reported.
 
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete Person resource(s) (before PersonAuthority resources).
         ClientResponse<Response> res;
         for (String resourceId : personIdsCreated) {
@@ -286,6 +287,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         // Delete PersonAuthority resource(s).
         res = personAuthClient.delete(personAuthCSID);
         // Delete Loans In resource(s).
+        LoaninClient loaninClient = new LoaninClient();
         for (String resourceId : loaninIdsCreated) {
             res = loaninClient.delete(resourceId);
         }
@@ -313,7 +315,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", loaninClient.getCommonPartName());
+        commonPart.getHeaders().add("label", new LoaninClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, loanin common");
index 9455f0c79516a380fae045635680a157b6e5ecbd..4a72a4d005944514b5f04c85c6cd7b2db51aab14 100644 (file)
@@ -58,7 +58,6 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
        LoggerFactory.getLogger(LoaninServiceTest.class);
 
     // Instance variables specific to this test.
-    private LoaninClient client = new LoaninClient();
     final String SERVICE_PATH_COMPONENT = "loansin";
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
@@ -77,8 +76,8 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         String identifier = createIdentifier();
-
         MultipartOutput multipart = createLoaninInstance(identifier);
         ClientResponse<Response> res = client.create(multipart);
 
@@ -228,6 +227,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -256,6 +256,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -282,6 +283,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         ClientResponse<LoansinCommonList> res = client.readList();
         LoansinCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -328,6 +330,8 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        LoaninClient client = new LoaninClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -482,8 +486,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        LoaninClient client = new LoaninClient();
         MultipartOutput multipart = createLoaninInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
@@ -512,6 +515,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -535,6 +539,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        LoaninClient client = new LoaninClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -593,7 +598,8 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
-        for (String resourceId : allResourceIdsCreated) {
+       LoaninClient client = new LoaninClient();
+       for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
         }
@@ -628,7 +634,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", new LoaninClient().getCommonPartName());
 
         if(logger.isDebugEnabled()){
             logger.debug("to be created, loanin common");
index 32d6d6a381d48974946108fdd1a06decdc8f2155..81872dd76674717dc4aced509b78a76388d750d4 100644 (file)
@@ -64,8 +64,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         LoggerFactory.getLogger(OrgAuthorityServiceTest.class);
 
     // Instance variables specific to this test.
-    private OrgAuthorityClient client = new OrgAuthorityClient();
-    private ContactClient contactClient = new ContactClient();
     final String SERVICE_PATH_COMPONENT = "orgauthorities";
     final String ITEM_SERVICE_PATH_COMPONENT = "items";
     final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
@@ -98,6 +96,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         String identifier = createIdentifier();
         String displayName = "displayName-" + identifier;
        String refName = OrgAuthorityClientUtils.createOrgAuthRefName(displayName, true);
@@ -154,6 +153,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         String identifier = createIdentifier();
         String refName = OrgAuthorityClientUtils.createOrganizationRefName(knownResourceRefName, identifier, true);
         Map<String, String> testOrgMap = new HashMap<String,String>();
@@ -198,10 +198,11 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         String identifier = createIdentifier();
         MultipartOutput multipart =
             ContactClientUtils.createContactInstance(parentcsid,
-            itemcsid, identifier, contactClient.getCommonPartName());
+            itemcsid, identifier, new ContactClient().getCommonPartName());
         ClientResponse<Response> res =
              client.createContact(parentcsid, itemcsid, multipart);
         int statusCode = res.getStatus();
@@ -373,6 +374,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead();
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -399,31 +401,32 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
             groups = {"read"}, dependsOnGroups = {"create"})
         public void readByName(String testName) throws Exception {
 
-            // Perform setup.
-            setupRead();
-            
-            // Submit the request to the service and store the response.
-            ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if(logger.isDebugEnabled()){
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-            //FIXME: remove the following try catch once Aron fixes signatures
-            try {
-                MultipartInput input = (MultipartInput) res.getEntity();
-                OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
-                        client.getCommonPartName(), OrgauthoritiesCommon.class);
-                Assert.assertNotNull(orgAuthority);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
+        // Perform setup.
+        setupRead();
+
+        // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
+        ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if(logger.isDebugEnabled()){
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        //FIXME: remove the following try catch once Aron fixes signatures
+        try {
+            MultipartInput input = (MultipartInput) res.getEntity();
+            OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
+                    new OrgAuthorityClient().getCommonPartName(), OrgauthoritiesCommon.class);
+            Assert.assertNotNull(orgAuthority);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
+    }
 
 /*
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
@@ -465,6 +468,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -499,6 +503,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -604,6 +609,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
        setupUpdateWithWrongXmlSchema(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -649,6 +655,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res =
             client.readContact(knownResourceId, knownItemResourceId,
             knownContactResourceId);
@@ -666,7 +673,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Check whether we've received a contact.
         MultipartInput input = (MultipartInput) res.getEntity();
         ContactsCommon contact = (ContactsCommon) extractPart(input,
-                contactClient.getCommonPartName(), ContactsCommon.class);
+                new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(contact);
         boolean showFull = true;
         if(showFull && logger.isDebugEnabled()){
@@ -688,6 +695,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -709,6 +717,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -730,6 +739,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res =
             client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
@@ -758,6 +768,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<OrgauthoritiesCommonList> res = client.readList();
         OrgauthoritiesCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -809,13 +820,11 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<OrganizationsCommonList> res = null;
-        
         if(vcsid!= null) {
-               // Submit the request to the service and store the response.
                res = client.readItemList(vcsid);
         } else if(name!= null) {
-               // Submit the request to the service and store the response.
                res = client.readItemListForNamedAuthority(name);
         } else {
                Assert.fail("readItemList passed null csid and name!");
@@ -880,6 +889,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<ContactsCommonList> res =
                 client.readContactList(parentcsid, itemcsid);
         ContactsCommonList list = res.getEntity();
@@ -942,6 +952,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Retrieve the contents of a resource to update.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -1000,6 +1011,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.readItem(knownResourceId, knownItemResourceId);
         if(logger.isDebugEnabled()){
@@ -1061,6 +1074,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         if(logger.isDebugEnabled()){
@@ -1076,7 +1091,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
         MultipartInput input = (MultipartInput) res.getEntity();
         ContactsCommon contact = (ContactsCommon) extractPart(input,
-                contactClient.getCommonPartName(), ContactsCommon.class);
+                new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(contact);
 
         // Update the contents of this resource.
@@ -1090,7 +1105,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the updated resource to the service and store the response.
         MultipartOutput output = new MultipartOutput();
         OutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", contactClient.getCommonPartName());
+        commonPart.getHeaders().add("label", new ContactClient().getCommonPartName());
         res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
         int statusCode = res.getStatus();
 
@@ -1106,7 +1121,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         input = (MultipartInput) res.getEntity();
         ContactsCommon updatedContact =
                 (ContactsCommon) extractPart(input,
-                        contactClient.getCommonPartName(), ContactsCommon.class);
+                        new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(updatedContact);
 
         // Verify that the updated resource received the correct data.
@@ -1221,6 +1236,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         MultipartOutput multipart = createOrgAuthorityInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
@@ -1246,6 +1262,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID(s) used when creating the request payload may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         Map<String, String> nonexOrgMap = new HashMap<String,String>();
         nonexOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Non-existent");
         String refName = OrgAuthorityClientUtils.createOrganizationRefName(knownResourceRefName, NON_EXISTENT_ID, true);
@@ -1295,6 +1312,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res =
             client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         int statusCode = res.getStatus();
@@ -1322,6 +1340,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -1348,6 +1367,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -1371,6 +1391,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -1392,6 +1413,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -1413,6 +1435,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        OrgAuthorityClient client = new OrgAuthorityClient();
         ClientResponse<Response> res =
             client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
@@ -1522,6 +1545,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         String contactResourceId;
         // Clean up contact resources.
         parentResourceId = knownResourceId;
+        OrgAuthorityClient client = new OrgAuthorityClient();
         for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
             contactResourceId = entry.getKey();
             itemResourceId = entry.getValue();
@@ -1641,6 +1665,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
        String refName = OrgAuthorityClientUtils.createOrgAuthRefName(displayName, true);
         return OrgAuthorityClientUtils.createOrgAuthorityInstance(
                                displayName, refName, 
-                               client.getCommonPartName());
+                               new OrgAuthorityClient().getCommonPartName());
     }
 }
\ No newline at end of file
index 828d5683ae64e8ee4e6a46c8c851ce99e22c6ac1..b9db66bfd1534c79e6e61d82f065448c03eaf6ff 100644 (file)
@@ -63,8 +63,6 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         LoggerFactory.getLogger(PersonAuthorityServiceTest.class);
 
     // Instance variables specific to this test.
-    private PersonAuthorityClient client = new PersonAuthorityClient();
-    private ContactClient contactClient = new ContactClient();
     final String SERVICE_PATH_COMPONENT = "personauthorities";
     final String ITEM_SERVICE_PATH_COMPONENT = "items";
     final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
@@ -101,6 +99,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         String identifier = createIdentifier();
        String displayName = "displayName-" + identifier;
        String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(displayName, false);
@@ -158,6 +157,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         String identifier = createIdentifier();
         String refName = PersonAuthorityClientUtils.createPersonRefName(authRefName, "John Wayne", true);
         Map<String, String> johnWayneMap = new HashMap<String,String>();
@@ -222,10 +222,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         String identifier = createIdentifier();
         MultipartOutput multipart =
             ContactClientUtils.createContactInstance(parentcsid,
-            itemcsid, identifier, contactClient.getCommonPartName());
+            itemcsid, identifier, new ContactClient().getCommonPartName());
         ClientResponse<Response> res =
              client.createContact(parentcsid, itemcsid, multipart);
         int statusCode = res.getStatus();
@@ -397,6 +398,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead();
         
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -424,30 +426,31 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         public void readByName(String testName) throws Exception {
 
             // Perform setup.
-            setupRead();
-            
-            // Submit the request to the service and store the response.
-            ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
-            int statusCode = res.getStatus();
-
-            // Check the status code of the response: does it match
-            // the expected response(s)?
-            if(logger.isDebugEnabled()){
-                logger.debug(testName + ": status = " + statusCode);
-            }
-            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-            //FIXME: remove the following try catch once Aron fixes signatures
-            try {
-                MultipartInput input = (MultipartInput) res.getEntity();
-                PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
-                        client.getCommonPartName(), PersonauthoritiesCommon.class);
-                Assert.assertNotNull(personAuthority);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
+        setupRead();
+
+        // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
+        ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if(logger.isDebugEnabled()){
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        //FIXME: remove the following try catch once Aron fixes signatures
+        try {
+            MultipartInput input = (MultipartInput) res.getEntity();
+            PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
+                    client.getCommonPartName(), PersonauthoritiesCommon.class);
+            Assert.assertNotNull(personAuthority);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
+    }
 
 /*
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
@@ -489,6 +492,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -523,6 +527,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -630,6 +635,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
        setupUpdateWithWrongXmlSchema(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -675,6 +681,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res =
             client.readContact(knownResourceId, knownItemResourceId,
             knownContactResourceId);
@@ -692,7 +699,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Check whether we've received a contact.
         MultipartInput input = (MultipartInput) res.getEntity();
         ContactsCommon contact = (ContactsCommon) extractPart(input,
-                contactClient.getCommonPartName(), ContactsCommon.class);
+                new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(contact);
         boolean showFull = true;
         if(showFull && logger.isDebugEnabled()){
@@ -714,6 +721,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -735,6 +743,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -756,6 +765,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res =
             client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
@@ -784,6 +794,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<PersonauthoritiesCommonList> res = client.readList();
         PersonauthoritiesCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -833,13 +844,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupReadList(testName);
         
+       // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<PersonsCommonList> res = null;
-        
         if(vcsid!= null) {
-               // Submit the request to the service and store the response.
                res = client.readItemList(vcsid);
         } else if(name!= null) {
-               // Submit the request to the service and store the response.
                res = client.readItemListForNamedAuthority(name);
         } else {
                Assert.fail("readItemList passed null csid and name!");
@@ -904,6 +914,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<ContactsCommonList> res =
                 client.readContactList(parentcsid, itemcsid);
         ContactsCommonList list = res.getEntity();
@@ -966,6 +977,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Retrieve the contents of a resource to update.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -1024,6 +1036,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.readItem(knownResourceId, knownItemResourceId);
         if(logger.isDebugEnabled()){
@@ -1085,6 +1099,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<MultipartInput> res =
                 client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         if(logger.isDebugEnabled()){
@@ -1100,7 +1116,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
         MultipartInput input = (MultipartInput) res.getEntity();
         ContactsCommon contact = (ContactsCommon) extractPart(input,
-                contactClient.getCommonPartName(), ContactsCommon.class);
+                new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(contact);
 
         // Update the contents of this resource.
@@ -1114,7 +1130,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the updated resource to the service and store the response.
         MultipartOutput output = new MultipartOutput();
         OutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", contactClient.getCommonPartName());
+        commonPart.getHeaders().add("label", new ContactClient().getCommonPartName());
         res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
         int statusCode = res.getStatus();
 
@@ -1130,7 +1146,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         input = (MultipartInput) res.getEntity();
         ContactsCommon updatedContact =
                 (ContactsCommon) extractPart(input,
-                        contactClient.getCommonPartName(), ContactsCommon.class);
+                        new ContactClient().getCommonPartName(), ContactsCommon.class);
         Assert.assertNotNull(updatedContact);
 
         // Verify that the updated resource received the correct data.
@@ -1245,7 +1261,8 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID(s) used when creating the request payload may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-       String displayName = "displayName-NON_EXISTENT_ID";
+        PersonAuthorityClient client = new PersonAuthorityClient();
+       String displayName = "displayName-NON_EXISTENT_ID";
        String fullRefName = PersonAuthorityClientUtils.createPersonAuthRefName(displayName, true);
        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
                                displayName, fullRefName, client.getCommonPartName());
@@ -1273,8 +1290,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         Map<String, String> nonexMap = new HashMap<String,String>();
         nonexMap.put(PersonJAXBSchema.FORE_NAME, "John");
         nonexMap.put(PersonJAXBSchema.SUR_NAME, "Wayne");
@@ -1325,6 +1341,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res =
             client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
         int statusCode = res.getStatus();
@@ -1352,6 +1369,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -1378,6 +1396,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         }
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -1401,6 +1420,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -1422,6 +1442,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -1443,6 +1464,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         ClientResponse<Response> res =
             client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
@@ -1551,6 +1573,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
         String itemResourceId;
         String contactResourceId;
         // Clean up contact resources.
+        PersonAuthorityClient client = new PersonAuthorityClient();
         parentResourceId = knownResourceId;
         for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
             contactResourceId = entry.getKey();
index a763fc206f2da1ec8762cca8eabfc0b90f21b187..d99c453e0b9022ce8ab745869f9474c23cb5d7d9 100644 (file)
@@ -56,7 +56,6 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
    private final Logger logger =
         LoggerFactory.getLogger(RelationServiceTest.class);
 
-    private RelationClient client = new RelationClient();
     final String SERVICE_PATH_COMPONENT = "relations";
     private String knownResourceId = null;
     private List<String> allResourceIdsCreated = new ArrayList();
@@ -75,6 +74,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         String identifier = createIdentifier();
         MultipartOutput multipart = createRelationInstance(identifier);
         ClientResponse<Response> res = client.create(multipart);
@@ -220,6 +220,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -250,6 +251,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -276,6 +278,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         ClientResponse<RelationsCommonList> res = client.readList();
         RelationsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -323,6 +326,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Retrieve an existing resource that we can update.
+        RelationClient client = new RelationClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -484,6 +488,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
+        RelationClient client = new RelationClient();
         MultipartOutput multipart = createRelationInstance(NON_EXISTENT_ID);
         ClientResponse<MultipartInput> res =
                 client.update(NON_EXISTENT_ID, multipart);
@@ -512,6 +517,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -535,6 +541,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        RelationClient client = new RelationClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -600,6 +607,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
+        RelationClient client = new RelationClient();
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
             ClientResponse<Response> res = client.delete(resourceId);
@@ -621,7 +629,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
                 multipart.addPart(relation, MediaType.APPLICATION_XML_TYPE);
-        commonPart.getHeaders().add("label", client.getCommonPartName());
+        commonPart.getHeaders().add("label", new RelationClient().getCommonPartName());
         if(logger.isDebugEnabled()){
           logger.debug("to be created, relation common");
           logger.debug(objectAsXmlString(relation, RelationsCommon.class));
index b6d04b5671e2c96357c25658323fe66f6563b965..0e8d60e3614a9814430ceba245bb07fe53370fbc 100644 (file)
@@ -60,7 +60,6 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         LoggerFactory.getLogger(VocabularyServiceTest.class);
 
     // Instance variables specific to this test.
-    private VocabularyClient client = new VocabularyClient();
     final String SERVICE_PATH_COMPONENT = "vocabularies";
     final String ITEM_SERVICE_PATH_COMPONENT = "items";
     private String knownResourceId = null;
@@ -90,6 +89,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupCreate(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         String identifier = createIdentifier();
         String displayName = "displayName-" + identifier;
        String refName = VocabularyClientUtils.createVocabularyRefName(displayName, false);
@@ -128,12 +128,16 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"create"})
     public void createItem(String testName) {
+
+        // Perform setup.
         setupCreate(testName);
 
+        VocabularyClient client = new VocabularyClient();
         HashMap<String, String> itemInfo = new HashMap<String, String>();
         itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, createIdentifier());
         String newID = VocabularyClientUtils.createItemInVocabulary(knownResourceId,
                                knownResourceRefName, itemInfo, client);
+
         // Store the ID returned from the first item resource created
         // for additional tests below.
         if (knownItemResourceId == null){
@@ -271,6 +275,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupRead();
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res = client.read(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -333,6 +338,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupRead(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -362,6 +368,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
        setupUpdateWithWrongXmlSchema(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -427,6 +434,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -448,6 +456,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupReadNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -474,6 +483,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<VocabulariesCommonList> res = client.readList();
         VocabulariesCommonList list = res.getEntity();
         int statusCode = res.getStatus();
@@ -520,6 +530,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupReadList(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<VocabularyitemsCommonList> res =
                 client.readItemList(vcsid);
         VocabularyitemsCommonList list = res.getEntity();
@@ -575,6 +586,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupUpdate(testName);
 
         // Retrieve the contents of a resource to update.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res =
                 client.read(knownResourceId);
         if(logger.isDebugEnabled()){
@@ -633,6 +645,8 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupUpdate(testName);
 
+        // Retrieve the contents of a resource to update.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<MultipartInput> res =
                 client.readItem(knownResourceId, knownItemResourceId);
         if(logger.isDebugEnabled()){
@@ -793,8 +807,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        VocabularyClient client = new VocabularyClient();
        String displayName = "displayName-" + NON_EXISTENT_ID;
        String refName = VocabularyClientUtils.createVocabularyRefName(displayName, false);
        MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance(
@@ -823,8 +836,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         // Submit the request to the service and store the response.
         // Note: The ID used in this 'create' call may be arbitrary.
         // The only relevant ID may be the one used in update(), below.
-
-        // The only relevant ID may be the one used in update(), below.
+        VocabularyClient client = new VocabularyClient();
         HashMap<String, String> itemInfo = new HashMap<String, String>();
         itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, "nonex");
         MultipartOutput multipart = 
@@ -858,6 +870,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<Response> res = client.delete(knownResourceId);
         int statusCode = res.getStatus();
 
@@ -880,6 +893,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupDelete(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
         int statusCode = res.getStatus();
 
@@ -903,6 +917,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -924,6 +939,7 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         setupDeleteNonExistent(testName);
 
         // Submit the request to the service and store the response.
+        VocabularyClient client = new VocabularyClient();
         ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
@@ -1004,9 +1020,10 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
-        // Clean up vocabulary item resources.
+        VocabularyClient client = new VocabularyClient();
         String vocabularyResourceId;
         String vocabularyItemResourceId;
+        // Clean up vocabulary item resources.
         for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
             vocabularyItemResourceId = entry.getKey();
             vocabularyResourceId = entry.getValue();