From: Richard Millet Date: Sun, 2 May 2010 04:25:09 +0000 (+0000) Subject: CSPACE-1349, 1422, 1428, 1429, 1469, 1465, 1466, 1468, 1470, 1473: X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=1a73b47f43acb08824da191b2f8b126ce9f9f555;p=tmp%2Fjakarta-migration.git CSPACE-1349, 1422, 1428, 1429, 1469, 1465, 1466, 1468, 1470, 1473: 1. Adding pagination tests to all Nuxeo based services. 2. Updated POM settings to make some dependency declarations more consistent. --- diff --git a/services/IntegrationTests/pom.xml b/services/IntegrationTests/pom.xml index 3ef491151..0f70071dd 100644 --- a/services/IntegrationTests/pom.xml +++ b/services/IntegrationTests/pom.xml @@ -73,7 +73,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -85,12 +84,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 74ff2a90e..941fd06d0 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -140,6 +140,10 @@ commons-io 1.4 + + org.jboss.resteasy + jaxrs-api + org.jboss.resteasy resteasy-jaxrs @@ -153,12 +157,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA junit diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index 3bf763ec3..562ed9250 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -60,7 +60,7 @@ public class CollectionSpaceJaxRsApplication extends Application { private Set> empty = new HashSet>(); public CollectionSpaceJaxRsApplication() { - singletons.add(new SecurityInterceptor()); +// singletons.add(new SecurityInterceptor()); singletons.add(new AccountResource()); singletons.add(new RoleResource()); singletons.add(new PermissionResource()); diff --git a/services/PerformanceTests/pom.xml b/services/PerformanceTests/pom.xml index 12a80903d..bad8ee026 100644 --- a/services/PerformanceTests/pom.xml +++ b/services/PerformanceTests/pom.xml @@ -68,7 +68,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -80,12 +79,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/account/client/.settings/org.eclipse.jdt.core.prefs b/services/account/client/.settings/org.eclipse.jdt.core.prefs index 31e049bf2..2316c13b5 100644 --- a/services/account/client/.settings/org.eclipse.jdt.core.prefs +++ b/services/account/client/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,6 @@ -#Wed Dec 02 09:42:10 PST 2009 +#Fri Apr 30 14:56:50 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/account/client/pom.xml b/services/account/client/pom.xml index 3ab03a0d3..4d1772f7d 100644 --- a/services/account/client/pom.xml +++ b/services/account/client/pom.xml @@ -64,7 +64,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA tjws @@ -75,12 +74,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA commons-httpclient diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java index 552d8b956..129c89d94 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java @@ -66,6 +66,11 @@ public class AccountClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.accountProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java index ce724ff2c..2b53494cd 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountProxy.java @@ -50,7 +50,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/accounts/") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface AccountProxy { +public interface AccountProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleClient.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleClient.java index 7a9abaded..7bb2bcc3b 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleClient.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleClient.java @@ -65,6 +65,11 @@ public class AccountRoleClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.accountRoleProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java index 2b6b3e0f5..d64d9f1a7 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountRoleProxy.java @@ -45,7 +45,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/accounts") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface AccountRoleProxy { +public interface AccountRoleProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java index 6a6b87860..0a893e675 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java @@ -36,10 +36,12 @@ import org.collectionspace.services.authorization.RoleValue; import org.collectionspace.services.client.AccountClient; import org.collectionspace.services.client.AccountFactory; import org.collectionspace.services.client.AccountRoleClient; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.RoleClient; import org.collectionspace.services.client.RoleFactory; import org.collectionspace.services.client.test.AbstractServiceTestImpl; import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -64,7 +66,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { LoggerFactory.getLogger(AccountRoleServiceTest.class); // Instance variables specific to this test. private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + private List allResourceIdsCreated = new ArrayList(); private Hashtable accValues = new Hashtable(); private Hashtable roleValues = new Hashtable(); /* @@ -117,6 +119,30 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { roleValues.put(rv2.getRoleName(), rv2); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new AccountRoleClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + throw new UnsupportedOperationException(); + } + + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- @@ -159,6 +185,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) public void createList(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // Failure outcomes @@ -166,14 +193,17 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void createWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // --------------------------------------------------------------- @@ -217,7 +247,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { // Submit the request to the service and store the response. AccountRoleClient client = new AccountRoleClient(); - ClientResponse res = client.read(NON_EXISTENT_ID, "123"); + ClientResponse res = client.read(this.NON_EXISTENT_ID, "123"); int statusCode = res.getStatus(); // Check the status code of the response: does it match @@ -238,6 +268,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"}) public void readList(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // Failure outcomes @@ -250,6 +281,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read", "readList", "readNonExistent"}) public void update(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // Failure outcomes @@ -257,20 +289,24 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void updateWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"readNonExistent", "testSubmitRequest"}) public void updateNonExistent(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // --------------------------------------------------------------- @@ -302,6 +338,9 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void deleteNonExistent(String testName) throws Exception { @@ -341,12 +380,13 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl { // Utility methods used by tests above // --------------------------------------------------------------- /** - * create accRolerole instance - * @param accId - * @param roleValues array of role ids - * @param userPermId - * @param useRoleId - * @return + * Creates the account role instance. + * + * @param pv the pv + * @param rvs the rvs + * @param usePermId the use perm id + * @param useRoleId the use role id + * @return the account role */ static public AccountRole createAccountRoleInstance(AccountValue pv, Collection rvs, diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java index 25e7ad0ae..e05d608b6 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java @@ -27,12 +27,14 @@ import java.util.List; import javax.ws.rs.core.Response; import org.collectionspace.services.client.AccountClient; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.account.AccountsCommon; import org.collectionspace.services.account.AccountsCommonList; import org.collectionspace.services.account.Status; import org.collectionspace.services.client.AccountFactory; import org.collectionspace.services.client.test.AbstractServiceTestImpl; import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; @@ -57,15 +59,42 @@ public class AccountServiceTest extends AbstractServiceTestImpl { private String knownResourceId = null; private List allResourceIdsCreated = new ArrayList(); static boolean addTenant = true; + /* * This method is called only by the parent class, AbstractServiceTestImpl */ - @Override protected String getServicePathComponent() { return new AccountClient().getServicePathComponent(); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new AccountClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + throw new UnsupportedOperationException(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String) + */ + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- @@ -310,14 +339,17 @@ public class AccountServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void createWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // --------------------------------------------------------------- @@ -773,14 +805,17 @@ public class AccountServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void updateWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override diff --git a/services/account/service/pom.xml b/services/account/service/pom.xml index e20edc616..9672d49fa 100644 --- a/services/account/service/pom.xml +++ b/services/account/service/pom.xml @@ -26,7 +26,9 @@ slf4j-log4j12 provided + + org.collectionspace.services org.collectionspace.services.common @@ -47,7 +49,9 @@ org.collectionspace.services.account.jaxb ${project.version} + + junit junit @@ -71,8 +75,8 @@ commons-logging 1.1 - + javax.security @@ -81,13 +85,11 @@ provided - org.jboss.resteasy resteasy-jaxrs - 1.1.GA tjws @@ -98,15 +100,11 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA - - diff --git a/services/acquisition/client/pom.xml b/services/acquisition/client/pom.xml index 57cd84708..ed6bdb354 100644 --- a/services/acquisition/client/pom.xml +++ b/services/acquisition/client/pom.xml @@ -56,7 +56,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -67,12 +66,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java index 5052a18db..358804ef7 100644 --- a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java @@ -46,6 +46,11 @@ public class AcquisitionClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.acquisitionProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java index 233ccad27..2a105603d 100644 --- a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/acquisitions/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface AcquisitionProxy { +public interface AcquisitionProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java index 49e0592b0..d58348b69 100644 --- a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java @@ -32,9 +32,11 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.AcquisitionClient; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.acquisition.AcquisitionsCommon; import org.collectionspace.services.acquisition.AcquisitionsCommonList; @@ -78,6 +80,23 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest { private String fieldCollectorRefName = null; private final int NUM_AUTH_REFS_EXPECTED = 3; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java index 6f817176b..c15786e08 100644 --- a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java @@ -28,6 +28,8 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.client.AcquisitionClient; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.acquisition.AcquisitionsCommon; import org.collectionspace.services.acquisition.AcquisitionsCommonList; @@ -60,6 +62,23 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl { private String knownResourceId = null; private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new AcquisitionClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(AcquisitionsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/acquisition/service/pom.xml b/services/acquisition/service/pom.xml index 6f495d025..d59eb2168 100644 --- a/services/acquisition/service/pom.xml +++ b/services/acquisition/service/pom.xml @@ -22,80 +22,7 @@ org.collectionspace.services org.collectionspace.services.acquisition.jaxb ${project.version} - - diff --git a/services/authentication/client/pom.xml b/services/authentication/client/pom.xml index b5749e5f2..2b7adaeef 100644 --- a/services/authentication/client/pom.xml +++ b/services/authentication/client/pom.xml @@ -37,42 +37,6 @@ org.collectionspace.services.client ${project.version} - diff --git a/services/authorization-mgt/client/pom.xml b/services/authorization-mgt/client/pom.xml index d7c217344..e0554bef5 100644 --- a/services/authorization-mgt/client/pom.xml +++ b/services/authorization-mgt/client/pom.xml @@ -57,7 +57,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA tjws @@ -68,12 +67,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA commons-httpclient diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionClient.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionClient.java index bea5c333b..88b01e92b 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionClient.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionClient.java @@ -66,6 +66,11 @@ public class PermissionClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.permissionProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java index f096f824b..68655d319 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionProxy.java @@ -48,7 +48,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/permissions") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface PermissionProxy { +public interface PermissionProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleClient.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleClient.java index d19605487..1406a7ee5 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleClient.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleClient.java @@ -65,6 +65,11 @@ public class PermissionRoleClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.permissionRoleProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java index 9f9ee1d74..45d389c9b 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/PermissionRoleProxy.java @@ -45,7 +45,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/permissions") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface PermissionRoleProxy { +public interface PermissionRoleProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleClient.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleClient.java index 6ba71c339..5514859d7 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleClient.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleClient.java @@ -66,6 +66,11 @@ public class RoleClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.roleProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java index a65aab021..b87bd448e 100644 --- a/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java +++ b/services/authorization-mgt/client/src/main/java/org/collectionspace/services/client/RoleProxy.java @@ -48,7 +48,7 @@ import org.jboss.resteasy.client.ClientResponse; @Path("/authorization/roles") @Produces({"application/xml"}) @Consumes({"application/xml"}) -public interface RoleProxy { +public interface RoleProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java index 3fae6b3cd..d916765f8 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java @@ -35,6 +35,7 @@ import org.collectionspace.services.authorization.PermissionRole; import org.collectionspace.services.authorization.PermissionValue; import org.collectionspace.services.authorization.Role; import org.collectionspace.services.authorization.RoleValue; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PermissionClient; import org.collectionspace.services.client.PermissionFactory; import org.collectionspace.services.client.PermissionRoleClient; @@ -42,6 +43,7 @@ import org.collectionspace.services.client.RoleClient; import org.collectionspace.services.client.RoleFactory; import org.collectionspace.services.client.test.AbstractServiceTestImpl; import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; @@ -115,6 +117,29 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl { roleValues.put(rv2.getRoleName(), rv2); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new PermissionRoleClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + throw new UnsupportedOperationException(); + } + + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + } // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java index bd4de6a24..bf0c00ae6 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java @@ -25,9 +25,10 @@ package org.collectionspace.services.authorization.client.test; import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response; -import org.collectionspace.services.authorization.ActionType; +//import org.collectionspace.services.authorization.ActionType; import org.collectionspace.services.authorization.EffectType; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PermissionClient; import org.collectionspace.services.authorization.Permission; import org.collectionspace.services.authorization.PermissionAction; @@ -35,6 +36,7 @@ import org.collectionspace.services.authorization.PermissionsList; import org.collectionspace.services.client.PermissionFactory; import org.collectionspace.services.client.test.AbstractServiceTestImpl; import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; @@ -57,7 +59,7 @@ public class PermissionServiceTest extends AbstractServiceTestImpl { LoggerFactory.getLogger(PermissionServiceTest.class); // Instance variables specific to this test. private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + private List allResourceIdsCreated = new ArrayList(); boolean addTenant = true; /* * This method is called only by the parent class, AbstractServiceTestImpl @@ -68,7 +70,31 @@ public class PermissionServiceTest extends AbstractServiceTestImpl { return new PermissionClient().getServicePathComponent(); } - // --------------------------------------------------------------- + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new PermissionClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + throw new UnsupportedOperationException(); + } + + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + } + + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes @@ -200,14 +226,17 @@ public class PermissionServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void createWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // --------------------------------------------------------------- @@ -428,14 +457,17 @@ public class PermissionServiceTest extends AbstractServiceTestImpl { @Override public void updateWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java index f3874785a..292c541c5 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java @@ -26,12 +26,14 @@ import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.RoleClient; import org.collectionspace.services.authorization.Role; import org.collectionspace.services.authorization.RolesList; import org.collectionspace.services.client.RoleFactory; import org.collectionspace.services.client.test.AbstractServiceTestImpl; import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; @@ -54,7 +56,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl { LoggerFactory.getLogger(RoleServiceTest.class); // Instance variables specific to this test. private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + private List allResourceIdsCreated = new ArrayList(); boolean addTenant = true; /* * This method is called only by the parent class, AbstractServiceTestImpl @@ -65,6 +67,30 @@ public class RoleServiceTest extends AbstractServiceTestImpl { return new RoleClient().getServicePathComponent(); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new RoleClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + throw new UnsupportedOperationException(); + } + + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697 + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- @@ -199,14 +225,17 @@ public class RoleServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void createWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void createWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } // --------------------------------------------------------------- @@ -380,14 +409,17 @@ public class RoleServiceTest extends AbstractServiceTestImpl { // See Issue CSPACE-401. @Override public void updateWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override public void updateWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } @Override diff --git a/services/authorization-mgt/service/pom.xml b/services/authorization-mgt/service/pom.xml index f33ad5da7..6f72ad1b4 100644 --- a/services/authorization-mgt/service/pom.xml +++ b/services/authorization-mgt/service/pom.xml @@ -81,7 +81,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA tjws @@ -92,12 +91,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA diff --git a/services/client/pom.xml b/services/client/pom.xml index 5e9181e5c..5635bb6e0 100644 --- a/services/client/pom.xml +++ b/services/client/pom.xml @@ -30,6 +30,12 @@ ${project.version} true --> + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + org.apache.maven.plugins @@ -43,7 +49,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -54,12 +59,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java index 4425081cd..7755b48aa 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java @@ -29,59 +29,102 @@ import java.util.Properties; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; +//import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jboss.resteasy.client.ClientResponse; //import org.collectionspace.services.common.context.ServiceContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * BaseServiceClient is an abstract base client of all service clients + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ public abstract class AbstractServiceClientImpl implements CollectionSpaceClient { + /** The logger. */ protected final Logger logger = LoggerFactory.getLogger(AbstractServiceClientImpl.class); /** * The character used to separate the words in a part label */ public static final String PART_LABEL_SEPERATOR = "_"; + + /** The Constant PART_COMMON_LABEL. */ public static final String PART_COMMON_LABEL = "common"; + /** The properties. */ private Properties properties = new Properties(); + + /** The url. */ private URL url; + + /** The http client. */ private HttpClient httpClient; + /** + * Gets the common part name. + * + * @return the common part name + */ public String getCommonPartName() { return getCommonPartName(getServicePathComponent()); } + /** + * Gets the common part name. + * + * @param servicePathComponent the service path component + * @return the common part name + */ public String getCommonPartName(String servicePathComponent) { return servicePathComponent + PART_LABEL_SEPERATOR + PART_COMMON_LABEL; } + /** + * Gets the service path component. + * + * @return the service path component + */ abstract public String getServicePathComponent(); + /** + * Instantiates a new abstract service client impl. + */ protected AbstractServiceClientImpl() { readProperties(); setupHttpClient(); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#getProperty(java.lang.String) + */ @Override public String getProperty(String propName) { return properties.getProperty(propName); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#setProperty(java.lang.String, java.lang.String) + */ @Override public void setProperty(String propName, String value) { properties.setProperty(propName, value); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#removeProperty(java.lang.String) + */ @Override public Object removeProperty(String propName) { return properties.remove(propName); } + /** + * Prints the properties. + */ public void printProperties() { for(Object kobj : properties.keySet()){ String key = (String) kobj; @@ -89,22 +132,34 @@ public abstract class AbstractServiceClientImpl implements CollectionSpaceClient } } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#getBaseURL() + */ @Override public String getBaseURL() { return properties.getProperty(URL_PROPERTY); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#getHttpClient() + */ @Override public HttpClient getHttpClient() { return httpClient; } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#useAuth() + */ @Override public boolean useAuth() { String auth = properties.getProperty(AUTH_PROPERTY); return Boolean.valueOf(auth); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#useSSL() + */ @Override public boolean useSSL() { String ssl = properties.getProperty(SSL_PROPERTY); @@ -204,8 +259,21 @@ public abstract class AbstractServiceClientImpl implements CollectionSpaceClient } } + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#isServerSecure() + */ @Override public boolean isServerSecure() { return Boolean.getBoolean("cspace.server.secure"); } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.CollectionSpaceClient#readList(java.lang.String, java.lang.String) + */ + @Override + public ClientResponse readList(String pageSize, + String pageNumber) { + return getProxy().readList(pageSize, pageNumber); + } + } diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java index 6d08d1fb8..59c19888f 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java @@ -23,25 +23,72 @@ */ package org.collectionspace.services.client; import org.apache.commons.httpclient.HttpClient; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jboss.resteasy.client.ClientResponse; /** * */ public interface CollectionSpaceClient { + + /** The AUT h_ property. */ String AUTH_PROPERTY = "cspace.auth"; + + /** The PASSWOR d_ property. */ String PASSWORD_PROPERTY = "cspace.password"; + + /** The SS l_ property. */ String SSL_PROPERTY = "cspace.ssl"; + + /** The UR l_ property. */ String URL_PROPERTY = "cspace.url"; + + /** The USE r_ property. */ String USER_PROPERTY = "cspace.user"; + /** + * Gets the proxy. + * + * @return the proxy + */ + CollectionSpaceProxy getProxy(); + + /** + * Gets the base url. + * + * @return the base url + */ String getBaseURL(); + /** + * Gets the http client. + * + * @return the http client + */ HttpClient getHttpClient(); + /** + * Gets the property. + * + * @param propName the prop name + * @return the property + */ String getProperty(String propName); + /** + * Removes the property. + * + * @param propName the prop name + * @return the object + */ Object removeProperty(String propName); + /** + * Sets the property. + * + * @param propName the prop name + * @param value the value + */ void setProperty(String propName, String value); /** @@ -55,8 +102,18 @@ public interface CollectionSpaceClient { */ void setupHttpClient(); + /** + * Use auth. + * + * @return true, if successful + */ boolean useAuth(); + /** + * Use ssl. + * + * @return true, if successful + */ boolean useSSL(); /** @@ -64,5 +121,15 @@ public interface CollectionSpaceClient { * @return */ boolean isServerSecure(); + + /** + * Read list. + * + * @param pageSize the page size + * @param pageNumber the page number + * @return the client response + */ + public ClientResponse readList(String pageSize, + String pageNumber); } diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java new file mode 100644 index 000000000..90807a705 --- /dev/null +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java @@ -0,0 +1,54 @@ +/** + * CollectionSpaceProxy.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ + * $LastChangedRevision: $ + * $LastChangedDate: $ + * + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client; + +import javax.ws.rs.GET; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jboss.resteasy.client.ClientResponse; + +/** + * The Interface CollectionSpaceProxy. + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 + */ +public interface CollectionSpaceProxy { + + /** + * Read list. + * + * @param pageSize the page size + * @param pageNumber the page number + * @return the client response + */ + @GET + @Produces({"application/xml"}) + ClientResponse readList( + @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) String pageSize, + @QueryParam(IClientQueryParams.START_PAGE_PARAM) String pageNumber); +} diff --git a/services/client/src/main/java/org/collectionspace/services/client/IClientQueryParams.java b/services/client/src/main/java/org/collectionspace/services/client/IClientQueryParams.java new file mode 100644 index 000000000..1aeec0a46 --- /dev/null +++ b/services/client/src/main/java/org/collectionspace/services/client/IClientQueryParams.java @@ -0,0 +1,7 @@ +package org.collectionspace.services.client; + +public interface IClientQueryParams { + public static final String PAGE_SIZE_PARAM = "pgSz"; + public static final String START_PAGE_PARAM = "pgNum"; + +} diff --git a/services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java b/services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java index a9741fbe1..379a35497 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/TestServiceClient.java @@ -29,21 +29,19 @@ package org.collectionspace.services.client; * @version $Revision:$ */ public class TestServiceClient extends AbstractServiceClientImpl { - /** - * - * Default constructor for CollectionObjectClient class. - * - */ - public TestServiceClient() { - } - /** * * Returning NULL since this class is a base-level client, used (only) * to obtain the base service URL. * - */ + */ + @Override public String getServicePathComponent() { - return null; + throw new UnsupportedOperationException(); + } + + @Override + public CollectionSpaceProxy getProxy() { + throw new UnsupportedOperationException(); } } diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java index 827db26e6..d6da10add 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java @@ -23,17 +23,21 @@ */ package org.collectionspace.services.client.test; +import java.util.List; + import javax.ws.rs.core.Response; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.AbstractServiceClientImpl; +import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - - - - +import org.testng.Assert; +import org.testng.annotations.Test; /** + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685 * AbstractServiceTest, abstract base class for the client tests to be performed * to test an entity or relation service. * @@ -41,34 +45,73 @@ import org.slf4j.LoggerFactory; */ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements ServiceTest { + /** The logger. */ protected final Logger logger = LoggerFactory.getLogger(AbstractServiceTestImpl.class); - - // Success outcomes - @Override - public void create(String testName) throws Exception { + + /** The Constant DEFAULT_LIST_SIZE. */ + static protected final int DEFAULT_LIST_SIZE = 10; + +// // Success outcomes +// /* (non-Javadoc) +// * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) +// */ +// @Override +// public void create(String testName) throws Exception { +// //empty? +// } + + /** + * Gets the logger. + * + * @return the logger + */ + private Logger getLogger() { + return this.logger; } + /** + * Setup create. + */ protected void setupCreate() { setupCreate("Create"); } + /** + * Sets the up create. + * + * @param label the new up create + */ protected void setupCreate(String label) { testSetup(Response.Status.CREATED.getStatusCode(), ServiceRequestType.CREATE, label); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#createList(java.lang.String) + */ @Override public abstract void createList(String testName) throws Exception; // No setup required for createList() // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#createWithEmptyEntityBody(java.lang.String) + */ @Override public abstract void createWithEmptyEntityBody(String testName) throws Exception; + /** + * Setup create with empty entity body. + */ protected void setupCreateWithEmptyEntityBody() { setupCreateWithEmptyEntityBody("CreateWithEmptyEntityBody"); } + /** + * Sets the up create with empty entity body. + * + * @param label the new up create with empty entity body + */ protected void setupCreateWithEmptyEntityBody(String label) { clearSetup(); EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode(); @@ -78,13 +121,24 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements } } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#createWithMalformedXml(java.lang.String) + */ @Override public abstract void createWithMalformedXml(String testName) throws Exception; + /** + * Setup create with malformed xml. + */ protected void setupCreateWithMalformedXml() { setupCreateWithMalformedXml("CreateWithMalformedXml"); } + /** + * Sets the up create with malformed xml. + * + * @param label the new up create with malformed xml + */ protected void setupCreateWithMalformedXml(String label) { clearSetup(); // Expected status code: 400 Bad Request @@ -95,13 +149,24 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements } } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#createWithWrongXmlSchema(java.lang.String) + */ @Override public abstract void createWithWrongXmlSchema(String testName) throws Exception; + /** + * Setup create with wrong xml schema. + */ protected void setupCreateWithWrongXmlSchema() { setupCreateWithWrongXmlSchema("CreateWithWrongXmlSchema"); } + /** + * Sets the up create with wrong xml schema. + * + * @param label the new up create with wrong xml schema + */ protected void setupCreateWithWrongXmlSchema(String label) { clearSetup(); // Expected status code: 400 Bad Request @@ -116,41 +181,141 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#read(java.lang.String) + */ @Override public abstract void read(String testName) throws Exception; + /** + * Setup read. + */ protected void setupRead() { setupRead("Read"); } + /** + * Sets the up read. + * + * @param label the new up read + */ protected void setupRead(String label) { testSetup(Response.Status.OK.getStatusCode(), ServiceRequestType.READ, label); } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#readNonExistent(java.lang.String) + */ @Override public abstract void readNonExistent(String testName) throws Exception; + /** + * Setup read non existent. + */ protected void setupReadNonExistent() { setupReadNonExistent("ReadNonExistent"); } + /** + * Sets the up read non existent. + * + * @param label the new up read non existent + */ protected void setupReadNonExistent(String label) { // Expected status code: 404 Not Found testSetup(Response.Status.NOT_FOUND.getStatusCode(), ServiceRequestType.READ, label); } - // --------------------------------------------------------------- + /** + * Read list. + * + * @param testName the test name + * @param client the client + * @param pageSize the page size + * @param pageNumber the page number + * @return the abstract common list + * @throws Exception the exception + */ + private AbstractCommonList readList(String testName, + CollectionSpaceClient client, + long pageSize, long pageNumber) throws Exception { + ClientResponse response = + (ClientResponse)client.readList(Long.toString(pageSize), + Long.toString(pageNumber)); + AbstractCommonList list = this.getAbstractCommonList(response); + int statusCode = response.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (getLogger().isDebugEnabled()) { + getLogger().debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE); + + return list; + } + + /** + * Read paginated list. + * + * @param testName the test name + * @throws Exception the exception + */ + @Test(dataProvider = "testName") + public void readPaginatedList(String testName) throws Exception { + + // Perform setup. + setupReadList(testName); + + long pageSize = DEFAULT_LIST_SIZE / 3; //create 3 pages to iterate over + CollectionSpaceClient client = this.getClientInstance(); + AbstractCommonList list = this.readList(testName, client, pageSize, 0); + long totalItems = list.getTotalItems(); + long pagesTotal = totalItems / pageSize; + for (int i = 0; i < pagesTotal; i++) { + list = this.readList(testName, client, pageSize, i); + if (getLogger().isDebugEnabled() == true) { + getLogger().debug(testName + ":" + "page number is " + list.getPageNum()); + getLogger().debug(testName + ":" + "page size is " + list.getPageSize()); + getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems()); + } + } + + long mod = totalItems % pageSize; + if (mod != 0) { + list = this.readList(testName, client, pageSize, pagesTotal); + getLogger().debug(testName + ":" + "page number is " + list.getPageNum()); + getLogger().debug(testName + ":" + "page size is " + list.getPageSize()); + getLogger().debug(testName + ":" + "total number of items is " + list.getTotalItems()); + } + + } + + // --------------------------------------------------------------- // CRUD tests : READ (list, or multiple) tests // --------------------------------------------------------------- // Success outcomes - @Override + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#readList(java.lang.String) + */ + @Override public abstract void readList(String testName) throws Exception; + /** + * Setup read list. + */ protected void setupReadList() { setupReadList("ReadList"); } + /** + * Sets the up read list. + * + * @param label the new up read list + */ protected void setupReadList(String label) { testSetup(Response.Status.OK.getStatusCode(), ServiceRequestType.READ_LIST, label); } @@ -161,62 +326,117 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#update(java.lang.String) + */ @Override public abstract void update(String testName) throws Exception; + /** + * Setup update. + */ protected void setupUpdate() { setupUpdate("Update"); } + /** + * Sets the up update. + * + * @param label the new up update + */ protected void setupUpdate(String label) { // Expected status code: 200 OK testSetup(Response.Status.OK.getStatusCode(), ServiceRequestType.UPDATE, label); } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#updateWithEmptyEntityBody(java.lang.String) + */ @Override public abstract void updateWithEmptyEntityBody(String testName) throws Exception; + /** + * Setup update with empty entity body. + */ protected void setupUpdateWithEmptyEntityBody() { setupUpdateWithEmptyEntityBody("UpdateWithEmptyEntityBody"); } + /** + * Sets the up update with empty entity body. + * + * @param label the new up update with empty entity body + */ protected void setupUpdateWithEmptyEntityBody(String label) { // Expected status code: 400 Bad Request testSetup(Response.Status.BAD_REQUEST.getStatusCode(), ServiceRequestType.UPDATE, label); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#updateWithMalformedXml(java.lang.String) + */ @Override public abstract void updateWithMalformedXml(String testName) throws Exception; + /** + * Setup update with malformed xml. + */ protected void setupUpdateWithMalformedXml() { setupUpdateWithMalformedXml("UpdateWithMalformedXml"); } + /** + * Sets the up update with malformed xml. + * + * @param label the new up update with malformed xml + */ protected void setupUpdateWithMalformedXml(String label) { // Expected status code: 400 Bad Request testSetup(Response.Status.BAD_REQUEST.getStatusCode(), ServiceRequestType.UPDATE, label); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#updateWithWrongXmlSchema(java.lang.String) + */ @Override public abstract void updateWithWrongXmlSchema(String testName) throws Exception; + /** + * Setup update with wrong xml schema. + */ protected void setupUpdateWithWrongXmlSchema() { setupUpdateWithWrongXmlSchema("UpdateWithWrongXmlSchema"); } + /** + * Sets the up update with wrong xml schema. + * + * @param label the new up update with wrong xml schema + */ protected void setupUpdateWithWrongXmlSchema(String label) { // Expected status code: 400 Bad Request testSetup(Response.Status.BAD_REQUEST.getStatusCode(), ServiceRequestType.UPDATE, label); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#updateNonExistent(java.lang.String) + */ @Override public abstract void updateNonExistent(String testName) throws Exception; + /** + * Setup update non existent. + */ protected void setupUpdateNonExistent() { setupUpdateNonExistent("UpdateNonExistent"); } + /** + * Sets the up update non existent. + * + * @param label the new up update non existent + */ protected void setupUpdateNonExistent(String label) { // Expected status code: 404 Not Found testSetup(Response.Status.NOT_FOUND.getStatusCode(), ServiceRequestType.UPDATE, label); @@ -226,25 +446,47 @@ public abstract class AbstractServiceTestImpl extends BaseServiceTest implements // CRUD tests : DELETE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#delete(java.lang.String) + */ @Override public abstract void delete(String testName) throws Exception; + /** + * Setup delete. + */ protected void setupDelete() { setupDelete("Delete"); } + /** + * Sets the up delete. + * + * @param label the new up delete + */ protected void setupDelete(String label) { testSetup(Response.Status.OK.getStatusCode(), ServiceRequestType.DELETE, label); } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#deleteNonExistent(java.lang.String) + */ @Override public abstract void deleteNonExistent(String testName) throws Exception; + /** + * Setup delete non existent. + */ protected void setupDeleteNonExistent() { setupDeleteNonExistent("DeleteNonExistent"); } + /** + * Sets the up delete non existent. + * + * @param label the new up delete non existent + */ protected void setupDeleteNonExistent(String label) { clearSetup(); // Expected status code: 404 Not Found diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java b/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java index a85550c40..bf87cd4a6 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java @@ -1,3 +1,29 @@ +/** + * BaseServiceTest.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ + * $LastChangedRevision: $ + * $LastChangedDate: $ + * + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ package org.collectionspace.services.client.test; import java.io.ByteArrayInputStream; @@ -31,20 +57,60 @@ import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; import org.w3c.dom.Document; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.jaxb.AbstractCommonList; + +/** + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685 + * The Class BaseServiceTest. + */ public abstract class BaseServiceTest { + /** The Constant logger. */ static protected final Logger logger = LoggerFactory.getLogger(BaseServiceTest.class); + + /** The Constant serviceClient. */ protected static final TestServiceClient serviceClient = new TestServiceClient(); + + /** The NO n_ existen t_ id. */ protected final String NON_EXISTENT_ID = createNonExistentIdentifier(); + + /** The EXPECTE d_ statu s_ code. */ protected int EXPECTED_STATUS_CODE = 0; + + /** The REQUES t_ type. */ protected ServiceRequestType REQUEST_TYPE = ServiceRequestType.NON_EXISTENT; + + /** The Constant XML_DECLARATION. */ protected static final String XML_DECLARATION = ""; + + /** The Constant MALFORMED_XML_DATA. */ protected static final String MALFORMED_XML_DATA = XML_DECLARATION + "wrong schema contentswrong schema contents"; + + /** The NUL l_ charset. */ final String NULL_CHARSET = null; + /** + * Gets the client. + * + * @return the client + */ + abstract protected CollectionSpaceClient getClientInstance(); + + /** + * Gets the abstract common list. + * + * @param response the response + * @return the abstract common list + */ + abstract protected AbstractCommonList getAbstractCommonList( + ClientResponse response); + /** * Returns the name of the currently running test. * @@ -97,6 +163,9 @@ public abstract class BaseServiceTest { } } + /** + * Instantiates a new base service test. + */ public BaseServiceTest() { super(); } @@ -218,6 +287,12 @@ public abstract class BaseServiceTest { return statusCode; } + /** + * Extract id. + * + * @param res the res + * @return the string + */ static protected String extractId(ClientResponse res) { MultivaluedMap mvm = res.getMetadata(); String uri = (String) ((ArrayList) mvm.get("Location")).get(0); @@ -232,15 +307,34 @@ public abstract class BaseServiceTest { return id; } + /** + * Creates the identifier. + * + * @return the string + */ static protected String createIdentifier() { long identifier = System.currentTimeMillis(); return Long.toString(identifier); } + /** + * Creates the non existent identifier. + * + * @return the string + */ protected String createNonExistentIdentifier() { return Long.toString(Long.MAX_VALUE); } + /** + * Extract part. + * + * @param input the input + * @param label the label + * @param clazz the clazz + * @return the object + * @throws Exception the exception + */ static protected Object extractPart(MultipartInput input, String label, Class clazz) throws Exception { Object obj = null; @@ -292,6 +386,14 @@ public abstract class BaseServiceTest { return obj; } + /** + * Gets the part object. + * + * @param partStr the part str + * @param clazz the clazz + * @return the part object + * @throws JAXBException the jAXB exception + */ static protected Object getPartObject(String partStr, Class clazz) throws JAXBException { JAXBContext jc = JAXBContext.newInstance(clazz); @@ -312,6 +414,13 @@ public abstract class BaseServiceTest { return obj; } + /** + * Object as xml string. + * + * @param o the o + * @param clazz the clazz + * @return the string + */ static protected String objectAsXmlString(Object o, Class clazz) { StringWriter sw = new StringWriter(); try { @@ -345,6 +454,13 @@ public abstract class BaseServiceTest { return getObjectFromStream(jaxbClass, is); } + /** + * Gets the xml document. + * + * @param fileName the file name + * @return the xml document + * @throws Exception the exception + */ static protected Document getXmlDocument(String fileName) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); File f = new File(fileName); @@ -355,6 +471,13 @@ public abstract class BaseServiceTest { return factory.newDocumentBuilder().parse(f); } + /** + * Gets the xml document as string. + * + * @param fileName the file name + * @return the xml document as string + * @throws Exception the exception + */ static protected String getXmlDocumentAsString(String fileName) throws Exception { byte[] b = FileUtils.readFileToByteArray(new File(fileName)); return new String(b); @@ -375,6 +498,12 @@ public abstract class BaseServiceTest { return jaxbClass.cast(unmarshaller.unmarshal(is)); } + /** + * Map as string. + * + * @param map the map + * @return the string + */ protected String mapAsString(MultivaluedMap map) { StringBuffer sb = new StringBuffer(); for (Object entry : map.entrySet()) { @@ -385,6 +514,11 @@ public abstract class BaseServiceTest { return sb.toString(); } + /** + * Banner. + * + * @param label the label + */ protected void banner(String label) { if (logger.isDebugEnabled()) { logger.debug("==================================================="); diff --git a/services/collectionobject/client/.classpath b/services/collectionobject/client/.classpath index 505c7192a..425cd1620 100644 --- a/services/collectionobject/client/.classpath +++ b/services/collectionobject/client/.classpath @@ -4,7 +4,7 @@ + - diff --git a/services/collectionobject/client/pom.xml b/services/collectionobject/client/pom.xml index ad63562c7..f4af6b07b 100644 --- a/services/collectionobject/client/pom.xml +++ b/services/collectionobject/client/pom.xml @@ -61,7 +61,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA @@ -73,12 +72,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA commons-httpclient diff --git a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java index bb2b7a17c..f83f37aa2 100644 --- a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java +++ b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; - +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; import org.collectionspace.services.common.authorityref.AuthorityRefList; //import org.collectionspace.services.common.context.ServiceContext; @@ -47,6 +47,7 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory; /** * The Class CollectionObjectClient. + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ public class CollectionObjectClient extends AbstractServiceClientImpl { @@ -56,7 +57,8 @@ public class CollectionObjectClient extends AbstractServiceClientImpl { /* (non-Javadoc) * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent() */ - public String getServicePathComponent() { + @Override + public String getServicePathComponent() { return "collectionobjects"; } @@ -68,6 +70,11 @@ public class CollectionObjectClient extends AbstractServiceClientImpl { RegisterBuiltin.register(factory); setProxy(); } + + @Override + public CollectionSpaceProxy getProxy() { + return this.collectionObjectProxy; + } /** * Sets the proxy. @@ -92,6 +99,13 @@ public class CollectionObjectClient extends AbstractServiceClientImpl { return collectionObjectProxy.readList(); } + + @Override + public ClientResponse readList(String pageSize, + String pageNumber) { + return collectionObjectProxy.readList(pageSize, pageNumber); + + } /** * Roundtrip. diff --git a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java index d0e0a4dcf..a454f2279 100644 --- a/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java +++ b/services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectProxy.java @@ -1,3 +1,29 @@ +/** + * CollectionObjectProxy.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ + * $LastChangedRevision: $ + * $LastChangedDate: $ + * + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ package org.collectionspace.services.client; import javax.ws.rs.Consumes; @@ -13,9 +39,13 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import org.collectionspace.services.common.authorityref.AuthorityRefList; +import org.collectionspace.services.client.IClientQueryParams; +import org.collectionspace.services.client.CollectionSpaceProxy; import org.collectionspace.services.common.query.IQueryManager; +import org.collectionspace.services.common.authorityref.AuthorityRefList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; + import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; @@ -23,21 +53,38 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; /** * @version $Revision:$ + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ @Path("/collectionobjects/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface CollectionObjectProxy { +public interface CollectionObjectProxy extends CollectionSpaceProxy { + /** + * Read list. + * + * @return the client response + */ @GET @Produces({"application/xml"}) ClientResponse readList(); + /** + * Roundtrip. + * + * @return the client response + */ @GET @Path("/roundtrip") @Produces({"application/xml"}) ClientResponse roundtrip(); + /** + * Keyword search. + * + * @param keywords the keywords + * @return the client response + */ @GET @Path("/search") @Produces({"application/xml"}) @@ -45,15 +92,33 @@ public interface CollectionObjectProxy { @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords); //(C)reate + /** + * Creates the. + * + * @param multipart the multipart + * @return the client response + */ @POST ClientResponse create(MultipartOutput multipart); //(R)ead + /** + * Read. + * + * @param csid the csid + * @return the client response + */ @GET @Path("/{csid}") ClientResponse read(@PathParam("csid") String csid); // List Authority references + /** + * Gets the authority refs. + * + * @param csid the csid + * @return the authority refs + */ @GET @Produces({"application/xml"}) @Path("/{csid}/authorityrefs/") @@ -61,11 +126,24 @@ public interface CollectionObjectProxy { //(U)pdate + /** + * Update. + * + * @param csid the csid + * @param multipart the multipart + * @return the client response + */ @PUT @Path("/{csid}") ClientResponse update(@PathParam("csid") String csid, MultipartOutput multipart); //(D)elete + /** + * Delete. + * + * @param csid the csid + * @return the client response + */ @DELETE @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java index 67ff9059a..ac23ec854 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java @@ -32,11 +32,13 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -77,6 +79,23 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { private String inscriberRefName = null; private final int NUM_AUTH_REFS_EXPECTED = 4; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java index 2d91d0227..f1861d2c6 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java @@ -27,13 +27,16 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.AbstractServiceClientImpl; import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory; import org.collectionspace.services.collectionobject.CollectionobjectsCommonList; import org.collectionspace.services.collectionobject.ResponsibleDepartmentList; -import org.jboss.resteasy.client.ClientResponse; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.plugins.providers.multipart.OutputPart; @@ -53,25 +56,60 @@ import org.slf4j.LoggerFactory; */ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { + /** The logger. */ private final Logger logger = LoggerFactory.getLogger(CollectionObjectServiceTest.class); // Instance variables specific to this test. + /** The known resource id. */ private String knownResourceId = null; + + /** The all resource ids created. */ private List allResourceIdsCreated = new ArrayList(); + + /** The multivalue. */ private boolean multivalue; //toggle - /* - * This method is called only by the parent class, AbstractServiceTest + /** + * Gets the logger. + * + * @return the logger + */ + private Logger getLogger() { + return this.logger; + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() */ @Override protected String getServicePathComponent() { return new CollectionObjectClient().getServicePathComponent(); } - + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new CollectionObjectClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(CollectionobjectsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void create(String testName) throws Exception { @@ -121,6 +159,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { * Tests to diagnose and verify the fixed status of CSPACE-1026, * "Whitespace at certain points in payload cause failure" */ + /** + * Creates the from xml cambridge. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createFromXmlCambridge(String testName) throws Exception { @@ -129,6 +173,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { testSubmitRequest(newId); } + /** + * Creates the from xml rfw s1. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createFromXmlRFWS1(String testName) throws Exception { @@ -139,6 +189,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { testSubmitRequest(newId); } + /** + * Creates the from xml rfw s2. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createFromXmlRFWS2(String testName) throws Exception { @@ -149,6 +205,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { testSubmitRequest(newId); } + /** + * Creates the from xml rfw s3. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createFromXmlRFWS3(String testName) throws Exception { @@ -159,6 +221,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { testSubmitRequest(newId); } + /** + * Creates the from xml rfw s4. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createFromXmlRFWS4(String testName) throws Exception { @@ -174,6 +242,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { * fields, which contain null values, can be successfully created * but an error occurs on trying to retrieve those records). */ + /** + * Creates the with null value repeatable field. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "testSubmitRequest"}) public void createWithNullValueRepeatableField(String testName) throws Exception { @@ -194,7 +268,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) public void createList(String testName) throws Exception { - for (int i = 0; i < 3; i++) { + for (int i = 0; i < DEFAULT_LIST_SIZE; i++) { create(testName); } } @@ -202,6 +276,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void createWithEmptyEntityBody(String testName) throws Exception { @@ -221,6 +298,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { setupCreate(testName); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void createWithWrongXmlSchema(String testName) throws Exception { @@ -378,6 +458,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) @@ -420,6 +503,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -443,10 +529,14 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + // --------------------------------------------------------------- // CRUD tests : READ_LIST tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"}) @@ -496,6 +586,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -547,6 +640,13 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } + /** + * Update retrieve. + * + * @param testName the test name + * @param id the id + * @return the client response + */ private ClientResponse updateRetrieve(String testName, String id) { final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); CollectionObjectClient client = new CollectionObjectClient(); @@ -561,6 +661,14 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { return res; } + /** + * Update send. + * + * @param testName the test name + * @param id the id + * @param collectionObject the collection object + * @return the client response + */ private ClientResponse updateSend(String testName, String id, CollectionobjectsCommon collectionObject) { MultipartOutput output = new MultipartOutput(); @@ -574,6 +682,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -594,6 +705,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { public void updateWithMalformedXml(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -680,7 +794,10 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } */ - @Override + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String) + */ +@Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"}) public void updateNonExistent(String testName) throws Exception { @@ -768,6 +885,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // CRUD tests : DELETE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) @@ -792,6 +912,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ @Override @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"}) @@ -828,6 +951,12 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { testSubmitRequest(knownResourceId); } + /** + * Test submit request. + * + * @param resourceId the resource id + * @throws Exception the exception + */ private void testSubmitRequest(String resourceId) throws Exception { // Expected status code: 200 OK @@ -881,6 +1010,13 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { // --------------------------------------------------------------- // Utility methods used by tests above // --------------------------------------------------------------- + /** + * Creates the collection object instance. + * + * @param commonPartName the common part name + * @param identifier the identifier + * @return the multipart output + */ private MultipartOutput createCollectionObjectInstance(String commonPartName, String identifier) { return createCollectionObjectInstance(commonPartName, @@ -888,6 +1024,14 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { "objectName-" + identifier); } + /** + * Creates the collection object instance. + * + * @param commonPartName the common part name + * @param objectNumber the object number + * @param objectName the object name + * @return the multipart output + */ private MultipartOutput createCollectionObjectInstance(String commonPartName, String objectNumber, String objectName) { CollectionobjectsCommon collectionObject = new CollectionobjectsCommon(); @@ -921,6 +1065,14 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { return multipart; } + /** + * Creates the collection object instance. + * + * @param commonPartName the common part name + * @param collectionObject the collection object + * @param conh the conh + * @return the multipart output + */ private MultipartOutput createCollectionObjectInstance(String commonPartName, CollectionobjectsCommon collectionObject, CollectionobjectsNaturalhistory conh) { @@ -1001,10 +1153,24 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } + /** + * Gets the nH part name. + * + * @return the nH part name + */ private String getNHPartName() { return "collectionobjects_naturalhistory"; } + /** + * Creates the from xml file. + * + * @param testName the test name + * @param fileName the file name + * @param useJaxb the use jaxb + * @return the string + * @throws Exception the exception + */ private String createFromXmlFile(String testName, String fileName, boolean useJaxb) throws Exception { // Perform setup, such as initializing the type of service request // (e.g. CREATE, DELETE), its valid and expected status codes, and diff --git a/services/collectionobject/service/pom.xml b/services/collectionobject/service/pom.xml index 50ea8c6df..ca713ed14 100644 --- a/services/collectionobject/service/pom.xml +++ b/services/collectionobject/service/pom.xml @@ -93,7 +93,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA tjws @@ -104,12 +103,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA diff --git a/services/common/pom.xml b/services/common/pom.xml index bbabacf5d..cfbb94aab 100644 --- a/services/common/pom.xml +++ b/services/common/pom.xml @@ -20,6 +20,11 @@ org.collectionspace.services.jaxb ${project.version} + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + org.collectionspace.services org.collectionspace.services.authentication.jaxb @@ -113,6 +118,10 @@ + + org.jboss.resteasy + jaxrs-api + org.jboss.resteasy resteasy-jaxrs @@ -126,12 +135,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentFilter.java b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentFilter.java index e1092fcfd..1c4862f89 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentFilter.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentFilter.java @@ -20,6 +20,7 @@ package org.collectionspace.services.common.document; import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.MultivaluedMap; +import org.collectionspace.services.client.IClientQueryParams; import org.collectionspace.services.common.query.IQueryManager; import org.collectionspace.services.common.context.ServiceContext; @@ -34,11 +35,10 @@ import org.jboss.resteasy.specimpl.MultivaluedMapImpl; */ public class DocumentFilter { - public static final String PAGE_SIZE_DEFAULT_PROPERTY = "pageSizeDefault"; - public static final String PAGE_SIZE_PARAM = "pgSz"; - public static final String START_PAGE_PARAM = "pgNum"; public static final int DEFAULT_PAGE_SIZE_INIT = 40; + public static final String PAGE_SIZE_DEFAULT_PROPERTY = "pageSizeDefault"; public static int defaultPageSize = DEFAULT_PAGE_SIZE_INIT; + protected String whereClause; // Filtering clause. Omit the "WHERE". protected int startPage; // Pagination offset for list results protected int pageSize; // Pagination limit for list results @@ -128,7 +128,7 @@ public class DocumentFilter { // Set the page size // String pageSizeStr = null; - List list = queryParams.remove(PAGE_SIZE_PARAM); + List list = queryParams.remove(IClientQueryParams.PAGE_SIZE_PARAM); if (list != null) { pageSizeStr = list.get(0); } @@ -138,7 +138,7 @@ public class DocumentFilter { // Set the start page // String startPageStr = null; - list = queryParams.remove(START_PAGE_PARAM); + list = queryParams.remove(IClientQueryParams.START_PAGE_PARAM); if (list != null) { startPageStr = list.get(0); } @@ -243,7 +243,8 @@ public class DocumentFilter { } catch (NumberFormatException e) { //FIXME This should cause a warning in the log file and should result in the //FIXME page size being set to the default. We don't need to throw an exception here. - throw new NumberFormatException("Bad value for: " + PAGE_SIZE_PARAM); + throw new NumberFormatException("Bad value for: " + + IClientQueryParams.PAGE_SIZE_PARAM); } } @@ -260,7 +261,8 @@ public class DocumentFilter { try { startPage = Integer.valueOf(startPageStr); } catch (NumberFormatException e) { - throw new NumberFormatException("Bad value for: " + START_PAGE_PARAM); + throw new NumberFormatException("Bad value for: " + + IClientQueryParams.START_PAGE_PARAM); } } } diff --git a/services/contact/client/pom.xml b/services/contact/client/pom.xml index 5d4473176..6d85d46e1 100644 --- a/services/contact/client/pom.xml +++ b/services/contact/client/pom.xml @@ -43,7 +43,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -55,12 +54,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java index dadcbad2d..a5c2da88b 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java @@ -64,6 +64,11 @@ public class ContactClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.contactProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java index 99cf4b104..35ff0fdbd 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactProxy.java @@ -21,7 +21,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/contacts/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface ContactProxy { +public interface ContactProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java b/services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java index c6316ad9d..eed72b171 100644 --- a/services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java +++ b/services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java @@ -27,10 +27,12 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ContactClient; import org.collectionspace.services.client.ContactClientUtils; import org.collectionspace.services.contact.ContactsCommon; import org.collectionspace.services.contact.ContactsCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -61,6 +63,23 @@ public class ContactServiceTest extends AbstractServiceTestImpl { private String knownResourceId = null; private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new ContactClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(ContactsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/contact/service/pom.xml b/services/contact/service/pom.xml index bbe6e44b4..f51f7824f 100644 --- a/services/contact/service/pom.xml +++ b/services/contact/service/pom.xml @@ -51,7 +51,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -62,12 +61,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/dimension/client/pom.xml b/services/dimension/client/pom.xml index ecd144b2a..3bc8bcb70 100644 --- a/services/dimension/client/pom.xml +++ b/services/dimension/client/pom.xml @@ -46,7 +46,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -58,12 +57,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java index 3ea07ac21..ab26a2e5d 100644 --- a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java +++ b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java @@ -73,6 +73,11 @@ public class DimensionClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.dimensionProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java index f66872726..ea71d5aa1 100644 --- a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java +++ b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java @@ -21,7 +21,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/dimensions/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface DimensionProxy { +public interface DimensionProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java b/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java index 2b1509121..e0898e788 100644 --- a/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java +++ b/services/dimension/client/src/test/java/org/collectionspace/services/client/test/DimensionServiceTest.java @@ -27,9 +27,11 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.DimensionClient; import org.collectionspace.services.dimension.DimensionsCommon; import org.collectionspace.services.dimension.DimensionsCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -60,6 +62,23 @@ public class DimensionServiceTest extends AbstractServiceTestImpl { private String knownResourceId = null; private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new DimensionClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(DimensionsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/dimension/service/pom.xml b/services/dimension/service/pom.xml index 289b15ba7..57c36c026 100644 --- a/services/dimension/service/pom.xml +++ b/services/dimension/service/pom.xml @@ -58,7 +58,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -69,12 +68,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/id/client/pom.xml b/services/id/client/pom.xml index 34ad26e9f..eb6683bea 100644 --- a/services/id/client/pom.xml +++ b/services/id/client/pom.xml @@ -40,7 +40,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -52,12 +51,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/id/service/pom.xml b/services/id/service/pom.xml index 0b6ab8dd1..1c1179f94 100644 --- a/services/id/service/pom.xml +++ b/services/id/service/pom.xml @@ -33,7 +33,15 @@ services.id.service - + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + org.collectionspace.services @@ -76,12 +84,10 @@ - org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -93,13 +99,11 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/id/service/src/test/java/org/collectionspace/services/id/part/test/GregorianDateIDPartTest.java b/services/id/service/src/test/java/org/collectionspace/services/id/part/test/GregorianDateIDPartTest.java index f341b0e18..c377dc5d3 100644 --- a/services/id/service/src/test/java/org/collectionspace/services/id/part/test/GregorianDateIDPartTest.java +++ b/services/id/service/src/test/java/org/collectionspace/services/id/part/test/GregorianDateIDPartTest.java @@ -4,7 +4,7 @@ import org.collectionspace.services.id.part.GregorianDateIDPart; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Date; +//import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; @@ -15,6 +15,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class GregorianDateIDPartTest { + + public GregorianDateIDPartTest(String inComingString) { + System.err.println("GregorianDateIDPartTest constructor invoked!"); + //empty constructor + } final Logger logger = LoggerFactory.getLogger(GregorianDateIDPartTest.class); @@ -48,6 +53,7 @@ public class GregorianDateIDPartTest { @Test public void format() { + //empty? } @Test diff --git a/services/id/service/src/test/java/org/collectionspace/services/id/part/test/NumericIDPartRegexValidatorTest.java b/services/id/service/src/test/java/org/collectionspace/services/id/part/test/NumericIDPartRegexValidatorTest.java index 7a1b28a07..2504fd2f3 100644 --- a/services/id/service/src/test/java/org/collectionspace/services/id/part/test/NumericIDPartRegexValidatorTest.java +++ b/services/id/service/src/test/java/org/collectionspace/services/id/part/test/NumericIDPartRegexValidatorTest.java @@ -9,6 +9,11 @@ public class NumericIDPartRegexValidatorTest { NumericIDPartRegexValidator validator = new NumericIDPartRegexValidator(); + public NumericIDPartRegexValidatorTest(String inComingString) { + System.err.println("NumericIDPartRegexValidatorTest constructor invoked!"); + //empty constructor + } + @Test public void isValid() { Assert.assertTrue(validator.isValid("0")); diff --git a/services/intake/client/pom.xml b/services/intake/client/pom.xml index e7487b6b6..09b15d019 100644 --- a/services/intake/client/pom.xml +++ b/services/intake/client/pom.xml @@ -61,7 +61,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -73,12 +72,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java index 6c5adba64..cb215bec2 100644 --- a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java +++ b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java @@ -44,6 +44,7 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory; * A IntakeClient. * @version $Revision:$ + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ public class IntakeClient extends AbstractServiceClientImpl { @@ -73,6 +74,11 @@ public class IntakeClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.intakeProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java index 4ac7ca434..21c8760c7 100644 --- a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java +++ b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java @@ -1,3 +1,29 @@ +/** + * IntakeProxy.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ + * $LastChangedRevision: $ + * $LastChangedDate: $ + * + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ package org.collectionspace.services.client; import javax.ws.rs.Consumes; @@ -19,36 +45,73 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; /** * @version $Revision:$ + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684 */ @Path("/intakes/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface IntakeProxy { +public interface IntakeProxy extends CollectionSpaceProxy { + /** + * Read list. + * + * @return the client response + */ @GET @Produces({"application/xml"}) ClientResponse readList(); //(C)reate + /** + * Creates the. + * + * @param multipart the multipart + * @return the client response + */ @POST ClientResponse create(MultipartOutput multipart); //(R)ead + /** + * Read. + * + * @param csid the csid + * @return the client response + */ @GET @Path("/{csid}") ClientResponse read(@PathParam("csid") String csid); //(U)pdate + /** + * Update. + * + * @param csid the csid + * @param multipart the multipart + * @return the client response + */ @PUT @Path("/{csid}") ClientResponse update(@PathParam("csid") String csid, MultipartOutput multipart); //(D)elete + /** + * Delete. + * + * @param csid the csid + * @return the client response + */ @DELETE @Path("/{csid}") ClientResponse delete(@PathParam("csid") String csid); // List Items + /** + * Gets the authority refs. + * + * @param csid the csid + * @return the authority refs + */ @GET @Produces({"application/xml"}) @Path("/{csid}/authorityrefs/") diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java index 82812a2be..557706a0e 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java @@ -31,12 +31,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IntakeClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.intake.IntakesCommon; -import org.collectionspace.services.intake.IntakesCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -79,6 +80,23 @@ public class IntakeAuthRefsTest extends BaseServiceTest { private String valuerRefName = null; private final int NUM_AUTH_REFS_EXPECTED = 6; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java index 7c1c1ca63..11433935a 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java @@ -27,12 +27,13 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IntakeClient; import org.collectionspace.services.intake.IntakesCommon; import org.collectionspace.services.intake.IntakesCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; - import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.plugins.providers.multipart.OutputPart; @@ -44,6 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** + * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685 * IntakeServiceTest, carries out tests against a * deployed and running Intake Service. * @@ -52,18 +54,44 @@ import org.slf4j.LoggerFactory; */ public class IntakeServiceTest extends AbstractServiceTestImpl { + /** The logger. */ private final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class); // Instance variables specific to this test. + /** The SERVIC e_ pat h_ component. */ final String SERVICE_PATH_COMPONENT = "intakes"; + + /** The known resource id. */ private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + + /** The all resource ids created. */ + private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new IntakeClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(IntakesCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class) public void create(String testName) throws Exception { @@ -108,6 +136,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { allResourceIdsCreated.add(extractId(res)); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) @@ -120,14 +151,23 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String) + */ @Override public void createWithEmptyEntityBody(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String) + */ @Override public void createWithMalformedXml(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String) + */ @Override public void createWithWrongXmlSchema(String testName) throws Exception { } @@ -216,6 +256,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) @@ -245,6 +288,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -272,6 +318,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ_LIST tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"}) @@ -320,6 +369,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -384,12 +436,23 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String) + */ @Override public void updateWithEmptyEntityBody(String testName) throws Exception{ } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String) + */ @Override public void updateWithMalformedXml(String testName) throws Exception { } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String) + */ @Override public void updateWithWrongXmlSchema(String testName) throws Exception { } @@ -474,6 +537,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { } */ + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"}) @@ -505,6 +571,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // CRUD tests : DELETE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) @@ -529,6 +598,9 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"delete"}) @@ -614,11 +686,20 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { // --------------------------------------------------------------- // Utility methods used by tests above // --------------------------------------------------------------- + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ @Override public String getServicePathComponent() { return SERVICE_PATH_COMPONENT; } + /** + * Creates the intake instance. + * + * @param identifier the identifier + * @return the multipart output + */ private MultipartOutput createIntakeInstance(String identifier) { return createIntakeInstance( "entryNumber-" + identifier, @@ -626,6 +707,14 @@ public class IntakeServiceTest extends AbstractServiceTestImpl { "depositor-" + identifier); } + /** + * Creates the intake instance. + * + * @param entryNumber the entry number + * @param entryDate the entry date + * @param depositor the depositor + * @return the multipart output + */ private MultipartOutput createIntakeInstance(String entryNumber, String entryDate, String depositor) { diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java index 1d06f354d..7577b9e84 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java @@ -31,12 +31,14 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IntakeClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefDocList; import org.collectionspace.services.intake.IntakesCommon; import org.collectionspace.services.intake.IntakesCommonList; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.jboss.resteasy.client.ClientResponse; @@ -80,6 +82,23 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { private String valuerRefName = null; private final int NUM_AUTH_REF_DOCS_EXPECTED = 1; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/intake/service/pom.xml b/services/intake/service/pom.xml index 1ccf37416..6dbd12b32 100644 --- a/services/intake/service/pom.xml +++ b/services/intake/service/pom.xml @@ -63,7 +63,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -74,12 +73,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/loanin/client/pom.xml b/services/loanin/client/pom.xml index b64917c61..6b2cd8249 100644 --- a/services/loanin/client/pom.xml +++ b/services/loanin/client/pom.xml @@ -61,7 +61,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA @@ -73,12 +72,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA commons-httpclient diff --git a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java index 50a61df32..405448e9b 100644 --- a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java +++ b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninClient.java @@ -64,6 +64,11 @@ public class LoaninClient extends AbstractServiceClientImpl { RegisterBuiltin.register(factory); setProxy(); } + + @Override + public CollectionSpaceProxy getProxy() { + return this.loaninProxy; + } /** * allow to reset proxy as per security needs diff --git a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java index f8871bc63..4c8b64138 100644 --- a/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java +++ b/services/loanin/client/src/main/java/org/collectionspace/services/client/LoaninProxy.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/loansin/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface LoaninProxy { +public interface LoaninProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java index 4dc8fd1fb..db34e6b4f 100644 --- a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java +++ b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java @@ -31,11 +31,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoaninClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.loanin.LoansinCommon; import org.collectionspace.services.loanin.LoansinCommonList; @@ -79,6 +81,23 @@ public class LoaninAuthRefsTest extends BaseServiceTest { // to tenant-bindings.xml private final int NUM_AUTH_REFS_EXPECTED = 3; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java index 8a0f95e79..4b977b6fb 100644 --- a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java +++ b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java @@ -27,14 +27,14 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoaninClient; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.loanin.LoansinCommon; import org.collectionspace.services.loanin.LoansinCommonList; import org.collectionspace.services.loanin.LenderList; - import org.jboss.resteasy.client.ClientResponse; - import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.plugins.providers.multipart.OutputPart; @@ -60,8 +60,25 @@ public class LoaninServiceTest extends AbstractServiceTestImpl { // Instance variables specific to this test. final String SERVICE_PATH_COMPONENT = "loansin"; private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new LoaninClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(LoansinCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/loanin/service/pom.xml b/services/loanin/service/pom.xml index 9deb8b93e..9950fd532 100644 --- a/services/loanin/service/pom.xml +++ b/services/loanin/service/pom.xml @@ -63,7 +63,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -74,12 +73,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/loanout/client/pom.xml b/services/loanout/client/pom.xml index 93f2e0f05..74ac0fa23 100644 --- a/services/loanout/client/pom.xml +++ b/services/loanout/client/pom.xml @@ -61,7 +61,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.1.GA @@ -73,12 +72,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.1.GA org.jboss.resteasy resteasy-multipart-provider - 1.1.GA commons-httpclient diff --git a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java index c78b27af3..8771e1ae1 100644 --- a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java +++ b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutClient.java @@ -65,6 +65,11 @@ public class LoanoutClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.loanoutProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java index 511158142..00a6652d1 100644 --- a/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java +++ b/services/loanout/client/src/main/java/org/collectionspace/services/client/LoanoutProxy.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/loansout/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface LoanoutProxy { +public interface LoanoutProxy extends CollectionSpaceProxy { //(C)reate @POST diff --git a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java index f89481c57..ef19f4c5f 100644 --- a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java +++ b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java @@ -31,11 +31,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoanoutClient; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.loanout.LoansoutCommon; import org.collectionspace.services.loanout.LoansoutCommonList; @@ -81,6 +83,23 @@ public class LoanoutAuthRefsTest extends BaseServiceTest { // number of expected authRefs to 4. private final int NUM_AUTH_REFS_EXPECTED = 3; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java index 228a7fc5e..b19069700 100644 --- a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java +++ b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java @@ -27,7 +27,9 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoanoutClient; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.loanout.LoansoutCommon; import org.collectionspace.services.loanout.LoansoutCommonList; @@ -52,18 +54,44 @@ import org.slf4j.LoggerFactory; */ public class LoanoutServiceTest extends AbstractServiceTestImpl { + /** The logger. */ private final Logger logger = LoggerFactory.getLogger(LoanoutServiceTest.class); // Instance variables specific to this test. + /** The SERVIC e_ pat h_ component. */ final String SERVICE_PATH_COMPONENT = "loansout"; + + /** The known resource id. */ private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + + /** The all resource ids created. */ + private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new LoanoutClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(LoansoutCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class) public void create(String testName) throws Exception { @@ -108,6 +136,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { allResourceIdsCreated.add(extractId(res)); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) @@ -120,14 +151,23 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String) + */ @Override public void createWithEmptyEntityBody(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String) + */ @Override public void createWithMalformedXml(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String) + */ @Override public void createWithWrongXmlSchema(String testName) throws Exception { } @@ -216,6 +256,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) @@ -245,6 +288,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -272,6 +318,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ_LIST tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"}) @@ -320,6 +369,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) @@ -383,12 +435,23 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String) + */ @Override public void updateWithEmptyEntityBody(String testName) throws Exception{ } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String) + */ @Override public void updateWithMalformedXml(String testName) throws Exception { } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String) + */ @Override public void updateWithWrongXmlSchema(String testName) throws Exception { } @@ -473,6 +536,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { } */ + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"}) @@ -504,6 +570,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // CRUD tests : DELETE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) @@ -528,6 +597,9 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"delete"}) @@ -613,17 +685,33 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl { // --------------------------------------------------------------- // Utility methods used by tests above // --------------------------------------------------------------- + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ @Override public String getServicePathComponent() { return SERVICE_PATH_COMPONENT; } + /** + * Creates the loanout instance. + * + * @param identifier the identifier + * @return the multipart output + */ private MultipartOutput createLoanoutInstance(String identifier) { return createLoanoutInstance( "loanoutNumber-" + identifier, "returnDate-" + identifier); } + /** + * Creates the loanout instance. + * + * @param loanOutNumber the loan out number + * @param returnDate the return date + * @return the multipart output + */ private MultipartOutput createLoanoutInstance(String loanOutNumber, String returnDate) { LoansoutCommon loanout = new LoansoutCommon(); diff --git a/services/loanout/service/pom.xml b/services/loanout/service/pom.xml index 3fd62547f..a424698f2 100644 --- a/services/loanout/service/pom.xml +++ b/services/loanout/service/pom.xml @@ -63,7 +63,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -74,12 +73,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/organization/client/pom.xml b/services/organization/client/pom.xml index 39416b426..f260a56d7 100644 --- a/services/organization/client/pom.xml +++ b/services/organization/client/pom.xml @@ -55,7 +55,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -67,12 +66,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java index 3e8ed0a7e..95b2195a1 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java @@ -53,6 +53,11 @@ public class OrgAuthorityClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.orgAuthorityProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java index 60332c1bc..600e0a6d8 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java @@ -24,7 +24,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/orgauthorities/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface OrgAuthorityProxy { +public interface OrgAuthorityProxy extends CollectionSpaceProxy { // List OrgAuthorities @GET diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java index 9fb22eb66..1a2ec608f 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java @@ -31,13 +31,13 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.OrganizationJAXBSchema; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.OrgAuthorityClient; import org.collectionspace.services.client.OrgAuthorityClientUtils; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.common.authorityref.AuthorityRefList; -import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem; -import org.collectionspace.services.organization.OrgauthoritiesCommon; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.organization.OrganizationsCommon; import org.jboss.resteasy.client.ClientResponse; @@ -79,6 +79,23 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest { private String organizationContactPersonRefName = null; private final int NUM_AUTH_REFS_EXPECTED = 1; + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java index 59aaa854b..db4d0ac4d 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java @@ -30,12 +30,14 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.OrganizationJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ContactClient; import org.collectionspace.services.client.ContactClientUtils; import org.collectionspace.services.contact.ContactsCommon; import org.collectionspace.services.contact.ContactsCommonList; import org.collectionspace.services.client.OrgAuthorityClient; import org.collectionspace.services.client.OrgAuthorityClientUtils; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.organization.OrgauthoritiesCommon; import org.collectionspace.services.organization.OrgauthoritiesCommonList; import org.collectionspace.services.organization.OrganizationsCommon; @@ -81,6 +83,23 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl { private Map allContactResourceIdsCreated = new HashMap(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new OrgAuthorityClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(OrganizationsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/organization/import/pom.xml b/services/organization/import/pom.xml index 2e3886da3..136f7bbac 100644 --- a/services/organization/import/pom.xml +++ b/services/organization/import/pom.xml @@ -41,17 +41,9 @@ org.collectionspace.services.organization.client ${project.version} - org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -63,12 +55,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/organization/service/pom.xml b/services/organization/service/pom.xml index 7cdf7380d..b0d5251f0 100644 --- a/services/organization/service/pom.xml +++ b/services/organization/service/pom.xml @@ -84,7 +84,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -95,12 +94,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/person/client/pom.xml b/services/person/client/pom.xml index d2da2f27a..4c7f7d649 100644 --- a/services/person/client/pom.xml +++ b/services/person/client/pom.xml @@ -59,7 +59,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -71,12 +70,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java index af2efcd16..782743beb 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java @@ -56,6 +56,11 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.personAuthorityProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java index ca8f4e688..6d8c0ac58 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java @@ -24,7 +24,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/personauthorities/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface PersonAuthorityProxy { +public interface PersonAuthorityProxy extends CollectionSpaceProxy { // List Personauthorities @GET diff --git a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java index 90358fcd0..3006ad2c3 100644 --- a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java +++ b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java @@ -30,12 +30,14 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ContactClient; import org.collectionspace.services.client.ContactClientUtils; import org.collectionspace.services.contact.ContactsCommon; import org.collectionspace.services.contact.ContactsCommonList; import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.person.PersonauthoritiesCommon; import org.collectionspace.services.person.PersonauthoritiesCommonList; import org.collectionspace.services.person.PersonsCommon; @@ -59,35 +61,88 @@ import org.testng.annotations.Test; */ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { + /** The logger. */ private final Logger logger = LoggerFactory.getLogger(PersonAuthorityServiceTest.class); // Instance variables specific to this test. + /** The SERVIC e_ pat h_ component. */ final String SERVICE_PATH_COMPONENT = "personauthorities"; + + /** The ITE m_ servic e_ pat h_ component. */ final String ITEM_SERVICE_PATH_COMPONENT = "items"; + + /** The CONTAC t_ servic e_ pat h_ component. */ final String CONTACT_SERVICE_PATH_COMPONENT = "contacts"; + + /** The TES t_ for e_ name. */ final String TEST_FORE_NAME = "John"; + + /** The TES t_ middl e_ name. */ final String TEST_MIDDLE_NAME = null; + + /** The TES t_ su r_ name. */ final String TEST_SUR_NAME = "Wayne"; + + /** The TES t_ birt h_ date. */ final String TEST_BIRTH_DATE = "May 26, 1907"; + + /** The TES t_ deat h_ date. */ final String TEST_DEATH_DATE = "June 11, 1979"; + /** The known resource id. */ private String knownResourceId = null; + + /** The known resource display name. */ private String knownResourceDisplayName = null; + + /** The known resource ref name. */ private String knownResourceRefName = null; + + /** The known item resource id. */ private String knownItemResourceId = null; + + /** The known contact resource id. */ private String knownContactResourceId = null; + + /** The n items to create in list. */ private int nItemsToCreateInList = 3; + + /** The all resource ids created. */ private List allResourceIdsCreated = new ArrayList(); + + /** The all item resource ids created. */ private Map allItemResourceIdsCreated = new HashMap(); + + /** The all contact resource ids created. */ private Map allContactResourceIdsCreated = new HashMap(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new PersonAuthorityClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(PersonsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"create"}) @@ -119,9 +174,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { if(logger.isDebugEnabled()){ logger.debug(testName + ": status = " + statusCode); } - Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), - invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE); // Store the refname from the first resource created // for additional tests below. @@ -142,6 +197,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { allResourceIdsCreated.add(newID); } + /** + * Creates the item. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"create"}, dependsOnMethods = {"create"}) public void createItem(String testName) { @@ -149,6 +209,13 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { String newID = createItemInAuthority(knownResourceId, knownResourceRefName); } + /** + * Creates the item in authority. + * + * @param vcsid the vcsid + * @param authRefName the auth ref name + * @return the string + */ private String createItemInAuthority(String vcsid, String authRefName) { final String testName = "createItemInAuthority"; @@ -206,6 +273,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { return newID; } + /** + * Creates the contact. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"create"}, dependsOnMethods = {"createItem"}) public void createContact(String testName) { @@ -213,6 +285,13 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { String newID = createContactInItem(knownResourceId, knownItemResourceId); } + /** + * Creates the contact in item. + * + * @param parentcsid the parentcsid + * @param itemcsid the itemcsid + * @return the string + */ private String createContactInItem(String parentcsid, String itemcsid) { final String testName = "createContactInItem"; @@ -262,14 +341,23 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String) + */ @Override public void createWithEmptyEntityBody(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String) + */ @Override public void createWithMalformedXml(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String) + */ @Override public void createWithWrongXmlSchema(String testName) throws Exception { } @@ -358,7 +446,10 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // CRUD tests : CREATE LIST tests // --------------------------------------------------------------- // Success outcomes - @Override + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ +@Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"createList"}, dependsOnGroups = {"create"}) public void createList(String testName) throws Exception { @@ -367,6 +458,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } } + /** + * Creates the item list. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"createList"}, dependsOnMethods = {"createList"}) public void createItemList(String testName) throws Exception { @@ -376,6 +473,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } } + /** + * Creates the contact list. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"createList"}, dependsOnMethods = {"createItemList"}) public void createContactList(String testName) throws Exception { @@ -389,6 +492,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // CRUD tests : READ tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnGroups = {"create"}) @@ -421,6 +527,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } } + /** + * Read by name. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnGroups = {"create"}) public void readByName(String testName) throws Exception { @@ -484,7 +596,13 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } */ - @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, + /** + * Read item. + * + * @param testName the test name + * @throws Exception the exception + */ +@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnMethods = {"read"}) public void readItem(String testName) throws Exception { @@ -519,6 +637,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } + /** + * Verify item display name. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"readItem", "updateItem"}) public void verifyItemDisplayName(String testName) throws Exception { @@ -627,6 +751,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { "Updated DisplayName (not computed) in Person not stored."); } + /** + * Verify illegal item display name. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, dependsOnMethods = {"verifyItemDisplayName"}) public void verifyIllegalItemDisplayName(String testName) throws Exception { @@ -673,6 +803,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Read contact. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnMethods = {"readItem"}) public void readContact(String testName) throws Exception { @@ -712,6 +848,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnMethods = {"read"}) @@ -735,6 +874,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Read item non existent. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnMethods = {"readItem"}) public void readItemNonExistent(String testName) { @@ -757,6 +901,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Read contact non existent. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"read"}, dependsOnMethods = {"readContact"}) public void readContactNonExistent(String testName) { @@ -785,6 +934,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"readList"}, dependsOnGroups = {"createList", "read"}) @@ -828,15 +980,28 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } } + /** + * Read item list. + */ @Test(groups = {"readList"}, dependsOnMethods = {"readList"}) public void readItemList() { readItemList(knownResourceId, null); } + /** + * Read item list by authority name. + */ @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"}) public void readItemListByAuthorityName() { readItemList(null, knownResourceDisplayName); } + + /** + * Read item list. + * + * @param vcsid the vcsid + * @param name the name + */ private void readItemList(String vcsid, String name) { final String testName = "readItemList"; @@ -902,11 +1067,20 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } } + /** + * Read contact list. + */ @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"}) public void readContactList() { readContactList(knownResourceId, knownItemResourceId); } + /** + * Read contact list. + * + * @param parentcsid the parentcsid + * @param itemcsid the itemcsid + */ private void readContactList(String parentcsid, String itemcsid) { final String testName = "readContactList"; @@ -968,6 +1142,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // CRUD tests : UPDATE tests // --------------------------------------------------------------- // Success outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnGroups = {"read", "readList"}) @@ -1029,6 +1206,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { "Data in updated object did not match submitted data."); } + /** + * Update item. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnMethods = {"update"}) public void updateItem(String testName) throws Exception { @@ -1092,6 +1275,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { "Data in updated Person did not match submitted data."); } + /** + * Update contact. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnMethods = {"updateItem"}) public void updateContact(String testName) throws Exception { @@ -1158,14 +1347,23 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // Failure outcomes // Placeholders until the three tests below can be uncommented. // See Issue CSPACE-401. + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String) + */ @Override public void updateWithEmptyEntityBody(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String) + */ @Override public void updateWithMalformedXml(String testName) throws Exception { } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String) + */ @Override public void updateWithWrongXmlSchema(String testName) throws Exception { } @@ -1250,7 +1448,10 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } */ - @Override + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String) + */ +@Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"}) public void updateNonExistent(String testName) throws Exception { @@ -1280,6 +1481,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Update non existent item. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"}) public void updateNonExistentItem(String testName) throws Exception { @@ -1313,6 +1520,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Update non existent contact. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"update"}, dependsOnMethods = {"updateContact", "testContactSubmitRequest"}) public void updateNonExistentContact(String testName) throws Exception { @@ -1327,6 +1540,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // Note: delete sub-resources in ascending hierarchical order, // before deleting their parents. + /** + * Delete contact. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"}) public void deleteContact(String testName) throws Exception { @@ -1356,6 +1575,12 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Delete item. + * + * @param testName the test name + * @throws Exception the exception + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnMethods = {"deleteContact"}) public void deleteItem(String testName) throws Exception { @@ -1383,6 +1608,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnMethods = {"deleteItem"}) @@ -1411,6 +1639,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } // Failure outcomes + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnMethods = {"delete"}) @@ -1434,6 +1665,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Delete non existent item. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnMethods = {"deleteItem"}) public void deleteNonExistentItem(String testName) { @@ -1456,6 +1692,11 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); } + /** + * Delete non existent contact. + * + * @param testName the test name + */ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"delete"}, dependsOnMethods = {"deleteContact"}) public void deleteNonExistentContact(String testName) { @@ -1507,6 +1748,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } + /** + * Test item submit request. + */ @Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"}) public void testItemSubmitRequest() { @@ -1528,6 +1772,9 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { } + /** + * Test contact submit request. + */ @Test(dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"}) public void testContactSubmitRequest() { @@ -1610,15 +1857,28 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl { // --------------------------------------------------------------- // Utility methods used by tests above // --------------------------------------------------------------- + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ @Override public String getServicePathComponent() { return SERVICE_PATH_COMPONENT; } + /** + * Gets the item service path component. + * + * @return the item service path component + */ public String getItemServicePathComponent() { return ITEM_SERVICE_PATH_COMPONENT; } + /** + * Gets the contact service path component. + * + * @return the contact service path component + */ public String getContactServicePathComponent() { return CONTACT_SERVICE_PATH_COMPONENT; } diff --git a/services/person/import/pom.xml b/services/person/import/pom.xml index 70a687d2a..13b28b703 100644 --- a/services/person/import/pom.xml +++ b/services/person/import/pom.xml @@ -51,7 +51,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -63,12 +62,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/person/service/pom.xml b/services/person/service/pom.xml index 3e6c73fa6..d4e49fcd3 100644 --- a/services/person/service/pom.xml +++ b/services/person/service/pom.xml @@ -84,7 +84,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -95,12 +94,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/pom.xml b/services/pom.xml index 607685dd7..758598c56 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -197,11 +197,6 @@ - net.java.dev.jaxb2-commons jaxb-fluent-api @@ -214,11 +209,6 @@ test jdk15 - - org.jboss.resteasy - jaxrs-api - 1.1.GA - org.jvnet.jaxb2_commons basic @@ -234,11 +224,26 @@ runtime 0.4.1.4 + + org.jboss.resteasy + jaxrs-api + 1.2.GA + org.jboss.resteasy resteasy-jaxrs - 1.1.GA + 1.2.GA + + + org.jboss.resteasy + resteasy-jaxb-provider + 1.2.GA + + org.jboss.resteasy + resteasy-multipart-provider + 1.2.GA + commons-httpclient commons-httpclient diff --git a/services/query/service/pom.xml b/services/query/service/pom.xml index 116deeca6..830b2e951 100644 --- a/services/query/service/pom.xml +++ b/services/query/service/pom.xml @@ -74,7 +74,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -85,12 +84,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/relation/client/pom.xml b/services/relation/client/pom.xml index 672a7943b..202557562 100644 --- a/services/relation/client/pom.xml +++ b/services/relation/client/pom.xml @@ -45,7 +45,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -57,12 +56,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java index 9bbc015be..836bf9382 100644 --- a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java +++ b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java @@ -1,3 +1,29 @@ +/** + * RelationClient.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ + * $LastChangedRevision: $ + * $LastChangedDate: $ + * + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ package org.collectionspace.services.client; import javax.ws.rs.core.Response; @@ -13,96 +39,120 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; import org.jboss.resteasy.spi.ResteasyProviderFactory; /** - * A RelationClient. - - * @version $Revision:$ + * The Class RelationClient. */ -public class RelationClient extends AbstractServiceClientImpl implements RelationProxy { +public class RelationClient extends AbstractServiceClientImpl { - /* (non-Javadoc) - * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent() + /* + * (non-Javadoc) + * + * @see + * org.collectionspace.services.client.BaseServiceClient#getServicePathComponent + * () */ + @Override public String getServicePathComponent() { return "relations"; } - - /** - * - */ - private RelationProxy relationProxy; - /** - * - * Default constructor for CollectionObjectClient class. - * - */ - public RelationClient() { - ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); - RegisterBuiltin.register(factory); - setProxy(); - } - - /** - * allow to reset proxy as per security needs - */ - public void setProxy() { - if(useAuth()){ - relationProxy = ProxyFactory.create(RelationProxy.class, - getBaseURL(), getHttpClient()); - }else{ - relationProxy = ProxyFactory.create(RelationProxy.class, - getBaseURL()); - } - } + /** The relation proxy. */ + private RelationProxy relationProxy; - /** - * @return - * @see org.collectionspace.hello.client.RelationProxy#getRelation() - */ - public ClientResponse readList() { - return relationProxy.readList(); - } - - public ClientResponse readList_SPO(String subjectCsid, - String predicate, - String objectCsid) { - return relationProxy.readList_SPO(subjectCsid, predicate, objectCsid); - } - - /** - * @param csid - * @return - * @see org.collectionspace.hello.client.RelationProxy#getRelation(java.lang.String) - */ - public ClientResponse read(String csid) { - return relationProxy.read(csid); - } + /** + * Instantiates a new relation client. + */ + public RelationClient() { + ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); + RegisterBuiltin.register(factory); + setProxy(); + } - /** - * @param relation - * @return - * @see org.collectionspace.hello.client.RelationProxy#createRelation(org.collectionspace.hello.Relation) - */ - public ClientResponse create(MultipartOutput multipart) { - return relationProxy.create(multipart); - } +// /* (non-Javadoc) +// * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy() +// */ +// @Override +// public CollectionSpaceProxy getProxy() { +// return this.relationProxy; +// } - /** - * @param csid - * @param relation - * @return - * @see org.collectionspace.hello.client.RelationProxy#updateRelation(java.lang.Long, org.collectionspace.hello.Relation) - */ - public ClientResponse update(String csid, MultipartOutput multipart) { - return relationProxy.update(csid, multipart); + public CollectionSpaceProxy getProxy() { + return this.relationProxy; } /** - * @param csid - * @return - * @see org.collectionspace.hello.client.RelationProxy#deleteRelation(java.lang.Long) - */ - public ClientResponse delete(String csid) { - return relationProxy.delete(csid); - } + * Sets the proxy. + */ + public void setProxy() { + if (useAuth()) { + relationProxy = ProxyFactory.create(RelationProxy.class, + getBaseURL(), getHttpClient()); + } else { + relationProxy = ProxyFactory.create(RelationProxy.class, + getBaseURL()); + } + } + + /** + * Read list. + * + * @return the client response + */ + public ClientResponse readList() { + return relationProxy.readList(); + } + + /** + * Read list_ spo. + * + * @param subjectCsid the subject csid + * @param predicate the predicate + * @param objectCsid the object csid + * @return the client response + */ + public ClientResponse readList_SPO(String subjectCsid, + String predicate, String objectCsid) { + return relationProxy.readList_SPO(subjectCsid, predicate, objectCsid); + } + + /** + * Read. + * + * @param csid the csid + * @return the client response + */ + public ClientResponse read(String csid) { + return relationProxy.read(csid); + } + + /** + * Creates the. + * + * @param multipart the multipart + * @return the client response + */ + public ClientResponse create(MultipartOutput multipart) { + return relationProxy.create(multipart); + } + + /** + * Update. + * + * @param csid the csid + * @param multipart the multipart + * @return the client response + */ + public ClientResponse update(String csid, + MultipartOutput multipart) { + return relationProxy.update(csid, multipart); + } + + /** + * Delete. + * + * @param csid the csid + * @return the client response + */ + public ClientResponse delete(String csid) { + return relationProxy.delete(csid); + } } diff --git a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java index d6e75f977..352f4f3b8 100644 --- a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java +++ b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationProxy.java @@ -21,7 +21,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/relations/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface RelationProxy { +public interface RelationProxy extends CollectionSpaceProxy { @GET @Produces({"application/xml"}) diff --git a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java index 551a2ff00..13f158366 100644 --- a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java +++ b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java @@ -27,7 +27,9 @@ import java.util.List; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.RelationClient; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.relation.RelationsCommon; import org.collectionspace.services.relation.RelationsCommonList; import org.collectionspace.services.relation.RelationshipType; @@ -58,14 +60,31 @@ public class RelationServiceTest extends AbstractServiceTestImpl { final String SERVICE_PATH_COMPONENT = "relations"; private String knownResourceId = null; - private List allResourceIdsCreated = new ArrayList(); + private List allResourceIdsCreated = new ArrayList(); + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new RelationClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(RelationsCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- // Success outcomes - @Override @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class) + @Override public void create(String testName) throws Exception { // Perform setup, such as initializing the type of service request diff --git a/services/relation/service/pom.xml b/services/relation/service/pom.xml index d000ae1e1..4c63612e6 100644 --- a/services/relation/service/pom.xml +++ b/services/relation/service/pom.xml @@ -59,7 +59,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -70,12 +69,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA diff --git a/services/security/client/pom.xml b/services/security/client/pom.xml index 69fa3cb16..fded08294 100644 --- a/services/security/client/pom.xml +++ b/services/security/client/pom.xml @@ -56,7 +56,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -68,12 +67,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/security/client/src/test/java/org/collectionspace/services/authentication/client/test/AuthenticationServiceTest.java b/services/security/client/src/test/java/org/collectionspace/services/authentication/client/test/AuthenticationServiceTest.java index d7e695b9c..7b12a2963 100644 --- a/services/security/client/src/test/java/org/collectionspace/services/authentication/client/test/AuthenticationServiceTest.java +++ b/services/security/client/src/test/java/org/collectionspace/services/authentication/client/test/AuthenticationServiceTest.java @@ -24,22 +24,28 @@ package org.collectionspace.services.authentication.client.test; import java.util.ArrayList; import java.util.List; + import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.apache.commons.codec.binary.Base64; -import org.collectionspace.services.account.AccountTenant; -import org.collectionspace.services.client.AccountClient; -import org.collectionspace.services.account.AccountsCommon; + +//import org.apache.commons.codec.binary.Base64; import org.jboss.resteasy.client.ClientResponse; +import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; +import org.jboss.resteasy.plugins.providers.multipart.OutputPart; + import org.testng.Assert; import org.testng.annotations.Test; +import org.collectionspace.services.account.AccountTenant; +import org.collectionspace.services.client.AccountClient; +import org.collectionspace.services.account.AccountsCommon; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.test.AbstractServiceTestImpl; -import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; -import org.jboss.resteasy.plugins.providers.multipart.OutputPart; +import org.collectionspace.services.client.test.BaseServiceTest; +import org.collectionspace.services.jaxb.AbstractCommonList; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,7 +75,30 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { return null; } - @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new AccountClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + throw new UnsupportedOperationException(); //Since this test does not support lists, this method is not needed. + } + + @Test(dataProvider = "testName") + @Override + public void readPaginatedList(String testName) throws Exception { + // Test not supported. + } + + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) public void createAccounts(String testName) throws Exception { // Perform setup, such as initializing the type of service request // (e.g. CREATE, DELETE), its valid and expected status codes, and @@ -126,7 +155,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void create(String testName) { setupCreate(testName); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -161,7 +190,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void createWithoutPassword() { banner("createWithoutPassword"); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -191,7 +220,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void createWithUnknownUser() { banner("createWithUnknownUser"); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -222,7 +251,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void createWithIncorrectPassword() { banner("createWithIncorrectPassword"); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -253,7 +282,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void createWithIncorrectUserPassword() { banner("createWithIncorrectUserPassword"); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -285,7 +314,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { public void createWithoutTenant() { banner("createWithoutTenant"); CollectionObjectClient collectionObjectClient = new CollectionObjectClient(); - String identifier = this.createIdentifier(); + String identifier = BaseServiceTest.createIdentifier(); MultipartOutput multipart = createCollectionObjectInstance( collectionObjectClient.getCommonPartName(), identifier); @@ -449,6 +478,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void createList(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -456,6 +486,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void createWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -463,6 +494,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void createWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -470,6 +502,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void createWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -477,6 +510,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void read(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -484,6 +518,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void readNonExistent(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -491,6 +526,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void readList(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -498,6 +534,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void update(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -505,6 +542,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void updateWithEmptyEntityBody(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -512,6 +550,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void updateWithMalformedXml(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -519,6 +558,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void updateWithWrongXmlSchema(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -526,6 +566,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void updateNonExistent(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } /* (non-Javadoc) @@ -533,5 +574,6 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl { */ @Override public void deleteNonExistent(String testName) throws Exception { + //FIXME: Should this test really be empty? If so, please comment accordingly. } } diff --git a/services/vocabulary/client/pom.xml b/services/vocabulary/client/pom.xml index f4722277c..a026cb9fb 100644 --- a/services/vocabulary/client/pom.xml +++ b/services/vocabulary/client/pom.xml @@ -44,7 +44,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -56,12 +55,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java index 8befd392b..94d9af755 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java @@ -51,6 +51,11 @@ public class VocabularyClient extends AbstractServiceClientImpl { setProxy(); } + @Override + public CollectionSpaceProxy getProxy() { + return this.vocabularyProxy; + } + /** * allow to reset proxy as per security needs */ diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java index 066e1f7cb..171f73289 100644 --- a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java +++ b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java @@ -22,7 +22,7 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput; @Path("/vocabularies/") @Produces({"multipart/mixed"}) @Consumes({"multipart/mixed"}) -public interface VocabularyProxy { +public interface VocabularyProxy extends CollectionSpaceProxy { // List Vocabularies @GET diff --git a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java index 82cec283a..02c2f3225 100644 --- a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java +++ b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java @@ -30,8 +30,10 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.collectionspace.services.VocabularyItemJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; +import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.vocabulary.VocabulariesCommon; import org.collectionspace.services.vocabulary.VocabulariesCommonList; import org.collectionspace.services.vocabulary.VocabularyitemsCommon; @@ -75,6 +77,23 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl { knownResourceRefName = refName; } + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() { + return new VocabularyClient(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getAbstractCommonList( + ClientResponse response) { + return response.getEntity(VocabulariesCommonList.class); + } + // --------------------------------------------------------------- // CRUD tests : CREATE tests // --------------------------------------------------------------- diff --git a/services/vocabulary/import/pom.xml b/services/vocabulary/import/pom.xml index 7ab80d45e..2339a75d9 100644 --- a/services/vocabulary/import/pom.xml +++ b/services/vocabulary/import/pom.xml @@ -49,7 +49,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA @@ -61,12 +60,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA commons-httpclient diff --git a/services/vocabulary/service/pom.xml b/services/vocabulary/service/pom.xml index 25c28669c..baa49e02b 100644 --- a/services/vocabulary/service/pom.xml +++ b/services/vocabulary/service/pom.xml @@ -79,7 +79,6 @@ org.jboss.resteasy resteasy-jaxrs - 1.0.2.GA tjws @@ -90,12 +89,10 @@ org.jboss.resteasy resteasy-jaxb-provider - 1.0.2.GA org.jboss.resteasy resteasy-multipart-provider - 1.0.2.GA