Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,13 @@ public class RetrieveAndRankSolrClusterDeleteExample {
*/
private static String SOLR_CLUSTER_ID = "your-solr-cluster-id";

/**
* Whether to delete all Solr clusters associated with the service instance
*/
private static boolean DELETE_ALL_SOLR_CLUSTERS = false;

private static HttpClusterLifecycleClient clusterLifecycleClient;

public static void main(String[] args) {
clusterLifecycleClient = new HttpClusterLifecycleClient(URI.create(SERVICE_URL), USERNAME, PASSWORD);

try {
deleteSolrCluster();
if (DELETE_ALL_SOLR_CLUSTERS) {
deleteAllSolrClusters();
}
} catch (final Exception e) {
e.printStackTrace();
} finally {
Expand All @@ -73,15 +65,6 @@ private static void deleteSolrCluster() {
System.out.println("Deleted Solr cluster.");
}

/**
* Deletes all Solr clusters associated with this instance of the service.
*/
private static void deleteAllSolrClusters() {
System.out.println("Deleting all Solr clusters...");
clusterLifecycleClient.deleteSolrClusters();
System.out.println("Deleted all Solr clusters.");
}

/**
* Cleanup the resources created via the example.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public interface ClusterLifecycleClient {
*/
void deleteSolrCluster(SolrCluster solrCluster);

/**
* Deletes all Solr clusters currently associated with the service instance.
*/
void deleteSolrClusters();

/**
* Checks whether a provided Solr cluster is ready for use.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ public void deleteSolrCluster(SolrCluster solrCluster) {
clusterLifecycleRestSender.deleteSolrCluster(solrCluster);
}

@Override
public void deleteSolrClusters() {
clusterLifecycleRestSender.deleteSolrClusters();
}

@Override
public SolrClusterListResponse listSolrClusters() {
return clusterLifecycleRestSender.listSolrClusters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,6 @@ public void deleteSolrCluster(SolrCluster solrCluster) {
}
}

public void deleteSolrClusters() {
final HttpDelete request = new HttpDelete(watsonSearchUrl);
try {
final HttpResponse response = client.execute(request);

if (!(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)) {
throw new RuntimeException(
generateErrorMessage(response, RetrieveAndRankMessages.ERROR_DELETING_CLUSTERS_1));
}
} catch (final IOException e) {
throw new RuntimeException(MSGS.format(ERROR_DELETING_CLUSTERS), e);
}
}

public SolrClusterListResponse listSolrClusters() {
final HttpUriRequest request = new HttpGet(watsonSearchUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum RetrieveAndRankMessages implements BundleKey {

// ClusterLifecycleRestSender
ERROR_CREATING_CLUSTER, ERROR_CREATING_CLUSTER_1, ERROR_DELETING_CLUSTER_1, ERROR_DELETING_CLUSTER_2,
ERROR_DELETING_CLUSTERS, ERROR_DELETING_CLUSTERS_1, ERROR_LISTING_CLUSTERS, ERROR_LISTING_CLUSTERS_1,
ERROR_LISTING_CLUSTERS, ERROR_LISTING_CLUSTERS_1,
ERROR_POLLING_CLUSTER_1, ERROR_POLLING_CLUSTER_2, ERROR_CAUSE_1,

// SolrConfigRestSender
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/RetrieveAndRankMessages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ ERROR_CREATING_CLUSTER = WRRHC004: Error creating new Solr cluster.
ERROR_CREATING_CLUSTER_1 = WRRHC005: Error creating new Solr cluster with status code [{0}].
ERROR_DELETING_CLUSTER_1 = WRRHC006: Error deleting Solr cluster ID [{0}].
ERROR_DELETING_CLUSTER_2 = WRRHC007: Error deleting Solr cluster ID [{0}] with status code [{1}].
ERROR_DELETING_CLUSTERS = WRRHC008: Error deleting Solr clusters.
ERROR_DELETING_CLUSTERS_1 = WRRHC009: Error deleting Solr clusters with status code [{0}].
ERROR_LISTING_CLUSTERS = WRRHC010: Error listing Solr clusters.
ERROR_LISTING_CLUSTERS_1 = WRRHC011: Error listing Solr clusters with status code [{0}].
ERROR_POLLING_CLUSTER_1 = WRRHC0012: Error polling Solr cluster ID [{0}].
Expand Down