Java 类com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded 实例源码

项目:lambdora    文件:IntegrationTestBase.java   
/**
 * setup
 */
@Before
public void setup() {
    // Create an in-memory and in-process instance of DynamoDB Local that skips HTTP
    dynamodbClient = DynamoDBEmbedded.create().amazonDynamoDB();

    // Create and verify table
    final CreateTableResult createTableResult = createTable();
    assertEquals(TABLE_NAME, createTableResult.getTableDescription().getTableName());
}
项目:aws-amazon-shopping-bot-lambda-func    文件:ObjectMother.java   
public static AmazonDynamoDB createInMemoryDb() {
    AmazonDynamoDB dynamodb = null;
    try {
        // Create an in-memory and in-process instance of DynamoDB Local
        AmazonDynamoDBLocal amazonDynamoDBLocal = DynamoDBEmbedded.create();
        dynamodb = amazonDynamoDBLocal.amazonDynamoDB();
        return dynamodb;
    } catch (Exception e){
        if(dynamodb != null)
            dynamodb.shutdown();// Shutdown the thread pools in DynamoDB Local / Embedded
    }
    return dynamodb;
}
项目:plano    文件:DynamoDBRepositoryTests.java   
@BeforeClass
public static void beforeClass() {
    sDynamoDB = DynamoDBEmbedded.create().amazonDynamoDB();
    sDynamoDBMapper = new DynamoDBMapper(sDynamoDB);
    sDynamoDBRepository = new DynamoDBRepository();
    sDynamoDBRepository.setDynamoDBMapper(sDynamoDBMapper);
    sDynamoDBRepository.setLockDurationMs(LOCK_DURATION_MS);
}
项目:fleet-cron    文件:LocalDynamoDbRule.java   
@Override
protected void before() throws Throwable {
    try {
        amazonDynamoDB = DynamoDBEmbedded.create().amazonDynamoDB();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:AssortmentOfJUnitRules    文件:LocalDynamoDbRule.java   
@Override
protected void before() throws Throwable {
  nativeLibraryRule.before();
  System.setProperty("sqlite4java.library.path", nativeLibraryRule.getNativeLibrariesFolder().toString());

  client = DynamoDBEmbedded.create().amazonDynamoDB();
}
项目:aws-dynamodb-encryption-java    文件:MostRecentProviderTests.java   
@Before
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();
}
项目:aws-dynamodb-encryption-java    文件:MetaStoreTests.java   
@Before
public void setup() {
    client = synchronize(DynamoDBEmbedded.create(), AmazonDynamoDB.class);
    MetaStore.createTable(client, TABLE_NAME, new ProvisionedThroughput(1L, 1L));
    store = new MetaStore(client, TABLE_NAME, ENCRYPTOR);
    ctx = new EncryptionContext.Builder().build();
}
项目:aws-dynamodb-encryption-java    文件:TransformerHolisticTests.java   
@Before
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)));
}
项目:aws-dynamodb-examples    文件:DynamoDBLocalFixture.java   
/**
 * 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();
        }
    }
}
项目:Java-9-Programming-Blueprints    文件:CloudNoticeDAO.java   
public CloudNoticeDAO(boolean local) {
    ddb = local ? DynamoDBEmbedded.create().amazonDynamoDB()
            : AmazonDynamoDBClientBuilder.defaultClient();
    verifyTables();
    mapper = new DynamoDBMapper(ddb);
}
项目:plano    文件:PlanoApplicationDynamoDBTests.java   
@Bean
@Primary
public AmazonDynamoDB createAmazonDynamoDBLocal() throws Exception {
    return DynamoDBEmbedded.create().amazonDynamoDB();
}