use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class Iv2InitiateTaskMessage method initFromBuffer.
@Override
public void initFromBuffer(ByteBuffer buf) throws IOException {
super.initFromBuffer(buf);
m_clientInterfaceHandle = buf.getLong();
m_connectionId = buf.getLong();
m_isSinglePartition = buf.get() == 1;
m_shouldReturnResultTables = buf.get() != 0;
m_invocation = new StoredProcedureInvocation();
m_invocation.initFromBuffer(buf);
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class TestVoltMessageSerialization method testIv2InitiateTask.
public void testIv2InitiateTask() throws IOException {
StoredProcedureInvocation spi = new StoredProcedureInvocation();
spi.setClientHandle(25);
spi.setProcName("johnisgreat");
spi.setParams(57, "gooniestoo", "dudemandude");
Iv2InitiateTaskMessage itask = new Iv2InitiateTaskMessage(23, 8, 10L, 100045, 99, true, false, spi, 2101, 3101, true);
itask.setSpHandle(31337);
Iv2InitiateTaskMessage itask2 = (Iv2InitiateTaskMessage) checkVoltMessage(itask);
assertEquals(10L, itask.getTruncationHandle());
assertEquals(itask.getInitiatorHSId(), itask2.getInitiatorHSId());
assertEquals(itask.getTruncationHandle(), itask2.getTruncationHandle());
assertEquals(itask.getTxnId(), itask2.getTxnId());
assertEquals(itask.getUniqueId(), itask2.getUniqueId());
assertEquals(itask.isReadOnly(), itask2.isReadOnly());
assertEquals(itask.isSinglePartition(), itask2.isSinglePartition());
assertEquals(itask.getStoredProcedureName(), itask2.getStoredProcedureName());
assertEquals(itask.getParameterCount(), itask2.getParameterCount());
assertEquals(itask.getClientInterfaceHandle(), itask2.getClientInterfaceHandle());
assertEquals(itask.getClientInterfaceHandle(), 2101);
assertEquals(itask.getConnectionId(), 3101);
assertEquals(itask.getSpHandle(), itask2.getSpHandle());
assertEquals(31337, itask.getSpHandle());
assertTrue(itask.isForReplay());
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class TestVoltMessageSerialization method testMispartitionedResponse.
public void testMispartitionedResponse() throws IOException {
StoredProcedureInvocation spi = new StoredProcedureInvocation();
spi.setClientHandle(25);
spi.setProcName("elmerfudd");
spi.setParams(57, "wrascallywabbit");
Iv2InitiateTaskMessage itask = new Iv2InitiateTaskMessage(23, 8, 10L, 100045, 99, true, false, spi, 2101, 3101, true);
InitiateResponseMessage iresponse = new InitiateResponseMessage(itask);
iresponse.setMispartitioned(true, spi, Pair.of(3l, new byte[] { 1, 2, 3 }));
iresponse.setClientHandle(99);
InitiateResponseMessage iresponse2 = (InitiateResponseMessage) checkVoltMessage(iresponse);
assertEquals(iresponse.getTxnId(), iresponse2.getTxnId());
assertTrue(iresponse2.isReadOnly());
assertTrue(iresponse2.isMispartitioned());
assertFalse(iresponse2.shouldCommit());
assertNotNull(iresponse2.getInvocation());
assertNotNull(iresponse2.getCurrentHashinatorConfig());
assertEquals(ClientResponse.TXN_RESTART, iresponse2.getClientResponseData().getStatus());
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class TestVoltMessageSerialization method testInitiateResponse.
public void testInitiateResponse() throws IOException {
StoredProcedureInvocation spi = new StoredProcedureInvocation();
spi.setClientHandle(25);
spi.setProcName("elmerfudd");
spi.setParams(57, "wrascallywabbit");
InitiateTaskMessage itask = new InitiateTaskMessage(23, 8, 100045, true, false, spi, 2101);
VoltTable table = new VoltTable(new VoltTable.ColumnInfo("foobar", VoltType.STRING));
table.addRow("howmanylicksdoesittaketogettothecenterofatootsiepop");
InitiateResponseMessage iresponse = new InitiateResponseMessage(itask);
iresponse.setResults(new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE, new VoltTable[] { table, table }, "knockknockbananna"));
iresponse.setClientHandle(99);
InitiateResponseMessage iresponse2 = (InitiateResponseMessage) checkVoltMessage(iresponse);
assertEquals(iresponse.getTxnId(), iresponse2.getTxnId());
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class TestProcedureInvocation method testGetAsBytes.
public void testGetAsBytes() throws Exception {
StoredProcedureInvocation spi = null;
try {
ByteBuffer buf = ByteBuffer.allocate(pi.getSerializedSize());
pi.flattenToBuffer(buf);
buf.flip();
spi = new StoredProcedureInvocation();
spi.initFromBuffer(buf);
} catch (IOException e) {
e.printStackTrace();
fail();
}
verifySpi(spi);
}
Aggregations