From d2a17777dc3de8a3628e7629c37203000f4b9adc Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Thu, 14 Jan 2010 20:50:50 +0000 Subject: [PATCH] NOJIRA - Updated to use common code in Utils class. --- .../client/test/VocabularyServiceTest.java | 52 ++----------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java index 3f0691328..7a441b289 100644 --- a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java +++ b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java @@ -130,57 +130,13 @@ public class VocabularyServiceTest extends AbstractServiceTest { public void createItem(String testName) { setupCreate(testName); - knownItemResourceId = createItemInVocab(knownResourceId, knownResourceRefName); - if(logger.isDebugEnabled()){ - logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId); - } - } - - private String createItemInVocab(String vcsid, String vocabRefName) { - - final String testName = "createItemInVocab"; - if(logger.isDebugEnabled()){ - logger.debug(testName + ":..."); - } - - // Submit the request to the service and store the response. - String identifier = createIdentifier(); - String refName = VocabularyClientUtils.createVocabularyItemRefName( - vocabRefName, identifier, true); HashMap itemInfo = new HashMap(); - itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, identifier); - MultipartOutput multipart = VocabularyClientUtils.createVocabularyItemInstance( - vcsid, refName, itemInfo, client.getItemCommonPartName()); - ClientResponse res = client.createItem(vcsid, multipart); - int statusCode = res.getStatus(); - - // Check the status code of the response: does it match - // the expected response(s)? + itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, createIdentifier()); + knownItemResourceId = VocabularyClientUtils.createItemInVocabulary(knownResourceId, + knownResourceRefName, itemInfo, client); if(logger.isDebugEnabled()){ - logger.debug(testName + ": status = " + statusCode); - } - Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), - invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); - Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); - - // Store the ID returned from the first item resource created - // for additional tests below. - if (knownItemResourceId == null){ - knownItemResourceId = extractId(res); - if (logger.isDebugEnabled()) { - logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId); - } + logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId); } - - // Store the IDs from any item resources created - // by tests, along with the IDs of their parents, so these items - // can be deleted after all tests have been run. - // - // Item resource IDs are unique, so these are used as keys; - // the non-unique IDs of their parents are stored as associated values. - allResourceItemIdsCreated.put(extractId(res), vcsid); - - return extractId(res); } @Override -- 2.47.3