*
* @param vcsid the csid of the authority
* @param authRefName the refname of the authority
- * @param materialMap properties for the new chronology
+ * @param chronologyMap properties for the new chronology
* @param terms terms for the new chronology
* @param client the service client
* @return the csid of the new item
*/
public static String createItemInAuthority(final String vcsid,
final String authRefName,
- final Map<String, String> materialMap,
+ final Map<String, String> chronologyMap,
final List<ChronologyTermGroup> terms,
final ChronologyAuthorityClient client) {
// Expected status code: 201 Created
displayName = terms.get(0).getTermDisplayName();
}
logger.debug("Creating item with display name: {} in chronologyAuthority: {}", displayName, vcsid);
- PoxPayloadOut multipart = createChronologyInstance(materialMap, terms, client.getItemCommonPartName());
+ PoxPayloadOut multipart = createChronologyInstance(chronologyMap, terms, client.getItemCommonPartName());
String newID;
final Response res = client.createItem(vcsid, multipart);
try {
int statusCode = res.getStatus();
- if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
+ if (!REQUEST_TYPE.isValidStatusCode(statusCode)) {
final String error = "Could not create Item: %s in chronologyAuthority: %s, %s";
throw new RuntimeException(String.format(error,
- materialMap.get(ChronologyJAXBSchema.SHORT_IDENTIFIER),
+ chronologyMap.get(ChronologyJAXBSchema.SHORT_IDENTIFIER),
authRefName,
invalidStatusCodeMessage(REQUEST_TYPE, statusCode)));
}
- if(statusCode != EXPECTED_STATUS_CODE) {
+ if (statusCode != EXPECTED_STATUS_CODE) {
final String error = "Unexpected Status when creating Item: %s in chronologyAuthority %s, Status: %d";
throw new RuntimeException(String.format(error,
- materialMap.get(ChronologyJAXBSchema.SHORT_IDENTIFIER),
+ chronologyMap.get(ChronologyJAXBSchema.SHORT_IDENTIFIER),
authRefName,
statusCode));
}
* 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;
+package org.collectionspace.services.client.test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import org.collectionspace.services.chronology.ChronologyTermGroup;
import org.collectionspace.services.chronology.ChronologyTermGroupList;
import org.collectionspace.services.chronology.ChronologyauthoritiesCommon;
-import org.collectionspace.services.client.test.AbstractAuthorityServiceTest;
+import org.collectionspace.services.client.AuthorityClient;
+import org.collectionspace.services.client.ChronologyAuthorityClient;
+import org.collectionspace.services.client.ChronologyAuthorityClientUtils;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterClass;
@Override
protected String getItemServiceRootURL(String parentResourceIdentifier) {
- return getResourceURL(parentResourceIdentifier) + "/" + getServicePathComponent();
+ return getResourceURL(parentResourceIdentifier) + "/" + AuthorityClient.ITEMS;
}
@Override