Search in sources :

Example 1 with TupleStoreConfiguration

use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.

the class TestQueryProcessing method init.

@Before
public void init() throws StorageManagerException {
    storageRegistry.deleteTable(TABLE_1, true);
    storageRegistry.createTable(TABLE_1, new TupleStoreConfiguration());
    storageRegistry.deleteTable(TABLE_2, true);
    storageRegistry.createTable(TABLE_2, new TupleStoreConfiguration());
    storageRegistry.deleteTable(TABLE_3, true);
    storageRegistry.createTable(TABLE_3, new TupleStoreConfiguration());
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) Before(org.junit.Before)

Example 2 with TupleStoreConfiguration

use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.

the class TestStorageManager method init.

@Before
public void init() throws StorageManagerException {
    // Delete the old table
    storageRegistry.deleteTable(TEST_RELATION, true);
    // Create a new table
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
    storageRegistry.createTable(TEST_RELATION, tupleStoreConfiguration);
    // Assure table is created successfully
    storageManager = storageRegistry.getTupleStoreManager(TEST_RELATION);
    Assert.assertTrue(storageManager.getServiceState().isInRunningState());
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) Before(org.junit.Before)

Example 3 with TupleStoreConfiguration

use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.

the class TestStorageManager method testWithDuplicates.

/**
 * Test the storage manager with duplicates
 * @throws StorageManagerException
 * @throws RejectedException
 */
@Test(timeout = 60000)
public void testWithDuplicates() throws StorageManagerException, RejectedException {
    // Delete the old table
    storageRegistry.deleteTable(TEST_RELATION, true);
    // Create a new table
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().allowDuplicates(true).build();
    storageRegistry.createTable(TEST_RELATION, tupleStoreConfiguration);
    // Assure table is created successfully
    storageManager = storageRegistry.getTupleStoreManager(TEST_RELATION);
    Assert.assertTrue(storageManager.getServiceState().isInRunningState());
    final Tuple tuple1 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc1".getBytes());
    storageManager.put(tuple1);
    final Tuple tuple2 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc2".getBytes());
    storageManager.put(tuple2);
    final Tuple tuple3 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc3".getBytes());
    storageManager.put(tuple3);
    final Tuple tuple4 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc4".getBytes());
    storageManager.put(tuple4);
    final Tuple tuple5 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc5".getBytes());
    storageManager.put(tuple5);
    final List<Tuple> readTuples = storageManager.get("abc");
    Assert.assertEquals(5, readTuples.size());
    Assert.assertTrue(readTuples.contains(tuple1));
    Assert.assertTrue(readTuples.contains(tuple2));
    Assert.assertTrue(readTuples.contains(tuple3));
    Assert.assertTrue(readTuples.contains(tuple4));
    Assert.assertTrue(readTuples.contains(tuple5));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 4 with TupleStoreConfiguration

use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.

the class TestStorageRegistry method testCalculateSize.

/**
 * Calculate the size of a distribution group
 * @throws StorageManagerException
 * @throws InterruptedException
 * @throws RejectedException
 */
@Test(timeout = 60000)
public void testCalculateSize() throws StorageManagerException, InterruptedException, RejectedException {
    storageRegistry.deleteTable(RELATION_NAME, true);
    Assert.assertFalse(storageRegistry.isStorageManagerActive(RELATION_NAME));
    storageRegistry.createTable(RELATION_NAME, new TupleStoreConfiguration());
    final TupleStoreManager storageManager = storageRegistry.getTupleStoreManager(RELATION_NAME);
    for (int i = 0; i < 50000; i++) {
        final Tuple createdTuple = new Tuple(Integer.toString(i), BoundingBox.FULL_SPACE, Integer.toString(i).getBytes());
        storageManager.put(createdTuple);
    }
    // Wait for requests to settle
    storageManager.flush();
    final List<TupleStoreName> tablesBeforeDelete = storageRegistry.getAllTables();
    System.out.println(tablesBeforeDelete);
    Assert.assertTrue(tablesBeforeDelete.contains(RELATION_NAME));
    final long size1 = TupleStoreUtil.getSizeOfDistributionGroupAndRegionId(storageRegistry, RELATION_NAME.getDistributionGroup(), 2);
    Assert.assertTrue(size1 > 0);
    storageRegistry.deleteTable(RELATION_NAME, true);
    final List<TupleStoreName> tablesAfterDelete = storageRegistry.getAllTables();
    System.out.println(tablesAfterDelete);
    Assert.assertFalse(tablesAfterDelete.contains(RELATION_NAME));
    final long size2 = TupleStoreUtil.getSizeOfDistributionGroupAndRegionId(storageRegistry, RELATION_NAME.getDistributionGroup(), 2);
    Assert.assertTrue(size2 == 0);
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Tuple(org.bboxdb.storage.entity.Tuple) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager) Test(org.junit.Test)

Example 5 with TupleStoreConfiguration

use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.

the class TestStorageRegistry method testRegisterAndUnregister.

/**
 * Test registering and unregistering the storage manager
 * @throws StorageManagerException
 *
 * @throws Exception
 */
@Test(timeout = 60000)
public void testRegisterAndUnregister() throws StorageManagerException {
    storageRegistry.deleteTable(RELATION_NAME, true);
    Assert.assertFalse(storageRegistry.isStorageManagerActive(RELATION_NAME));
    storageRegistry.createTable(RELATION_NAME, new TupleStoreConfiguration());
    storageRegistry.getTupleStoreManager(RELATION_NAME);
    Assert.assertTrue(storageRegistry.isStorageManagerActive(RELATION_NAME));
    storageRegistry.shutdownSStable(RELATION_NAME);
    Assert.assertFalse(storageRegistry.isStorageManagerActive(RELATION_NAME));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) Test(org.junit.Test)

Aggregations

TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)44 Test (org.junit.Test)23 Tuple (org.bboxdb.storage.entity.Tuple)21 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)15 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)13 BoundingBox (org.bboxdb.commons.math.BoundingBox)12 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)10 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)7 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)7 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)7 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)7 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)7 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)5 ArrayList (java.util.ArrayList)4 BBoxDBException (org.bboxdb.misc.BBoxDBException)4 BBoxDBClient (org.bboxdb.network.client.BBoxDBClient)4 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)3 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)3 SSTableWriter (org.bboxdb.storage.sstable.SSTableWriter)3 SSTableCompactor (org.bboxdb.storage.sstable.compact.SSTableCompactor)3