use of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient in project nifi by apache.
the class AbstractDynamoDBProcessor method createClient.
/**
* Create client using credentials provider. This is the preferred way for creating clients
*/
@Override
protected AmazonDynamoDBClient createClient(final ProcessContext context, final AWSCredentialsProvider credentialsProvider, final ClientConfiguration config) {
getLogger().debug("Creating client with credentials provider");
final AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentialsProvider, config);
return client;
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient in project wildfly-camel by wildfly-extras.
the class DynamoDBIntegrationTest method testKeyValueOperations.
@Test
public void testKeyValueOperations() throws Exception {
AmazonDynamoDBClient client = provider.getClient();
Assume.assumeNotNull("AWS client not null", client);
DynamoDBUtils.assertNoStaleTables(client, "before");
try {
try {
TableDescription description = DynamoDBUtils.createTable(client, tableName);
Assert.assertEquals("ACTIVE", description.getTableStatus());
WildFlyCamelContext camelctx = new WildFlyCamelContext();
camelctx.getNamingContext().bind("ddbClientA", client);
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("aws-ddb://" + tableName + "?amazonDDBClient=#ddbClientA");
}
});
camelctx.start();
try {
DynamoDBUtils.putItem(camelctx, "Book 103 Title");
String result = ((AttributeValue) DynamoDBUtils.getItem(camelctx).get("Title")).getS();
Assert.assertEquals("Book 103 Title", result);
DynamoDBUtils.updItem(camelctx, "Book 103 Update");
result = ((AttributeValue) DynamoDBUtils.getItem(camelctx).get("Title")).getS();
Assert.assertEquals("Book 103 Update", result);
} finally {
camelctx.stop();
}
} finally {
DynamoDBUtils.deleteTable(client, tableName);
}
} finally {
DynamoDBUtils.assertNoStaleTables(client, "after");
}
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient in project tutorials by eugenp.
the class ProductInfoRepositoryIntegrationTest method setupClass.
@BeforeClass
public static void setupClass() {
Properties testProperties = loadFromFileInClasspath("test.properties").filter(properties -> !isEmpty(properties.getProperty(AWS_ACCESSKEY))).filter(properties -> !isEmpty(properties.getProperty(AWS_SECRETKEY))).filter(properties -> !isEmpty(properties.getProperty(DYNAMODB_ENDPOINT))).orElseThrow(() -> new RuntimeException("Unable to get all of the required test property values"));
String amazonAWSAccessKey = testProperties.getProperty(AWS_ACCESSKEY);
String amazonAWSSecretKey = testProperties.getProperty(AWS_SECRETKEY);
String amazonDynamoDBEndpoint = testProperties.getProperty(DYNAMODB_ENDPOINT);
amazonDynamoDB = new AmazonDynamoDBClient(new BasicAWSCredentials(amazonAWSAccessKey, amazonAWSSecretKey));
amazonDynamoDB.setEndpoint(amazonDynamoDBEndpoint);
dynamoDBMapper = new DynamoDBMapper(amazonDynamoDB);
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient in project tutorials by eugenp.
the class SavePersonHandler method initDynamoDbClient.
private void initDynamoDbClient() {
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.setRegion(Region.getRegion(REGION));
this.dynamoDb = new DynamoDB(client);
}
use of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient in project archaius by Netflix.
the class DynamoDbConfigurationSourceIntegrationTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
try {
dbClient = new AmazonDynamoDBClient(new DefaultAWSCredentialsProviderChain().getCredentials());
} catch (Exception e) {
e.printStackTrace();
}
System.setProperty("com.netflix.config.dynamo.tableName", tableName);
if (dbClient != null) {
createTable(dbClient, tableName);
addElements(dbClient, tableName);
}
}
Aggregations