Search in sources :

Example 31 with StorageFactory

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

the class StorageWithReservedKeywordIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        StorageFactory factory = new StorageFactory(getDatabaseConfig());
        admin = factory.getAdmin();
        namespace = getNamespace();
        tableName = getTableName();
        columnName1 = getColumnName1();
        columnName2 = getColumnName2();
        columnName3 = getColumnName3();
        columnName4 = getColumnName4();
        columnName5 = getColumnName5();
        createTable();
        storage = factory.getStorage();
        initialized = true;
    }
    truncateTable();
    storage.with(namespace, tableName);
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) Before(org.junit.Before)

Example 32 with StorageFactory

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

the class StorageMultipleClusteringKeyScanIntegrationTestBase method setUp.

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

Example 33 with StorageFactory

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

the class ConsensusCommitIntegrationTestBase method setUp.

@Before
public void setUp() throws Exception {
    if (!initialized) {
        initialize();
        DatabaseConfig config = TestUtils.addSuffix(getDatabaseConfig(), TEST_NAME);
        StorageFactory factory = new StorageFactory(config);
        admin = factory.getAdmin();
        consensusCommitConfig = new ConsensusCommitConfig(config.getProperties());
        consensusCommitAdmin = new ConsensusCommitAdmin(admin, consensusCommitConfig);
        namespace1 = getNamespace1();
        namespace2 = getNamespace2();
        createTables();
        originalStorage = factory.getStorage();
        parallelExecutor = new ParallelExecutor(consensusCommitConfig);
        initialized = true;
    }
    truncateTables();
    storage = spy(originalStorage);
    coordinator = spy(new Coordinator(storage, consensusCommitConfig));
    TransactionalTableMetadataManager tableMetadataManager = new TransactionalTableMetadataManager(admin, -1);
    recovery = spy(new RecoveryHandler(storage, coordinator, tableMetadataManager));
    commit = spy(new CommitHandler(storage, coordinator, tableMetadataManager, parallelExecutor));
    manager = new ConsensusCommitManager(storage, admin, consensusCommitConfig, coordinator, parallelExecutor, recovery, commit);
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) DatabaseConfig(com.scalar.db.config.DatabaseConfig) Before(org.junit.Before)

Example 34 with StorageFactory

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

the class StorageSingleClusteringKeyScanIntegrationTestBase method setUp.

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

Example 35 with StorageFactory

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

the class JdbcTransactionIntegrationTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ExecutionException {
    DatabaseConfig databaseConfig = TestUtils.addSuffix(JdbcEnv.getJdbcConfig(), TEST_NAME);
    JdbcConfig config = new JdbcConfig(databaseConfig.getProperties());
    StorageFactory factory = new StorageFactory(config);
    admin = factory.getAdmin();
    admin.createNamespace(NAMESPACE, true);
    admin.createTable(NAMESPACE, TABLE, TableMetadata.newBuilder().addColumn(ACCOUNT_ID, DataType.INT).addColumn(ACCOUNT_TYPE, DataType.INT).addColumn(BALANCE, DataType.INT).addPartitionKey(ACCOUNT_ID).addClusteringKey(ACCOUNT_TYPE).build(), true);
    manager = new JdbcTransactionManager(config);
}
Also used : StorageFactory(com.scalar.db.service.StorageFactory) JdbcConfig(com.scalar.db.storage.jdbc.JdbcConfig) DatabaseConfig(com.scalar.db.config.DatabaseConfig) BeforeClass(org.junit.BeforeClass)

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