@Override public void deleteAll() throws Exception { final ListTablesResult tables = client.listTables(); for (final String tableName : tables.getTableNames()) { if ((gwNamespace == null) || tableName.startsWith(gwNamespace)) { client.deleteTable(new DeleteTableRequest(tableName)); } } tableExistsCache.clear(); }
@Override public Statement apply(Statement base, Description description) { assumeTrue(dynamoDbOnline.get(this.port)); String url = "http://localhost:" + this.port; this.amazonDynamoDB = AmazonDynamoDBAsyncClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", ""))) .withClientConfiguration( new ClientConfiguration() .withMaxErrorRetry(0) .withConnectionTimeout(1000)) .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(url, Regions.DEFAULT_REGION.getName())) .build(); try { this.amazonDynamoDB.listTables(); } catch (SdkClientException e) { logger.warn("Tests not running because no DynamoDb on " + url, e); assumeNoException(e); } return super.apply(base, description); }