This page last changed on Aug 04, 2009 by aidan.

Test Objectives

This initial phase of work involves minimal changes to existing classes and behaviour. There should be no impact on performance and existing functionality should remain unchanged. The only significant change is the stage at which the byte stream is encoded and decoded. Testing needs to verify that there has not been a negative affect on the fundamental parts of connection processing: connection establishment, encoding, decoding, frame handling, virtualhost selection failure, authentication failure, authorization failure and handling multiple connections at the same time.

Performance Test Plan

There should be no impact on performance since the underlying implementation and threading model remains the same. The performance test suite will be used to validate that there has not been a negative impact on performance.

Existing System Tests

There should be no change in functionality, the existing system tests should continue to function as is. System tests will present the main validation that this work has not had any negative impact. All system tests which create a connection to a broker will exercise the changed code.

In particular the following test cases contain tests which fully exercise the changed code paths in the broker:

ConnectionTest

This TestCase contains:

  1. testSimpleConnection which verifies that a basic AMQP connection can be created establishing that:
    1. TCP connections can be created from client to broker
    2. Protocol negotiation continues to work
    3. The broker can decode and encode frames properly
    4. The broker is properly handling decoded frames
  2. testPasswordFailureConnection which verifies that a connection with incorrect authentication fails to be established and throws the correct exception
  3. testUnresolvedVirtualHostFailure which verifies that a connection to the wrong virtual host fails to be established and throws the correct exception

AcknowledgeTest

This TestCase contains:

  1. test2ConsumersAutoAck which verifies that multiple connections doing input/output simultaneouslyworks
  2. test2ConsumersTx which verifies that multiple connections doing input/output simultaneously inside a transaction works

MultipleConnectionTest

This TestCase contains:

  1. test which verifies that many connections reading and writing to the broker at the same time works

SimpleACLTest

This TestCase contains multiple tests which will verify that connection attempts where authorization fails continue to throw the correct exception.

New system tests required

No system tests exist which test the AMQP heartbeating functionality.

ServerHeartbeatTest

testClientWriteIdleTest

This test will open a client connection and let it idle for longer than the timeout period. It will verify that the connection remains usable after this idle period.

Existing Unit Tests

Existing unit test coverage of the classes involved is minimal to non-existent. I will add tests for the changed functionality, but not for the existing functionality which has not been modified. org.apache.mina.common.ByteBuffer has an existing comprehensive unit test which will be imported along with it.

New unit tests required

Unit tests will need to be written for MINANetworkDriver, AMQProtocolEngine and AMQDecoder.

MINANetworkDriver tests

The unit test will create a ProtocolEngine to implement a simple echo server which will send back any recieved data.

testBindOpen

This test will create two NetworkDrivers, one of which binds to a socket and one of which opens a socket. This test will assert that the open fails before the bind and that open succeeds after the bind.

testBindSocketInUse

This test will create two NetworkDrivers, bind one to a port and check that that succeeds. It will then attempt to bind the second NetworkDriver to the same port and verify that BindException is thrown.

testSend

This test will create one NetworkDriver and call it's send method and verify that the data is passed to the ProcotolEngines receive() method.

testSetReadIdle

This test will create one NetworkDriver and set it's read idle timeout. It will verify that the ProtocolEngines readIdle method is called after the appropriate time.

testSetWriteIdle

This test will create one NetworkDriver and set it's write idle timeout. It will verify that the ProtocolEngines writeIdle method is called after the appropriate time.

testClosed

This test will create one NetworkDriver and close it. It will verify that the ProtocolEngines closed method is called.

testExceptionCaught

This test will create one NetworkDriver bind it and open a socket. It will forcibly close the socket to generate an exception. It will verify that the ProtocolEngines exception method is called.

testGetRemoteAddress

This getRemoteAddress method and returns a SocketAddress that corresponds to localhost.

AMQDecoder tests

testDecodePI09

This test will create a byte buffer containing an AMQP 0-9 protocol header and check that testDecode returns a ProtocolInitiation with the protocolMajor set to 0 and protocolMinor set to 9.

testDecodePI08

This test will create a byte buffer containing an AMQP 0-9 protocol header and check that testDecode returns a ProtocolInitiation with the protocolMajor set to 0 and protocolMinor set to 8.

testDecodePartialDataBlock

This test will create a byte buffer containing a partial data block and verify that doDecode returns null to indicate that the data should be held until more arrives.

testDecodeCompleteDataBlock

This test will create a byte buffer containing a complete AMQP data block and verify that doDecode returns an AMQFrame of the apppropriate type.

testEncodeFrame

This test will create an AMQP frame and verify that encodeFrame returns a byte array with the appropriate contents.

AMQProtocolEngine tests

These tests will use a MockNetworkDriver to test the functionality of the ProtocolEngine parts of AMQProtocolEngine.

testPartialReceived

This test will pass in a ByteBuffer containing a partial AMQP frame and check that the frame handler is not called. It will then pass in a second ByteBuffer containing the rest of the AMQ frame and check that the frame handler is called.

testCompleteReceived

This test will pass in a ByteBuffer containing a complete AMQP frame and check that the frame handler is called.

testReaderIdle

This test will call the ProtocolEngines readerIdle method and check that the ProtocolEngine closes itself

testWriterIdle

This test will call the ProtocolEngines writerIdle method and check that the ProtocolEngine calls the NetworkDriver.send() method with an encoded HeartBeatBody frame.

testGetRemoteAddress

This test will verify that the ProtocolEngine.getRemoteAddress method calls the NetworkDriver.getRemoteAddress method and returns the same data.

AMQProtocolEngineMbean tests

testGetRemoteAddress

This test will verify that the ProtocolEngineMbean.getRemoteAddress method calls the ProtocolEngine.getRemoteAddress method and returns the same data.

NetworkDriverConfiguration tests

This test case will construct a ServerConfiguration with known values.

h7. testGetKeepAlive

This test will verify that the method returns the expected value.

h7. testGetOOBInline

This test will verify that the method returns the expected value.

h7. testGetReuseAddress

This test will verify that the method returns the expected value.

h7. testGetSoLinger

This test will verify that the method returns the expected value.

h7. testGetSoTimeout

This test will verify that the method returns the expected value.

h7. testGetTcpNoDelay

This test will verify that the method returns the expected value.

h7. testGetTrafficClass

This test will verify that the method returns the expected value.

h7. testGetReceiveBufferSize

This test will verify that the method returns the expected value.

h7. testGetSendBufferSize

This test will verify that the method returns the expected value.

Document generated by Confluence on May 26, 2010 10:32