Search in sources :

Example 1 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class StorageMultiplePartitionKeyIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        StorageFactory factory = new StorageFactory(TestUtils.addSuffix(getDatabaseConfig(), TEST_NAME));
        admin = factory.getAdmin();
        namespaceBaseName = getNamespaceBaseName();
        partitionKeyTypes = getPartitionKeyTypes();
        executorService = Executors.newFixedThreadPool(getThreadNum());
        createTables();
        storage = factory.getStorage();
        seed = System.currentTimeMillis();
        System.out.println("The seed used in the multiple partition key integration test is " + seed);
        initialized = true;
    }
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) Before(org.junit.Before)

Example 2 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class StorageIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        initialize();
        StorageFactory factory = new StorageFactory(getDatabaseConfig());
        admin = factory.getAdmin();
        namespace = getNamespace();
        createTable();
        storage = factory.getStorage();
        initialized = true;
    }
    truncateTable();
    storage.with(namespace, TABLE);
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) Before(org.junit.Before)

Example 3 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class StorageSecondaryIndexIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        StorageFactory factory = new StorageFactory(TestUtils.addSuffix(getDatabaseConfig(), TEST_NAME));
        admin = factory.getAdmin();
        namespace = getNamespace();
        secondaryIndexTypes = getSecondaryIndexTypes();
        createTables();
        storage = factory.getStorage();
        seed = System.currentTimeMillis();
        System.out.println("The seed used in the secondary index integration test is " + seed);
        initialized = true;
    }
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) Before(org.junit.Before)

Example 4 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class SchemaLoaderIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        initialize();
        DatabaseConfig config = getDatabaseConfig();
        namespace1 = getNamespace1();
        namespace2 = getNamespace2();
        writeConfigFile(config.getProperties());
        Map<String, Object> schemaJsonMap = getSchemaJsonMap();
        writeSchemaFile(schemaJsonMap);
        StorageFactory factory = new StorageFactory(config);
        admin = factory.getAdmin();
        consensusCommitAdmin = new ConsensusCommitAdmin(admin, new ConsensusCommitConfig(config.getProperties()));
        initialized = true;
    }
    dropTablesIfExist();
}
Also used : ConsensusCommitConfig(com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig) StorageFactory(com.scalar.db.service.StorageFactory) ConsensusCommitAdmin(com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin) DatabaseConfig(com.scalar.db.config.DatabaseConfig) Before(org.junit.Before)

Example 5 with StorageFactory

use of com.scalar.db.service.StorageFactory in project scalardb by scalar-labs.

the class StorageSinglePartitionKeyIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        StorageFactory factory = new StorageFactory(TestUtils.addSuffix(getDatabaseConfig(), TEST_NAME));
        admin = factory.getAdmin();
        namespace = getNamespace();
        partitionKeyTypes = getPartitionKeyTypes();
        createTables();
        storage = factory.getStorage();
        seed = System.currentTimeMillis();
        System.out.println("The seed used in the single partition key integration test is " + seed);
        initialized = true;
    }
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) Before(org.junit.Before)

Aggregations

StorageFactory (com.scalar.db.service.StorageFactory)37 BeforeAll (org.junit.jupiter.api.BeforeAll)13 Before (org.junit.Before)11 ConsensusCommitAdmin (com.scalar.db.transaction.consensuscommit.ConsensusCommitAdmin)8 BeforeClass (org.junit.BeforeClass)8 GrpcConfig (com.scalar.db.storage.rpc.GrpcConfig)7 ConsensusCommitConfig (com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig)7 DatabaseConfig (com.scalar.db.config.DatabaseConfig)6 GrpcTransactionManager (com.scalar.db.transaction.rpc.GrpcTransactionManager)4 GrpcTwoPhaseCommitTransactionManager (com.scalar.db.transaction.rpc.GrpcTwoPhaseCommitTransactionManager)3 Properties (java.util.Properties)3 TableMetadata (com.scalar.db.api.TableMetadata)2 JdbcConfig (com.scalar.db.storage.jdbc.JdbcConfig)1