Updating name of few functions
This commit is contained in:
parent
84d2f1bcd8
commit
cfbb55b2b7
3 changed files with 14 additions and 14 deletions
|
|
@ -19,19 +19,19 @@ public abstract class AWSResourceManager {
|
||||||
/**
|
/**
|
||||||
* Make delete resource API call for specific resource type
|
* Make delete resource API call for specific resource type
|
||||||
*/
|
*/
|
||||||
public abstract void _deleteResource(String resourceName) throws Exception;
|
public abstract void deleteResourceCall(String resourceName) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if resource with given name is in active state
|
* Check if resource with given name is in active state
|
||||||
*/
|
*/
|
||||||
public abstract boolean _isResourceActive(String name);
|
public abstract boolean isResourceActive(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all the names of resources of a specified type
|
* Get a list of all the names of resources of a specified type
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract List<String> _getAllResourceNames() throws Exception;
|
public abstract List<String> getAllResourceNames() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete resource with specified resource name
|
* Delete resource with specified resource name
|
||||||
|
|
@ -39,7 +39,7 @@ public abstract class AWSResourceManager {
|
||||||
public void deleteResource(String resourceName) throws Exception {
|
public void deleteResource(String resourceName) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_deleteResource(resourceName);
|
deleteResourceCall(resourceName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new Exception("Could not delete resource: {}", e);
|
throw new Exception("Could not delete resource: {}", e);
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ public abstract class AWSResourceManager {
|
||||||
throw new RuntimeException("Failed resource deletion");
|
throw new RuntimeException("Failed resource deletion");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!_isResourceActive(resourceName)) {
|
if (!isResourceActive(resourceName)) {
|
||||||
log.info("Successfully deleted the resource {}", resourceName);
|
log.info("Successfully deleted the resource {}", resourceName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ public abstract class AWSResourceManager {
|
||||||
* Delete all instances of a particular resource type
|
* Delete all instances of a particular resource type
|
||||||
*/
|
*/
|
||||||
public void deleteAllResource() throws Exception {
|
public void deleteAllResource() throws Exception {
|
||||||
final List<String> resourceNames = _getAllResourceNames();
|
final List<String> resourceNames = getAllResourceNames();
|
||||||
for (String resourceName : resourceNames) {
|
for (String resourceName : resourceNames) {
|
||||||
deleteResource(resourceName);
|
deleteResource(resourceName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class LeaseTableManager extends AWSResourceManager {
|
||||||
|
|
||||||
private final DynamoDbAsyncClient dynamoClient;
|
private final DynamoDbAsyncClient dynamoClient;
|
||||||
|
|
||||||
public boolean _isResourceActive(String tableName) {
|
public boolean isResourceActive(String tableName) {
|
||||||
final DescribeTableRequest request = DescribeTableRequest.builder().tableName(tableName).build();
|
final DescribeTableRequest request = DescribeTableRequest.builder().tableName(tableName).build();
|
||||||
final CompletableFuture<DescribeTableResponse> describeTableResponseCompletableFuture = dynamoClient.describeTable(request);
|
final CompletableFuture<DescribeTableResponse> describeTableResponseCompletableFuture = dynamoClient.describeTable(request);
|
||||||
|
|
||||||
|
|
@ -49,12 +49,12 @@ public class LeaseTableManager extends AWSResourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _deleteResource(String tableName) throws Exception {
|
public void deleteResourceCall(String tableName) throws Exception {
|
||||||
final DeleteTableRequest request = DeleteTableRequest.builder().tableName(tableName).build();
|
final DeleteTableRequest request = DeleteTableRequest.builder().tableName(tableName).build();
|
||||||
FutureUtils.resolveOrCancelFuture(dynamoClient.deleteTable(request), Duration.ofSeconds(60));
|
FutureUtils.resolveOrCancelFuture(dynamoClient.deleteTable(request), Duration.ofSeconds(60));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> _getAllResourceNames() throws Exception {
|
public List<String> getAllResourceNames() throws Exception {
|
||||||
ListTablesRequest listTableRequest = ListTablesRequest.builder().build();
|
ListTablesRequest listTableRequest = ListTablesRequest.builder().build();
|
||||||
List<String> allTableNames = new ArrayList<>();
|
List<String> allTableNames = new ArrayList<>();
|
||||||
ListTablesResponse result = null;
|
ListTablesResponse result = null;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class StreamExistenceManager extends AWSResourceManager {
|
||||||
this.client = config.buildAsyncKinesisClient();
|
this.client = config.buildAsyncKinesisClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean _isResourceActive(String streamName) {
|
public boolean isResourceActive(String streamName) {
|
||||||
final DescribeStreamSummaryRequest request = DescribeStreamSummaryRequest.builder().streamName(streamName).build();
|
final DescribeStreamSummaryRequest request = DescribeStreamSummaryRequest.builder().streamName(streamName).build();
|
||||||
final CompletableFuture<DescribeStreamSummaryResponse> describeStreamSummaryResponseCompletableFuture = client.describeStreamSummary(request);
|
final CompletableFuture<DescribeStreamSummaryResponse> describeStreamSummaryResponseCompletableFuture = client.describeStreamSummary(request);
|
||||||
|
|
||||||
|
|
@ -58,12 +58,12 @@ public class StreamExistenceManager extends AWSResourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _deleteResource(String streamName) throws Exception {
|
public void deleteResourceCall(String streamName) throws Exception {
|
||||||
final DeleteStreamRequest request = DeleteStreamRequest.builder().streamName(streamName).enforceConsumerDeletion(true).build();
|
final DeleteStreamRequest request = DeleteStreamRequest.builder().streamName(streamName).enforceConsumerDeletion(true).build();
|
||||||
client.deleteStream(request).get(30, TimeUnit.SECONDS);
|
client.deleteStream(request).get(30, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> _getAllResourceNames() throws Exception {
|
public List<String> getAllResourceNames() throws Exception {
|
||||||
ListStreamsRequest listStreamRequest = ListStreamsRequest.builder().build();
|
ListStreamsRequest listStreamRequest = ListStreamsRequest.builder().build();
|
||||||
List<String> allStreamNames = new ArrayList<>();
|
List<String> allStreamNames = new ArrayList<>();
|
||||||
ListStreamsResponse result = null;
|
ListStreamsResponse result = null;
|
||||||
|
|
@ -77,7 +77,7 @@ public class StreamExistenceManager extends AWSResourceManager {
|
||||||
|
|
||||||
public void checkStreamAndCreateIfNecessary(String streamName) {
|
public void checkStreamAndCreateIfNecessary(String streamName) {
|
||||||
|
|
||||||
if (!_isResourceActive(streamName)) {
|
if (!isResourceActive(streamName)) {
|
||||||
createStream(streamName, testConfig.getShardCount());
|
createStream(streamName, testConfig.getShardCount());
|
||||||
}
|
}
|
||||||
log.info("Using stream {} with region {}", streamName, testConfig.getRegion());
|
log.info("Using stream {} with region {}", streamName, testConfig.getRegion());
|
||||||
|
|
@ -98,7 +98,7 @@ public class StreamExistenceManager extends AWSResourceManager {
|
||||||
throw new RuntimeException("Failed stream creation, did not transition into active");
|
throw new RuntimeException("Failed stream creation, did not transition into active");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
boolean isActive = _isResourceActive(streamName);
|
boolean isActive = isResourceActive(streamName);
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
log.info("Succesfully created the stream {}", streamName);
|
log.info("Succesfully created the stream {}", streamName);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue