/**
- * 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:
+ * 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
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
*
- * Copyright © 2009 Regents of the University of California
+ * Copyright © 2009 Regents of the University of California
*
- * Licensed under the Educational Community License (ECL), Version 2.0.
- * You may not use this file except in compliance with this License.
+ * 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
+ * You may obtain a copy of the ECL 2.0 License at
+ *
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.collectionspace.services.client;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
/**
- * MovementClient.java
+ * MovementProxy.java
*
* $LastChangedRevision$
* $LastChangedDate$
}
+ /*
+ * Tests whether a request to sort by an invalid identifier for the
+ * sort order (ascending or descending) is handled as expected.
+ */
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+ public void sortWithInvalidSortOrderIdentifier(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // FIXME: Ultimately, this should return a BAD_REQUEST status.
+ testSetup(STATUS_INTERNAL_SERVER_ERROR, ServiceRequestType.READ);
+
+ // Submit the request to the service and store the response.
+ MovementClient client = new MovementClient();
+ final String INVALID_SORT_ORDER_IDENTIFIER = "NO_DIRECTION";
+ ClientResponse<MovementsCommonList> res =
+ client.readListSortedBy(MovementJAXBSchema.LOCATION_DATE
+ + " " + INVALID_SORT_ORDER_IDENTIFIER);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ }
+
/*
* Tests whether a request to sort by a malformed field name is
* handled as expected.
// FIXME: While this convention - appending a suffix to the name of
// the service's first unique URL path component - works, it would
// be preferable to get the common schema name from configuration.
+ //
+ // Such configuration is provided for example, on the services side, in
+ // org.collectionspace.services.common.context.AbstractServiceContextImpl
return getServicePathComponent() + "_" + "common";
}
};
}
+ /*
+ * Create multiple test records, initially in unsorted order,
+ * using values for various fields obtained from the data provider.
+ */
@Test(dataProvider = "unsortedValues")
public void createList(int expectedSortOrder, String movementNote,
String locationDate) throws Exception {
}
testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
- // Create each unsorted record provided by the data provider.
+ // Iterates through the sets of values returned by the data provider,
+ // and creates a corresponding test record for each set of values.
create(movementNote, locationDate);
}