blob: 99a4a3c2c03572cd8fdd252975a416d31fbbe680 [file]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_
#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <activemq/connector/stomp/commands/DisconnectCommand.h>
namespace activemq{
namespace connector{
namespace stomp{
namespace commands{
class DisconnectCommandTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( DisconnectCommandTest );
CPPUNIT_TEST( test );
CPPUNIT_TEST_SUITE_END();
public:
DisconnectCommandTest() {}
virtual ~DisconnectCommandTest() {}
void test(void)
{
DisconnectCommand cmd;
CPPUNIT_ASSERT( cmd.getStompCommandId() ==
CommandConstants::DISCONNECT );
CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
cmd.setResponseRequired( true );
cmd.setCommandId( 123 );
CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
cmd.setCorrelationId( 99 );
CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
cmd.setTransactionId( "ID:123456" );
CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==
"ID:123456" );
StompFrame* frame = cmd.marshal().clone();
CPPUNIT_ASSERT( frame != NULL );
DisconnectCommand cmd1( frame );
CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() );
CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() );
CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() );
CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() );
CPPUNIT_ASSERT( cmd.getTransactionId() == cmd1.getTransactionId() );
}
};
}}}}
#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_*/