Revert changes made to ShardSyncTaskIntegrationTest
This commit is contained in:
parent
ea54fdd6b9
commit
d1bc673a96
1 changed files with 5 additions and 25 deletions
|
|
@ -18,15 +18,9 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
|
||||||
import com.amazonaws.auth.BasicAWSCredentials;
|
|
||||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
|
||||||
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
|
|
||||||
import com.amazonaws.services.dynamodbv2.model.BillingMode;
|
import com.amazonaws.services.dynamodbv2.model.BillingMode;
|
||||||
import com.amazonaws.services.dynamodbv2.model.DescribeTableResult;
|
import com.amazonaws.services.dynamodbv2.model.DescribeTableResult;
|
||||||
import com.amazonaws.services.dynamodbv2.model.ListTablesResult;
|
import com.amazonaws.services.dynamodbv2.model.ListTablesResult;
|
||||||
import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder;
|
|
||||||
import com.amazonaws.services.kinesis.model.CreateStreamRequest;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
@ -57,7 +51,7 @@ import static junit.framework.TestCase.fail;
|
||||||
public class ShardSyncTaskIntegrationTest {
|
public class ShardSyncTaskIntegrationTest {
|
||||||
|
|
||||||
private static final String STREAM_NAME = "IntegrationTestStream02";
|
private static final String STREAM_NAME = "IntegrationTestStream02";
|
||||||
private static final String KINESIS_ENDPOINT = "http://localhost:4566";
|
private static final String KINESIS_ENDPOINT = "https://kinesis.us-east-1.amazonaws.com";
|
||||||
|
|
||||||
private static AWSCredentialsProvider credentialsProvider;
|
private static AWSCredentialsProvider credentialsProvider;
|
||||||
private IKinesisClientLeaseManager leaseManager;
|
private IKinesisClientLeaseManager leaseManager;
|
||||||
|
|
@ -69,13 +63,8 @@ public class ShardSyncTaskIntegrationTest {
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpBeforeClass() throws Exception {
|
public static void setUpBeforeClass() throws Exception {
|
||||||
System.setProperty("com.amazonaws.sdk.disableCbor", "true");
|
|
||||||
|
|
||||||
credentialsProvider = new DefaultAWSCredentialsProviderChain();
|
credentialsProvider = new DefaultAWSCredentialsProviderChain();
|
||||||
AmazonKinesis kinesis = AmazonKinesisClientBuilder.standard()
|
AmazonKinesis kinesis = new AmazonKinesisClient(credentialsProvider);
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566","us-east-1"))
|
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("accessKey", "secretKey")))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
kinesis.createStream(STREAM_NAME, 1);
|
kinesis.createStream(STREAM_NAME, 1);
|
||||||
|
|
@ -103,10 +92,7 @@ public class ShardSyncTaskIntegrationTest {
|
||||||
boolean useConsistentReads = true;
|
boolean useConsistentReads = true;
|
||||||
leaseManager =
|
leaseManager =
|
||||||
new KinesisClientLeaseManager(tableName,
|
new KinesisClientLeaseManager(tableName,
|
||||||
AmazonDynamoDBClientBuilder.standard()
|
new AmazonDynamoDBClient(credentialsProvider),
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566", "us-east-1"))
|
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("accessKey", "secretKey")))
|
|
||||||
.build(),
|
|
||||||
useConsistentReads,
|
useConsistentReads,
|
||||||
billingMode);
|
billingMode);
|
||||||
|
|
||||||
|
|
@ -154,10 +140,7 @@ public class ShardSyncTaskIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanUpTable(String tableName) throws DependencyException {
|
private void cleanUpTable(String tableName) throws DependencyException {
|
||||||
AmazonDynamoDBClient client = (AmazonDynamoDBClient) AmazonDynamoDBClientBuilder.standard()
|
AmazonDynamoDBClient client = new AmazonDynamoDBClient(DefaultAWSCredentialsProviderChain.getInstance());
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566","us-east-1"))
|
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("accessKey", "secretKey")))
|
|
||||||
.build();
|
|
||||||
ListTablesResult tables = client.listTables();
|
ListTablesResult tables = client.listTables();
|
||||||
if(tables.getTableNames().contains(tableName)){
|
if(tables.getTableNames().contains(tableName)){
|
||||||
leaseManager.waitUntilLeaseTableExists(2,20);
|
leaseManager.waitUntilLeaseTableExists(2,20);
|
||||||
|
|
@ -177,10 +160,7 @@ public class ShardSyncTaskIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBillingMode(BillingMode billingMode, String tableName) {
|
private void checkBillingMode(BillingMode billingMode, String tableName) {
|
||||||
AmazonDynamoDBClient client = (AmazonDynamoDBClient) AmazonDynamoDBClientBuilder.standard()
|
AmazonDynamoDBClient client = new AmazonDynamoDBClient(DefaultAWSCredentialsProviderChain.getInstance());
|
||||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566","us-east-1"))
|
|
||||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("accessKey", "secretKey")))
|
|
||||||
.build();
|
|
||||||
DescribeTableResult tableDetails = client.describeTable(tableName);
|
DescribeTableResult tableDetails = client.describeTable(tableName);
|
||||||
if(BillingMode.PAY_PER_REQUEST.equals(billingMode)) {
|
if(BillingMode.PAY_PER_REQUEST.equals(billingMode)) {
|
||||||
Assert.assertEquals(tableDetails.getTable().getBillingModeSummary().getBillingMode(), billingMode.name());
|
Assert.assertEquals(tableDetails.getTable().getBillingModeSummary().getBillingMode(), billingMode.name());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue