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 {
1278
1278
1279
1279
for (Map <String , AttributeValue > tableMetadata : scanResponse .items ()) {
1280
1280
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 );
1283
1284
}
1284
1285
} while (!lastEvaluatedKey .isEmpty ());
1285
1286
Original file line number Diff line number Diff line change @@ -1243,20 +1243,23 @@ public void getNamespaceNames_WithExistingTables_ShouldWorkProperly() throws Exe
1243
1243
when (scanResponse .lastEvaluatedKey ())
1244
1244
.thenReturn (lastEvaluatedKeyFirstIteration )
1245
1245
.thenReturn (lastEvaluatedKeySecondIteration );
1246
+ String ns1 = getNamespacePrefixConfig ().orElse ("" ) + "ns1" ;
1247
+ String ns2 = getNamespacePrefixConfig ().orElse ("" ) + "ns2" ;
1248
+ when (scanResponse .count ()).thenReturn (2 );
1246
1249
when (scanResponse .items ())
1247
1250
.thenReturn (
1248
1251
ImmutableList .of (
1249
1252
ImmutableMap .of (
1250
1253
DynamoAdmin .METADATA_ATTR_TABLE ,
1251
- AttributeValue .builder ().s (" ns1.tbl1" ).build ())))
1254
+ AttributeValue .builder ().s (ns1 + " .tbl1" ).build ())))
1252
1255
.thenReturn (
1253
1256
ImmutableList .of (
1254
1257
ImmutableMap .of (
1255
1258
DynamoAdmin .METADATA_ATTR_TABLE ,
1256
- AttributeValue .builder ().s (" ns1.tbl2" ).build ()),
1259
+ AttributeValue .builder ().s (ns1 + " .tbl2" ).build ()),
1257
1260
ImmutableMap .of (
1258
1261
DynamoAdmin .METADATA_ATTR_TABLE ,
1259
- AttributeValue .builder ().s (" ns2.tbl3" ).build ())));
1262
+ AttributeValue .builder ().s (ns2 + " .tbl3" ).build ())));
1260
1263
1261
1264
// Act
1262
1265
Set <String > actual = admin .getNamespaceNames ();
You can’t perform that action at this time.
0 commit comments