コード例 #1
0
 // ENG-2553. Connection shouldn't timeout.
 void testLargeReply() {
     (m_client)->createConnection("localhost");
     std::vector<Parameter> signature;
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     Procedure proc("Insert", signature);
     ParameterSet *params = proc.params();
     params->addString("Hello").addString("World").addString("English");
     m_voltdb->filenameForNextResponse("mimicLargeReply");
     InvocationResponse response = (m_client)->invoke(proc);
     CPPUNIT_ASSERT(response.success());
 }
コード例 #2
0
 void testSyncInvoke() {
     m_client->createConnection("localhost");
     std::vector<Parameter> signature;
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     Procedure proc("Insert", signature);
     ParameterSet *params = proc.params();
     params->addString("Hello").addString("World").addString("English");
     m_voltdb->filenameForNextResponse("invocation_response_success.msg");
     InvocationResponse response = (m_client)->invoke(proc);
     CPPUNIT_ASSERT(response.success());
     CPPUNIT_ASSERT(response.statusString() == "");
     CPPUNIT_ASSERT(response.appStatusCode() == -128);
     CPPUNIT_ASSERT(response.appStatusString() == "");
     CPPUNIT_ASSERT(response.results().size() == 0);
 }
コード例 #3
0
    void testAsyncInvoke() {
        (m_client)->createConnection("localhost");
        std::vector<Parameter> signature;
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        Procedure proc("Insert", signature);
        ParameterSet *params = proc.params();
        params->addString("Hello").addString("World").addString("English");
        m_voltdb->filenameForNextResponse("invocation_response_success.msg");

        SyncCallback *cb = new SyncCallback();
        boost::shared_ptr<ProcedureCallback> callback(cb);
        (m_client)->invoke(proc, callback);
        while (!cb->m_hasResponse) {
            (m_client)->runOnce();
        }
        InvocationResponse response = cb->m_response;
        CPPUNIT_ASSERT(response.success());
        CPPUNIT_ASSERT(response.statusString() == "");
        CPPUNIT_ASSERT(response.appStatusCode() == -128);
        CPPUNIT_ASSERT(response.appStatusString() == "");
        CPPUNIT_ASSERT(response.results().size() == 0);
    }