summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-03-06 14:10:35 +0000
committerGordon Sim <gsim@apache.org>2009-03-06 14:10:35 +0000
commit9fa04de677291450ec559bde3155f9b8cde7a787 (patch)
tree0de3ca4e69ea0c679efb068c5c3bc11764757d29 /cpp/src
parent87beda537fdf425b8cc8f0a6c8e4273742f0b3a2 (diff)
downloadqpid-python-9fa04de677291450ec559bde3155f9b8cde7a787.tar.gz
QPID-1719: Ensure management object id remain in sync across cluster.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@750910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/cluster/ConnectionCodec.cpp2
-rw-r--r--cpp/src/qpid/cluster/UpdateClient.cpp2
-rwxr-xr-xcpp/src/tests/federated_cluster_test40
3 files changed, 37 insertions, 7 deletions
diff --git a/cpp/src/qpid/cluster/ConnectionCodec.cpp b/cpp/src/qpid/cluster/ConnectionCodec.cpp
index 1ddd64d3d6..007337792b 100644
--- a/cpp/src/qpid/cluster/ConnectionCodec.cpp
+++ b/cpp/src/qpid/cluster/ConnectionCodec.cpp
@@ -44,7 +44,7 @@ ConnectionCodec::Factory::create(ProtocolVersion v, sys::OutputControl& out, con
return 0;
}
-// Used for outgoing Link connections, we don't care.
+// Used for outgoing Link connections
sys::ConnectionCodec*
ConnectionCodec::Factory::create(sys::OutputControl& out, const std::string& logId) {
return new ConnectionCodec(out, logId, cluster, false, true);
diff --git a/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp
index 7e349905ab..d5e6635c45 100644
--- a/cpp/src/qpid/cluster/UpdateClient.cpp
+++ b/cpp/src/qpid/cluster/UpdateClient.cpp
@@ -98,7 +98,7 @@ UpdateClient::UpdateClient(const MemberId& updater, const MemberId& updatee, con
done(ok), failed(fail), connectionSettings(cs)
{
connection.open(url, cs);
- session = connection.newSession("update_shared");
+ session = connection.newSession(UPDATE);
}
UpdateClient::~UpdateClient() {}
diff --git a/cpp/src/tests/federated_cluster_test b/cpp/src/tests/federated_cluster_test
index 8c2117fb8c..575a5d9c9b 100755
--- a/cpp/src/tests/federated_cluster_test
+++ b/cpp/src/tests/federated_cluster_test
@@ -37,9 +37,14 @@ stop_brokers() {
unset BROKER_A
fi
if [[ $NODE_1 ]] ; then
- $srcdir/stop_cluster
+ ../qpidd -q --port $NODE_1
unset NODE_1
fi
+ if [[ $NODE_2 ]] ; then
+ ../qpidd -q --port $NODE_2
+ unset NODE_2
+ fi
+ rm cluster.ports
}
start_brokers() {
@@ -60,8 +65,8 @@ setup() {
$PYTHON_DIR/commands/qpid-config -a "localhost:$NODE_1" add exchange direct test-exchange
#create dynamic routes for test exchange
- $PYTHON_DIR/commands/qpid-route dynamic add "localhost:$NODE_1" "localhost:$BROKER_A" test-exchange
- $PYTHON_DIR/commands/qpid-route dynamic add "localhost:$BROKER_A" "localhost:$NODE_1" test-exchange
+ $PYTHON_DIR/commands/qpid-route dynamic add "localhost:$NODE_2" "localhost:$BROKER_A" test-exchange
+ $PYTHON_DIR/commands/qpid-route dynamic add "localhost:$BROKER_A" "localhost:$NODE_2" test-exchange
#create test queue on cluster and bind it to the test exchange
$PYTHON_DIR/commands/qpid-config -a "localhost:$NODE_1" add queue test-queue
@@ -72,7 +77,7 @@ setup() {
$PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" bind test-exchange test-queue from-cluster
}
-run_test_pull_to_cluster() {
+run_test_pull_to_cluster_two_consumers() {
#start consumers on each of the two nodes of the cluster
./receiver --port $NODE_1 --queue test-queue --credit-window 1 > fed1.out.tmp &
./receiver --port $NODE_2 --queue test-queue --credit-window 1 > fed2.out.tmp &
@@ -89,6 +94,20 @@ run_test_pull_to_cluster() {
rm -f fed*.tmp #cleanup
}
+run_test_pull_to_cluster() {
+ #send stream of messages to test exchange on single broker
+ for i in `seq 1 1000`; do echo Message $i >> fed.in.tmp; done
+ ./sender --port $BROKER_A --exchange test-exchange --routing-key to-cluster --send-eos 1 < fed.in.tmp
+
+ #consume from remaining node of the cluster
+ ./receiver --port $NODE_2 --queue test-queue > fed.out.tmp
+
+ #verify all messages are received
+ diff fed.in.tmp fed.out.tmp || fail "federated link to cluster failed: expectations not met!"
+
+ rm -f fed*.tmp #cleanup
+}
+
run_test_pull_from_cluster() {
#start consumer on single broker
./receiver --port $BROKER_A --queue test-queue --credit-window 1 > fed.out.tmp &
@@ -125,8 +144,19 @@ EOF
echo "brokers started"
setup
echo "setup completed"
- run_test_pull_to_cluster
+ run_test_pull_to_cluster_two_consumers
echo "federated link to cluster verified"
run_test_pull_from_cluster
echo "federated link from cluster verified"
+ if [[ $TEST_NODE_FAILURE ]] ; then
+ #kill first cluster node and retest
+ kill -9 $(../qpidd --check --port $NODE_1) && unset NODE_1
+ echo "killed first cluster node; waiting for links to re-establish themselves..."
+ sleep 5
+ echo "retesting..."
+ run_test_pull_to_cluster
+ echo "federated link to cluster verified"
+ run_test_pull_from_cluster
+ echo "federated link from cluster verified"
+ fi
fi