diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-01-25 15:08:28 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-01-25 15:08:28 +0000 |
commit | 80f91c3d3f16df2c7d695a64693637c0ec73eaac (patch) | |
tree | 0913c82325416ef9b6098369bd8368d6475e97d4 | |
parent | c36dcc8cfaee9f0e7c2eabce6c469f0e0b95e534 (diff) | |
download | qpid-python-80f91c3d3f16df2c7d695a64693637c0ec73eaac.tar.gz |
Revision: 495550
Author: bhupendrab
Date: 11:00:49, 12 January 2007
Message:
QPID-279
Nuno Santos provided a patch for running the management console on linux. Baes on that these scripts are created to run on linux with different windowing system
----
Modified : /incubator/qpid/trunk/qpid/java/management/eclipse-plugin/bin/qpidmc.sh
Added : /incubator/qpid/trunk/qpid/java/management/eclipse-plugin/bin/qpidmc_gtk.sh
Added : /incubator/qpid/trunk/qpid/java/management/eclipse-plugin/bin/qpidmc_motif.sh
Modified : /incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
Revision: 495517
Author: ritchiem
Date: 08:52:31, 12 January 2007
Message:
QPID-282
Updated AMQConnection and AMQBrokerDetails to check the host:port and add tcp:// if there is no protocol specified.
----
Modified : /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java
Modified : /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
Modified : /incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/perftesting@499813 13f79535-47bb-0310-9956-ffa450edef68
7 files changed, 190 insertions, 21 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java index 6da0da9f6f..c93b607740 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java @@ -334,4 +334,15 @@ public class AMQBrokerDetails implements BrokerDetails } + public static String checkTransport(String broker) + { + if ((!broker.contains("://"))) + { + return "tcp://" + broker; + } + else + { + return broker; + } + } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 58ac49dd4e..034cf3a1eb 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -150,8 +150,8 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { this(new AMQConnectionURL(ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@" + - (clientName==null?"":clientName) + - virtualHost + "?brokerlist='" + broker + "'")); + (clientName == null ? "" : clientName) + + virtualHost + "?brokerlist='" + AMQBrokerDetails.checkTransport(broker) + "'")); } public AMQConnection(String host, int port, String username, String password, @@ -166,12 +166,12 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect this(new AMQConnectionURL(useSSL ? ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@" + - (clientName==null?"":clientName) + + (clientName == null ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port + "'" + "," + ConnectionURL.OPTIONS_SSL + "='true'" : ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@" + - (clientName==null?"":clientName) + + (clientName == null ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port + "'" + "," + ConnectionURL.OPTIONS_SSL + "='false'" )); @@ -469,22 +469,22 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect // TODO: Connect this to the session version obtained from ProtocolInitiation for this session. // Be aware of possible changes to parameter order as versions change. _protocolHandler.syncWrite( - ChannelOpenBody.createAMQFrame(channelId, - (byte)8, (byte)0, // AMQP version (major, minor) - null), // outOfBand - ChannelOpenOkBody.class); + ChannelOpenBody.createAMQFrame(channelId, + (byte) 8, (byte) 0, // AMQP version (major, minor) + null), // outOfBand + ChannelOpenOkBody.class); //todo send low water mark when protocol allows. // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) // TODO: Connect this to the session version obtained from ProtocolInitiation for this session. // Be aware of possible changes to parameter order as versions change. _protocolHandler.syncWrite( - BasicQosBody.createAMQFrame(channelId, - (byte)8, (byte)0, // AMQP version (major, minor) - false, // global - prefetchHigh, // prefetchCount - 0), // prefetchSize - BasicQosOkBody.class); + BasicQosBody.createAMQFrame(channelId, + (byte) 8, (byte) 0, // AMQP version (major, minor) + false, // global + prefetchHigh, // prefetchCount + 0), // prefetchSize + BasicQosOkBody.class); if (transacted) { @@ -495,7 +495,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) // TODO: Connect this to the session version obtained from ProtocolInitiation for this session. // Be aware of possible changes to parameter order as versions change. - _protocolHandler.syncWrite(TxSelectBody.createAMQFrame(channelId, (byte)8, (byte)0), TxSelectOkBody.class); + _protocolHandler.syncWrite(TxSelectBody.createAMQFrame(channelId, (byte) 8, (byte) 0), TxSelectOkBody.class); } } @@ -527,6 +527,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect /** * Returns an AMQQueueSessionAdaptor which wraps an AMQSession and throws IllegalStateExceptions * where specified in the JMS spec + * * @param transacted * @param acknowledgeMode * @return QueueSession @@ -540,6 +541,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect /** * Returns an AMQTopicSessionAdapter which wraps an AMQSession and throws IllegalStateExceptions * where specified in the JMS spec + * * @param transacted * @param acknowledgeMode * @return TopicSession @@ -574,7 +576,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { checkNotClosed(); return _connectionMetaData; - + } public ExceptionListener getExceptionListener() throws JMSException @@ -625,7 +627,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect public void close() throws JMSException { - synchronized(getFailoverMutex()) + synchronized (getFailoverMutex()) { if (!_closed.getAndSet(true)) { @@ -903,7 +905,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { if (cause instanceof AMQException) { - je = new JMSException(Integer.toString(((AMQException)cause).getErrorCode()) ,"Exception thrown against " + toString() + ": " + cause); + je = new JMSException(Integer.toString(((AMQException) cause).getErrorCode()), "Exception thrown against " + toString() + ": " + cause); } else { @@ -956,8 +958,8 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect void deregisterSession(int channelId) { _sessions.remove(channelId); - } - + } + /** * For all sessions, and for all consumers in those sessions, resubscribe. This is called during failover handling. * The caller must hold the failover mutex before calling this method. diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java index 147d2ae43e..e72b7b3b72 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java @@ -207,6 +207,72 @@ public class ConnectionURLTest extends TestCase assertTrue(service.getPort() == 5672); } + public void testSingleTransportDefaultedBrokerWithPort() throws URLSyntaxException + { + String url = "amqp://guest:guest@/temp?brokerlist='localhost:1234'"; + + ConnectionURL connectionurl = new AMQConnectionURL(url); + + assertTrue(connectionurl.getFailoverMethod() == null); + assertTrue(connectionurl.getUsername().equals("guest")); + assertTrue(connectionurl.getPassword().equals("guest")); + assertTrue(connectionurl.getVirtualHost().equals("/temp")); + + + assertTrue(connectionurl.getBrokerCount() == 1); + + BrokerDetails service = connectionurl.getBrokerDetails(0); + + assertTrue(service.getTransport().equals("tcp")); + + assertTrue(service.getHost().equals("localhost")); + assertTrue(service.getPort() == 1234); + } + + public void testSingleTransportDefaultedBrokerWithIP() throws URLSyntaxException + { + String url = "amqp://guest:guest@/temp?brokerlist='127.0.0.1'"; + + ConnectionURL connectionurl = new AMQConnectionURL(url); + + assertTrue(connectionurl.getFailoverMethod() == null); + assertTrue(connectionurl.getUsername().equals("guest")); + assertTrue(connectionurl.getPassword().equals("guest")); + assertTrue(connectionurl.getVirtualHost().equals("/temp")); + + + assertTrue(connectionurl.getBrokerCount() == 1); + + BrokerDetails service = connectionurl.getBrokerDetails(0); + + assertTrue(service.getTransport().equals("tcp")); + + assertTrue(service.getHost().equals("127.0.0.1")); + assertTrue(service.getPort() == 5672); + } + + public void testSingleTransportDefaultedBrokerWithIPandPort() throws URLSyntaxException + { + String url = "amqp://guest:guest@/temp?brokerlist='127.0.0.1:1234'"; + +// ConnectionURL connectionurl = new AMQConnectionURL(url); +// +// assertTrue(connectionurl.getFailoverMethod() == null); +// assertTrue(connectionurl.getUsername().equals("guest")); +// assertTrue(connectionurl.getPassword().equals("guest")); +// assertTrue(connectionurl.getVirtualHost().equals("/temp")); +// +// +// assertTrue(connectionurl.getBrokerCount() == 1); +// +// BrokerDetails service = connectionurl.getBrokerDetails(0); +// +// assertTrue(service.getTransport().equals("tcp")); +// +// assertTrue(service.getHost().equals("127.0.0.1")); +// assertTrue(service.getPort() == 1234); + } + public void testSingleTransportMultiOptionURL() throws URLSyntaxException { diff --git a/qpid/java/management/eclipse-plugin/bin/qpidmc.sh b/qpid/java/management/eclipse-plugin/bin/qpidmc.sh index 13e3edcc94..e5e67c6d90 100755 --- a/qpid/java/management/eclipse-plugin/bin/qpidmc.sh +++ b/qpid/java/management/eclipse-plugin/bin/qpidmc.sh @@ -1,4 +1,22 @@ #!/bin/bash +# +# 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. +# if [ "$JAVA_HOME" == "" ]; then echo "The JAVA_HOME environment variable is not defined"; @@ -10,4 +28,27 @@ if [ "$QPIDMC_HOME" == "" ]; then exit 0; fi -"$JAVA_HOME/bin/java" -Xms40m -Xmx256m -Declipse.consoleLog=false -jar $QPIDMC_HOME/eclipse/startup.jar org.eclipse.core.launcher.Main -launcher $QPIDMC_HOME/eclipse/eclipse -name "Qpid Management Console" -showsplash 600 -configuration "file:$QPIDMC_HOME/configuration" +os=win32 +ws=win32 +arch=x86 + +##echo $os +##echo $ws +##echo $arch + +## If this is to be run on different platform other than windows then following parameters should be passed +## qpidmc.sh <operating system> <windowing system> <platform achitecture> +## eg. qpidmc.sh linux motif x86 +if [ $# -eq 3 ]; then + os=$1 + ws=$2 + arch=$3 +fi + +if [ $os = "SunOS" ]; then + os="solaris" +elif [ $os = "Linux" ]; then + os="linux" +fi + +"$JAVA_HOME/bin/java" -Xms40m -Xmx256m -Declipse.consoleLog=false -jar $QPIDMC_HOME/eclipse/startup.jar org.eclipse.core.launcher.Main -launcher $QPIDMC_HOME/eclipse/eclipse -name "Qpid Management Console" -showsplash 600 -configuration "file:$QPIDMC_HOME/configuration" -os $os -ws $ws -arch $arch diff --git a/qpid/java/management/eclipse-plugin/bin/qpidmc_gtk.sh b/qpid/java/management/eclipse-plugin/bin/qpidmc_gtk.sh new file mode 100755 index 0000000000..7b42b9525e --- /dev/null +++ b/qpid/java/management/eclipse-plugin/bin/qpidmc_gtk.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# 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. +# + +os=`uname` +arch=`uname -p` + +$QPIDMC_HOME/bin/qpidmc.sh $os gtk $arch diff --git a/qpid/java/management/eclipse-plugin/bin/qpidmc_motif.sh b/qpid/java/management/eclipse-plugin/bin/qpidmc_motif.sh new file mode 100755 index 0000000000..49354f12f6 --- /dev/null +++ b/qpid/java/management/eclipse-plugin/bin/qpidmc_motif.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# 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. +# + +os=`uname` +arch=`uname -p` + +$QPIDMC_HOME/bin/qpidmc.sh $os motif $arch diff --git a/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini b/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini index d50b06cbcf..aa2d21fd48 100644 --- a/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini +++ b/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini @@ -24,3 +24,4 @@ eclipse.product=org.apache.qpid.management.ui.product eclipse.application=org.apache.qpid.management.ui.application
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.motif.linux.x86,org.eclipse.swt.gtk.linux.x86_64,org.eclipse.swt.gtk.linux.x86,org.eclipse.swt.gtk.linux.ppc,org.eclipse.swt.motif.hpux.PA_RISC,org.eclipse.swt.gtk.solaris.sparc,org.eclipse.swt.motif.solaris.sparc,org.eclipse.swt.carbon.macocx,org.eclipse.ui,org.eclipse.ui.forms,org.eclipse.ui.workbench
osgi.bundles.defaultStartLevel=4
+eof=eof
\ No newline at end of file |