import javax.ws.rs.core.Response;
-import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.PayloadOutputPart;
-import org.collectionspace.services.client.PoxPayloadIn;
-import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.index.IndexCommon;
-import org.collectionspace.services.client.DimensionClient;
-import org.collectionspace.services.client.index.IndexClient;
-import org.collectionspace.services.dimension.DimensionsCommon;
-import org.jboss.resteasy.client.ClientResponse;
-import org.testng.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * ObjectExitServiceTest, carries out tests against a deployed and running ObjectExit Service. <p/>
+ * IndexServiceTest, carries out tests against a deployed and running Index Service. <p/>
* $LastChangedRevision: $
* $LastChangedDate: $
*/
-public class IndexServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, IndexCommon> {
-
+public class IndexServiceTest {
private final String CLASS_NAME = IndexServiceTest.class.getName();
private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
- private String knownResourceId = null;
-
- @Override
- public String getServicePathComponent() {
- return IndexClient.SERVICE_PATH_COMPONENT;
- }
-
- @Override
- protected String getServiceName() {
- return IndexClient.SERVICE_NAME;
- }
-
- @Override
- protected CollectionSpaceClient getClientInstance() {
- return new DimensionClient();
- }
-
- //
- // Test overrides
- //
-
- @Override
- public void create(String testName) throws Exception {
- String csid = this.createTestObject(testName);
- if (this.knownResourceId == null) {
- this.knownResourceId = csid;
- }
- }
-
- @Override
- public void read(String testName) throws Exception {
-// setupRead();
-// DimensionClient client = new DimensionClient();
-// Response res = client.getIndex(knownResourceId);
-// try {
-// assertStatusCode(res, testName);
-// PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
-// IndexCommon indexsCommon = (IndexCommon) extractPart(input, IndexClient.SERVICE_COMMONPART_NAME, IndexCommon.class);
-// if (logger.isDebugEnabled() == true) {
-// logger.debug("Index payload is: " + input.getXmlPayload());
-// }
-// Assert.assertNotNull(indexsCommon);
-// } finally {
-// if (res != null) {
-// res.close();
-// }
-// }
- }
-
- //
- // FIXME: REM - This test should be a subclass of BaseServiceTest and *not* AbstractPoxServiceTestImpl
- //
-
- @Override
- public void update(String testName) throws Exception {
- setupUpdate();
- }
-
- @Override
- public void delete(String testName) throws Exception {
- // Do nothing. N/A
- }
-
- public void searchIndexDeleted(String testName) throws Exception {
- // Do nothing. N/A
- }
-
- @Override
- public void readList(String testName) throws Exception {
- // Do nothing. N/A
- }
-
- @Override
- public void readPaginatedList(String testName) throws Exception {
- // Do nothing. N/A
- }
-
- @Override
- public void CRUDTests(String testName) {
- // TODO Auto-generated method stub
- }
-
- @Override
- protected IndexCommon updateInstance(IndexCommon commonPartObject) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected void compareUpdatedInstances(IndexCommon original,
- IndexCommon updated) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
- */
- @Override
- public void createList(String testName) throws Exception {
- //empty N/A
- }
-
- public void testSubmitRequest() {
- // Do nothing. N/A
- }
-
- // ---------------------------------------------------------------
- // Utility methods used by tests above
- // ---------------------------------------------------------------
-
- @Override
- protected PoxPayloadOut createInstance(String identifier) {
- String dimensionsCommonPartName = new DimensionClient().getCommonPartName();
- return createInstance(identifier, dimensionsCommonPartName);
- }
-
- @Override
- protected PoxPayloadOut createInstance(String commonPartName,
- String identifier) {
- return createDimensionInstance(commonPartName, identifier);
- }
-
- /*
- * We're using a DimensionsCommon instance to test the index service.
- */
- private PoxPayloadOut createDimensionInstance(String dimensionValue) {
- String commonPartName = new DimensionClient().getCommonPartName();
- return createDimensionInstance(commonPartName, dimensionValue);
- }
-
- /*
- * We're using a DimensionsCommon instance to test the index service.
- */
- private PoxPayloadOut createDimensionInstance(String commonPartName,
- String dimensionValue) {
- String measurementUnit = "measurementUnit-" + dimensionValue;
- DimensionsCommon dimensionsCommon = new DimensionsCommon();
-
- dimensionsCommon.setMeasurementUnit(measurementUnit);
- PoxPayloadOut multipart = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
- PayloadOutputPart commonPart = multipart.addPart(commonPartName, dimensionsCommon);
-
- if (logger.isDebugEnabled()) {
- logger.debug("To be created, Dimensions common: " + commonPart.asXML());
- logger.debug(objectAsXmlString(dimensionsCommon, DimensionsCommon.class));
- }
-
- return multipart;
- }
-
}