com.amazonaws.services.dynamodbv2.local.main.ServerRunner Java Examples
The following examples show how to use
com.amazonaws.services.dynamodbv2.local.main.ServerRunner.
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: Aws2ITest.java From java-specialagent with Apache License 2.0 | 6 votes |
public static void main(final String[] args) throws Exception { System.getProperties().setProperty("sqlite4java.library.path", "src/test/resources/libs"); final DynamoDBProxyServer server = ServerRunner.createServerFromCommandLineArgs(new String[] {"-inMemory", "-port", "8000"}); server.start(); final DynamoDbClient dbClient = buildClient(); try { createTable(dbClient, "tableName-" + ThreadLocalRandom.current().nextLong(Long.MAX_VALUE)); } catch (final Exception e) { System.out.println("Exception: " + e.getMessage() + "\nIgnoring."); } server.stop(); TestUtil.checkSpan(new ComponentSpanCount("java-aws-sdk", 1)); System.exit(0); }
Example #2
Source File: Aws1ITest.java From java-specialagent with Apache License 2.0 | 6 votes |
public static void main(final String[] args) throws Exception { System.getProperties().setProperty("sqlite4java.library.path", "src/test/resources/libs"); final DynamoDBProxyServer server = ServerRunner.createServerFromCommandLineArgs(new String[] {"-inMemory", "-port", "8000"}); server.start(); final AmazonDynamoDB dbClient = buildClient(); try { createTable(dbClient, "tableName-" + ThreadLocalRandom.current().nextLong(Long.MAX_VALUE)); } catch (final Exception e) { System.out.println("Exception: " + e.getMessage() + "\nIgnoring."); } server.stop(); dbClient.shutdown(); TestUtil.checkSpan(new ComponentSpanCount("java-aws-sdk", 1)); System.exit(0); }
Example #3
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 #4
Source File: LocalDynamoDb.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
private DynamoDBProxyServer createServer(String portString) throws Exception { return ServerRunner.createServerFromCommandLineArgs( new String[]{ "-inMemory", "-port", portString }); }
Example #5
Source File: LocalDynamoDb.java From aws-dynamodb-encryption-java with Apache License 2.0 | 5 votes |
private DynamoDBProxyServer createServer(String portString) throws Exception { return ServerRunner.createServerFromCommandLineArgs( new String[]{ "-inMemory", "-port", portString }); }
Example #6
Source File: Aws2Test.java From java-specialagent with Apache License 2.0 | 4 votes |
@BeforeClass public static void beforeClass() throws Exception { System.setProperty("sqlite4java.library.path", "src/test/resources/libs"); server = ServerRunner.createServerFromCommandLineArgs(new String[] {"-inMemory", "-port", "8000"}); server.start(); }
Example #7
Source File: LocalDbCreationRule.java From tutorials with MIT License | 4 votes |
@Override protected void before() throws Exception { String port = "8000"; this.server = ServerRunner.createServerFromCommandLineArgs(new String[]{"-inMemory","-sharedDb" ,"-port", port}); server.start(); }
Example #8
Source File: LocalDbCreationRule.java From tutorials with MIT License | 4 votes |
@Override protected void before() throws Exception { String port = "8000"; this.server = ServerRunner.createServerFromCommandLineArgs(new String[]{"-inMemory", "-port", port}); server.start(); }