Search in sources :

Example 46 with TupleStoreName

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

the class TestNetworkCommunication method testSendDeletePackage.

/**
 * Send a delete package to the server
 * @throws InterruptedException
 * @throws ExecutionException
 * @throws ZookeeperException
 * @throws BBoxDBException
 */
@Test(timeout = 60000)
public void testSendDeletePackage() throws InterruptedException, ExecutionException, ZookeeperException, BBoxDBException {
    System.out.println("=== Running sendDeletePackage");
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    final String tableName = DISTRIBUTION_GROUP + "_relation3";
    final TupleStoreName tupleStoreName = new TupleStoreName(tableName);
    final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
    final TupleStoreAdapter tupleStoreAdapter = zookeeperClient.getTupleStoreAdapter();
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
    // Create table
    final TupleStoreConfiguration configuration = TupleStoreConfigurationBuilder.create().build();
    final EmptyResultFuture createFuture = bboxDBClient.createTable(tableName, configuration);
    createFuture.waitForAll();
    Assert.assertTrue(createFuture.isDone());
    Assert.assertFalse(createFuture.isFailed());
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
    // Delete table
    final EmptyResultFuture deleteResult1 = bboxDBClient.deleteTable(tableName);
    deleteResult1.waitForAll();
    Assert.assertTrue(deleteResult1.isDone());
    Assert.assertFalse(deleteResult1.isFailed());
    Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
    // Second call
    final EmptyResultFuture deleteResult2 = bboxDBClient.deleteTable(tableName);
    deleteResult2.waitForAll();
    Assert.assertTrue(deleteResult2.isDone());
    Assert.assertFalse(deleteResult2.isFailed());
    Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
    // Disconnect
    disconnect(bboxDBClient);
    Assert.assertFalse(bboxDBClient.isConnected());
    System.out.println("=== End sendDeletePackage");
}
Also used : ZookeeperClient(org.bboxdb.distribution.zookeeper.ZookeeperClient) BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture) Test(org.junit.Test)

Example 47 with TupleStoreName

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

the class TestRegionIdMapper method testGetTableNames1.

/**
 * Test the tablename result
 */
@Test(timeout = 60000)
public void testGetTableNames1() {
    final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
    regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
    regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
    regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
    final Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 55d, 1.5d, 55d), DEFAULT_SSTABLE_NAME);
    Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
    Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
    Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
    Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) DistributionRegionIdMapper(org.bboxdb.distribution.region.DistributionRegionIdMapper) Test(org.junit.Test)

Example 48 with TupleStoreName

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

the class TestRegionIdMapper method testGetTableNames2.

/**
 * Test the tablename result
 */
@Test(timeout = 60000)
public void testGetTableNames2() {
    final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
    regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
    regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
    regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
    final Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 1.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME);
    Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
    Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
    Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
    Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) DistributionRegionIdMapper(org.bboxdb.distribution.region.DistributionRegionIdMapper) Test(org.junit.Test)

Example 49 with TupleStoreName

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

the class TestTupleStoreAdapter method testDeleteDistributionGroup.

@Test(timeout = 60000)
public void testDeleteDistributionGroup() throws ZookeeperException {
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
    final TupleStoreName tupleStoreName1 = new TupleStoreName("dg_table1");
    final TupleStoreName tupleStoreName2 = new TupleStoreName("dg_table2");
    tupleStoreAdapter.deleteTable(tupleStoreName1);
    tupleStoreAdapter.deleteTable(tupleStoreName2);
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName1, tupleStoreConfiguration);
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName2, tupleStoreConfiguration);
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName2));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Test(org.junit.Test)

Example 50 with TupleStoreName

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

the class TestTupleStoreAdapter method deleteAndCreateTable.

/**
 * Test the tuplestore creation and deletion
 * @throws ZookeeperException
 */
@Test(timeout = 60000)
public void deleteAndCreateTable() throws ZookeeperException {
    final TupleStoreName tupleStoreName1 = new TupleStoreName("dg_table1");
    final TupleStoreName tupleStoreName2 = new TupleStoreName("dg_table2");
    tupleStoreAdapter.deleteTable(tupleStoreName1);
    tupleStoreAdapter.deleteTable(tupleStoreName2);
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName1, tupleStoreConfiguration);
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName2, tupleStoreConfiguration);
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName2));
    tupleStoreAdapter.deleteTable(tupleStoreName1);
    tupleStoreAdapter.deleteTable(tupleStoreName2);
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Test(org.junit.Test)

Aggregations

TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)77 Test (org.junit.Test)25 Tuple (org.bboxdb.storage.entity.Tuple)18 StorageManagerException (org.bboxdb.storage.StorageManagerException)15 ArrayList (java.util.ArrayList)14 PackageEncodeException (org.bboxdb.network.packages.PackageEncodeException)14 SpacePartitioner (org.bboxdb.distribution.partitioner.SpacePartitioner)13 ByteBuffer (java.nio.ByteBuffer)12 BoundingBox (org.bboxdb.commons.math.BoundingBox)12 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)12 BBoxDBException (org.bboxdb.misc.BBoxDBException)12 InsertTupleRequest (org.bboxdb.network.packages.request.InsertTupleRequest)12 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)12 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)12 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)11 List (java.util.List)10 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)10 TupleStoreManagerRegistry (org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry)10 ErrorResponse (org.bboxdb.network.packages.response.ErrorResponse)9 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)9