use of com.amazonaws.services.dynamodbv2.AmazonDynamoDB in project athenz by yahoo.
the class DynamoDBWorkloadRecordStoreFactory method create.
@Override
public WorkloadRecordStore create(PrivateKeyStore keyStore) {
final String tableName = System.getProperty(ZTSConsts.ZTS_PROP_WORKLOAD_DYNAMODB_TABLE_NAME);
if (StringUtil.isEmpty(tableName)) {
LOGGER.error("Workload Store DynamoDB table name not specified");
throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE, "DynamoDB table name not specified");
}
final String serviceIndexName = System.getProperty(ZTSConsts.ZTS_PROP_WORKLOAD_DYNAMODB_INDEX_SERVICE_NAME);
if (StringUtil.isEmpty(serviceIndexName)) {
LOGGER.error("Workload Store DynamoDB index by name service not specified");
throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE, "DynamoDB index workload-service-index not specified");
}
final String ipIndexName = System.getProperty(ZTSConsts.ZTS_PROP_WORKLOAD_DYNAMODB_INDEX_IP_NAME);
if (StringUtil.isEmpty(ipIndexName)) {
LOGGER.error("Workload Store DynamoDB index by name ip not specified");
throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE, "DynamoDB index workload-ip-index not specified");
}
AmazonDynamoDB client = getDynamoDBClient(null, keyStore);
return new DynamoDBWorkloadRecordStore(client, tableName, serviceIndexName, ipIndexName);
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDB in project qpp-conversion-tool by CMSgov.
the class QrdaApiAcceptance method getDynamoItemCount.
private long getDynamoItemCount() {
AmazonDynamoDB dynamoClient = AwsTestHelper.getDynamoClient();
ScanResult scanResult = dynamoClient.scan(AwsTestHelper.TEST_DYNAMO_TABLE_NAME, Lists.newArrayList("Uuid"));
long itemCount = scanResult.getCount();
while (scanResult.getLastEvaluatedKey() != null && !scanResult.getLastEvaluatedKey().isEmpty()) {
scanResult = dynamoClient.scan(new ScanRequest().withTableName(AwsTestHelper.TEST_DYNAMO_TABLE_NAME).withAttributesToGet("Uuid").withExclusiveStartKey(scanResult.getLastEvaluatedKey()));
itemCount += scanResult.getCount();
}
return itemCount;
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDB in project qpp-conversion-tool by CMSgov.
the class DynamoDbConfigTest method dbMapperNoAudit.
@Test
public void dbMapperNoAudit() {
when(environment.getProperty(eq(Constants.NO_AUDIT_ENV_VARIABLE))).thenReturn("true");
when(environment.getProperty(eq(Constants.DYNAMO_TABLE_NAME_ENV_VARIABLE))).thenReturn(null);
when(environment.getProperty(eq(Constants.KMS_KEY_ENV_VARIABLE))).thenReturn(null);
DynamoDBMapper dynamoDBMapper = underTest.dynamoDbMapper(amazonDynamoDB);
assertThat(dynamoDBMapper).isNull();
}
Aggregations