public TableDescription unmarshall(JsonUnmarshallerContext context) throws Exception { TableDescription tableDescription = new TableDescription();
return null; TableDescription tableDescription = new TableDescription(); reader.beginObject(); while (reader.hasNext()) {
@Test public void get_whenTableAlreadyExists_doesNotCreateTable() { CreateDynamoDBTable createDynamoDBTable = new CreateDynamoDBTable(dynamoDB, "asdf", "asdf", 1, 1); //setup when(dynamoDB.describeTable("asdf")).thenReturn(new DescribeTableResult().withTable(new TableDescription())); //test createDynamoDBTable.get(); //verify verify(dynamoDB).describeTable("asdf"); verify(dynamoDB, Mockito.never()).createTable(any(CreateTableRequest.class)); }
@Before public void setup() { when(dynamoDBClient.describeTable(TABLE_NAME)).thenReturn(new TableDescription() .withBillingModeSummary( new BillingModeSummary().withBillingMode(DynamoDBConstants.BILLING_MODE_PROVISIONED)) .withProvisionedThroughput( new ProvisionedThroughputDescription().withReadCapacityUnits(READ_CAPACITY_UNITS))); JobConf jobConf = new JobConf(); jobConf.set(DynamoDBConstants.THROUGHPUT_READ_PERCENT, String.valueOf(THROUGHPUT_READ_PERCENT)); when(jobClient.getConf()).thenReturn(jobConf); readIopsCalculator = new ReadIopsCalculator(jobClient, dynamoDBClient, TABLE_NAME, TOTAL_SEGMETNS, LOCAL_SEGMENTS); }
@Test public void get_whenTableDoesNotExist_createsTable() { CreateDynamoDBTable createDynamoDBTable = new CreateDynamoDBTable(dynamoDB, "asdf", "asdf", 1, 1); //setup when(dynamoDB.describeTable("asdf")).thenThrow(new ResourceNotFoundException("asdf")); when(dynamoDB.createTable(any(CreateTableRequest.class))) .thenReturn(new CreateTableResult().withTableDescription(new TableDescription())); when(dynamoDB.describeTable(new DescribeTableRequest().withTableName("asdf"))) .thenReturn(new DescribeTableResult().withTable(new TableDescription().withTableStatus(TableStatus.ACTIVE))); //test createDynamoDBTable.get(); //verify verify(dynamoDB).describeTable("asdf"); verify(dynamoDB).createTable(any(CreateTableRequest.class)); } }
@Before public void setup() { when(dynamoDBClient.describeTable(TABLE_NAME)).thenReturn(new TableDescription() .withBillingModeSummary( new BillingModeSummary().withBillingMode(DynamoDBConstants.BILLING_MODE_PROVISIONED)) .withProvisionedThroughput( new ProvisionedThroughputDescription().withWriteCapacityUnits(WRITE_CAPACITY_UNITS))); JobConf jobConf = new JobConf(); jobConf.setNumMapTasks(TOTAL_MAP_TASKS); jobConf.set("mapreduce.task.attempt.id", "attempt_m_1"); jobConf.set(DynamoDBConstants.THROUGHPUT_WRITE_PERCENT, String.valueOf (THROUGHPUT_WRITE_PERCENT)); when(jobClient.getConf()).thenReturn(jobConf); writeIopsCalculator = new WriteIopsCalculator(jobClient, dynamoDBClient, TABLE_NAME) { @Override int calculateMaxMapTasks(int totalMapTasks) { return MAX_CONCURRENT_MAP_TASKS; } }; }
private TableDescription getTableDescription(String hashType, String rangeType) { List<KeySchemaElement> keySchema = new ArrayList<>(); List<AttributeDefinition> definitions = new ArrayList<>(); keySchema.add(new KeySchemaElement().withAttributeName("hashKey").withKeyType(KeyType.HASH)); definitions.add(new AttributeDefinition().withAttributeName("hashKey").withAttributeType (hashType)); if (rangeType != null) { keySchema.add(new KeySchemaElement().withAttributeName("rangeKey").withKeyType(KeyType .RANGE)); definitions.add(new AttributeDefinition().withAttributeName("rangeKey").withAttributeType (rangeType)); } TableDescription description = new TableDescription().withKeySchema(keySchema) .withAttributeDefinitions(definitions).withProvisionedThroughput(new ProvisionedThroughputDescription().withReadCapacityUnits(1000L) .withWriteCapacityUnits(1000L)); return description; }
public TableDescription unmarshall(JsonUnmarshallerContext context) throws Exception { TableDescription tableDescription = new TableDescription();