Search in sources :

Example 1 with DistributedStorageAdmin

use of com.scalar.db.api.DistributedStorageAdmin in project scalardb by scalar-labs.

the class MultiStorageAdminTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    MockitoAnnotations.openMocks(this).close();
    // Arrange
    Map<String, DistributedStorageAdmin> tableAdminMap = new HashMap<>();
    tableAdminMap.put(NAMESPACE1 + "." + TABLE1, admin1);
    tableAdminMap.put(NAMESPACE1 + "." + TABLE2, admin2);
    Map<String, DistributedStorageAdmin> namespaceAdminMap = new HashMap<>();
    namespaceAdminMap.put(NAMESPACE2, admin2);
    DistributedStorageAdmin defaultAdmin = admin3;
    multiStorageAdmin = new MultiStorageAdmin(tableAdminMap, namespaceAdminMap, defaultAdmin);
}
Also used : HashMap(java.util.HashMap) DistributedStorageAdmin(com.scalar.db.api.DistributedStorageAdmin) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with DistributedStorageAdmin

use of com.scalar.db.api.DistributedStorageAdmin in project scalardb by scalar-labs.

the class MultiStorageAdmin method getAdmin.

private DistributedStorageAdmin getAdmin(String namespace, String table) {
    String fullTaleName = namespace + "." + table;
    DistributedStorageAdmin admin = tableAdminMap.get(fullTaleName);
    if (admin != null) {
        return admin;
    }
    return getAdmin(namespace);
}
Also used : DistributedStorageAdmin(com.scalar.db.api.DistributedStorageAdmin)

Aggregations

DistributedStorageAdmin (com.scalar.db.api.DistributedStorageAdmin)2 HashMap (java.util.HashMap)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1