You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2012/06/28 11:15:39 UTC
svn commit: r1354874 [13/14] - in /qpid/branches/java-config-and-management:
./ qpid/ qpid/bin/ qpid/cpp/ qpid/cpp/bindings/ qpid/cpp/bindings/qmf/ruby/
qpid/cpp/bindings/qpid/python/ qpid/cpp/bindings/qpid/ruby/
qpid/cpp/bindings/qpid/ruby/features/ q...
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-ping.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-ping.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-ping.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-ping.cpp Thu Jun 28 09:14:52 2012
@@ -32,11 +32,20 @@
#include <string>
#include <iostream>
-using namespace std;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace qpid::client;
-using namespace qpid;
+using std::cerr;
+using std::cout;
+using std::endl;
+using std::exception;
+using std::string;
+using namespace qpid::client::arg; // For keyword args
+using qpid::client::AsyncSession;
+using qpid::client::Connection;
+using qpid::client::Message;
+using qpid::client::SubscriptionManager;
+using qpid::framing::Uuid;
+
+namespace qpid {
+namespace tests {
struct PingOptions : public qpid::TestOptions {
int timeout; // Timeout in seconds.
@@ -48,9 +57,11 @@ struct PingOptions : public qpid::TestOp
}
};
+}} // namespace qpid::tests
+
int main(int argc, char** argv) {
try {
- PingOptions opts;
+ qpid::tests::PingOptions opts;
opts.parse(argc, argv);
opts.con.heartbeat = (opts.timeout+1)/2;
Connection connection;
@@ -58,8 +69,8 @@ int main(int argc, char** argv) {
if (!opts.quiet) cout << "Opened connection." << endl;
AsyncSession s = connection.newSession();
string qname(Uuid(true).str());
- s.queueDeclare(arg::queue=qname,arg::autoDelete=true,arg::exclusive=true);
- s.messageTransfer(arg::content=Message("hello", qname));
+ s.queueDeclare(queue=qname, autoDelete=true, exclusive=true);
+ s.messageTransfer(content=Message("hello", qname));
if (!opts.quiet) cout << "Sent message." << endl;
SubscriptionManager subs(s);
subs.get(qname);
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-receive.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-receive.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-receive.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-receive.cpp Thu Jun 28 09:14:52 2012
@@ -68,6 +68,7 @@ struct Options : public qpid::Options
bool reportHeader;
string readyAddress;
uint receiveRate;
+ std::string replyto;
Options(const std::string& argv0=std::string())
: qpid::Options("Options"),
@@ -114,6 +115,7 @@ struct Options : public qpid::Options
("report-header", qpid::optValue(reportHeader, "yes|no"), "Headers on report.")
("ready-address", qpid::optValue(readyAddress, "ADDRESS"), "send a message to this address when ready to receive")
("receive-rate", qpid::optValue(receiveRate,"N"), "Receive at rate of N messages/second. 0 means receive as fast as possible.")
+ ("reply-to", qpid::optValue(replyto, "REPLY-TO"), "specify reply-to address on response messages")
("help", qpid::optValue(help), "print this usage statement");
add(log);
}
@@ -246,6 +248,9 @@ int main(int argc, char ** argv)
s = session.createSender(msg.getReplyTo());
s.setCapacity(opts.capacity);
}
+ if (!opts.replyto.empty()) {
+ msg.setReplyTo(Address(opts.replyto));
+ }
s.send(msg);
}
if (opts.receiveRate) {
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-send.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-send.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-send.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-send.cpp Thu Jun 28 09:14:52 2012
@@ -36,15 +36,26 @@
#include <iostream>
#include <memory>
-using namespace std;
-using namespace qpid::messaging;
-using namespace qpid::types;
+using std::string;
+using std::ios_base;
-typedef std::vector<std::string> string_vector;
+using qpid::messaging::Address;
+using qpid::messaging::Connection;
+using qpid::messaging::Duration;
+using qpid::messaging::FailoverUpdates;
+using qpid::messaging::Message;
+using qpid::messaging::Receiver;
+using qpid::messaging::Session;
+using qpid::messaging::Sender;
+using qpid::types::Exception;
+using qpid::types::Uuid;
+using qpid::types::Variant;
namespace qpid {
namespace tests {
+typedef std::vector<std::string> string_vector;
+
struct Options : public qpid::Options
{
bool help;
@@ -74,7 +85,6 @@ struct Options : public qpid::Options
uint reportEvery;
bool reportHeader;
uint sendRate;
- uint flowControl;
bool sequence;
bool timestamp;
std::string groupKey;
@@ -104,7 +114,6 @@ struct Options : public qpid::Options
reportEvery(0),
reportHeader(true),
sendRate(0),
- flowControl(0),
sequence(true),
timestamp(true),
groupPrefix("GROUP-"),
@@ -138,7 +147,6 @@ struct Options : public qpid::Options
("report-every", qpid::optValue(reportEvery,"N"), "Report throughput statistics every N messages")
("report-header", qpid::optValue(reportHeader, "yes|no"), "Headers on report.")
("send-rate", qpid::optValue(sendRate,"N"), "Send at rate of N messages/second. 0 means send as fast as possible.")
- ("flow-control", qpid::optValue(flowControl,"N"), "Do end to end flow control to limit queue depth to 2*N. 0 means no flow control.")
("sequence", qpid::optValue(sequence, "yes|no"), "Add a sequence number messages property (required for duplicate/lost message detection)")
("timestamp", qpid::optValue(timestamp, "yes|no"), "Add a time stamp messages property (required for latency measurement)")
("group-key", qpid::optValue(groupKey, "KEY"), "Generate groups of messages using message header 'KEY' to hold the group identifier")
@@ -223,10 +231,6 @@ const string EOS("eos");
const string SN("sn");
const string TS("ts");
-}} // namespace qpid::tests
-
-using namespace qpid::tests;
-
class ContentGenerator {
public:
virtual ~ContentGenerator() {}
@@ -329,6 +333,20 @@ public:
}
};
+}} // namespace qpid::tests
+
+using qpid::tests::Options;
+using qpid::tests::Reporter;
+using qpid::tests::Throughput;
+using qpid::tests::ContentGenerator;
+using qpid::tests::GroupGenerator;
+using qpid::tests::GetlineContentGenerator;
+using qpid::tests::MapContentGenerator;
+using qpid::tests::FixedContentGenerator;
+using qpid::tests::SN;
+using qpid::tests::TS;
+using qpid::tests::EOS;
+
int main(int argc, char ** argv)
{
Connection connection;
@@ -350,8 +368,6 @@ int main(int argc, char ** argv)
msg.setPriority(opts.priority);
}
if (!opts.replyto.empty()) {
- if (opts.flowControl)
- throw Exception("Can't use reply-to and flow-control together");
msg.setReplyTo(Address(opts.replyto));
}
if (!opts.userid.empty()) msg.setUserId(opts.userid);
@@ -385,26 +401,10 @@ int main(int argc, char ** argv)
int64_t interval = 0;
if (opts.sendRate) interval = qpid::sys::TIME_SEC/opts.sendRate;
- Receiver flowControlReceiver;
- Address flowControlAddress("flow-"+Uuid(true).str()+";{create:always,delete:always}");
- uint flowSent = 0;
- if (opts.flowControl) {
- flowControlReceiver = session.createReceiver(flowControlAddress);
- flowControlReceiver.setCapacity(2);
- }
-
while (contentGen->setContent(msg)) {
++sent;
if (opts.sequence)
msg.getProperties()[SN] = sent;
- if (opts.flowControl) {
- if ((sent % opts.flowControl) == 0) {
- msg.setReplyTo(flowControlAddress);
- ++flowSent;
- }
- else
- msg.setReplyTo(Address()); // Clear the reply address.
- }
if (groupGen.get())
groupGen->setGroupInfo(msg);
@@ -423,19 +423,12 @@ int main(int argc, char ** argv)
}
if (opts.messages && sent >= opts.messages) break;
- if (opts.flowControl && flowSent == 2) {
- flowControlReceiver.get(Duration::SECOND);
- --flowSent;
- }
-
if (opts.sendRate) {
qpid::sys::AbsTime waitTill(start, sent*interval);
int64_t delay = qpid::sys::Duration(qpid::sys::now(), waitTill);
if (delay > 0) qpid::sys::usleep(delay/qpid::sys::TIME_USEC);
}
}
- for ( ; flowSent>0; --flowSent)
- flowControlReceiver.get(Duration::SECOND);
if (opts.reportTotal) reporter.report();
for (uint i = opts.sendEos; i > 0; --i) {
if (opts.sequence)
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-txtest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-txtest.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-txtest.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/qpid-txtest.cpp Thu Jun 28 09:14:52 2012
@@ -33,6 +33,7 @@
#include "qpid/client/SubscriptionManager.h"
#include "qpid/framing/Array.h"
#include "qpid/framing/Buffer.h"
+#include "qpid/framing/FieldValue.h"
#include "qpid/framing/Uuid.h"
#include "qpid/sys/Thread.h"
@@ -245,10 +246,10 @@ struct Controller : public Client
// Recover DTX transactions (if any)
if (opts.dtx) {
- std::vector<std::string> inDoubtXids;
framing::DtxRecoverResult dtxRes = session.dtxRecover().get();
const framing::Array& xidArr = dtxRes.getInDoubt();
- xidArr.collect(inDoubtXids);
+ std::vector<std::string> inDoubtXids(xidArr.size());
+ std::transform(xidArr.begin(), xidArr.end(), inDoubtXids.begin(), framing::Array::get<std::string, framing::Array::ValuePtr>);
if (inDoubtXids.size()) {
if (!opts.quiet) std::cout << "Recovering DTX in-doubt transaction(s):" << std::endl;
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_acl_tests
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_acl_tests?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_acl_tests (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_acl_tests Thu Jun 28 09:14:52 2012
@@ -22,16 +22,24 @@
# Run the acl tests. $srcdir is set by the Makefile.
source ./test_env.sh
DATA_DIR=`pwd`/data_dir
+DATA_DIRI=`pwd`/data_diri
+DATA_DIRU=`pwd`/data_diru
trap stop_brokers INT TERM QUIT
start_brokers() {
- ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIR --load-module $ACL_LIB --acl-file policy.acl --auth no > qpidd.port
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIR --load-module $ACL_LIB --acl-file policy.acl --auth no --log-to-file local.log > qpidd.port
LOCAL_PORT=`cat qpidd.port`
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIRI --load-module $ACL_LIB --acl-file policy.acl --auth no --max-connections-per-ip 2 --log-to-file locali.log > qpiddi.port
+ LOCAL_PORTI=`cat qpiddi.port`
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIRU --load-module $ACL_LIB --acl-file policy.acl --auth no --max-connections-per-user 2 --log-to-file localu.log > qpiddu.port
+ LOCAL_PORTU=`cat qpiddu.port`
}
stop_brokers() {
$QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORT
+ $QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORTI
+ $QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORTU
}
test_loading_acl_from_absolute_path(){
@@ -49,14 +57,22 @@ test_loading_acl_from_absolute_path(){
if test -d ${PYTHON_DIR} ; then
rm -rf $DATA_DIR
+ rm -rf $DATA_DIRI
+ rm -rf $DATA_DIRU
mkdir -p $DATA_DIR
+ mkdir -p $DATA_DIRI
+ mkdir -p $DATA_DIRU
cp $srcdir/policy.acl $DATA_DIR
+ cp $srcdir/policy.acl $DATA_DIRI
+ cp $srcdir/policy.acl $DATA_DIRU
start_brokers
- echo "Running acl tests using brokers on ports $LOCAL_PORT"
- $QPID_PYTHON_TEST -b localhost:$LOCAL_PORT -m acl || EXITCODE=1
+ echo "Running acl tests using brokers on ports $LOCAL_PORT, $LOCAL_PORTI, and $LOCAL_PORTU"
+ $QPID_PYTHON_TEST -b localhost:$LOCAL_PORT -m acl -Dport-i=$LOCAL_PORTI -Dport-u=$LOCAL_PORTU || EXITCODE=1
stop_brokers || EXITCODE=1
test_loading_acl_from_absolute_path || EXITCODE=1
rm -rf $DATA_DIR
+ rm -rf $DATA_DIRI
+ rm -rf $DATA_DIRU
exit $EXITCODE
fi
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_soak
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_soak?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_soak (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_soak Thu Jun 28 09:14:52 2012
@@ -19,8 +19,9 @@
source ./test_env.sh
-source $srcdir/ais_check
source sasl_test_setup.sh
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group ./cluster_authentication_soak 500
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_test
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_test?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_test (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_authentication_test Thu Jun 28 09:14:52 2012
@@ -19,8 +19,9 @@
source ./test_env.sh
-source $srcdir/ais_check
source sasl_test_setup.sh
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group ./cluster_authentication_soak
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_test
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_test?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_test (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_test Thu Jun 28 09:14:52 2012
@@ -22,5 +22,6 @@
# Run the tests
srcdir=`dirname $0`
-. $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group $srcdir/run_test ./cluster_test
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_tests
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_tests?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_tests (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_cluster_tests Thu Jun 28 09:14:52 2012
@@ -20,7 +20,9 @@
#
source ./test_env.sh
-source $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
+
test -x $QPID_PYTHON_TEST || { echo Skipping test, $QPID_PYTHON_TEST not found; exit 0; }
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_failover_soak
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_failover_soak?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_failover_soak (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_failover_soak Thu Jun 28 09:14:52 2012
@@ -20,7 +20,8 @@
#
source ./test_env.sh
-. $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
host=127.0.0.1
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_sys_tests
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_sys_tests?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_sys_tests (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_sys_tests Thu Jun 28 09:14:52 2012
@@ -26,12 +26,8 @@ source ./test_env.sh
MODULENAME=federation_sys
# Test for clustering
-ps -u root | grep 'aisexec\|corosync' > /dev/null
-if (( $? == 0 )); then
- CLUSTERING_ENABLED=1
-else
- echo "WARNING: No clustering detected; tests using it will be ignored."
-fi
+source cpg_check.sh
+if cpg_enabled; then CLUSTERING_ENABLED=1; fi
# Test for long test
if [[ "$1" == "LONG_TEST" ]]; then
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_tests
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_tests?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_tests (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/run_federation_tests Thu Jun 28 09:14:52 2012
@@ -33,16 +33,13 @@ else
SKIPTESTS='-i *_xml' # note: single quotes prevent expansion of *
fi
+QPIDD_CMD="../qpidd --daemon --port 0 --no-data-dir $MODULES --auth no --log-enable=info+ --log-enable=debug+:Bridge --log-to-file"
start_brokers() {
- ../qpidd --daemon --port 0 --no-data-dir $MODULES --auth no > qpidd.port
- LOCAL_PORT=`cat qpidd.port`
- ../qpidd --daemon --port 0 --no-data-dir $MODULES --auth no > qpidd.port
- REMOTE_PORT=`cat qpidd.port`
-
- ../qpidd --daemon --port 0 --no-data-dir $MODULES --auth no > qpidd.port
- REMOTE_B1=`cat qpidd.port`
- ../qpidd --daemon --port 0 --no-data-dir $MODULES --auth no > qpidd.port
- REMOTE_B2=`cat qpidd.port`
+ rm -f fed_local.log fed_remote.log fed_b1.log fed_b2.log
+ LOCAL_PORT=$($QPIDD_CMD fed_local.log --federation-tag LOCAL)
+ REMOTE_PORT=$($QPIDD_CMD fed_remote.log --federation-tag REMOTE)
+ REMOTE_B1=$($QPIDD_CMD fed_b1.log --federation-tag B1)
+ REMOTE_B2=$($QPIDD_CMD fed_b2.log --federation-tag B2)
}
stop_brokers() {
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl.mk
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl.mk?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl.mk (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl.mk Thu Jun 28 09:14:52 2012
@@ -20,18 +20,37 @@
# Test that are only relevant if SASL is enabled.
if HAVE_SASL
+if HAVE_LIBCPG
check_PROGRAMS+=cluster_authentication_soak
cluster_authentication_soak_INCLUDES=$(PUBLIC_INCLUDES)
cluster_authentication_soak_SOURCES=cluster_authentication_soak.cpp ForkedBroker.h ForkedBroker.cpp
cluster_authentication_soak_LDADD=$(lib_client) $(lib_broker)
+endif HAVE_LIBCPG
# Note: sasl_version is not a test -- it is a tool used by tests.
check_PROGRAMS+=sasl_version
sasl_version_SOURCES=sasl_version.cpp
sasl_version_LDADD=$(lib_client)
-TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster sasl_no_dir
+TESTS += sasl_fed
+ sasl_fed_ex_dynamic
+ sasl_fed_ex_link
+ sasl_fed_ex_queue
+ sasl_fed_ex_route
+ sasl_no_dir
+
+if HAVE_LIBCPG
+
+TESTS += run_cluster_authentication_test \
+ sasl_fed_ex_route_cluster \
+ sasl_fed_ex_link_cluster \
+ sasl_fed_ex_queue_cluster \
+ sasl_fed_ex_dynamic_cluster
+
LONG_TESTS += run_cluster_authentication_soak
+
+endif HAVE_LIBCPG
+
EXTRA_DIST += run_cluster_authentication_test \
sasl_fed \
sasl_fed_ex \
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster Thu Jun 28 09:14:52 2012
@@ -21,7 +21,9 @@
source ./test_env.sh
-source $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
+
with_ais_group ${srcdir}/sasl_fed_ex dynamic cluster
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_link_cluster
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_link_cluster?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_link_cluster (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_link_cluster Thu Jun 28 09:14:52 2012
@@ -21,7 +21,8 @@
source ./test_env.sh
-source $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group ${srcdir}/sasl_fed_ex link cluster
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster Thu Jun 28 09:14:52 2012
@@ -21,7 +21,8 @@
source ./test_env.sh
-source ${srcdir}/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group ${srcdir}/sasl_fed_ex queue cluster
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_route_cluster
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_route_cluster?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_route_cluster (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_fed_ex_route_cluster Thu Jun 28 09:14:52 2012
@@ -21,7 +21,8 @@
source ./test_env.sh
-source ${srcdir}/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
with_ais_group ${srcdir}/sasl_fed_ex route cluster
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_test_setup.sh
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_test_setup.sh?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_test_setup.sh (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/sasl_test_setup.sh Thu Jun 28 09:14:52 2012
@@ -30,7 +30,7 @@ pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: $PWD/sasl_config/qpidd.sasldb
sql_select: dummy select
-mech_list: ANONYMOUS PLAIN DIGEST-MD5 EXTERNAL
+mech_list: ANONYMOUS PLAIN DIGEST-MD5 EXTERNAL CRAM-MD5
EOF
# Populate temporary sasl db.
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/ssl_test
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/ssl_test?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/ssl_test (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/ssl_test Thu Jun 28 09:14:52 2012
@@ -100,8 +100,10 @@ start_ssl_mux_broker() {
PORTS=( ${PORTS[@]} $1 )
}
+sasl_config_dir=$builddir/sasl_config
+
start_authenticating_broker() {
- start_brokers 1 "--transport ssl --ssl-port 0 --require-encryption --ssl-sasl-no-dict --ssl-require-client-authentication --auth yes"
+ start_brokers 1 "--transport ssl --ssl-port 0 --require-encryption --ssl-sasl-no-dict --ssl-require-client-authentication --auth yes --sasl-config=${sasl_config_dir}"
}
ssl_cluster_broker() { # $1 = port
@@ -190,7 +192,8 @@ stop_brokers
test -z $CLUSTER_LIB && exit 0 # Exit if cluster not supported.
## Test failover in a cluster using SSL only
-. $srcdir/ais_check # Will exit if clustering not enabled.
+source cpg_check.sh
+cpg_enabled || exit 0
PORT1=`pick_port`; ssl_cluster_broker $PORT1
echo "Running SSL cluster broker on port $PORT1"
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/start_cluster
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/start_cluster?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/start_cluster (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/start_cluster Thu Jun 28 09:14:52 2012
@@ -24,7 +24,8 @@
# Execute command with the ais group set.
source ./test_env.sh
-. `dirname $0`/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
rm -f cluster*.log cluster.ports qpidd.port
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/test_env.sh.in
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/test_env.sh.in?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/test_env.sh.in (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/test_env.sh.in Thu Jun 28 09:14:52 2012
@@ -75,6 +75,7 @@ exportmodule XML_LIB xml.so
# Qpid options
export QPID_NO_MODULE_DIR=1 # Don't accidentally load installed modules
export QPID_DATA_DIR=
+export QPID_CONFIG=$srcdir/qpidd-empty.conf
# Use temporary directory if $HOME does not exist
if [ ! -e "$HOME" ]; then
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/testagent.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/testagent.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/testagent.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/testagent.cpp Thu Jun 28 09:14:52 2012
@@ -36,9 +36,12 @@
#include <sstream>
+namespace qpid {
+namespace tests {
+
static bool running = true;
-using namespace std;
+using std::string;
using qpid::management::ManagementAgent;
using qpid::management::ManagementObject;
using qpid::management::Manageable;
@@ -191,12 +194,14 @@ int main_int(int argc, char** argv)
return 0;
}
+}} // namespace qpid::tests
+
int main(int argc, char** argv)
{
try {
- return main_int(argc, argv);
+ return qpid::tests::main_int(argc, argv);
} catch(std::exception& e) {
- cerr << "Top Level Exception: " << e.what() << endl;
+ std::cerr << "Top Level Exception: " << e.what() << std::endl;
return 1;
}
}
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/txjob.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/txjob.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/txjob.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/txjob.cpp Thu Jun 28 09:14:52 2012
@@ -38,9 +38,9 @@ namespace tests {
struct Args : public qpid::TestOptions
{
- string workQueue;
- string source;
- string dest;
+ std::string workQueue;
+ std::string source;
+ std::string dest;
uint messages;
uint jobs;
bool quit;
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/txshift.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/txshift.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/txshift.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/txshift.cpp Thu Jun 28 09:14:52 2012
@@ -39,7 +39,7 @@ namespace tests {
struct Args : public qpid::TestOptions
{
- string workQueue;
+ std::string workQueue;
size_t workers;
Args() : workQueue("txshift-control"), workers(1)
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp Thu Jun 28 09:14:52 2012
@@ -32,7 +32,9 @@
#include <windows.h>
#include <iostream>
-namespace {
+namespace qpid {
+namespace tests {
+namespace windows {
// Instead of popping up a window for exceptions, just print something out
LONG _stdcall UnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo)
@@ -73,4 +75,4 @@ redirect_errors_to_stderr::redirect_erro
SetUnhandledExceptionFilter (&UnhandledExceptionFilter);
}
-} // namespace
+}}} // namespace
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/windows/QpiddBroker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/windows/QpiddBroker.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/windows/QpiddBroker.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/windows/QpiddBroker.cpp Thu Jun 28 09:14:52 2012
@@ -32,11 +32,12 @@
#include <iostream>
#include <windows.h>
-using namespace qpid::broker;
+namespace qpid {
+namespace broker {
BootstrapOptions::BootstrapOptions(const char* argv0)
: qpid::Options("Options"),
- common("", QPIDD_CONF_FILE),
+ common("", QPIDD_CONF_FILE, QPIDC_CONF_FILE),
module(QPIDD_MODULE_DIR),
log(argv0)
{
@@ -314,7 +315,7 @@ struct QpiddWindowsOptions : public Qpid
QpiddOptions::QpiddOptions(const char* argv0)
: qpid::Options("Options"),
- common("", QPIDD_CONF_FILE),
+ common("", QPIDD_CONF_FILE, QPIDC_CONF_FILE),
module(QPIDD_MODULE_DIR),
log(argv0)
{
@@ -451,6 +452,7 @@ int QpiddBroker::execute (QpiddOptions *
return 0;
}
+}} // namespace qpid::broker
int main(int argc, char* argv[])
{
@@ -459,13 +461,13 @@ int main(int argc, char* argv[])
// the service is stopped.
SERVICE_TABLE_ENTRY dispatchTable[] =
{
- { "", (LPSERVICE_MAIN_FUNCTION)ServiceMain },
+ { "", (LPSERVICE_MAIN_FUNCTION)qpid::broker::ServiceMain },
{ NULL, NULL }
};
if (!StartServiceCtrlDispatcher(dispatchTable)) {
DWORD err = ::GetLastError();
if (err == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) // Run as console
- return run_broker(argc, argv);
+ return qpid::broker::run_broker(argc, argv);
throw QPID_WINDOWS_ERROR(err);
}
return 0;
Modified: qpid/branches/java-config-and-management/qpid/cpp/src/windows/SCM.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/src/windows/SCM.cpp?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/src/windows/SCM.cpp (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/src/windows/SCM.cpp Thu Jun 28 09:14:52 2012
@@ -1,332 +1,332 @@
-/*
- *
- * 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 "qpid/log/Statement.h"
-#include "qpid/sys/windows/check.h"
-#include "SCM.h"
-
-#pragma comment(lib, "advapi32.lib")
-
-namespace {
-
-// Container that will close a SC_HANDLE upon destruction.
-class AutoServiceHandle {
-public:
- AutoServiceHandle(SC_HANDLE h_ = NULL) : h(h_) {}
- ~AutoServiceHandle() { if (h != NULL) ::CloseServiceHandle(h); }
- void release() { h = NULL; }
- void reset(SC_HANDLE newHandle)
- {
- if (h != NULL)
- ::CloseServiceHandle(h);
- h = newHandle;
- }
- operator SC_HANDLE() const { return h; }
-
-private:
- SC_HANDLE h;
-};
-
-}
-
-namespace qpid {
-namespace windows {
-
-SCM::SCM() : scmHandle(NULL)
-{
-}
-
-SCM::~SCM()
-{
- if (NULL != scmHandle)
- ::CloseServiceHandle(scmHandle);
-}
-
-/**
- * Install this executable as a service
- */
-void SCM::install(const string& serviceName,
- const string& serviceDesc,
- const string& args,
- DWORD startType,
- const string& account,
- const string& password,
- const string& depends)
-{
- // Handle dependent service name list; Windows wants a set of nul-separated
- // names ending with a double nul.
- string depends2 = depends;
- if (!depends2.empty()) {
- // CDL to null delimiter w/ trailing double null
- size_t p = 0;
- while ((p = depends2.find_first_of( ',', p)) != string::npos)
- depends2.replace(p, 1, 1, '\0');
- depends2.push_back('\0');
- depends2.push_back('\0');
- }
-
-#if 0
- // I'm nervous about adding a user/password check here. Is this a
- // potential attack vector, letting users check passwords without
- // control? -Steve Huston, Feb 24, 2011
-
- // Validate account, password
- HANDLE hToken = NULL;
- bool logStatus = false;
- if (!account.empty() && !password.empty() &&
- !(logStatus = ::LogonUserA(account.c_str(),
- "",
- password.c_str(),
- LOGON32_LOGON_NETWORK,
- LOGON32_PROVIDER_DEFAULT,
- &hToken ) != 0))
- std::cout << "warning: supplied account & password failed with LogonUser." << std::endl;
- if (logStatus)
- ::CloseHandle(hToken);
-#endif
-
- // Get fully qualified .exe name
- char myPath[MAX_PATH];
- DWORD myPathLength = ::GetModuleFileName(NULL, myPath, MAX_PATH);
- QPID_WINDOWS_CHECK_NOT(myPathLength, 0);
- string imagePath(myPath, myPathLength);
- if (!args.empty())
- imagePath += " " + args;
-
- // Ensure there's a handle to the SCM database.
- openSvcManager();
-
- // Create the service
- SC_HANDLE svcHandle;
- svcHandle = ::CreateService(scmHandle, // SCM database
- serviceName.c_str(), // name of service
- serviceDesc.c_str(), // name to display
- SERVICE_ALL_ACCESS, // desired access
- SERVICE_WIN32_OWN_PROCESS, // service type
- startType, // start type
- SERVICE_ERROR_NORMAL, // error cntrl type
- imagePath.c_str(), // path to service's binary w/ optional arguments
- NULL, // no load ordering group
- NULL, // no tag identifier
- depends2.empty() ? NULL : depends2.c_str(),
- account.empty() ? NULL : account.c_str(), // account name, or NULL for LocalSystem
- password.empty() ? NULL : password.c_str()); // password, or NULL for none
- QPID_WINDOWS_CHECK_NULL(svcHandle);
- ::CloseServiceHandle(svcHandle);
- QPID_LOG(info, "Service installed successfully");
-}
-
-/**
- *
- */
-void SCM::uninstall(const string& serviceName)
-{
- // Ensure there's a handle to the SCM database.
- openSvcManager();
- AutoServiceHandle svc(::OpenService(scmHandle,
- serviceName.c_str(),
- DELETE));
- QPID_WINDOWS_CHECK_NULL((SC_HANDLE)svc);
- QPID_WINDOWS_CHECK_NOT(::DeleteService(svc), 0);
- QPID_LOG(info, "Service deleted successfully.");
-}
-
-/**
- * Attempt to start the service.
- */
-void SCM::start(const string& serviceName)
-{
- // Ensure we have a handle to the SCM database.
- openSvcManager();
-
- // Get a handle to the service.
- AutoServiceHandle svc(::OpenService(scmHandle,
- serviceName.c_str(),
- SERVICE_ALL_ACCESS));
- QPID_WINDOWS_CHECK_NULL(svc);
-
- // Check the status in case the service is not stopped.
- DWORD state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
- if (state == SERVICE_STOP_PENDING)
- throw qpid::Exception("Timed out waiting for running service to stop.");
-
- // Attempt to start the service.
- QPID_WINDOWS_CHECK_NOT(::StartService(svc, 0, NULL), 0);
-
- QPID_LOG(info, "Service start pending...");
-
- // Check the status until the service is no longer start pending.
- state = waitForStateChangeFrom(svc, SERVICE_START_PENDING);
- // Determine whether the service is running.
- if (state == SERVICE_RUNNING) {
- QPID_LOG(info, "Service started successfully");
- }
- else {
- throw qpid::Exception(QPID_MSG("Service not yet running; state now " << state));
- }
-}
-
-/**
- *
- */
-void SCM::stop(const string& serviceName)
-{
- // Ensure a handle to the SCM database.
- openSvcManager();
-
- // Get a handle to the service.
- AutoServiceHandle svc(::OpenService(scmHandle,
- serviceName.c_str(),
- SERVICE_STOP | SERVICE_QUERY_STATUS |
- SERVICE_ENUMERATE_DEPENDENTS));
- QPID_WINDOWS_CHECK_NULL(svc);
-
- // Make sure the service is not already stopped; if it's stop-pending,
- // wait for it to finalize.
- DWORD state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
- if (state == SERVICE_STOPPED) {
- QPID_LOG(info, "Service is already stopped");
- return;
- }
-
- // If the service is running, dependencies must be stopped first.
- std::auto_ptr<ENUM_SERVICE_STATUS> deps;
- DWORD numDeps = getDependentServices(svc, deps);
- for (DWORD i = 0; i < numDeps; i++)
- stop(deps.get()[i].lpServiceName);
-
- // Dependents stopped; send a stop code to the service.
- SERVICE_STATUS_PROCESS ssp;
- if (!::ControlService(svc, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS)&ssp))
- throw qpid::Exception(QPID_MSG("Stopping " << serviceName << ": " <<
- qpid::sys::strError(::GetLastError())));
-
- // Wait for the service to stop.
- state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
- if (state == SERVICE_STOPPED)
- QPID_LOG(info, QPID_MSG("Service " << serviceName <<
- " stopped successfully."));
-}
-
-/**
- *
- */
-void SCM::openSvcManager()
-{
- if (NULL != scmHandle)
- return;
-
- scmHandle = ::OpenSCManager(NULL, // local computer
- NULL, // ServicesActive database
- SC_MANAGER_ALL_ACCESS); // Rights
- QPID_WINDOWS_CHECK_NULL(scmHandle);
-}
-
-DWORD SCM::waitForStateChangeFrom(SC_HANDLE svc, DWORD originalState)
-{
- SERVICE_STATUS_PROCESS ssStatus;
- DWORD bytesNeeded;
- DWORD waitTime;
- if (!::QueryServiceStatusEx(svc, // handle to service
- SC_STATUS_PROCESS_INFO, // information level
- (LPBYTE)&ssStatus, // address of structure
- sizeof(ssStatus), // size of structure
- &bytesNeeded)) // size needed if buffer is too small
- throw QPID_WINDOWS_ERROR(::GetLastError());
-
- // Save the tick count and initial checkpoint.
- DWORD startTickCount = ::GetTickCount();
- DWORD oldCheckPoint = ssStatus.dwCheckPoint;
-
- // Wait for the service to change out of the noted state.
- while (ssStatus.dwCurrentState == originalState) {
- // Do not wait longer than the wait hint. A good interval is
- // one-tenth of the wait hint but not less than 1 second
- // and not more than 10 seconds.
- waitTime = ssStatus.dwWaitHint / 10;
- if (waitTime < 1000)
- waitTime = 1000;
- else if (waitTime > 10000)
- waitTime = 10000;
-
- ::Sleep(waitTime);
-
- // Check the status until the service is no longer stop pending.
- if (!::QueryServiceStatusEx(svc,
- SC_STATUS_PROCESS_INFO,
- (LPBYTE) &ssStatus,
- sizeof(ssStatus),
- &bytesNeeded))
- throw QPID_WINDOWS_ERROR(::GetLastError());
-
- if (ssStatus.dwCheckPoint > oldCheckPoint) {
- // Continue to wait and check.
- startTickCount = ::GetTickCount();
- oldCheckPoint = ssStatus.dwCheckPoint;
- } else {
- if ((::GetTickCount() - startTickCount) > ssStatus.dwWaitHint)
- break;
- }
- }
- return ssStatus.dwCurrentState;
-}
-
-/**
- * Get the services that depend on @arg svc. All dependent service info
- * is returned in an array of ENUM_SERVICE_STATUS structures via @arg deps.
- *
- * @retval The number of dependent services.
- */
-DWORD SCM::getDependentServices(SC_HANDLE svc,
- std::auto_ptr<ENUM_SERVICE_STATUS>& deps)
-{
- DWORD bytesNeeded;
- DWORD numEntries;
-
- // Pass a zero-length buffer to get the required buffer size.
- if (::EnumDependentServices(svc,
- SERVICE_ACTIVE,
- 0,
- 0,
- &bytesNeeded,
- &numEntries)) {
- // If the Enum call succeeds, then there are no dependent
- // services, so do nothing.
- return 0;
- }
-
- if (::GetLastError() != ERROR_MORE_DATA)
- throw QPID_WINDOWS_ERROR((::GetLastError()));
-
- // Allocate a buffer for the dependencies.
- deps.reset((LPENUM_SERVICE_STATUS)(new char[bytesNeeded]));
- // Enumerate the dependencies.
- if (!::EnumDependentServices(svc,
- SERVICE_ACTIVE,
- deps.get(),
- bytesNeeded,
- &bytesNeeded,
- &numEntries))
- throw QPID_WINDOWS_ERROR((::GetLastError()));
- return numEntries;
-}
-
-} } // namespace qpid::windows
+/*
+ *
+ * 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 "qpid/log/Statement.h"
+#include "qpid/sys/windows/check.h"
+#include "SCM.h"
+
+#pragma comment(lib, "advapi32.lib")
+
+namespace qpid {
+namespace windows {
+
+namespace {
+
+// Container that will close a SC_HANDLE upon destruction.
+class AutoServiceHandle {
+public:
+ AutoServiceHandle(SC_HANDLE h_ = NULL) : h(h_) {}
+ ~AutoServiceHandle() { if (h != NULL) ::CloseServiceHandle(h); }
+ void release() { h = NULL; }
+ void reset(SC_HANDLE newHandle)
+ {
+ if (h != NULL)
+ ::CloseServiceHandle(h);
+ h = newHandle;
+ }
+ operator SC_HANDLE() const { return h; }
+
+private:
+ SC_HANDLE h;
+};
+
+}
+
+SCM::SCM() : scmHandle(NULL)
+{
+}
+
+SCM::~SCM()
+{
+ if (NULL != scmHandle)
+ ::CloseServiceHandle(scmHandle);
+}
+
+/**
+ * Install this executable as a service
+ */
+void SCM::install(const string& serviceName,
+ const string& serviceDesc,
+ const string& args,
+ DWORD startType,
+ const string& account,
+ const string& password,
+ const string& depends)
+{
+ // Handle dependent service name list; Windows wants a set of nul-separated
+ // names ending with a double nul.
+ string depends2 = depends;
+ if (!depends2.empty()) {
+ // CDL to null delimiter w/ trailing double null
+ size_t p = 0;
+ while ((p = depends2.find_first_of( ',', p)) != string::npos)
+ depends2.replace(p, 1, 1, '\0');
+ depends2.push_back('\0');
+ depends2.push_back('\0');
+ }
+
+#if 0
+ // I'm nervous about adding a user/password check here. Is this a
+ // potential attack vector, letting users check passwords without
+ // control? -Steve Huston, Feb 24, 2011
+
+ // Validate account, password
+ HANDLE hToken = NULL;
+ bool logStatus = false;
+ if (!account.empty() && !password.empty() &&
+ !(logStatus = ::LogonUserA(account.c_str(),
+ "",
+ password.c_str(),
+ LOGON32_LOGON_NETWORK,
+ LOGON32_PROVIDER_DEFAULT,
+ &hToken ) != 0))
+ std::cout << "warning: supplied account & password failed with LogonUser." << std::endl;
+ if (logStatus)
+ ::CloseHandle(hToken);
+#endif
+
+ // Get fully qualified .exe name
+ char myPath[MAX_PATH];
+ DWORD myPathLength = ::GetModuleFileName(NULL, myPath, MAX_PATH);
+ QPID_WINDOWS_CHECK_NOT(myPathLength, 0);
+ string imagePath(myPath, myPathLength);
+ if (!args.empty())
+ imagePath += " " + args;
+
+ // Ensure there's a handle to the SCM database.
+ openSvcManager();
+
+ // Create the service
+ SC_HANDLE svcHandle;
+ svcHandle = ::CreateService(scmHandle, // SCM database
+ serviceName.c_str(), // name of service
+ serviceDesc.c_str(), // name to display
+ SERVICE_ALL_ACCESS, // desired access
+ SERVICE_WIN32_OWN_PROCESS, // service type
+ startType, // start type
+ SERVICE_ERROR_NORMAL, // error cntrl type
+ imagePath.c_str(), // path to service's binary w/ optional arguments
+ NULL, // no load ordering group
+ NULL, // no tag identifier
+ depends2.empty() ? NULL : depends2.c_str(),
+ account.empty() ? NULL : account.c_str(), // account name, or NULL for LocalSystem
+ password.empty() ? NULL : password.c_str()); // password, or NULL for none
+ QPID_WINDOWS_CHECK_NULL(svcHandle);
+ ::CloseServiceHandle(svcHandle);
+ QPID_LOG(info, "Service installed successfully");
+}
+
+/**
+ *
+ */
+void SCM::uninstall(const string& serviceName)
+{
+ // Ensure there's a handle to the SCM database.
+ openSvcManager();
+ AutoServiceHandle svc(::OpenService(scmHandle,
+ serviceName.c_str(),
+ DELETE));
+ QPID_WINDOWS_CHECK_NULL((SC_HANDLE)svc);
+ QPID_WINDOWS_CHECK_NOT(::DeleteService(svc), 0);
+ QPID_LOG(info, "Service deleted successfully.");
+}
+
+/**
+ * Attempt to start the service.
+ */
+void SCM::start(const string& serviceName)
+{
+ // Ensure we have a handle to the SCM database.
+ openSvcManager();
+
+ // Get a handle to the service.
+ AutoServiceHandle svc(::OpenService(scmHandle,
+ serviceName.c_str(),
+ SERVICE_ALL_ACCESS));
+ QPID_WINDOWS_CHECK_NULL(svc);
+
+ // Check the status in case the service is not stopped.
+ DWORD state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
+ if (state == SERVICE_STOP_PENDING)
+ throw qpid::Exception("Timed out waiting for running service to stop.");
+
+ // Attempt to start the service.
+ QPID_WINDOWS_CHECK_NOT(::StartService(svc, 0, NULL), 0);
+
+ QPID_LOG(info, "Service start pending...");
+
+ // Check the status until the service is no longer start pending.
+ state = waitForStateChangeFrom(svc, SERVICE_START_PENDING);
+ // Determine whether the service is running.
+ if (state == SERVICE_RUNNING) {
+ QPID_LOG(info, "Service started successfully");
+ }
+ else {
+ throw qpid::Exception(QPID_MSG("Service not yet running; state now " << state));
+ }
+}
+
+/**
+ *
+ */
+void SCM::stop(const string& serviceName)
+{
+ // Ensure a handle to the SCM database.
+ openSvcManager();
+
+ // Get a handle to the service.
+ AutoServiceHandle svc(::OpenService(scmHandle,
+ serviceName.c_str(),
+ SERVICE_STOP | SERVICE_QUERY_STATUS |
+ SERVICE_ENUMERATE_DEPENDENTS));
+ QPID_WINDOWS_CHECK_NULL(svc);
+
+ // Make sure the service is not already stopped; if it's stop-pending,
+ // wait for it to finalize.
+ DWORD state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
+ if (state == SERVICE_STOPPED) {
+ QPID_LOG(info, "Service is already stopped");
+ return;
+ }
+
+ // If the service is running, dependencies must be stopped first.
+ std::auto_ptr<ENUM_SERVICE_STATUS> deps;
+ DWORD numDeps = getDependentServices(svc, deps);
+ for (DWORD i = 0; i < numDeps; i++)
+ stop(deps.get()[i].lpServiceName);
+
+ // Dependents stopped; send a stop code to the service.
+ SERVICE_STATUS_PROCESS ssp;
+ if (!::ControlService(svc, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS)&ssp))
+ throw qpid::Exception(QPID_MSG("Stopping " << serviceName << ": " <<
+ qpid::sys::strError(::GetLastError())));
+
+ // Wait for the service to stop.
+ state = waitForStateChangeFrom(svc, SERVICE_STOP_PENDING);
+ if (state == SERVICE_STOPPED)
+ QPID_LOG(info, QPID_MSG("Service " << serviceName <<
+ " stopped successfully."));
+}
+
+/**
+ *
+ */
+void SCM::openSvcManager()
+{
+ if (NULL != scmHandle)
+ return;
+
+ scmHandle = ::OpenSCManager(NULL, // local computer
+ NULL, // ServicesActive database
+ SC_MANAGER_ALL_ACCESS); // Rights
+ QPID_WINDOWS_CHECK_NULL(scmHandle);
+}
+
+DWORD SCM::waitForStateChangeFrom(SC_HANDLE svc, DWORD originalState)
+{
+ SERVICE_STATUS_PROCESS ssStatus;
+ DWORD bytesNeeded;
+ DWORD waitTime;
+ if (!::QueryServiceStatusEx(svc, // handle to service
+ SC_STATUS_PROCESS_INFO, // information level
+ (LPBYTE)&ssStatus, // address of structure
+ sizeof(ssStatus), // size of structure
+ &bytesNeeded)) // size needed if buffer is too small
+ throw QPID_WINDOWS_ERROR(::GetLastError());
+
+ // Save the tick count and initial checkpoint.
+ DWORD startTickCount = ::GetTickCount();
+ DWORD oldCheckPoint = ssStatus.dwCheckPoint;
+
+ // Wait for the service to change out of the noted state.
+ while (ssStatus.dwCurrentState == originalState) {
+ // Do not wait longer than the wait hint. A good interval is
+ // one-tenth of the wait hint but not less than 1 second
+ // and not more than 10 seconds.
+ waitTime = ssStatus.dwWaitHint / 10;
+ if (waitTime < 1000)
+ waitTime = 1000;
+ else if (waitTime > 10000)
+ waitTime = 10000;
+
+ ::Sleep(waitTime);
+
+ // Check the status until the service is no longer stop pending.
+ if (!::QueryServiceStatusEx(svc,
+ SC_STATUS_PROCESS_INFO,
+ (LPBYTE) &ssStatus,
+ sizeof(ssStatus),
+ &bytesNeeded))
+ throw QPID_WINDOWS_ERROR(::GetLastError());
+
+ if (ssStatus.dwCheckPoint > oldCheckPoint) {
+ // Continue to wait and check.
+ startTickCount = ::GetTickCount();
+ oldCheckPoint = ssStatus.dwCheckPoint;
+ } else {
+ if ((::GetTickCount() - startTickCount) > ssStatus.dwWaitHint)
+ break;
+ }
+ }
+ return ssStatus.dwCurrentState;
+}
+
+/**
+ * Get the services that depend on @arg svc. All dependent service info
+ * is returned in an array of ENUM_SERVICE_STATUS structures via @arg deps.
+ *
+ * @retval The number of dependent services.
+ */
+DWORD SCM::getDependentServices(SC_HANDLE svc,
+ std::auto_ptr<ENUM_SERVICE_STATUS>& deps)
+{
+ DWORD bytesNeeded;
+ DWORD numEntries;
+
+ // Pass a zero-length buffer to get the required buffer size.
+ if (::EnumDependentServices(svc,
+ SERVICE_ACTIVE,
+ 0,
+ 0,
+ &bytesNeeded,
+ &numEntries)) {
+ // If the Enum call succeeds, then there are no dependent
+ // services, so do nothing.
+ return 0;
+ }
+
+ if (::GetLastError() != ERROR_MORE_DATA)
+ throw QPID_WINDOWS_ERROR((::GetLastError()));
+
+ // Allocate a buffer for the dependencies.
+ deps.reset((LPENUM_SERVICE_STATUS)(new char[bytesNeeded]));
+ // Enumerate the dependencies.
+ if (!::EnumDependentServices(svc,
+ SERVICE_ACTIVE,
+ deps.get(),
+ bytesNeeded,
+ &bytesNeeded,
+ &numEntries))
+ throw QPID_WINDOWS_ERROR((::GetLastError()));
+ return numEntries;
+}
+
+} } // namespace qpid::windows
Modified: qpid/branches/java-config-and-management/qpid/cpp/xml/cluster.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/cpp/xml/cluster.xml?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/cpp/xml/cluster.xml (original)
+++ qpid/branches/java-config-and-management/qpid/cpp/xml/cluster.xml Thu Jun 28 09:14:52 2012
@@ -179,6 +179,7 @@
<field name="position" type="sequence-no"/>
<field name="used-msg-credit" type="uint32"/>
<field name="used-byte-credit" type="uint32"/>
+ <field name="deliveryCount" type="uint32"/>
</control>
<!-- Delivery-record for outgoing messages sent but not yet accepted. -->
@@ -326,6 +327,12 @@
<field name="dequeueSincePurge" type="uint32"/>
</control>
+ <!-- Replicate the internal state for an object - e.g. Links, bridges, etc -->
+ <control name="internal-state" code="0x42">
+ <field name="type" type="str8"/> <!-- The type of object the state is for (e.g. 'link') -->
+ <field name="name" type="str8"/> <!-- Identifies the particular object to be updated -->
+ <field name="state" type="map"/> <!-- The internal state for the object -->
+ </control>
</class>
Modified: qpid/branches/java-config-and-management/qpid/doc/book/Makefile
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/Makefile?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/doc/book/Makefile (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/Makefile Thu Jun 28 09:14:52 2012
@@ -17,37 +17,22 @@
# under the License.
#
-#
-# This Makefile requires the following:
-#
-# Apache FOP, version 0.95 or higher
-# Docbook 4.5
-# Docbook XSL stylesheets - tested with xsl-stylesheets (1.75.2 and 1.65.1-2)
-# xsltproc
-# xmllint
-#
-
-all: cpp java programming
+DIRS = src/java-broker src/cpp-broker src/programming
-cpp: build/AMQP-Messaging-Broker-CPP-Book
-java: build/AMQP-Messaging-Broker-Java-Book
+.PHONY: all $(DIRS)
-programming: build/Programming-In-Apache-Qpid
+all: $(DIRS)
-qmf: build/QmfBook
-
-build/AMQP-Messaging-Broker-CPP-Book:
- ./build-book.sh AMQP-Messaging-Broker-CPP-Book
+clean:
+ rm -rf build
-build/AMQP-Messaging-Broker-Java-Book:
- ./build-book.sh AMQP-Messaging-Broker-Java-Book
+html: TARGET = html
+html: all
-build/Programming-In-Apache-Qpid:
- ./build-book.sh Programming-In-Apache-Qpid
+pdf: TARGET = pdf
+pdf: all
-build/QmfBook: src/QmfBook.xml src/QmfIntroduction.xml
- ./build-book.sh QmfBook
+$(DIRS):
+ $(MAKE) -C $@ $(TARGET) OUTPUTDIR=../../build/
-clean:
- rm -rf build
Propchange: qpid/branches/java-config-and-management/qpid/doc/book/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 28 09:14:52 2012
@@ -0,0 +1 @@
+output
Copied: qpid/branches/java-config-and-management/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml (from r1339789, qpid/trunk/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml?p2=qpid/branches/java-config-and-management/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml&p1=qpid/trunk/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml&r1=1339789&r2=1354874&rev=1354874&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml Thu Jun 28 09:14:52 2012
@@ -22,15 +22,13 @@ under the License.
<section id="chap-Messaging_User_Guide-Active_Passive_Cluster">
- <title>Active-passive Messaging Clusters (Preview)</title>
+ <title>Active-passive Messaging Clusters</title>
<section>
<title>Overview</title>
<para>
- This release provides a preview of a new module for High Availability (HA). The new module is
- not yet complete or ready for production use. It being made available so that users can
- experiment with the new approach and provide feedback early in the development process.
- Feedback should go to <ulink url="mailto:user@qpid.apache.org">dev@qpid.apache.org</ulink>.
+ This release provides a preview of a new module for High Availability (HA).
+ This module is intended to eventually replace the existing cluster module.
</para>
<para>
The old cluster module takes an <firstterm>active-active</firstterm> approach, i.e. all the
@@ -45,13 +43,13 @@ under the License.
promoted to take over as the new primary. Clients fail-over to the new primary
automatically. If there are multiple backups, the backups also fail-over to become backups of
the new primary. Backup brokers reject connection attempts, to enforce the requirement that
- only the primary be active.
+ only the primary be active. Clients fail-over till the successfully connect to the primary broker.
</para>
<para>
- This approach depends on an external <firstterm>cluster resource manager</firstterm> to detect
- failures and choose the primary. <ulink
- url="https://fedorahosted.org/cluster/wiki/RGManager">Rgmanager</ulink> is supported
- initially, but others may be supported in the future.
+ This approach requires on an external <firstterm>cluster resource
+ manager</firstterm> to detect failures and choose the new primary. <ulink
+ url="https://fedorahosted.org/cluster/wiki/RGManager">Rgmanager</ulink> is
+ supported initially, but others may be supported in the future.
</para>
<section>
<title>Why the new approach?</title>
@@ -77,19 +75,17 @@ under the License.
virtual IP addresses.
</listitem>
<listitem>
- Improved performance and scalability due to better use of multiple CPU s
+ Improved performance and scalability due to better use of multiple CPUs
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>Limitations</title>
-
<para>
There are a number of known limitations in the current preview implementation. These
will be fixed in the production versions.
</para>
-
<itemizedlist>
<listitem>
Transactional changes to queue state are not replicated atomically. If the primary crashes
@@ -97,23 +93,11 @@ under the License.
changes introduced by a transaction.
</listitem>
<listitem>
- During a fail-over one backup is promoted to primary and any other backups switch to
- the new primary. Messages sent to the new primary before all the backups have
- switched could be lost if the new primary itself fails before all the backups have
- switched.
- </listitem>
- <listitem>
- Acknowledgments are confirmed to clients before the message has been dequeued
- from replicas or indeed from the local store if that is asynchronous.
- </listitem>
- <listitem>
- When used with a persistent store: if the entire cluster fails, there are no tools to help
- identify the most recent store.
- </listitem>
- <listitem>
- A persistent broker must have its store erased before joining an existing cluster.
- In the production version a persistent broker will be able to load its store and
- avoid downloading messages that are in the store from the primary.
+ Not yet integrated with the persistent store. A persistent broker must have its
+ store erased before joining an existing cluster. If the entire cluster fails,
+ there are no tools to help identify the most recent store. In the future a
+ persistent broker will be able to use its stored messages to avoid downloading
+ messages from the primary when joining a cluster.
</listitem>
<listitem>
Configuration changes (creating or deleting queues, exchanges and bindings) are
@@ -127,20 +111,9 @@ under the License.
re-appear if that backup is promoted to primary on a subsequent failure.
</listitem>
<listitem>
- Better control is needed over which queues/exchanges are replicated and which are not.
- </listitem>
- <listitem>
- There are some known issues affecting performance, both the throughput of
- replication and the time taken for backups to fail-over. Performance will improve
- in the production version.
- </listitem>
- <listitem>
Federated links from the primary will be lost in fail over, they will not be
re-connected on the new primary. Federation links to the primary can fail over.
</listitem>
- <listitem>
- Only plain FIFO queues can be replicated. LVQ and ring queues are not yet supported.
- </listitem>
</itemizedlist>
</section>
</section>
@@ -192,7 +165,7 @@ under the License.
</row>
<row>
<entry>
- <literal>--ha-brokers <replaceable>URL</replaceable></literal>
+ <literal>--ha-brokers-url <replaceable>URL</replaceable></literal>
</entry>
<entry>
<para>
@@ -209,23 +182,23 @@ under the License.
</programlisting>
</para>
</footnote>
- used by brokers to connect to each other. If you use a virtual IP address
- then this is a single address, for example
- <literal>amqp:20.0.20.200</literal>. If you do not use a virtual IP
- address then the URL must list all the addresses of brokers in the
- cluster, for example <literal>amqp:node1,node2,node3</literal>
+ used by cluster brokers to connect to each other. The URL can
+ contain a list of all the brokers' addresses or it can contain a single
+ virtual IP address. If a list is used it is comma separated, for example
+ <literal>amqp:node1.exaple.com,node2.exaple.com,node3.exaple.com</literal>
</para>
</entry>
</row>
<row>
- <entry><literal>--ha-public-brokers <replaceable>URL</replaceable></literal> </entry>
+ <entry><literal>--ha-public-url <replaceable>URL</replaceable></literal> </entry>
<entry>
<para>
- The URL used by clients to connect to the brokers. This has the same
- format as the <literal>--ha-brokers</literal> URL above.
+ The URL that is advertized to clients. This defaults to the
+ <literal>--ha-brokers-url</literal> URL above, and has the same format. A
+ virtual IP address is recommended for the public URL as it simplifies
+ deployment and hides changes to the cluster membership from clients.
</para>
<para>
- If this option is not set, clients will use the same URL as brokers.
This option allows you to put client traffic on a different network from
broker traffic, which is recommended.
</para>
@@ -237,7 +210,7 @@ under the License.
<entry>
<para>
Specifies whether queues and exchanges are replicated by default.
- For details see <xref linkend="creating-replicated"/>
+ For details see <xref linkend="ha-creating-replicated"/>
</para>
</entry>
</row>
@@ -256,7 +229,7 @@ under the License.
</table>
<para>
To configure a HA cluster you must set at least <literal>ha-cluster</literal> and
- <literal>ha-brokers</literal>.
+ <literal>ha-brokers-url</literal>.
</para>
</section>
@@ -270,9 +243,9 @@ under the License.
</para>
<para>
The resource manager is responsible for starting the <command>qpidd</command> broker
- on each node in the cluster. The resource manager <firstterm>promotes</firstterm>
+ on each node in the cluster. The resource manager then <firstterm>promotes</firstterm>
one of the brokers to be the primary. The other brokers connect to the primary as
- backups, using the URL provided in the <literal>ha-brokers</literal> configuration
+ backups, using the URL provided in the <literal>ha-brokers-url</literal> configuration
option.
</para>
<para>
@@ -406,8 +379,8 @@ NOTE: fencing is not shown, you must con
</para>
<programlisting>
ha-cluster=yes
- ha-brokers=20.0.20.200
- ha-public-brokers=20.0.10.200
+ ha-brokers-url=20.0.20.200
+ ha-public-url=20.0.10.200
</programlisting>
<para>
This configuration specifies that backup brokers will use 20.0.20.200
@@ -459,7 +432,8 @@ NOTE: fencing is not shown, you must con
option. It has one of the following values:
<itemizedlist>
<listitem>
- <firstterm>all</firstterm>: Replicate everything automatically: queues, exchanges, bindings and messages.
+ <firstterm>all</firstterm>: Replicate everything automatically: queues,
+ exchanges, bindings and messages.
</listitem>
<listitem>
<firstterm>configuration</firstterm>: Replicate the existence of queues,
@@ -655,6 +629,43 @@ NOTE: fencing is not shown, you must con
</screen>
</section>
</section>
+
+ <section>
+ <title>Integrating with other Cluster Resource Managers</title>
+ <para>
+ To integrate with a different resource manager you must configure it to:
+ <itemizedlist>
+ <listitem>Start a qpidd process on each node of the cluster.</listitem>
+ <listitem>Restart qpidd if it crases.</listitem>
+ <listitem>Promote exactly one of the brokers to primary.</listitem>
+ <listitem>Detect a failure and promote a new primary.</listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ The <command>qpid-ha</command> command allows you to check if a broker is primary,
+ and to promote a backup to primary.
+ </para>
+ <para>
+ To test if a broker is the primary:
+ <programlisting>
+ qpid-ha -b <replaceable>broker-address</replaceable> status --expect=primary
+ </programlisting>
+ This command will return 0 if the broker at <replaceable>broker-address</replaceable>
+ is the primary, non-0 otherwise.
+ </para>
+ <para>
+ To promote a broker to primary:
+ <programlisting>
+ qpid-ha -b <replaceable>broker-address</replaceable> promote
+ </programlisting>
+ </para>
+ <para>
+ <command>qpid-ha --help</command> gives information on other commands and options available.
+ You can also use <command>qpid-ha</command> to manually examine and promote brokers. This
+ can be useful for testing failover scenarios without having to set up a full resource manager,
+ or to simulate a cluster on a single node. For deployment, a resource manager is required.
+ </para>
+ </section>
</section>
<!-- LocalWords: scalability rgmanager multicast RGManager mailto LVQ qpidd IP dequeued Transactional username
Propchange: qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 28 09:14:52 2012
@@ -0,0 +1 @@
+output
Copied: qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml (from r1339789, qpid/trunk/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml?p2=qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml&p1=qpid/trunk/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml&r1=1339789&r2=1354874&rev=1354874&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml Thu Jun 28 09:14:52 2012
@@ -31,7 +31,7 @@
<listitem><para>Implemented in Java - Fully JMS compliant, runs on any Java platform.</para></listitem>
</itemizedlist>
- <para>Both AMQP messaging brokers support clients in multiple languages, as long as the messaging client and the messaging broker use the same version of AMQP. See <link linkend="AMQP-Compatibility"/> to see which messaging clients work with each broker.</para>
+ <para>Both AMQP messaging brokers support clients in multiple languages, as long as the messaging client and the messaging broker use the same version of AMQP.</para>
<para>This manual contains information specific to the broker that is implemented in Java.</para>
</preface>
@@ -44,6 +44,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Environment-Variables.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Qpid-Troubleshooting-Guide.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Broker-Configuration-Guide.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="HA-Guide.xml"/>
</chapter>
<chapter id="Qpid-Java-Broker-HowTos">
@@ -67,7 +68,6 @@
<chapter id="QpidJavaBroker-ManagementTools">
<title>Management Tools</title>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="MessageStore-Tool.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Qpid-Java-Broker-Management-CLI.xml"/>
</chapter>
</book>
Copied: qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml (from r1339789, qpid/trunk/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml?p2=qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml&p1=qpid/trunk/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml&r1=1339789&r2=1354874&rev=1354874&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Broker-Configuration-Guide.xml Thu Jun 28 09:14:52 2012
@@ -23,6 +23,6 @@
<section id="Java-Broker-Configuration-Guide">
<title>Broker Configuration Guide </title>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="Topic-Configuration.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Producer-Flow-Control.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Topic-Configuration.xml"/>
</section>
Copied: qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml (from r1339789, qpid/trunk/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml?p2=qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml&p1=qpid/trunk/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml&r1=1339789&r2=1354874&rev=1354874&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/src/java-broker/Qpid-Java-FAQ.xml Thu Jun 28 09:14:52 2012
@@ -742,15 +742,9 @@ amqj.logging.level
</title>
<para>
- There are two possibilities here:
- </para><para>
- 1) The management console can be used to interogate an active
+ The management console can be used to interogate an active
broker and browse the contents of a queue.See the <xref linkend="qpid_Qpid-JMX-Management-Console"/>
page for further details.
- </para><para>
- 2) The <xref linkend="qpid_MessageStore-Tool"/> can be used to inspect
- the contents of a persistent message store. Note: this can
- currently only be used when the broker is offline.
</para>
<!--h3--></section>
@@ -773,13 +767,14 @@ amqj.logging.level
</title>
<para>
- The Java broker does not currently implement producer flow
- control. Publishes are currently asynchronous, so there is no
- ability to rate limit this automatically. While this is something
- which will be addressed in the future, it is currently up to
- applications to ensure that they do not publish faster than the
- messages are being consumed for signifcant periods of time.
- </para>
+ Switch on producer flow control to prevent temporary spikes in
+ message production over-filling the broker.
+
+ Of course, if the long-term rate of message production exceeds
+ the rate of message
+ consumption then that is an architectural problem that can only
+ be temporarily mitigated by producer flow control.
+ </para>
<!--h3--></section>
<section role="h3" id="QpidJavaFAQ-ThebrokerkeepsthrowinganOutOfMemoryexception-3F"><title>
Copied: qpid/branches/java-config-and-management/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml (from r1339789, qpid/trunk/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml)
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml?p2=qpid/branches/java-config-and-management/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml&p1=qpid/trunk/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml&r1=1339789&r2=1354874&rev=1354874&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml (original)
+++ qpid/branches/java-config-and-management/qpid/doc/book/src/programming/Programming-In-Apache-Qpid-Book.xml Thu Jun 28 09:14:52 2012
@@ -3783,6 +3783,16 @@ spout - -content "$(cat rdu.xml | sed -e
<para>For compatibility with older clients, the synonym <varname>amqj.receiveBufferSize</varname> is supported.</para>
</entry>
</row>
+ <row>
+ <entry>qpid.failover_method_timeout</entry>
+ <entry>long</entry>
+ <entry>60000</entry>
+ <entry>
+ <para>During failover, this is the timeout for each attempt to try to re-establish the connection.
+ If a reconnection attempt exceeds the timeout, the entire failover process is aborted.</para>
+ <para>It is only applicable for AMQP 0-8/0-9/0-9-1 clients.</para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: qpid/branches/java-config-and-management/qpid/extras/qmf/src/py/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/branches/java-config-and-management/qpid/extras/qmf/src/py/qmf/console.py?rev=1354874&r1=1354873&r2=1354874&view=diff
==============================================================================
--- qpid/branches/java-config-and-management/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/branches/java-config-and-management/qpid/extras/qmf/src/py/qmf/console.py Thu Jun 28 09:14:52 2012
@@ -3948,7 +3948,7 @@ class Event:
return "<uninterpretable>"
out = strftime("%c", gmtime(self.timestamp / 1000000000))
out += " " + self._sevName() + " " + self.classKey.getPackageName() + ":" + self.classKey.getClassName()
- out += " broker=" + self.broker.getUrl()
+ out += " broker=" + str(self.broker.getUrl())
for arg in self.schema.arguments:
disp = self.session._displayValue(self.arguments[arg.name], arg.type).encode("utf8")
if " " in disp:
Propchange: qpid/branches/java-config-and-management/qpid/java/amqp-1-0-client/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/amqp-1-0-client:r1300143-1309476
Propchange: qpid/branches/java-config-and-management/qpid/java/amqp-1-0-client-jms/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/amqp-1-0-client-jms:r1300143-1309476
Propchange: qpid/branches/java-config-and-management/qpid/java/amqp-1-0-common/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/amqp-1-0-common:r1300143-1309476
Propchange: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData_1_0.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData_1_0.java:r1300143-1309633
Propchange: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java:r1300143-1309633
Propchange: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java:r1300143-1309633
Propchange: qpid/branches/java-config-and-management/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0:r1300143-1309476
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ConfigurationManagement.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ConfigurationManagement.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java:r1339579-1339789
Propchange: qpid/branches/java-config-and-management/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java:r1339579-1339789
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org