Search in sources :

Example 11 with TupleStoreName

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

the class TestRegionIdMapper method testGetAll.

/**
 * Get all known mappings
 */
@Test(timeout = 60000)
public void testGetAll() {
    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 List<TupleStoreName> mappingResult = regionIdMapper.getAllLocalTables(DEFAULT_SSTABLE_NAME);
    Assert.assertEquals(3, mappingResult.size());
}
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 12 with TupleStoreName

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

the class TestTupleSink method createTupleRedistributor.

/**
 * Get the tuple redistributor
 * @return
 * @throws BBoxDBException
 * @throws InterruptedException
 */
protected TupleRedistributor createTupleRedistributor() throws InterruptedException, BBoxDBException {
    final TupleStoreName tupleStoreName = new TupleStoreName(TABLENAME.getFullname());
    final TupleStoreManagerRegistry tupleStoreManagerRegistry = new TupleStoreManagerRegistry();
    tupleStoreManagerRegistry.init();
    return new TupleRedistributor(tupleStoreManagerRegistry, tupleStoreName);
}
Also used : TupleRedistributor(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.TupleRedistributor) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName)

Example 13 with TupleStoreName

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

the class TestTupleStoreAdapter method testTupleStoreConfig1.

/**
 * Test configuration 1
 * @throws ZookeeperException
 */
@Test(timeout = 60000)
public void testTupleStoreConfig1() throws ZookeeperException {
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
    final TupleStoreName tupleStoreName = new TupleStoreName("dg_table1");
    tupleStoreAdapter.deleteTable(tupleStoreName);
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName, tupleStoreConfiguration);
    final TupleStoreConfiguration readConfig = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreName);
    Assert.assertEquals(tupleStoreConfiguration, readConfig);
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Test(org.junit.Test)

Example 14 with TupleStoreName

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

the class TestTupleStoreAdapter method testTupleStoreConfig3.

/**
 * Test configuration 3
 * @throws ZookeeperException
 */
@Test(timeout = 60000)
public void testTupleStoreConfig3() throws ZookeeperException {
    final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().withSpatialIndexReader("reader").withSpatialIndexWriter("writer").build();
    final TupleStoreName tupleStoreName = new TupleStoreName("dg_table1");
    tupleStoreAdapter.deleteTable(tupleStoreName);
    Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
    tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName, tupleStoreConfiguration);
    final TupleStoreConfiguration readConfig = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreName);
    Assert.assertEquals(tupleStoreConfiguration, readConfig);
    Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Test(org.junit.Test)

Example 15 with TupleStoreName

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

the class TestNetworkClasses method encodeAndDecodeDeletedTuple1.

/**
 * The the encoding and decoding of an insert tuple package
 * @throws IOException
 * @throws PackageEncodeException
 */
@Test(timeout = 60000)
public void encodeAndDecodeDeletedTuple1() throws IOException, PackageEncodeException {
    final Tuple tuple = new DeletedTuple("key", 12);
    final short sequenceNumber = sequenceNumberGenerator.getNextSequenceNummber();
    final InsertTupleRequest insertPackage = new InsertTupleRequest(sequenceNumber, ROUTING_HEADER_UNROUTED, new TupleStoreName("test"), tuple);
    byte[] encodedVersion = networkPackageToByte(insertPackage);
    Assert.assertNotNull(encodedVersion);
    final ByteBuffer bb = NetworkPackageDecoder.encapsulateBytes(encodedVersion);
    final InsertTupleRequest decodedPackage = InsertTupleRequest.decodeTuple(bb);
    Assert.assertEquals(insertPackage.getTuple(), decodedPackage.getTuple());
    Assert.assertEquals(insertPackage.getTable(), decodedPackage.getTable());
    Assert.assertEquals(insertPackage.getRoutingHeader(), new RoutingHeader(false));
    Assert.assertEquals(insertPackage, decodedPackage);
    Assert.assertEquals(insertPackage.hashCode(), decodedPackage.hashCode());
    Assert.assertEquals(insertPackage.toString(), decodedPackage.toString());
    Assert.assertTrue(TupleHelper.isDeletedTuple(decodedPackage.getTuple()));
}
Also used : DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) ByteBuffer(java.nio.ByteBuffer) JoinedTuple(org.bboxdb.storage.entity.JoinedTuple) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) InsertTupleRequest(org.bboxdb.network.packages.request.InsertTupleRequest) 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