src/app/http-streamer/testcli.cpp
void TestCLI::testStatShow(const std::string& test, bool presence)
{
    // variables
    adapter::MessagesProtocol proto(test::Factory::instance());
    // test addition of known command
    IMessagePtr in = m_msgfactory->getMessage(STAT_COMMAND_ID);
    CPPUNIT_ASSERT(in);

    // input test
    cli::ParameterVector params(1);
    params[0] = STAT_COMMAND_PARAM_INPUT;
    cli::Utils::setProcessParams(in, params);
    IMessagePtr out = proto.sendSync(in);
    CPPUNIT_ASSERT(out);
    CPPUNIT_ASSERT(out->getValue(msg::key::STATUS) == msg::key::OK);

    std::string response = out->getValue(msg::key::CLIRESULT);
    bool found = (response.find(test) != std::string::npos);
    if (presence)
    {
        CPPUNIT_ASSERT(found == true);
    }
    else
    {
        CPPUNIT_ASSERT(found == false);
    }


    // output test
    params[0] = STAT_COMMAND_PARAM_OUTPUT;
    cli::Utils::setProcessParams(in, params);

    out = proto.sendSync(in);
    CPPUNIT_ASSERT(out);
    CPPUNIT_ASSERT(out->getValue(msg::key::STATUS) == msg::key::OK);

    response = out->getValue(msg::key::CLIRESULT);
    found = (response.find(test) != std::string::npos);
    if (presence)
    {
        CPPUNIT_ASSERT(found == true);
    }
    else
    {
        CPPUNIT_ASSERT(found == false);
    }

}
// Test that response have the specified data
Test that response have the specified data
Test that response have the specified data
void TestCLI::testStatShow(const std::string& test, bool presence)
{
    adapter::MessagesProtocol proto(test::Factory::instance());
    IMessagePtr in = m_msgfactory->getMessage(STAT_COMMAND_ID);
    CPPUNIT_ASSERT(in);
    cli::ParameterVector params(1);
    params[0] = STAT_COMMAND_PARAM_INPUT;
    cli::Utils::setProcessParams(in, params);
    IMessagePtr out = proto.sendSync(in);
    CPPUNIT_ASSERT(out);
    CPPUNIT_ASSERT(out->getValue(msg::key::STATUS) == msg::key::OK);
    std::string response = out->getValue(msg::key::CLIRESULT);
    bool found = (response.find(test) != std::string::npos);
    if (presence)
    {
        CPPUNIT_ASSERT(found == true);
    }
    else
    {
        CPPUNIT_ASSERT(found == false);
    }
    params[0] = STAT_COMMAND_PARAM_OUTPUT;
    cli::Utils::setProcessParams(in, params);
    out = proto.sendSync(in);
    CPPUNIT_ASSERT(out);
    CPPUNIT_ASSERT(out->getValue(msg::key::STATUS) == msg::key::OK);
    response = out->getValue(msg::key::CLIRESULT);
    found = (response.find(test) != std::string::npos);
    if (presence)
    {
        CPPUNIT_ASSERT(found == true);
    }
    else
    {
        CPPUNIT_ASSERT(found == false);
    }
}
void TestCLI :: testStatShow ( const std :: string & test , bool presence ) { adapter :: MessagesProtocol proto ( test :: Factory :: instance ( ) ) ; IMessagePtr in = m_msgfactory -> getMessage ( STAT_COMMAND_ID ) ; CPPUNIT_ASSERT ( in ) ; cli :: ParameterVector params ( 1 ) ; params [ 0 ] = STAT_COMMAND_PARAM_INPUT ; cli :: Utils :: setProcessParams ( in , params ) ; IMessagePtr out = proto . sendSync ( in ) ; CPPUNIT_ASSERT ( out ) ; CPPUNIT_ASSERT ( out -> getValue ( msg :: key :: STATUS ) == msg :: key :: OK ) ; std :: string response = out -> getValue ( msg :: key :: CLIRESULT ) ; bool found = ( response . find ( test ) != std :: string :: npos ) ; if ( presence ) { CPPUNIT_ASSERT ( found == true ) ; } else { CPPUNIT_ASSERT ( found == false ) ; } params [ 0 ] = STAT_COMMAND_PARAM_OUTPUT ; cli :: Utils :: setProcessParams ( in , params ) ; out = proto . sendSync ( in ) ; CPPUNIT_ASSERT ( out ) ; CPPUNIT_ASSERT ( out -> getValue ( msg :: key :: STATUS ) == msg :: key :: OK ) ; response = out -> getValue ( msg :: key :: CLIRESULT ) ; found = ( response . find ( test ) != std :: string :: npos ) ; if ( presence ) { CPPUNIT_ASSERT ( found == true ) ; } else { CPPUNIT_ASSERT ( found == false ) ; } }
Test that response have the specified data
Test that response have the specified data
// variables // test addition of known command // input test // output test