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 @@ -1278,8 +1278,9 @@ private Set<String> getNamespacesOfExistingTables() throws ExecutionException {
12781278
12791279 for (Map <String , AttributeValue > tableMetadata : scanResponse .items ()) {
12801280 String fullTableName = tableMetadata .get (METADATA_ATTR_TABLE ).s ();
1281- String namespaceName = fullTableName .substring (0 , fullTableName .indexOf ('.' ));
1282- nonPrefixedNamespaceNames .add (namespaceName );
1281+ String prefixedNamespaceName = fullTableName .substring (0 , fullTableName .indexOf ('.' ));
1282+ String nonPrefixedNamespaceName = prefixedNamespaceName .substring (namespacePrefix .length ());
1283+ nonPrefixedNamespaceNames .add (nonPrefixedNamespaceName );
12831284 }
12841285 } while (!lastEvaluatedKey .isEmpty ());
12851286
Original file line number Diff line number Diff line change @@ -1243,20 +1243,23 @@ public void getNamespaceNames_WithExistingTables_ShouldWorkProperly() throws Exe
12431243 when (scanResponse .lastEvaluatedKey ())
12441244 .thenReturn (lastEvaluatedKeyFirstIteration )
12451245 .thenReturn (lastEvaluatedKeySecondIteration );
1246+ String ns1 = getNamespacePrefixConfig ().orElse ("" ) + "ns1" ;
1247+ String ns2 = getNamespacePrefixConfig ().orElse ("" ) + "ns2" ;
1248+ when (scanResponse .count ()).thenReturn (2 );
12461249 when (scanResponse .items ())
12471250 .thenReturn (
12481251 ImmutableList .of (
12491252 ImmutableMap .of (
12501253 DynamoAdmin .METADATA_ATTR_TABLE ,
1251- AttributeValue .builder ().s (" ns1.tbl1" ).build ())))
1254+ AttributeValue .builder ().s (ns1 + " .tbl1" ).build ())))
12521255 .thenReturn (
12531256 ImmutableList .of (
12541257 ImmutableMap .of (
12551258 DynamoAdmin .METADATA_ATTR_TABLE ,
1256- AttributeValue .builder ().s (" ns1.tbl2" ).build ()),
1259+ AttributeValue .builder ().s (ns1 + " .tbl2" ).build ()),
12571260 ImmutableMap .of (
12581261 DynamoAdmin .METADATA_ATTR_TABLE ,
1259- AttributeValue .builder ().s (" ns2.tbl3" ).build ())));
1262+ AttributeValue .builder ().s (ns2 + " .tbl3" ).build ())));
12601263
12611264 // Act
12621265 Set <String > actual = admin .getNamespaceNames ();
You can’t perform that action at this time.
0 commit comments