1. Adding pagination tests to all Nuxeo based services.
2. Updated POM settings to make some dependency declarations more consistent.
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
<artifactId>commons-io</artifactId>\r
<version>1.4</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>jaxrs-api</artifactId>\r
+ </dependency> \r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>junit</groupId>\r
private Set<Class<?>> empty = new HashSet<Class<?>>();
public CollectionSpaceJaxRsApplication() {
- singletons.add(new SecurityInterceptor());
+// singletons.add(new SecurityInterceptor());
singletons.add(new AccountResource());
singletons.add(new RoleResource());
singletons.add(new PermissionResource());
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
-#Wed Dec 02 09:42:10 PST 2009\r
+#Fri Apr 30 14:56:50 PDT 2010\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning\r
org.eclipse.jdt.core.compiler.source=1.6\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.accountProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/accounts/")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface AccountProxy {
+public interface AccountProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.accountRoleProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/accounts")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface AccountRoleProxy {
+public interface AccountRoleProxy extends CollectionSpaceProxy {
//(C)reate
@POST
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;
LoggerFactory.getLogger(AccountRoleServiceTest.class);
// Instance variables specific to this test.
private String knownResourceId = null;
- private List<String> allResourceIdsCreated = new ArrayList();
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
private Hashtable<String, AccountValue> accValues = new Hashtable<String, AccountValue>();
private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
/*
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<AbstractCommonList> 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
// ---------------------------------------------------------------
@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
// 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.
}
// ---------------------------------------------------------------
// Submit the request to the service and store the response.
AccountRoleClient client = new AccountRoleClient();
- ClientResponse<AccountRole> res = client.read(NON_EXISTENT_ID, "123");
+ ClientResponse<AccountRole> res = client.read(this.NON_EXISTENT_ID, "123");
int statusCode = res.getStatus();
// Check the status code of the response: does it match
@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
@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
// 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.
}
// ---------------------------------------------------------------
}
// 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 {
// 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<RoleValue> rvs,
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;
private String knownResourceId = null;
private List<String> 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<AbstractCommonList> 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
// ---------------------------------------------------------------
// 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.
}
// ---------------------------------------------------------------
// 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
<artifactId>slf4j-log4j12</artifactId>\r
<scope>provided</scope>\r
</dependency>\r
+ \r
<!-- CollectionSpace Dependencies -->\r
+ \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
<artifactId>org.collectionspace.services.account.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ \r
<!-- External dependencies -->\r
+ \r
<dependency>\r
<groupId>junit</groupId>\r
<artifactId>junit</artifactId>\r
<artifactId>commons-logging</artifactId>\r
<version>1.1</version>\r
</dependency>\r
- <!-- javax -->\r
\r
+ <!-- javax -->\r
\r
<dependency>\r
<groupId>javax.security</groupId>\r
<scope>provided</scope>\r
</dependency>\r
\r
-\r
<!-- jboss -->\r
\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
-\r
-\r
</dependencies>\r
\r
<build>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.acquisitionProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/acquisitions/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface AcquisitionProxy {
+public interface AcquisitionProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
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;
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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
private String knownResourceId = null;
private List<String> 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<AbstractCommonList> response) {
+ return response.getEntity(AcquisitionsCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.acquisition.jaxb</artifactId>\r
<version>${project.version}</version>\r
- </dependency> \r
-<!-- <dependency>\r
- <groupId>junit</groupId>\r
- <artifactId>junit</artifactId>\r
- <version>4.1</version>\r
- <scope>test</scope>\r
</dependency>\r
- <dependency>\r
- <groupId>org.testng</groupId>\r
- <artifactId>testng</artifactId>\r
- <version>5.6</version>\r
- </dependency> \r
-\r
- <dependency>\r
- <groupId>javax.security</groupId>\r
- <artifactId>jaas</artifactId>\r
- <version>1.0.01</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>dom4j</groupId>\r
- <artifactId>dom4j</artifactId>\r
- <version>1.6.1</version>\r
- <scope>provided</scope>\r
- </dependency> \r
- \r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
- <exclusions>\r
- <exclusion>\r
- <groupId>tjws</groupId>\r
- <artifactId>webserver</artifactId>\r
- </exclusion>\r
- </exclusions>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
- </dependency> \r
- \r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-api</artifactId>\r
- <version>${nuxeo.version.1.5}</version>\r
- <exclusions>\r
- <exclusion>\r
- <artifactId>jboss-remoting</artifactId>\r
- <groupId>jboss</groupId>\r
- </exclusion>\r
- </exclusions>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.restlet</groupId>\r
- <artifactId>org.restlet</artifactId>\r
- <version>1.0.7</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.noelios.restlet</groupId>\r
- <artifactId>com.noelios.restlet.ext.httpclient</artifactId>\r
- <version>1.0.7</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.noelios.restlet</groupId>\r
- <artifactId>com.noelios.restlet</artifactId>\r
- <version>1.0.7</version>\r
- </dependency> -->\r
</dependencies>\r
\r
<build>\r
<artifactId>org.collectionspace.services.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
- <!--\r
- <dependency>\r
- <groupId>org.testng</groupId>\r
- <artifactId>testng</artifactId>\r
- <version>5.6</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
- <exclusions>\r
- <exclusion>\r
- <groupId>tjws</groupId>\r
- <artifactId>webserver</artifactId>\r
- </exclusion>\r
- </exclusions>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-httpclient</groupId>\r
- <artifactId>commons-httpclient</artifactId>\r
- <version>3.1</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>mysql</groupId>\r
- <artifactId>mysql-connector-java</artifactId>\r
- </dependency> -->\r
</dependencies>\r
\r
<build>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.permissionProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/authorization/permissions")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface PermissionProxy {
+public interface PermissionProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.permissionRoleProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/authorization/permissions")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface PermissionRoleProxy {
+public interface PermissionRoleProxy extends CollectionSpaceProxy {
//(C)reate
@POST
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.roleProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/authorization/roles")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface RoleProxy {
+public interface RoleProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
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;
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;
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<AbstractCommonList> 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
// ---------------------------------------------------------------
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;
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;
LoggerFactory.getLogger(PermissionServiceTest.class);
// Instance variables specific to this test.
private String knownResourceId = null;
- private List<String> allResourceIdsCreated = new ArrayList();
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
boolean addTenant = true;
/*
* This method is called only by the parent class, 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<AbstractCommonList> 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
// 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.
}
// ---------------------------------------------------------------
@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
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;
LoggerFactory.getLogger(RoleServiceTest.class);
// Instance variables specific to this test.
private String knownResourceId = null;
- private List<String> allResourceIdsCreated = new ArrayList();
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
boolean addTenant = true;
/*
* This method is called only by the parent class, 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<AbstractCommonList> 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
// ---------------------------------------------------------------
// 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.
}
// ---------------------------------------------------------------
// 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
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
\r
<!-- spring -->\r
<version>${project.version}</version>\r
<optional>true</optional>\r
</dependency> -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ \r
<!-- External dependencies --> \r
<dependency>\r
<groupId>org.apache.maven.plugins</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<!-- Set TestNG scope to default (compile), rather than test -->\r
<!-- to allow import(s) in AbstractServiceTest class -->\r
import org.apache.commons.httpclient.HttpClient;\r
import org.apache.commons.httpclient.UsernamePasswordCredentials;\r
import org.apache.commons.httpclient.auth.AuthScope;\r
+//import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+import org.jboss.resteasy.client.ClientResponse;\r
//import org.collectionspace.services.common.context.ServiceContext;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
/**\r
* BaseServiceClient is an abstract base client of all service clients\r
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684\r
*/\r
public abstract class AbstractServiceClientImpl implements CollectionSpaceClient {\r
\r
+ /** The logger. */\r
protected final Logger logger = LoggerFactory.getLogger(AbstractServiceClientImpl.class);\r
\r
/**\r
* The character used to separate the words in a part label\r
*/\r
public static final String PART_LABEL_SEPERATOR = "_";\r
+ \r
+ /** The Constant PART_COMMON_LABEL. */\r
public static final String PART_COMMON_LABEL = "common";\r
\r
+ /** The properties. */\r
private Properties properties = new Properties();\r
+ \r
+ /** The url. */\r
private URL url;\r
+ \r
+ /** The http client. */\r
private HttpClient httpClient;\r
\r
+ /**\r
+ * Gets the common part name.\r
+ *\r
+ * @return the common part name\r
+ */\r
public String getCommonPartName() {\r
return getCommonPartName(getServicePathComponent());\r
}\r
\r
+ /**\r
+ * Gets the common part name.\r
+ *\r
+ * @param servicePathComponent the service path component\r
+ * @return the common part name\r
+ */\r
public String getCommonPartName(String servicePathComponent) {\r
return servicePathComponent\r
+ PART_LABEL_SEPERATOR\r
+ PART_COMMON_LABEL;\r
}\r
\r
+ /**\r
+ * Gets the service path component.\r
+ *\r
+ * @return the service path component\r
+ */\r
abstract public String getServicePathComponent();\r
\r
+ /**\r
+ * Instantiates a new abstract service client impl.\r
+ */\r
protected AbstractServiceClientImpl() {\r
readProperties();\r
setupHttpClient();\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#getProperty(java.lang.String)\r
+ */\r
@Override\r
public String getProperty(String propName) {\r
return properties.getProperty(propName);\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#setProperty(java.lang.String, java.lang.String)\r
+ */\r
@Override\r
public void setProperty(String propName, String value) {\r
properties.setProperty(propName, value);\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#removeProperty(java.lang.String)\r
+ */\r
@Override\r
public Object removeProperty(String propName) {\r
return properties.remove(propName);\r
}\r
\r
+ /**\r
+ * Prints the properties.\r
+ */\r
public void printProperties() {\r
for(Object kobj : properties.keySet()){\r
String key = (String) kobj;\r
}\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#getBaseURL()\r
+ */\r
@Override\r
public String getBaseURL() {\r
return properties.getProperty(URL_PROPERTY);\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#getHttpClient()\r
+ */\r
@Override\r
public HttpClient getHttpClient() {\r
return httpClient;\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#useAuth()\r
+ */\r
@Override\r
public boolean useAuth() {\r
String auth = properties.getProperty(AUTH_PROPERTY);\r
return Boolean.valueOf(auth);\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#useSSL()\r
+ */\r
@Override\r
public boolean useSSL() {\r
String ssl = properties.getProperty(SSL_PROPERTY);\r
}\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#isServerSecure()\r
+ */\r
@Override\r
public boolean isServerSecure() {\r
return Boolean.getBoolean("cspace.server.secure");\r
}\r
+ \r
+ /* (non-Javadoc)\r
+ * @see org.collectionspace.services.client.CollectionSpaceClient#readList(java.lang.String, java.lang.String)\r
+ */\r
+ @Override\r
+ public ClientResponse<AbstractCommonList> readList(String pageSize,\r
+ String pageNumber) {\r
+ return getProxy().readList(pageSize, pageNumber);\r
+ }\r
+ \r
}\r
*/
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);
/**
*/
void setupHttpClient();
+ /**
+ * Use auth.
+ *
+ * @return true, if successful
+ */
boolean useAuth();
+ /**
+ * Use ssl.
+ *
+ * @return true, if successful
+ */
boolean useSSL();
/**
* @return
*/
boolean isServerSecure();
+
+ /**
+ * Read list.
+ *
+ * @param pageSize the page size
+ * @param pageNumber the page number
+ * @return the client response
+ */
+ public ClientResponse<AbstractCommonList> readList(String pageSize,
+ String pageNumber);
}
--- /dev/null
+/** \r
+ * CollectionSpaceProxy.java\r
+ *\r
+ * {Purpose of This Class}\r
+ *\r
+ * {Other Notes Relating to This Class (Optional)}\r
+ *\r
+ * $LastChangedBy: $\r
+ * $LastChangedRevision: $\r
+ * $LastChangedDate: $\r
+ *\r
+ * This document is a part of the source code and related artifacts\r
+ * for CollectionSpace, an open source collections management system\r
+ * for museums and related institutions:\r
+ *\r
+ * http://www.collectionspace.org\r
+ * http://wiki.collectionspace.org\r
+ *\r
+ * Copyright © 2009 {Contributing Institution}\r
+ *\r
+ * Licensed under the Educational Community License (ECL), Version 2.0.\r
+ * You may not use this file except in compliance with this License.\r
+ *\r
+ * You may obtain a copy of the ECL 2.0 License at\r
+ * https://source.collectionspace.org/collection-space/LICENSE.txt\r
+ */\r
+package org.collectionspace.services.client;\r
+\r
+import javax.ws.rs.GET;\r
+import javax.ws.rs.Produces;\r
+import javax.ws.rs.QueryParam;\r
+\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+import org.jboss.resteasy.client.ClientResponse;\r
+\r
+/**\r
+ * The Interface CollectionSpaceProxy.\r
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684\r
+ */\r
+public interface CollectionSpaceProxy {\r
+ \r
+ /**\r
+ * Read list.\r
+ *\r
+ * @param pageSize the page size\r
+ * @param pageNumber the page number\r
+ * @return the client response\r
+ */\r
+ @GET\r
+ @Produces({"application/xml"})\r
+ ClientResponse<AbstractCommonList> readList(\r
+ @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) String pageSize,\r
+ @QueryParam(IClientQueryParams.START_PAGE_PARAM) String pageNumber);\r
+}\r
--- /dev/null
+package org.collectionspace.services.client;\r
+\r
+public interface IClientQueryParams {\r
+ public static final String PAGE_SIZE_PARAM = "pgSz";\r
+ public static final String START_PAGE_PARAM = "pgNum";\r
+\r
+}\r
* @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();
}
}
*/
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.
*
*/
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();
}
}
+ /* (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
}
}
+ /* (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
// 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<AbstractCommonList> response =
+ (ClientResponse<AbstractCommonList>)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);
}
// 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);
// 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
+/** \r
+ * BaseServiceTest.java\r
+ *\r
+ * {Purpose of This Class}\r
+ *\r
+ * {Other Notes Relating to This Class (Optional)}\r
+ *\r
+ * $LastChangedBy: $\r
+ * $LastChangedRevision: $\r
+ * $LastChangedDate: $\r
+ *\r
+ * This document is a part of the source code and related artifacts\r
+ * for CollectionSpace, an open source collections management system\r
+ * for museums and related institutions:\r
+ *\r
+ * http://www.collectionspace.org\r
+ * http://wiki.collectionspace.org\r
+ *\r
+ * Copyright © 2009 {Contributing Institution}\r
+ *\r
+ * Licensed under the Educational Community License (ECL), Version 2.0.\r
+ * You may not use this file except in compliance with this License.\r
+ *\r
+ * You may obtain a copy of the ECL 2.0 License at\r
+ * https://source.collectionspace.org/collection-space/LICENSE.txt\r
+ */\r
package org.collectionspace.services.client.test;\r
\r
import java.io.ByteArrayInputStream;\r
import org.testng.annotations.DataProvider;\r
import org.w3c.dom.Document;\r
\r
+import org.collectionspace.services.client.CollectionSpaceClient;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+\r
+/**\r
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685\r
+ * The Class BaseServiceTest.\r
+ */\r
public abstract class BaseServiceTest {\r
\r
+ /** The Constant logger. */\r
static protected final Logger logger = LoggerFactory.getLogger(BaseServiceTest.class);\r
+ \r
+ /** The Constant serviceClient. */\r
protected static final TestServiceClient serviceClient = new TestServiceClient();\r
+ \r
+ /** The NO n_ existen t_ id. */\r
protected final String NON_EXISTENT_ID = createNonExistentIdentifier();\r
+ \r
+ /** The EXPECTE d_ statu s_ code. */\r
protected int EXPECTED_STATUS_CODE = 0;\r
+ \r
+ /** The REQUES t_ type. */\r
protected ServiceRequestType REQUEST_TYPE = ServiceRequestType.NON_EXISTENT;\r
+ \r
+ /** The Constant XML_DECLARATION. */\r
protected static final String XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";\r
+ \r
+ /** The Constant MALFORMED_XML_DATA. */\r
protected static final String MALFORMED_XML_DATA = XML_DECLARATION\r
+ "<malformed_xml>wrong schema contents</malformed_xml";\r
+ \r
+ /** The WRON g_ xm l_ schem a_ data. */\r
protected final String WRONG_XML_SCHEMA_DATA = XML_DECLARATION\r
+ "<wrong_schema>wrong schema contents</wrong_schema>";\r
+ \r
+ /** The NUL l_ charset. */\r
final String NULL_CHARSET = null;\r
\r
+ /**\r
+ * Gets the client.\r
+ *\r
+ * @return the client\r
+ */\r
+ abstract protected CollectionSpaceClient getClientInstance();\r
+ \r
+ /**\r
+ * Gets the abstract common list.\r
+ *\r
+ * @param response the response\r
+ * @return the abstract common list\r
+ */\r
+ abstract protected AbstractCommonList getAbstractCommonList(\r
+ ClientResponse<AbstractCommonList> response); \r
+ \r
/**\r
* Returns the name of the currently running test.\r
*\r
}\r
}\r
\r
+ /**\r
+ * Instantiates a new base service test.\r
+ */\r
public BaseServiceTest() {\r
super();\r
}\r
return statusCode;\r
}\r
\r
+ /**\r
+ * Extract id.\r
+ *\r
+ * @param res the res\r
+ * @return the string\r
+ */\r
static protected String extractId(ClientResponse<Response> res) {\r
MultivaluedMap mvm = res.getMetadata();\r
String uri = (String) ((ArrayList) mvm.get("Location")).get(0);\r
return id;\r
}\r
\r
+ /**\r
+ * Creates the identifier.\r
+ *\r
+ * @return the string\r
+ */\r
static protected String createIdentifier() {\r
long identifier = System.currentTimeMillis();\r
return Long.toString(identifier);\r
}\r
\r
+ /**\r
+ * Creates the non existent identifier.\r
+ *\r
+ * @return the string\r
+ */\r
protected String createNonExistentIdentifier() {\r
return Long.toString(Long.MAX_VALUE);\r
}\r
\r
+ /**\r
+ * Extract part.\r
+ *\r
+ * @param input the input\r
+ * @param label the label\r
+ * @param clazz the clazz\r
+ * @return the object\r
+ * @throws Exception the exception\r
+ */\r
static protected Object extractPart(MultipartInput input, String label, Class clazz)\r
throws Exception {\r
Object obj = null;\r
return obj;\r
}\r
\r
+ /**\r
+ * Gets the part object.\r
+ *\r
+ * @param partStr the part str\r
+ * @param clazz the clazz\r
+ * @return the part object\r
+ * @throws JAXBException the jAXB exception\r
+ */\r
static protected Object getPartObject(String partStr, Class clazz)\r
throws JAXBException {\r
JAXBContext jc = JAXBContext.newInstance(clazz);\r
return obj;\r
}\r
\r
+ /**\r
+ * Object as xml string.\r
+ *\r
+ * @param o the o\r
+ * @param clazz the clazz\r
+ * @return the string\r
+ */\r
static protected String objectAsXmlString(Object o, Class clazz) {\r
StringWriter sw = new StringWriter();\r
try {\r
return getObjectFromStream(jaxbClass, is);\r
}\r
\r
+ /**\r
+ * Gets the xml document.\r
+ *\r
+ * @param fileName the file name\r
+ * @return the xml document\r
+ * @throws Exception the exception\r
+ */\r
static protected Document getXmlDocument(String fileName) throws Exception {\r
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\r
File f = new File(fileName);\r
return factory.newDocumentBuilder().parse(f);\r
}\r
\r
+ /**\r
+ * Gets the xml document as string.\r
+ *\r
+ * @param fileName the file name\r
+ * @return the xml document as string\r
+ * @throws Exception the exception\r
+ */\r
static protected String getXmlDocumentAsString(String fileName) throws Exception {\r
byte[] b = FileUtils.readFileToByteArray(new File(fileName));\r
return new String(b);\r
return jaxbClass.cast(unmarshaller.unmarshal(is));\r
}\r
\r
+ /**\r
+ * Map as string.\r
+ *\r
+ * @param map the map\r
+ * @return the string\r
+ */\r
protected String mapAsString(MultivaluedMap map) {\r
StringBuffer sb = new StringBuffer();\r
for (Object entry : map.entrySet()) {\r
return sb.toString();\r
}\r
\r
+ /**\r
+ * Banner.\r
+ *\r
+ * @param label the label\r
+ */\r
protected void banner(String label) {\r
if (logger.isDebugEnabled()) {\r
logger.debug("===================================================");\r
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
<classpathentry kind="output" path="target/classes"/>\r
</classpath>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
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;
/**
* The Class CollectionObjectClient.
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
*/
public class CollectionObjectClient extends AbstractServiceClientImpl {
/* (non-Javadoc)
* @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
*/
- public String getServicePathComponent() {
+ @Override
+ public String getServicePathComponent() {
return "collectionobjects";
}
RegisterBuiltin.register(factory);
setProxy();
}
+
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.collectionObjectProxy;
+ }
/**
* Sets the proxy.
return collectionObjectProxy.readList();
}
+
+ @Override
+ public ClientResponse<AbstractCommonList> readList(String pageSize,
+ String pageNumber) {
+ return collectionObjectProxy.readList(pageSize, pageNumber);
+
+ }
/**
* Roundtrip.
+/**
+ * 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;
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;
/**
* @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<CollectionobjectsCommonList> readList();
+ /**
+ * Roundtrip.
+ *
+ * @return the client response
+ */
@GET
@Path("/roundtrip")
@Produces({"application/xml"})
ClientResponse<Response> roundtrip();
+ /**
+ * Keyword search.
+ *
+ * @param keywords the keywords
+ * @return the client response
+ */
@GET
@Path("/search")
@Produces({"application/xml"})
@QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords);
//(C)reate
+ /**
+ * Creates the.
+ *
+ * @param multipart the multipart
+ * @return the client response
+ */
@POST
ClientResponse<Response> create(MultipartOutput multipart);
//(R)ead
+ /**
+ * Read.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
@GET
@Path("/{csid}")
ClientResponse<MultipartInput> 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/")
//(U)pdate
+ /**
+ * Update.
+ *
+ * @param csid the csid
+ * @param multipart the multipart
+ * @return the client response
+ */
@PUT
@Path("/{csid}")
ClientResponse<MultipartInput> update(@PathParam("csid") String csid, MultipartOutput multipart);
//(D)elete
+ /**
+ * Delete.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
@DELETE
@Path("/{csid}")
ClientResponse<Response> delete(@PathParam("csid") String csid);
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;
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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
*/
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<String> 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<AbstractCommonList> 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 {
* 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 {
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 {
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 {
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 {
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 {
* 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 {
@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);
}
}
// 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 {
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 {
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"read"})
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"})
// 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"})
}
+ /**
+ * Update retrieve.
+ *
+ * @param testName the test name
+ * @param id the id
+ * @return the client response
+ */
private ClientResponse<MultipartInput> updateRetrieve(String testName, String id) {
final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
CollectionObjectClient client = new CollectionObjectClient();
return res;
}
+ /**
+ * Update send.
+ *
+ * @param testName the test name
+ * @param id the id
+ * @param collectionObject the collection object
+ * @return the client response
+ */
private ClientResponse<MultipartInput> updateSend(String testName, String id,
CollectionobjectsCommon collectionObject) {
MultipartOutput output = new MultipartOutput();
// 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"})
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"})
}
*/
- @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 {
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"delete"})
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
// ---------------------------------------------------------------
// 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,
"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();
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) {
}
+ /**
+ * 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
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.1.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<artifactId>org.collectionspace.services.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
</dependency>\r
\r
<!-- jboss -->\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>jaxrs-api</artifactId>\r
+ </dependency> \r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.1.GA</version>\r
</dependency>\r
\r
<dependency>\r
import java.util.ArrayList;\r
import java.util.List;\r
import javax.ws.rs.core.MultivaluedMap;\r
+import org.collectionspace.services.client.IClientQueryParams;\r
import org.collectionspace.services.common.query.IQueryManager;\r
import org.collectionspace.services.common.context.ServiceContext;\r
\r
*/\r
public class DocumentFilter {\r
\r
- public static final String PAGE_SIZE_DEFAULT_PROPERTY = "pageSizeDefault";\r
- public static final String PAGE_SIZE_PARAM = "pgSz";\r
- public static final String START_PAGE_PARAM = "pgNum";\r
public static final int DEFAULT_PAGE_SIZE_INIT = 40;\r
+ public static final String PAGE_SIZE_DEFAULT_PROPERTY = "pageSizeDefault";\r
public static int defaultPageSize = DEFAULT_PAGE_SIZE_INIT;\r
+\r
protected String whereClause; // Filtering clause. Omit the "WHERE".\r
protected int startPage; // Pagination offset for list results\r
protected int pageSize; // Pagination limit for list results\r
// Set the page size\r
//\r
String pageSizeStr = null;\r
- List<String> list = queryParams.remove(PAGE_SIZE_PARAM);\r
+ List<String> list = queryParams.remove(IClientQueryParams.PAGE_SIZE_PARAM);\r
if (list != null) {\r
pageSizeStr = list.get(0);\r
}\r
// Set the start page\r
//\r
String startPageStr = null;\r
- list = queryParams.remove(START_PAGE_PARAM);\r
+ list = queryParams.remove(IClientQueryParams.START_PAGE_PARAM);\r
if (list != null) {\r
startPageStr = list.get(0);\r
}\r
} catch (NumberFormatException e) {\r
//FIXME This should cause a warning in the log file and should result in the\r
//FIXME page size being set to the default. We don't need to throw an exception here.\r
- throw new NumberFormatException("Bad value for: " + PAGE_SIZE_PARAM);\r
+ throw new NumberFormatException("Bad value for: " +\r
+ IClientQueryParams.PAGE_SIZE_PARAM);\r
}\r
}\r
\r
try {\r
startPage = Integer.valueOf(startPageStr);\r
} catch (NumberFormatException e) {\r
- throw new NumberFormatException("Bad value for: " + START_PAGE_PARAM);\r
+ throw new NumberFormatException("Bad value for: " +\r
+ IClientQueryParams.START_PAGE_PARAM);\r
}\r
}\r
}\r
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<!-- filter out unwanted jars -->
<exclusions>
<exclusion>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.contactProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/contacts/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface ContactProxy {
+public interface ContactProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
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;
private String knownResourceId = null;
private List<String> 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<AbstractCommonList> response) {
+ return response.getEntity(ContactsCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>tjws</groupId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<!-- nuxeo -->
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.dimensionProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/dimensions/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface DimensionProxy {
+public interface DimensionProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
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;
private String knownResourceId = null;
private List<String> 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<AbstractCommonList> response) {
+ return response.getEntity(DimensionsCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<!-- filter out unwanted jars -->
<exclusions>
<exclusion>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
</dependencies>
<name>services.id.service</name>
<dependencies>
-
+ <!-- keep slf4j dependencies on the top -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
<!-- Code common to all CollectionSpace services. -->
<dependency>
<groupId>org.collectionspace.services</groupId>
</dependency>
<!-- JBoss RESTEasy, a framework for providing and consuming RESTful services. -->
- <!-- NOTE: Versions later than 1.0.2.GA - such as 1.1 GA - are available. -->
<!-- JAX-RS support, a Java specification for RESTful services. -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>tjws</groupId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<!-- MIME Multipart messaging support. -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<!-- Cobertura, a tool for identifying the extent of code coverage in test classes -->
import java.text.SimpleDateFormat;
import java.util.Calendar;
-import java.util.Date;
+//import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
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);
@Test
public void format() {
+ //empty?
}
@Test
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"));
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
* A IntakeClient.
* @version $Revision:$
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
*/
public class IntakeClient extends AbstractServiceClientImpl {
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.intakeProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
+/**
+ * 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;
/**
* @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<IntakesCommonList> readList();
//(C)reate
+ /**
+ * Creates the.
+ *
+ * @param multipart the multipart
+ * @return the client response
+ */
@POST
ClientResponse<Response> create(MultipartOutput multipart);
//(R)ead
+ /**
+ * Read.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
@GET
@Path("/{csid}")
ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
//(U)pdate
+ /**
+ * Update.
+ *
+ * @param csid the csid
+ * @param multipart the multipart
+ * @return the client response
+ */
@PUT
@Path("/{csid}")
ClientResponse<MultipartInput> update(@PathParam("csid") String csid, MultipartOutput multipart);
//(D)elete
+ /**
+ * Delete.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
@DELETE
@Path("/{csid}")
ClientResponse<Response> 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/")
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;
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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
import org.slf4j.LoggerFactory;
/**
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
* IntakeServiceTest, carries out tests against a
* deployed and running Intake Service.
*
*/
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<String> allResourceIdsCreated = new ArrayList();
+
+ /** The all resource ids created. */
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
+ /* (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<AbstractCommonList> 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 {
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"})
// 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 {
}
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"read"})
// 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"})
// 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"})
// 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 {
}
}
*/
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"update", "testSubmitRequest"})
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"delete"})
// ---------------------------------------------------------------
// 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,
"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) {
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;
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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.1.GA</version>
<!-- filter out unwanted jars -->
<exclusions>
<exclusion>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.1.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.1.GA</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
RegisterBuiltin.register(factory);
setProxy();
}
+
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.loaninProxy;
+ }
/**
* allow to reset proxy as per security needs
@Path("/loansin/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface LoaninProxy {
+public interface LoaninProxy extends CollectionSpaceProxy {
//(C)reate
@POST
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;
// 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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "loansin";
private String knownResourceId = null;
- private List<String> allResourceIdsCreated = new ArrayList();
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
+ /* (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<AbstractCommonList> response) {
+ return response.getEntity(LoansinCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>tjws</groupId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<!-- nuxeo -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.1.GA</version>
<!-- filter out unwanted jars -->
<exclusions>
<exclusion>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.1.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.1.GA</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.loanoutProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/loansout/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface LoanoutProxy {
+public interface LoanoutProxy extends CollectionSpaceProxy {
//(C)reate
@POST
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;
// 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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
*/
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<String> allResourceIdsCreated = new ArrayList();
+
+ /** The all resource ids created. */
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
+ /* (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<AbstractCommonList> 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 {
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"})
// 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 {
}
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"read"})
// 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"})
// 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"})
// 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 {
}
}
*/
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"update", "testSubmitRequest"})
// 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"})
}
// Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
+ */
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"delete"})
// ---------------------------------------------------------------
// 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();
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.0.2.GA</version>
<exclusions>
<exclusion>
<groupId>tjws</groupId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
- <version>1.0.2.GA</version>
</dependency>
<!-- nuxeo -->
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.orgAuthorityProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/orgauthorities/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface OrgAuthorityProxy {
+public interface OrgAuthorityProxy extends CollectionSpaceProxy {
// List OrgAuthorities
@GET
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;
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<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
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;
private Map<String, String> allContactResourceIdsCreated =
new HashMap<String, String>();
+ /* (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<AbstractCommonList> response) {
+ return response.getEntity(OrganizationsCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<artifactId>org.collectionspace.services.organization.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
-<!-- \r
- <dependency>\r
- <groupId>org.testng</groupId>\r
- <artifactId>testng</artifactId>\r
- <version>5.6</version>\r
- </dependency>\r
- --> \r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.personAuthorityProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/personauthorities/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface PersonAuthorityProxy {
+public interface PersonAuthorityProxy extends CollectionSpaceProxy {
// List Personauthorities
@GET
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;
*/
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<String> allResourceIdsCreated = new ArrayList<String>();
+
+ /** The all item resource ids created. */
private Map<String, String> allItemResourceIdsCreated =
new HashMap<String, String>();
+
+ /** The all contact resource ids created. */
private Map<String, String> allContactResourceIdsCreated =
new HashMap<String, String>();
+ /* (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<AbstractCommonList> 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"})
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.
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) {
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";
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) {
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";
// 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 {
}
// 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 {
}
}
+ /**
+ * 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 {
}
}
+ /**
+ * 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 {
// 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"})
}
}
+ /**
+ * 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 {
}
*/
- @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 {
}
+ /**
+ * 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 {
"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 {
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 {
}
// 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"})
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) {
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) {
// ---------------------------------------------------------------
// 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"})
}
}
+ /**
+ * 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";
}
}
+ /**
+ * 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";
// 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"})
"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 {
"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 {
// 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 {
}
}
*/
- @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 {
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 {
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 {
// 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 {
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 {
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"})
}
// 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"})
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) {
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) {
}
+ /**
+ * Test item submit request.
+ */
@Test(dependsOnMethods = {"createItem", "readItem", "testSubmitRequest"})
public void testItemSubmitRequest() {
}
+ /**
+ * Test contact submit request.
+ */
@Test(dependsOnMethods = {"createContact", "readContact", "testItemSubmitRequest"})
public void testContactSubmitRequest() {
// ---------------------------------------------------------------
// 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;
}
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
</reporting>
<dependencyManagement>
<dependencies>
-<!-- <dependency>
- <groupId>net.java.dev.jaxb2-commons</groupId>
- <artifactId>jaxb-fluent-api</artifactId>
- <version>2.0.1</version>
- </dependency> -->
<dependency>
<groupId>net.java.dev.jaxb2-commons</groupId>
<artifactId>jaxb-fluent-api</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>jaxrs-api</artifactId>
- <version>1.1.GA</version>
- </dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>basic</artifactId>
<artifactId>runtime</artifactId>
<version>0.4.1.4</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <version>1.2.GA</version>
+ </dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.1.GA</version>
+ <version>1.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ <version>1.2.GA</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ <version>1.2.GA</version>
+ </dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
+/**
+ * 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;
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<RelationsCommonList> readList() {
- return relationProxy.readList();
- }
-
- public ClientResponse<RelationsCommonList> 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<MultipartInput> 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<Response> 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<MultipartInput> 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<Response> 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<RelationsCommonList> 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<RelationsCommonList> 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<MultipartInput> read(String csid) {
+ return relationProxy.read(csid);
+ }
+
+ /**
+ * Creates the.
+ *
+ * @param multipart the multipart
+ * @return the client response
+ */
+ public ClientResponse<Response> create(MultipartOutput multipart) {
+ return relationProxy.create(multipart);
+ }
+
+ /**
+ * Update.
+ *
+ * @param csid the csid
+ * @param multipart the multipart
+ * @return the client response
+ */
+ public ClientResponse<MultipartInput> update(String csid,
+ MultipartOutput multipart) {
+ return relationProxy.update(csid, multipart);
+ }
+
+ /**
+ * Delete.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
+ public ClientResponse<Response> delete(String csid) {
+ return relationProxy.delete(csid);
+ }
}
@Path("/relations/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface RelationProxy {
+public interface RelationProxy extends CollectionSpaceProxy {
@GET
@Produces({"application/xml"})
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;
final String SERVICE_PATH_COMPONENT = "relations";
private String knownResourceId = null;
- private List<String> allResourceIdsCreated = new ArrayList();
+ private List<String> allResourceIdsCreated = new ArrayList<String>();
+ /* (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<AbstractCommonList> 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
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
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;
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<AbstractCommonList> 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
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);
public void createWithoutPassword() {
banner("createWithoutPassword");
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- String identifier = this.createIdentifier();
+ String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
public void createWithUnknownUser() {
banner("createWithUnknownUser");
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- String identifier = this.createIdentifier();
+ String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
public void createWithIncorrectPassword() {
banner("createWithIncorrectPassword");
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- String identifier = this.createIdentifier();
+ String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
public void createWithIncorrectUserPassword() {
banner("createWithIncorrectUserPassword");
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- String identifier = this.createIdentifier();
+ String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
public void createWithoutTenant() {
banner("createWithoutTenant");
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- String identifier = this.createIdentifier();
+ String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
*/
@Override
public void createList(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void createWithEmptyEntityBody(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void createWithMalformedXml(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void createWithWrongXmlSchema(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void read(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void readNonExistent(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void readList(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void update(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void updateWithEmptyEntityBody(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void updateWithMalformedXml(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void updateWithWrongXmlSchema(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void updateNonExistent(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
/* (non-Javadoc)
*/
@Override
public void deleteNonExistent(String testName) throws Exception {
+ //FIXME: Should this test really be empty? If so, please comment accordingly.
}
}
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
setProxy();
}
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.vocabularyProxy;
+ }
+
/**
* allow to reset proxy as per security needs
*/
@Path("/vocabularies/")
@Produces({"multipart/mixed"})
@Consumes({"multipart/mixed"})
-public interface VocabularyProxy {
+public interface VocabularyProxy extends CollectionSpaceProxy {
// List Vocabularies
@GET
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;
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<AbstractCommonList> response) {
+ return response.getEntity(VocabulariesCommonList.class);
+ }
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<!-- filter out unwanted jars -->\r
<exclusions>\r
<exclusion>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>commons-httpclient</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxrs</artifactId>\r
- <version>1.0.2.GA</version>\r
<exclusions>\r
<exclusion>\r
<groupId>tjws</groupId>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-jaxb-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
<dependency>\r
<groupId>org.jboss.resteasy</groupId>\r
<artifactId>resteasy-multipart-provider</artifactId>\r
- <version>1.0.2.GA</version>\r
</dependency>\r
\r
<!-- nuxeo -->\r