You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ru...@apache.org on 2007/09/27 16:50:43 UTC
svn commit: r580040 - /incubator/qpid/branches/M2.1/cpp/tests/
Author: rupertlssmith
Date: Thu Sep 27 07:50:42 2007
New Revision: 580040
URL: http://svn.apache.org/viewvc?rev=580040&view=rev
Log:
Added test cases 4 and 5, for message size tests.
Added:
incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.h
incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.o (with props)
incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.cpp
incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.h
incubator/qpid/branches/M2.1/cpp/tests/TestUtils.cpp
incubator/qpid/branches/M2.1/cpp/tests/TestUtils.h
Modified:
incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.cpp
incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.h
incubator/qpid/branches/M2.1/cpp/tests/TestCase.h
incubator/qpid/branches/M2.1/cpp/tests/interop_runner.cpp
Added: incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.cpp?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.cpp (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.cpp Thu Sep 27 07:50:42 2007
@@ -0,0 +1,114 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "P2PMessageSizeTest.h"
+
+using namespace qpid;
+using namespace qpid::client;
+
+/**
+ * P2PMessageSizeTest::Receiver is a Worker to play the receiving role in P2P test.
+ *
+ * TODO: This code is identical to the receiver in BasicP2PTest so should share implementation with that.
+ */
+class P2PMessageSizeTest::Receiver : public Worker, public MessageListener
+{
+ /** Holds the name of the queue to send the test message on. */
+ const std::string queue;
+
+ /** Used for ? */
+ std::string tag;
+
+public:
+
+ /**
+ * Creates a new Worker from given the TestOptions. The namd of the queue, to consume from is also specified.
+ *
+ * @param options The test options to configure the worker with.
+ * @param _queue The name of the queue to consume from on the default direct exchange.
+ * @param _mesages The expected number of messages to consume. Ignored.
+ */
+ Receiver(TestOptions& options, const std::string& _queue, const int _messages)
+ : Worker(options, _messages), queue(_queue)
+ {}
+
+ /**
+ * Binds this receivers queue to the standard exchange, and starts the dispatcher thread on its channel.
+ */
+ void init()
+ {
+ Queue q(queue, true);
+ channel.declareQueue(q);
+ framing::FieldTable args;
+ channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, q, queue, args);
+ channel.consume(q, tag, this);
+ channel.start();
+ }
+
+ /**
+ * Does nothing.
+ */
+ void start()
+ {
+ }
+
+ /**
+ * Increments the message count, on every message received.
+ *
+ * @param message The test message. Ignored.
+ */
+ void received(Message& )
+ {
+ count++;
+ }
+};
+
+/**
+ * Assigns the role to be played by this test case. The test parameters are fully specified in the
+ * assignment messages filed table. If the role is "SENDER" a Sender worker is created to delegate
+ * the test functionality to, if the role is "RECEIVER" a Receiver is used.
+ *
+ * @param role The role to be played; sender or receiver.
+ * @param assignRoleMessage The role assingment messages field table, contains the full test parameters.
+ * @param options Additional test options.
+ */
+void P2PMessageSizeTest::assign(const std::string& role, framing::FieldTable& params, TestOptions& options)
+{
+ std::string queue = params.getString("P2P_QUEUE_AND_KEY_NAME");
+
+ int messages = params.getInt("P2P_NUM_MESSAGES");
+ int messageSize = params.getInt("messageSize");
+
+ if (role == "SENDER")
+ {
+ worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_DIRECT_EXCHANGE, queue, messages, messageSize));
+ }
+ else if(role == "RECEIVER")
+ {
+ worker = std::auto_ptr<Worker>(new Receiver(options, queue, messages));
+ }
+ else
+ {
+ throw Exception("unrecognised role");
+ }
+
+ worker->init();
+}
Added: incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.h?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.h (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.h Thu Sep 27 07:50:42 2007
@@ -0,0 +1,58 @@
+#ifndef _P2PMessageSizeTest_
+#define _P2PMessageSizeTest_
+/*
+ *
+ * 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.
+ *
+ */
+
+#include <memory>
+#include <sstream>
+
+#include <ClientChannel.h>
+#include <ClientMessage.h>
+#include <Connection.h>
+#include <Exception.h>
+#include <MessageListener.h>
+#include "SimpleTestCaseBase.h"
+
+namespace qpid {
+
+/**
+ * P2PMessageSizeTest implements test case 4, P2P messages with message size. Sends/received a specified number of messages to a
+ * specified route on the default exchange, of a specified size. Produces reports on the actual number of messages sent/received.
+ */
+class P2PMessageSizeTest : public SimpleTestCaseBase
+{
+ class Receiver;
+
+public:
+
+ /**
+ * Assigns the role to be played by this test case. The test parameters are fully specified in the
+ * assignment messages filed table.
+ *
+ * @param role The role to be played; sender or receiver.
+ * @param assignRoleMessage The role assingment messages field table, contains the full test parameters.
+ * @param options Additional test options.
+ */
+ void assign(const std::string& role, framing::FieldTable& params, TestOptions& options);
+};
+}
+
+#endif
Added: incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.o
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.o?rev=580040&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/branches/M2.1/cpp/tests/P2PMessageSizeTest.o
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.cpp?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.cpp (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.cpp Thu Sep 27 07:50:42 2007
@@ -0,0 +1,123 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "PubSubMessageSizeTest.h"
+
+using namespace qpid;
+
+class PubSubMessageSizeTest::Receiver : public Worker, public MessageListener
+{
+ const Exchange& exchange;
+ const std::string queue;
+ const std::string key;
+ std::string tag;
+public:
+ Receiver(TestOptions& options, const Exchange& _exchange, const std::string& _queue, const std::string& _key, const int _messages)
+ : Worker(options, _messages), exchange(_exchange), queue(_queue), key(_key){}
+
+ void init()
+ {
+ Queue q(queue, true);
+ channel.declareQueue(q);
+ framing::FieldTable args;
+ channel.bind(exchange, q, key, args);
+ channel.consume(q, tag, this);
+ channel.start();
+ }
+
+ void start(){
+ }
+
+ void received(Message&)
+ {
+ count++;
+ }
+};
+
+class PubSubMessageSizeTest::MultiReceiver : public Worker, public MessageListener
+{
+ typedef boost::ptr_vector<Receiver> ReceiverList;
+ ReceiverList receivers;
+
+public:
+ MultiReceiver(TestOptions& options, const Exchange& exchange, const std::string& key, const int _messages, int receiverCount)
+ : Worker(options, _messages)
+ {
+ for (int i = 0; i != receiverCount; i++) {
+ std::string queue = (boost::format("%1%_%2%") % options.clientid % i).str();
+ receivers.push_back(new Receiver(options, exchange, queue, key, _messages));
+ }
+ }
+
+ void init()
+ {
+ for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
+ receivers[i].init();
+ }
+ }
+
+ void start()
+ {
+ for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
+ receivers[i].start();
+ }
+ }
+
+ void received(Message& msg)
+ {
+ for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
+ receivers[i].received(msg);
+ }
+ }
+
+ virtual int getCount()
+ {
+ count = 0;
+ for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
+ count += receivers[i].getCount();
+ }
+ return count;
+ }
+ virtual void stop()
+ {
+ for (ReceiverList::size_type i = 0; i != receivers.size(); i++) {
+ receivers[i].stop();
+ }
+ }
+};
+
+void PubSubMessageSizeTest::assign(const std::string& role, framing::FieldTable& params, TestOptions& options)
+{
+ std::string key = params.getString("PUBSUB_KEY");
+ int messages = params.getInt("PUBSUB_NUM_MESSAGES");
+ int receivers = params.getInt("PUBSUB_NUM_RECEIVERS");
+ int messageSize = params.getInt("messageSize");
+
+ if (role == "SENDER") {
+ worker = std::auto_ptr<Worker>(new Sender(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages, messageSize));
+ } else if(role == "RECEIVER"){
+ worker = std::auto_ptr<Worker>(new MultiReceiver(options, Exchange::STANDARD_TOPIC_EXCHANGE, key, messages, receivers));
+ } else {
+ throw Exception("unrecognised role");
+ }
+ worker->init();
+}
+
Added: incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.h?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.h (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/PubSubMessageSizeTest.h Thu Sep 27 07:50:42 2007
@@ -0,0 +1,51 @@
+#ifndef _PubSubMessageSizeTest_
+#define _PubSubMessageSizeTest_
+/*
+ *
+ * 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.
+ *
+ */
+
+#include <memory>
+#include <sstream>
+
+#include <ClientChannel.h>
+#include <ClientMessage.h>
+#include <Connection.h>
+#include <Exception.h>
+#include <MessageListener.h>
+#include "SimpleTestCaseBase.h"
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/format.hpp>
+
+
+namespace qpid {
+
+using namespace qpid::client;
+
+class PubSubMessageSizeTest : public SimpleTestCaseBase
+{
+ class Receiver;
+ class MultiReceiver;
+public:
+ void assign(const std::string& role, framing::FieldTable& params, TestOptions& options);
+};
+
+}
+
+#endif
Modified: incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.cpp?rev=580040&r1=580039&r2=580040&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.cpp Thu Sep 27 07:50:42 2007
@@ -21,49 +21,98 @@
#include "SimpleTestCaseBase.h"
using namespace qpid;
+using namespace qpid::client;
+/**
+ * Starts the test cases worker.
+ */
void SimpleTestCaseBase::start()
{
- if (worker.get()) {
+ if (worker.get())
+ {
worker->start();
}
}
+/**
+ * Stops the test cases worker.
+ */
void SimpleTestCaseBase::stop()
{
- if (worker.get()) {
+ if (worker.get())
+ {
worker->stop();
}
}
+/**
+ * Adds the test report to the specified message. This consists of writing the count of messages received into
+ * a header on the message.
+ *
+ * @param report The report message to add the test report to.
+ */
void SimpleTestCaseBase::report(client::Message& report)
{
- if (worker.get()) {
+ if (worker.get())
+ {
report.getHeaders().setInt("MESSAGE_COUNT", worker->getCount());
- //add number of messages sent or received
+
+ // Add number of messages sent or received in the message body.
+ /*
std::stringstream reportstr;
reportstr << worker->getCount();
report.setData(reportstr.str());
+ */
}
}
+/**
+ * Creates a sender using the specified options, for the given expected message count, exchange and routing key.
+ * This sets up the sender with the default message size for interop tests.
+ *
+ * @param options The creation options.
+ * @param exchange The exchange to send the messages over.
+ * @param key The routing key for the messages.
+ * @param messages The number of messages expected to be sent or received.
+ */
SimpleTestCaseBase::Sender::Sender(TestOptions& options,
const Exchange& _exchange,
const std::string& _key,
const int _messages)
- : Worker(options, _messages), exchange(_exchange), key(_key) {}
+ : Worker(options, _messages), exchange(_exchange), key(_key), messageSize(DEFAULT_INTEROP_MESSAGE_SIZE) {}
+
+/**
+ * Creates a sender using the specified options, for the given expected message count, exchange and routing key.
+ *
+ * @param options The creation options.
+ * @param exchange The exchange to send the messages over.
+ * @param key The routing key for the messages.
+ * @param messages The number of messages expected to be sent or received.
+ * @param messageSize The size of test messages to send.
+ */
+SimpleTestCaseBase::Sender::Sender(TestOptions& options,
+ const Exchange& _exchange,
+ const std::string& _key,
+ const int _messages,
+ const int _messageSize)
+ : Worker(options, _messages), exchange(_exchange), key(_key), messageSize(_messageSize) {}
void SimpleTestCaseBase::Sender::init()
{
channel.start();
}
-void SimpleTestCaseBase::Sender::start(){
- Message msg;
- while (count < messages) {
- channel.publish(msg, exchange, key);
+void SimpleTestCaseBase::Sender::start()
+{
+ Message message;
+ qpid::createTestMessageOfSize(message, messageSize);
+
+ while (count < messages)
+ {
+ channel.publish(message, exchange, key);
count++;
}
+
stop();
}
@@ -84,4 +133,3 @@
{
return count;
}
-
Modified: incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.h?rev=580040&r1=580039&r2=580040&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.h (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/SimpleTestCaseBase.h Thu Sep 27 07:50:42 2007
@@ -30,59 +30,158 @@
#include <Exception.h>
#include <MessageListener.h>
#include "TestCase.h"
+#include "TestUtils.h"
+#define DEFAULT_INTEROP_MESSAGE_SIZE 256
namespace qpid {
using namespace qpid::client;
+/**
+ * SimpleTestCaseBase defines a base implementation of TestCase class. It provides the ability, to wrap a 'Worker' that
+ * the work of running a test case is delegated too. There are two kinds of workers provided, a base worker, which is abstract
+ * and may be extended to provide the tests behaviour, and a 'Sender' worker, that provides the ability to send a number
+ * of messages.
+ *
+ * <p/>A worker encapsulates a connection, a channel, an expected number of messages to be sent or received, and a count of the
+ * number actually sent or received.
+ */
class SimpleTestCaseBase : public TestCase
{
protected:
+
+ /**
+ * A worker encapsulates a connection, channel, an expected number of messages to be sent or received, and a count of the
+ * number actually sent or received.
+ *
+ * <p/>Worker is an abstract class, extend it to do something usefull on the init() and start() methods.
+ *
+ * <p/>A worker is created from a set of TestOptions, which captures a number of configuration parameters, such as the
+ * broker to connect to.
+ *
+ * TODO: Extend TestOptions to capture the full set of creation properties for distributed tests.
+ */
class Worker
{
protected:
+ /** Holds the connection for the worker to send/receive over. */
client::Connection connection;
+
+ /** Holds the channel for the worker to send/receive over. */
client::Channel channel;
+
+ /** Holds the expected number of messages for the worker to send or received. */
const int messages;
+
+ /** Holds a count of the number of messages actually sent or received. */
int count;
public:
+ /**
+ * Creates a worker using the specified options, for the given expected message count.
+ *
+ * @param options The creation options.
+ * @param messages The number of messages expected to be sent or received.
+ */
Worker(TestOptions& options, const int messages);
virtual ~Worker(){}
+
+ /** Should be called ahead of start() to configure the worker. */
+ virtual void init() = 0;
+ /** Starts the workers test activity. */
+ virtual void start() = 0;
+
+ /** Terminates the workers test activity. */
virtual void stop();
+
+ /** Gets the count of messages actually sent or received by the worker. */
virtual int getCount();
- virtual void init() = 0;
- virtual void start() = 0;
};
+ /**
+ * Sender is a worker that sends the expected number of messages to be sent, over the configured exchange, using a
+ * specified routing key.
+ */
class Sender : public Worker
{
+ /** Holds the exchange to send message to. */
const Exchange& exchange;
+
+ /** Holds the routing key for the messages. */
const std::string key;
+
+ /** Holds the message size parameter for all test messages. */
+ const int messageSize;
+
public:
- Sender(TestOptions& options,
- const Exchange& exchange,
- const std::string& key,
- const int messages);
+
+ /**
+ * Creates a sender using the specified options, for the given expected message count, exchange and routing key.
+ *
+ * @param options The creation options.
+ * @param exchange The exchange to send the messages over.
+ * @param key The routing key for the messages.
+ * @param messages The number of messages expected to be sent or received.
+ */
+ Sender(TestOptions& options, const Exchange& exchange, const std::string& key, const int messages);
+
+ /**
+ * Creates a sender using the specified options, for the given expected message count, exchange and routing key.
+ *
+ * @param options The creation options.
+ * @param exchange The exchange to send the messages over.
+ * @param key The routing key for the messages.
+ * @param messages The number of messages expected to be sent or received.
+ * @param messageSize The size of test messages to send.
+ */
+ Sender(TestOptions& options, const Exchange& exchange, const std::string& key, const int messages, const int messageSize);
+
+ /**
+ * Starts the underlying channel.
+ */
void init();
+
+ /**
+ * Sends the specified number of messages over the connection, channel and exchange using the configured routing key.
+ */
void start();
};
+ /** Holds a pointer to the encapsulated worker. */
std::auto_ptr<Worker> worker;
public:
- virtual void assign(const std::string& role, framing::FieldTable& params, TestOptions& options) = 0;
-
+
virtual ~SimpleTestCaseBase() {}
+ /**
+ * Assigns the role to be played by this test case. The test parameters are fully specified in the
+ * assignment messages filed table.
+ *
+ * @param role The role to be played; sender or receiver.
+ * @param assignRoleMessage The role assingment messages field table, contains the full test parameters.
+ * @param options Additional test options.
+ */
+ virtual void assign(const std::string& role, framing::FieldTable& params, TestOptions& options) = 0;
+
+ /**
+ * Starts the worker.
+ */
void start();
+
+ /**
+ * Stops the worker.
+ */
void stop();
+
+ /**
+ * Reports the number of messages sent or received.
+ */
void report(client::Message& report);
};
-
}
#endif
Modified: incubator/qpid/branches/M2.1/cpp/tests/TestCase.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/TestCase.h?rev=580040&r1=580039&r2=580040&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/TestCase.h (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/TestCase.h Thu Sep 27 07:50:42 2007
@@ -28,28 +28,39 @@
namespace qpid {
/**
- * Interface to be implemented by test cases for use with the test
- * runner.
+ * TestCase provides an interface that classes implementing tests to be run using a distributed test client
+ * must implement. The interop test spec, defines a life-cycle for interop tests. This consists of, inviting
+ * a test to participate in a test, assigning a role, starting the test, and extracting a report on the
+ * outcome of the test.
+ *
+ * TODO: There is not method to process the test invitation. Add one.
*/
class TestCase
{
public:
+
/**
- * Directs the test case to act in a particular role. Some roles
- * may be 'activated' at this stage others may require an explicit
- * start request.
+ * Assigns the role to be played by this test case. The test parameters are fully specified in the
+ * assignment messages filed table.
+ *
+ * @param role The role to be played; sender or receiver.
+ * @param assignRoleMessage The role assingment messages field table, contains the full test parameters.
+ * @param options Additional test options.
*/
virtual void assign(const std::string& role, framing::FieldTable& params, TestOptions& options) = 0;
+
/**
* Each test will be started on its own thread, which should block
* until the test completes (this may or may not require an
* explicit stop() request).
*/
virtual void start() = 0;
+
/**
* Requests that the test be stopped if still running.
*/
virtual void stop() = 0;
+
/**
* Allows the test to fill in details on the final report
* message. Will be called only after start has returned.
Added: incubator/qpid/branches/M2.1/cpp/tests/TestUtils.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/TestUtils.cpp?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/TestUtils.cpp (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/TestUtils.cpp Thu Sep 27 07:50:42 2007
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.
+ *
+ */
+#include "TestUtils.h"
+#include <string>
+
+using namespace qpid;
+
+/**
+ * Creates a test message of the specified size. The message is filled with dummy (non-zero) data.
+ *
+ * @param size The size of the message to create.
+ */
+void qpid::createTestMessageOfSize(qpid::client::Message& message, int size)
+{
+ std::string MESSAGE_DATA("-- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message ");
+ std::string data;
+
+ if (size > 0)
+ {
+ int div = MESSAGE_DATA.length() / size;
+ int mod = MESSAGE_DATA.length() % size;
+
+ for (int i = 0; i < div; i++)
+ {
+ data += MESSAGE_DATA;
+ }
+
+ if (mod != 0)
+ {
+ data += MESSAGE_DATA.substr(0, mod);
+ }
+ }
+
+ message.setData(data);
+}
Added: incubator/qpid/branches/M2.1/cpp/tests/TestUtils.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/TestUtils.h?rev=580040&view=auto
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/TestUtils.h (added)
+++ incubator/qpid/branches/M2.1/cpp/tests/TestUtils.h Thu Sep 27 07:50:42 2007
@@ -0,0 +1,32 @@
+#ifndef _TestUtils_
+#define _TestUtils_
+/*
+ *
+ * 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.
+ *
+ */
+
+#include <ClientMessage.h>
+
+namespace qpid {
+
+void createTestMessageOfSize(qpid::client::Message& message, int size);
+
+}
+
+#endif
Modified: incubator/qpid/branches/M2.1/cpp/tests/interop_runner.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/cpp/tests/interop_runner.cpp?rev=580040&r1=580039&r2=580040&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/cpp/tests/interop_runner.cpp (original)
+++ incubator/qpid/branches/M2.1/cpp/tests/interop_runner.cpp Thu Sep 27 07:50:42 2007
@@ -33,6 +33,8 @@
#include <memory>
#include "BasicP2PTest.h"
#include "BasicPubSubTest.h"
+#include "P2PMessageSizeTest.h"
+#include "PubSubMessageSizeTest.h"
#include "TestCase.h"
#include <boost/ptr_container/ptr_map.hpp>
@@ -111,6 +113,8 @@
listener.registerTest("TC1_DummyRun", new DummyRun());
listener.registerTest("TC2_BasicP2P", new qpid::BasicP2PTest());
listener.registerTest("TC3_BasicPubSub", new qpid::BasicPubSubTest());
+ listener.registerTest("TC4_P2PMessageSizeTest", new qpid::P2PMessageSizeTest());
+ listener.registerTest("TC5_PubSubMessageSizeTest", new qpid::PubSubMessageSizeTest());
listener.bindAndConsume();