Package org.tarantool.facade

Examples of org.tarantool.facade.TupleSupport


public class TestSnapshotAndXLog {
  // @Test
  public void insertTestTuples() {
    SocketChannelPooledConnectionFactory factory = new SocketChannelPooledConnectionFactory();
    TarantoolConnection connection = factory.getConnection();
    TupleSupport ts = new TupleSupport();
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      connection.insert(0, tuple);
    }
    connection.close();
  }
View Full Code Here


      @Override
      protected long getLSN() {
        return 0L;
      }
    };
    TupleSupport ts = new TupleSupport();
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      snapshot.writeRow(0, tuple);
    }

    snapshot.close();
    Assert.assertTrue(closed.get());
View Full Code Here

      @Override
      protected long getCookie() {
        return 72058143204835330L;
      }
    };
    TupleSupport ts = new TupleSupport();
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      xlog.writeXLog(new Insert(0, tuple).flags(2));
    }

    xlog.close();
    Assert.assertTrue(closed.get());
View Full Code Here

  public void testSnapReader() throws IOException {

    final AtomicBoolean closed = new AtomicBoolean(false);
    byte[] ar = readFile("test.snap");
    ReadableByteChannel readableByteChannel = createReadableByteChannel(closed, ar);
    TupleSupport ts = new TupleSupport();
    SnapshotReader snapShotReader = new SnapshotReader(readableByteChannel);
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      Row row = snapShotReader.nextRow();
      Assert.assertTrue(Arrays.equals(tuple.pack(), row.data.pack()));
    }
    snapShotReader.close();
    Assert.assertTrue(closed.get());
View Full Code Here

  public void testXLogReader() throws IOException {

    final AtomicBoolean closed = new AtomicBoolean(false);
    byte[] ar = readFile("test.xlog");
    ReadableByteChannel readableByteChannel = createReadableByteChannel(closed, ar);
    TupleSupport ts = new TupleSupport();
    XLogReader xlogReader = new XLogReader(readableByteChannel);
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      XLogEntry entry = xlogReader.nextEntry();
      Assert.assertTrue(Arrays.equals(tuple.pack(), entry.tuple.pack()));
    }
    xlogReader.close();
    Assert.assertTrue(closed.get());
View Full Code Here

TOP

Related Classes of org.tarantool.facade.TupleSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.