com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded Java Examples
The following examples show how to use
com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDBLocalFixture.java From aws-dynamodb-examples with Apache License 2.0 | 6 votes |
/** * You can use mvn to run DynamoDBLocalFixture, e.g. * <p> * $ mvn clean package * <p> * $ mvn exec:java -Dexec.mainClass="com.amazonaws.services.dynamodbv2.DynamoDBLocalFixture" \ * -Dexec.classpathScope="test" \ * -Dsqlite4java.library.path=target/dependencies * <p> * It's recommended to run "aws configure" one time before you run DynamoDBLocalFixture * * @param args - no args * @throws Exception */ public static void main(String[] args) throws Exception { AmazonDynamoDB dynamodb = null; try { // Create an in-memory and in-process instance of DynamoDB Local that skips HTTP dynamodb = DynamoDBEmbedded.create().amazonDynamoDB(); // use the DynamoDB API with DynamoDBEmbedded listTables(dynamodb.listTables(), "DynamoDB Embedded"); } finally { // Shutdown the thread pools in DynamoDB Local / Embedded if(dynamodb != null) { dynamodb.shutdown(); } } // Create an in-memory and in-process instance of DynamoDB Local that runs over HTTP final String[] localArgs = { "-inMemory" }; DynamoDBProxyServer server = null; try { server = ServerRunner.createServerFromCommandLineArgs(localArgs); server.start(); dynamodb = AmazonDynamoDBClientBuilder.standard().withEndpointConfiguration( // we can use any region here new AwsClientBuilder.EndpointConfiguration("http://localhost:8000", "us-west-2")) .build(); // use the DynamoDB API over HTTP listTables(dynamodb.listTables(), "DynamoDB Local over HTTP"); } finally { // Stop the DynamoDB Local endpoint if(server != null) { server.stop(); } } }
Example #2
Source File: DynamoDbFunctionalTest.java From pocket-etl with Apache License 2.0 | 5 votes |
@Before public void setup() { tableName = "etl001"; ddb = DynamoDBEmbedded.create().amazonDynamoDB(); CreateTableRequest createTableRequest = new CreateTableRequest() .withTableName(tableName) .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L)) .withAttributeDefinitions(new AttributeDefinition("pk", "S")) .withKeySchema(new KeySchemaElement("pk", "HASH")); ddb.createTable(createTableRequest); }
Example #3
Source File: MostRecentProviderTests.java From aws-dynamodb-encryption-java with Apache License 2.0 | 5 votes |
@BeforeMethod public void setup() { methodCalls = new HashMap<String, Integer>(); client = instrument(DynamoDBEmbedded.create(), AmazonDynamoDB.class, methodCalls); MetaStore.createTable(client, TABLE_NAME, new ProvisionedThroughput(1L, 1L)); store = new MetaStore(client, TABLE_NAME, ENCRYPTOR); ctx = new EncryptionContext.Builder().build(); methodCalls.clear(); }
Example #4
Source File: MetaStoreTests.java From aws-dynamodb-encryption-java with Apache License 2.0 | 5 votes |
@BeforeMethod public void setup() { client = synchronize(DynamoDBEmbedded.create(), AmazonDynamoDB.class); targetClient = synchronize(DynamoDBEmbedded.create(), AmazonDynamoDB.class); MetaStore.createTable(client, SOURCE_TABLE_NAME, new ProvisionedThroughput(1L, 1L)); //Creating Targeted DynamoDB Object MetaStore.createTable(targetClient, DESTINATION_TABLE_NAME, new ProvisionedThroughput(1L, 1L)); store = new MetaStore(client, SOURCE_TABLE_NAME, ENCRYPTOR); targetStore = new MetaStore(targetClient, DESTINATION_TABLE_NAME, TARGET_ENCRYPTOR); ctx = new EncryptionContext.Builder().build(); }
Example #5
Source File: TransformerHolisticTests.java From aws-dynamodb-encryption-java with Apache License 2.0 | 4 votes |
@BeforeMethod public void setUp() { client = DynamoDBEmbedded.create(); ArrayList<AttributeDefinition> attrDef = new ArrayList<AttributeDefinition>(); attrDef.add(new AttributeDefinition().withAttributeName("hashKey").withAttributeType(ScalarAttributeType.N)); attrDef.add(new AttributeDefinition().withAttributeName("rangeKey").withAttributeType(ScalarAttributeType.N)); ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashKey").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeKey").withKeyType(KeyType.RANGE)); client.createTable(new CreateTableRequest().withTableName("TableName") .withAttributeDefinitions(attrDef) .withKeySchema(keySchema) .withProvisionedThroughput(new ProvisionedThroughput(100L, 100L))); attrDef = new ArrayList<AttributeDefinition>(); attrDef.add(new AttributeDefinition().withAttributeName("hashKey").withAttributeType(ScalarAttributeType.S)); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashKey").withKeyType(KeyType.HASH)); client.createTable(new CreateTableRequest().withTableName("HashKeyOnly") .withAttributeDefinitions(attrDef) .withKeySchema(keySchema) .withProvisionedThroughput(new ProvisionedThroughput(100L, 100L))); attrDef = new ArrayList<AttributeDefinition>(); attrDef.add(new AttributeDefinition().withAttributeName("hashKey").withAttributeType(ScalarAttributeType.B)); attrDef.add(new AttributeDefinition().withAttributeName("rangeKey").withAttributeType(ScalarAttributeType.N)); keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("hashKey").withKeyType(KeyType.HASH)); keySchema.add(new KeySchemaElement().withAttributeName("rangeKey").withKeyType(KeyType.RANGE)); client.createTable(new CreateTableRequest().withTableName("DeterministicTable") .withAttributeDefinitions(attrDef) .withKeySchema(keySchema) .withProvisionedThroughput(new ProvisionedThroughput(100L, 100L))); MetaStore.createTable(client, "metastore", new ProvisionedThroughput(100L, 100L)); mrProv = new MostRecentProvider(new MetaStore(client, "metastore", DynamoDBEncryptor.getInstance(symProv)), "materialName", 1000); }
Example #6
Source File: DynamoDBTestBase.java From aws-dynamodb-encryption-java with Apache License 2.0 | 4 votes |
public static void setUpTestBase() { dynamo = DynamoDBEmbedded.create(); }