// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // snippet-start:[dynamodb.java.trydax.TryDax] import com.amazonaws.services.dynamodbv2.document.DynamoDB; public class TryDax { public static void main(String[] args) throws Exception { TryDaxHelper helper = new TryDaxHelper(); TryDaxTests tests = new TryDaxTests(); DynamoDB ddbClient = helper.getDynamoDBClient(); DynamoDB daxClient = null; if (args.length >= 1) { daxClient = helper.getDaxClient(args[0]); } String tableName = "TryDaxTable"; System.out.println("Creating table..."); helper.createTable(tableName, ddbClient); System.out.println("Populating table..."); helper.writeData(tableName, ddbClient, 10, 10); DynamoDB testClient = null; if (daxClient != null) { testClient = daxClient; } else { testClient = ddbClient; } System.out.println("Running GetItem, Scan, and Query tests..."); System.out.println("First iteration of each test will result in cache misses"); System.out.println("Next iterations are cache hits\n"); // GetItem tests.getItemTest(tableName, testClient, 1, 10, 5); // Query tests.queryTest(tableName, testClient, 5, 2, 9, 5); // Scan tests.scanTest(tableName, testClient, 5); helper.deleteTable(tableName, ddbClient); } } // snippet-end:[dynamodb.java.trydax.TryDax]