Search in sources :

Example 6 with TupleOutput

use of com.sleepycat.bind.tuple.TupleOutput in project qpid-broker-j by apache.

the class AMQShortStringEncodingTest method testWriteReadNullValues.

public void testWriteReadNullValues() {
    // write into tuple output
    TupleOutput tupleOutput = new TupleOutput();
    AMQShortStringEncoding.writeShortString(null, tupleOutput);
    byte[] data = tupleOutput.getBufferBytes();
    // read from tuple input
    TupleInput tupleInput = new TupleInput(data);
    AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
    assertNull("Expected null but got " + result, result);
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) TupleInput(com.sleepycat.bind.tuple.TupleInput) TupleOutput(com.sleepycat.bind.tuple.TupleOutput)

Example 7 with TupleOutput

use of com.sleepycat.bind.tuple.TupleOutput in project qpid-broker-j by apache.

the class OrphanConfigurationRecordPurger method uuidToKey.

private TupleOutput uuidToKey(final UUID uuid) {
    DatabaseEntry key = new DatabaseEntry();
    TupleOutput output = new TupleOutput();
    output.writeLong(uuid.getMostSignificantBits());
    output.writeLong(uuid.getLeastSignificantBits());
    return output;
}
Also used : DatabaseEntry(com.sleepycat.je.DatabaseEntry) TupleOutput(com.sleepycat.bind.tuple.TupleOutput)

Example 8 with TupleOutput

use of com.sleepycat.bind.tuple.TupleOutput in project qpid-broker-j by apache.

the class UpgradeFrom7To8 method storeVirtualHostHierarchyRecord.

void storeVirtualHostHierarchyRecord(Database hierarchyDb, Transaction txn, UUID id, UUID virtualHostId) {
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry value = new DatabaseEntry();
    UUIDTupleBinding.getInstance().objectToEntry(virtualHostId, value);
    TupleOutput tupleOutput = new TupleOutput();
    tupleOutput.writeLong(id.getMostSignificantBits());
    tupleOutput.writeLong(id.getLeastSignificantBits());
    tupleOutput.writeString("VirtualHost");
    TupleBinding.outputToEntry(tupleOutput, key);
    hierarchyDb.put(txn, key, value);
}
Also used : DatabaseEntry(com.sleepycat.je.DatabaseEntry) TupleOutput(com.sleepycat.bind.tuple.TupleOutput)

Example 9 with TupleOutput

use of com.sleepycat.bind.tuple.TupleOutput in project qpid-broker-j by apache.

the class AMQShortStringEncodingTest method testWriteReadShortStringWithLengthOver127.

public void testWriteReadShortStringWithLengthOver127() {
    AMQShortString value = createString('a', 128);
    // write into tuple output
    TupleOutput tupleOutput = new TupleOutput();
    AMQShortStringEncoding.writeShortString(value, tupleOutput);
    byte[] data = tupleOutput.getBufferBytes();
    // read from tuple input
    TupleInput tupleInput = new TupleInput(data);
    AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
    assertEquals("Expected " + value + " but got " + result, value, result);
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) TupleInput(com.sleepycat.bind.tuple.TupleInput) TupleOutput(com.sleepycat.bind.tuple.TupleOutput)

Example 10 with TupleOutput

use of com.sleepycat.bind.tuple.TupleOutput in project qpid-broker-j by apache.

the class AMQShortStringEncodingTest method testWriteReadShortStringWithLengthLess127.

public void testWriteReadShortStringWithLengthLess127() {
    AMQShortString value = new AMQShortString("test");
    // write into tuple output
    TupleOutput tupleOutput = new TupleOutput();
    AMQShortStringEncoding.writeShortString(value, tupleOutput);
    byte[] data = tupleOutput.getBufferBytes();
    // read from tuple input
    TupleInput tupleInput = new TupleInput(data);
    AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
    assertEquals("Expected " + value + " but got " + result, value, result);
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) TupleInput(com.sleepycat.bind.tuple.TupleInput) TupleOutput(com.sleepycat.bind.tuple.TupleOutput)

Aggregations

TupleOutput (com.sleepycat.bind.tuple.TupleOutput)10 TupleInput (com.sleepycat.bind.tuple.TupleInput)6 DatabaseEntry (com.sleepycat.je.DatabaseEntry)5 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)4 Database (com.sleepycat.je.Database)3 Cursor (com.sleepycat.je.Cursor)2 Transaction (com.sleepycat.je.Transaction)2 UUID (java.util.UUID)2 ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DatabaseConfig (com.sleepycat.je.DatabaseConfig)1 OperationStatus (com.sleepycat.je.OperationStatus)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1 FieldTable (org.apache.qpid.server.protocol.v0_8.FieldTable)1 StoreException (org.apache.qpid.server.store.StoreException)1