diff options
Diffstat (limited to 'qpid/cpp/src/tests')
-rw-r--r-- | qpid/cpp/src/tests/AccumulatedAckTest.cpp | 8 | ||||
-rw-r--r-- | qpid/cpp/src/tests/ClientSessionTest.cpp | 71 | ||||
-rw-r--r-- | qpid/cpp/src/tests/InProcessBroker.h | 1 | ||||
-rw-r--r-- | qpid/cpp/src/tests/Makefile.am | 5 |
4 files changed, 79 insertions, 6 deletions
diff --git a/qpid/cpp/src/tests/AccumulatedAckTest.cpp b/qpid/cpp/src/tests/AccumulatedAckTest.cpp index 601af532fa..62245e463b 100644 --- a/qpid/cpp/src/tests/AccumulatedAckTest.cpp +++ b/qpid/cpp/src/tests/AccumulatedAckTest.cpp @@ -19,13 +19,13 @@ * under the License. * */ -#include "qpid/broker/AccumulatedAck.h" +#include "qpid/framing/AccumulatedAck.h" #include "qpid_test_plugin.h" #include <iostream> #include <list> using std::list; -using namespace qpid::broker; +using namespace qpid::framing; class AccumulatedAckTest : public CppUnit::TestCase { @@ -44,12 +44,12 @@ class AccumulatedAckTest : public CppUnit::TestCase public: bool covers(const AccumulatedAck& ack, int i) { - return ack.covers(DeliveryId(i)); + return ack.covers(SequenceNumber(i)); } void update(AccumulatedAck& ack, int start, int end) { - ack.update(DeliveryId(start), DeliveryId(end)); + ack.update(SequenceNumber(start), SequenceNumber(end)); } void testGeneral() diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp new file mode 100644 index 0000000000..1acac9c980 --- /dev/null +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -0,0 +1,71 @@ +/* + * + * 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 <vector> +#include "qpid_test_plugin.h" +#include "InProcessBroker.h" +#include "qpid/client/Session.h" + +using namespace qpid::client; +using namespace qpid::framing; + +class ClientSessionTest : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE(ClientSessionTest); + CPPUNIT_TEST(testQueueQuery);; + CPPUNIT_TEST_SUITE_END(); + + boost::shared_ptr<Connector> broker; + Connection connection; + Session session; + + public: + + ClientSessionTest() : broker(new qpid::broker::InProcessBroker()), connection(broker) + { + connection.open(""); + session = connection.newSession(); + } + + void testQueueQuery() + { + std::string name("my-queue"); + std::string alternate("amq.fanout"); + session.queueDeclare(0, name, alternate, false, false, true, true, FieldTable()); + TypedResult<QueueQueryResult> result = session.queueQuery(name); + CPPUNIT_ASSERT_EQUAL(false, result.get().getDurable()); + CPPUNIT_ASSERT_EQUAL(true, result.get().getExclusive()); + CPPUNIT_ASSERT_EQUAL(alternate, result.get().getAlternateExchange()); + } + + void testCompletion() + { + std::string queue("my-queue"); + std::string dest("my-dest"); + session.queueDeclare(0, queue, "", false, false, true, true, FieldTable()); + //subcribe to the queue with confirm_mode = 1 + session.messageSubscribe(0, queue, dest, false, 1, 0, false, FieldTable()); + //publish some messages + } +}; + +// Make this test suite a plugin. +CPPUNIT_PLUGIN_IMPLEMENT(); +CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); diff --git a/qpid/cpp/src/tests/InProcessBroker.h b/qpid/cpp/src/tests/InProcessBroker.h index 0e5f3895f9..531ebd8fa7 100644 --- a/qpid/cpp/src/tests/InProcessBroker.h +++ b/qpid/cpp/src/tests/InProcessBroker.h @@ -101,6 +101,7 @@ class InProcessBroker : public client::Connector { ) : sender(sender_), conversation(conversation_), in(ih) {} void send(framing::AMQFrame& frame) { + //std::cout << (sender == CLIENT ? "C->S: " : "S->C: ") << frame << std::endl; conversation.push_back(TaggedFrame(sender, frame)); in->received(frame); } diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am index 874a9a448a..de7a12c027 100644 --- a/qpid/cpp/src/tests/Makefile.am +++ b/qpid/cpp/src/tests/Makefile.am @@ -94,10 +94,11 @@ broker_unit_tests = \ TxPublishTest \ ValueTest \ MessageHandlerTest \ - MessageBuilderTest + MessageBuilderTest \ + ClientSessionTest #client_unit_tests = \ - ClientChannelTest + ClientChannelTest framing_unit_tests = \ FieldTableTest \ |