Search in sources :

Example 6 with StoredProcedureInvocation

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);
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation)

Example 7 with StoredProcedureInvocation

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());
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation)

Example 8 with StoredProcedureInvocation

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());
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation)

Example 9 with StoredProcedureInvocation

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());
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) ClientResponseImpl(org.voltdb.ClientResponseImpl) VoltTable(org.voltdb.VoltTable)

Example 10 with StoredProcedureInvocation

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);
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) IOException(java.io.IOException) ByteBuffer(java.nio.ByteBuffer)

Aggregations

StoredProcedureInvocation (org.voltdb.StoredProcedureInvocation)28 Iv2InitiateTaskMessage (org.voltdb.messaging.Iv2InitiateTaskMessage)13 Test (org.junit.Test)8 Mailbox (org.voltcore.messaging.Mailbox)7 SiteProcedureConnection (org.voltdb.SiteProcedureConnection)6 FragmentResponseMessage (org.voltdb.messaging.FragmentResponseMessage)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ClientResponseImpl (org.voltdb.ClientResponseImpl)4 VoltTable (org.voltdb.VoltTable)4 ByteBuffer (java.nio.ByteBuffer)3 IOException (java.io.IOException)2 ParameterSet (org.voltdb.ParameterSet)2 EEException (org.voltdb.exceptions.EEException)2 FragmentTaskMessage (org.voltdb.messaging.FragmentTaskMessage)2 BorrowTaskMessage (org.voltdb.messaging.BorrowTaskMessage)1 InitiateResponseMessage (org.voltdb.messaging.InitiateResponseMessage)1