@@ -10,12 +10,14 @@ public final class DynamoEnv {
1010 private static final String PROP_DYNAMO_REGION = "scalardb.dynamo.region" ;
1111 private static final String PROP_DYNAMO_ACCESS_KEY_ID = "scalardb.dynamo.access_key_id" ;
1212 private static final String PROP_DYNAMO_SECRET_ACCESS_KEY = "scalardb.dynamo.secret_access_key" ;
13+ private static final String PROP_DYNAMO_EMULATOR = "scalardb.dynamo.emulator" ;
1314 private static final String PROP_DYNAMO_CREATE_OPTIONS = "scalardb.dynamo.create_options" ;
1415
1516 private static final String DEFAULT_DYNAMO_ENDPOINT_OVERRIDE = "http://localhost:8000" ;
1617 private static final String DEFAULT_DYNAMO_REGION = "us-west-2" ;
1718 private static final String DEFAULT_DYNAMO_ACCESS_KEY_ID = "fakeMyKeyId" ;
1819 private static final String DEFAULT_DYNAMO_SECRET_ACCESS_KEY = "fakeSecretAccessKey" ;
20+ private static final String DEFAULT_DYNAMO_EMULATOR = "true" ;
1921
2022 private static final ImmutableMap <String , String > DEFAULT_DYNAMO_CREATE_OPTIONS =
2123 ImmutableMap .of (DynamoAdmin .NO_SCALING , "true" , DynamoAdmin .NO_BACKUP , "true" );
@@ -30,9 +32,10 @@ public static Properties getProperties(String testName) {
3032 System .getProperty (PROP_DYNAMO_ACCESS_KEY_ID , DEFAULT_DYNAMO_ACCESS_KEY_ID );
3133 String secretAccessKey =
3234 System .getProperty (PROP_DYNAMO_SECRET_ACCESS_KEY , DEFAULT_DYNAMO_SECRET_ACCESS_KEY );
35+ String isEmulator = System .getProperty (PROP_DYNAMO_EMULATOR , DEFAULT_DYNAMO_EMULATOR );
3336
3437 Properties properties = new Properties ();
35- if (endpointOverride != null ) {
38+ if (isEmulator . equals ( "true" ) && endpointOverride != null ) {
3639 properties .setProperty (DynamoConfig .ENDPOINT_OVERRIDE , endpointOverride );
3740 }
3841 properties .setProperty (DatabaseConfig .CONTACT_POINTS , region );
@@ -51,35 +54,6 @@ public static Properties getProperties(String testName) {
5154 return properties ;
5255 }
5356
54- /**
55- * Returns properties for tests that require real DynamoDB (not the emulator) to be used.
56- *
57- * <p>These properties are used in tests that require real DynamoDB (not the emulator) to be used.
58- */
59- public static Properties getPropertiesForNonEmulator (String testName ) {
60- String region = System .getProperty (PROP_DYNAMO_REGION , DEFAULT_DYNAMO_REGION );
61- String accessKeyId =
62- System .getProperty (PROP_DYNAMO_ACCESS_KEY_ID , DEFAULT_DYNAMO_ACCESS_KEY_ID );
63- String secretAccessKey =
64- System .getProperty (PROP_DYNAMO_SECRET_ACCESS_KEY , DEFAULT_DYNAMO_SECRET_ACCESS_KEY );
65-
66- Properties properties = new Properties ();
67- properties .setProperty (DatabaseConfig .CONTACT_POINTS , region );
68- properties .setProperty (DatabaseConfig .USERNAME , accessKeyId );
69- properties .setProperty (DatabaseConfig .PASSWORD , secretAccessKey );
70- properties .setProperty (DatabaseConfig .STORAGE , "dynamo" );
71- properties .setProperty (DatabaseConfig .CROSS_PARTITION_SCAN , "true" );
72- properties .setProperty (DatabaseConfig .CROSS_PARTITION_SCAN_FILTERING , "true" );
73- properties .setProperty (DatabaseConfig .CROSS_PARTITION_SCAN_ORDERING , "false" );
74-
75- // Add testName as a metadata namespace suffix
76- properties .setProperty (
77- DatabaseConfig .SYSTEM_NAMESPACE_NAME ,
78- DatabaseConfig .DEFAULT_SYSTEM_NAMESPACE_NAME + "_" + testName );
79-
80- return properties ;
81- }
82-
8357 public static Map <String , String > getCreationOptions () {
8458 String createOptionsString = System .getProperty (PROP_DYNAMO_CREATE_OPTIONS );
8559 if (createOptionsString == null ) {
0 commit comments