]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-360,CSPACE-384: Removed some unneeded import statements, and other minor code...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 26 Aug 2009 23:39:20 +0000 (23:39 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 26 Aug 2009 23:39:20 +0000 (23:39 +0000)
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/AbstractServiceTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java

index 815a467e2721420afbf69704ebe978246a8938f1..dd9d18cf214170cae51b6e55e5c5407bac2fb2be 100644 (file)
@@ -62,9 +62,14 @@ public abstract class AbstractServiceTest implements ServiceTest {
 
     final Logger logger = LoggerFactory.getLogger(AbstractServiceTest.class);
 
-    private final TestServiceClient serviceClient = new TestServiceClient();
+    // Currently used for performing several negative (failure) tests.
+    //
+    // @TODO To be replaced with RESTeasy's ClientRequest, per Issue CSPACE-386.
     protected HttpClient httpClient = new HttpClient();
 
+    // Used (only) to obtain the base service URL.
+    private final TestServiceClient serviceClient = new TestServiceClient();
+
     // The status code expected to be returned by a test method (where relevant).
     int EXPECTED_STATUS_CODE = 0;
     
@@ -276,8 +281,8 @@ public abstract class AbstractServiceTest implements ServiceTest {
     // ---------------------------------------------------------------
 
     /**
-     * Reinitializes setup values to guard against unintended reuse
-     * of those values.
+     * Reinitializes setup values, to help expose any unintended reuse
+     * of those values between tests.
      */
     protected void clearSetup() {
         EXPECTED_STATUS_CODE = 0;
index d592c3fcf51b28c9fee5ee63c684578d90ad08fa..b690bce9738d9f09f470980e20a116afdd5a01fb 100644 (file)
@@ -25,25 +25,22 @@ package org.collectionspace.services.client.test;
 
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.jboss.resteasy.client.ClientResponse;
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import javax.ws.rs.core.Response.Status;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
 
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.test.ServiceRequestType;
 import org.collectionspace.services.collectionobject.CollectionObject;
 import org.collectionspace.services.collectionobject.CollectionObjectList;
 
-import java.util.Arrays;
-import java.util.Set;
-import javax.ws.rs.core.Response.Status;
-// import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
 
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 /**
  * CollectionObjectServiceTest, carries out tests against a
@@ -84,7 +81,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTest {
         // Check the status code of the response: does it match the expected response(s)?
         //
         // Does it fall within the set of valid status codes?
-        // Does it match the expected status code?
+        // Does it exactly match the expected status code?
         verbose("create: status = " + statusCode);
         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
             invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
@@ -315,9 +312,6 @@ public class CollectionObjectServiceTest extends AbstractServiceTest {
         // Perform setup.
         super.setupUpdateWithWrongXmlSchema();
         
-        // @TODO This test is currently commented out, because it returns a
-        // 500 Internal Server Error status code, rather than the expected status code.
-
         // Submit the request to the service and store the response.
         String url = getResourceURL(knownObjectId);
         PutMethod method = new PutMethod(url);
@@ -386,12 +380,6 @@ public class CollectionObjectServiceTest extends AbstractServiceTest {
         // Perform setup.
         super.setupDeleteNonExistent();
 
-        // Expected status code: 404 Not Found
-        final int EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
-
-        // Type of service request being tested
-        final ServiceRequestType REQUEST_TYPE = ServiceRequestType.DELETE;
-
         // Submit the request to the service and store the response.
         ClientResponse<Response> res =
             client.deleteCollectionObject(NON_EXISTENT_ID);