File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
discovery/src/test/java/com/ibm/watson/discovery/v1 Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,26 @@ public void cleanup() {
178178 "deleteConfiguration failed. Configuration " + configurationId + " not found" );
179179 }
180180 }
181+
182+ ListCollectionsOptions listCollectionsOptions = new ListCollectionsOptions .Builder ()
183+ .environmentId (environmentId )
184+ .build ();
185+ ListCollectionsResponse response = discovery .listCollections (listCollectionsOptions ).execute ().getResult ();
186+ for (Collection collection : response .getCollections ()){
187+ if (collection .getName ().matches ("java-sdk-.*collection" ) ||
188+ collection .getName ().matches ("my_watson_developer_cloud_collection.*" ) ||
189+ collection .getName ().matches ("tokenization-dict-testing-collection.*" )) {
190+ DeleteCollectionOptions deleteCollectionOptions = new DeleteCollectionOptions .Builder ()
191+ .collectionId (collection .getCollectionId ())
192+ .environmentId (environmentId )
193+ .build ();
194+ try {
195+ DeleteCollectionResponse deleteCollectionResponse = discovery .deleteCollection (deleteCollectionOptions ).execute ().getResult ();
196+ } catch (NotFoundException ex ) {
197+ System .out .println ("deleteCollection failed. Collection " + collectionId + " not found" );
198+ }
199+ }
200+ }
181201 }
182202
183203 /**
You can’t perform that action at this time.
0 commit comments