]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-489: Clean up extra VocabularyItems created during client tests of the Vocabul...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 17 Feb 2010 02:05:58 +0000 (02:05 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 17 Feb 2010 02:05:58 +0000 (02:05 +0000)
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java

index 90c1f90335bf59c5b6bd3fac018704c910815357..b6d04b5671e2c96357c25658323fe66f6563b965 100644 (file)
@@ -132,11 +132,20 @@ public class VocabularyServiceTest extends AbstractServiceTestImpl {
 
         HashMap<String, String> itemInfo = new HashMap<String, String>();
         itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, createIdentifier());
-        knownItemResourceId = VocabularyClientUtils.createItemInVocabulary(knownResourceId, 
+        String newID = VocabularyClientUtils.createItemInVocabulary(knownResourceId,
                                knownResourceRefName, itemInfo, client);
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
+        // Store the ID returned from the first item resource created
+        // for additional tests below.
+        if (knownItemResourceId == null){
+            knownItemResourceId = newID;
+            if (logger.isDebugEnabled()) {
+                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.
+        allResourceItemIdsCreated.put(newID, knownResourceId);
     }
 
     @Override