use of org.bboxdb.network.packages.response.ListTablesResponse in project bboxdb by jnidzwetzki.
the class TestNetworkClasses method testListTablesResponse.
/**
* Try to encode and decode the list tables response
* @throws PackageEncodeException
* @throws IOException
*/
@Test(timeout = 60000)
public void testListTablesResponse() throws PackageEncodeException, IOException {
final List<TupleStoreName> tables = new ArrayList<TupleStoreName>();
tables.add(new TupleStoreName("3_group1_table1"));
tables.add(new TupleStoreName("3_group1_testtable"));
tables.add(new TupleStoreName("3_group1_test4711"));
tables.add(new TupleStoreName("3_group1_mytest57"));
final ListTablesResponse response = new ListTablesResponse((short) 3, tables);
final byte[] encodedPackage = networkPackageToByte(response);
Assert.assertNotNull(encodedPackage);
final ByteBuffer bb = NetworkPackageDecoder.encapsulateBytes(encodedPackage);
final ListTablesResponse responseDecoded = ListTablesResponse.decodePackage(bb);
final List<TupleStoreName> myTables = responseDecoded.getTables();
Assert.assertEquals(tables, myTables);
Assert.assertEquals(tables.size(), myTables.size());
}
Aggregations