UnitTest for payload call seems not consistent with API signature.


Benjamin Taieb
 

Hi List,

 

I've started looking at UnitTests in more details, and hit some question :

 

SetByteBuffer test is using (msgPayload*, mamaPayloadBridge, void**,mama_size_t)

 

which doesn't match the signature defined in payloadbridge.h :

 

typedef mama_status

(*msgPayload_setByteBuffer)    (const msgPayload    msg,

                                mamaPayloadBridge   bridge,

                                const void*         buffer,

                                mama_size_t         bufferLength);

 

See below extract from payloadgeneraltests.cpp

 

TEST_F(PayloadGeneralTests, SetByteBufferValid)

{

    msgPayload          testPayload = NULL;

    const char*         testBuffer;

    mama_size_t         testBufferLength = 100;

 

    result = aBridge->msgPayloadCreate(&testPayload);

                EXPECT_EQ (result, MAMA_STATUS_OK);

 

    aBridge->msgPayloadAddString (testPayload, "name2", 102, "Unit");

    aBridge->msgPayloadAddString (testPayload, "name3", 103, "Testing");

    aBridge->msgPayloadAddString (testPayload, "name4", 104, "Is");

    aBridge->msgPayloadAddString (testPayload, "name5", 105, "Fun");

 

                result = aBridge->msgPayloadGetByteBuffer(testPayload, (const void**)&testBuffer, &testBufferLength);

                EXPECT_EQ (result, MAMA_STATUS_OK);

 

                result = aBridge->msgPayloadCreateFromByteBuffer(&testPayload, aBridge, (const void*)testBuffer, testBufferLength);

                EXPECT_EQ (result, MAMA_STATUS_OK);

 

    result = aBridge->msgPayloadSetByteBuffer(&testPayload, aBridge, &testBuffer, testBufferLength);

                EXPECT_EQ (result, MAMA_STATUS_OK);

}

 

Furthermore when looking at mamaMsgImpl_setMsgBuffer from msg.c, I see line 563:

impl->mPayloadBridge->msgPayloadSetByteBuffer (impl->mPayload,

                                                       impl->mPayloadBridge,

                                                       data,

                                                       len)))

 

If you can confirm

result = aBridge->msgPayloadSetByteBuffer(&testPayload, aBridge, &testBuffer, testBufferLength);

should be

result = aBridge->msgPayloadSetByteBuffer(testPayload, aBridge, testBuffer, testBufferLength);

I will happily produces a patch for payload UnitTest.

 

Cheers,

Ben.

 

 

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.