File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
main/java/com/scalar/db/storage/dynamo
test/java/com/scalar/db/storage/dynamo Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1261,8 +1261,9 @@ private Set<String> getNamespacesOfExistingTables() throws ExecutionException {
12611261
12621262 for (Map <String , AttributeValue > tableMetadata : scanResponse .items ()) {
12631263 String fullTableName = tableMetadata .get (METADATA_ATTR_TABLE ).s ();
1264- String namespaceName = fullTableName .substring (0 , fullTableName .indexOf ('.' ));
1265- nonPrefixedNamespaceNames .add (namespaceName );
1264+ String prefixedNamespaceName = fullTableName .substring (0 , fullTableName .indexOf ('.' ));
1265+ String nonPrefixedNamespaceName = prefixedNamespaceName .substring (namespacePrefix .length ());
1266+ nonPrefixedNamespaceNames .add (nonPrefixedNamespaceName );
12661267 }
12671268 } while (!lastEvaluatedKey .isEmpty ());
12681269
Original file line number Diff line number Diff line change @@ -1222,20 +1222,23 @@ public void getNamespaceNames_WithExistingTables_ShouldWorkProperly() throws Exe
12221222 when (scanResponse .lastEvaluatedKey ())
12231223 .thenReturn (lastEvaluatedKeyFirstIteration )
12241224 .thenReturn (lastEvaluatedKeySecondIteration );
1225+ String ns1 = getNamespacePrefixConfig ().orElse ("" ) + "ns1" ;
1226+ String ns2 = getNamespacePrefixConfig ().orElse ("" ) + "ns2" ;
1227+ when (scanResponse .count ()).thenReturn (2 );
12251228 when (scanResponse .items ())
12261229 .thenReturn (
12271230 ImmutableList .of (
12281231 ImmutableMap .of (
12291232 DynamoAdmin .METADATA_ATTR_TABLE ,
1230- AttributeValue .builder ().s (" ns1.tbl1" ).build ())))
1233+ AttributeValue .builder ().s (ns1 + " .tbl1" ).build ())))
12311234 .thenReturn (
12321235 ImmutableList .of (
12331236 ImmutableMap .of (
12341237 DynamoAdmin .METADATA_ATTR_TABLE ,
1235- AttributeValue .builder ().s (" ns1.tbl2" ).build ()),
1238+ AttributeValue .builder ().s (ns1 + " .tbl2" ).build ()),
12361239 ImmutableMap .of (
12371240 DynamoAdmin .METADATA_ATTR_TABLE ,
1238- AttributeValue .builder ().s (" ns2.tbl3" ).build ())));
1241+ AttributeValue .builder ().s (ns2 + " .tbl3" ).build ())));
12391242
12401243 // Act
12411244 Set <String > actual = admin .getNamespaceNames ();
You can’t perform that action at this time.
0 commit comments