diff options
Diffstat (limited to 'java/systests/src')
6 files changed, 29 insertions, 131 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java index 30d2d851a0..98cdf94ac9 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import javax.jms.ExceptionListener; import javax.jms.JMSException; +import org.apache.qpid.AMQConnectionClosedException; import org.apache.qpid.AMQDisconnectedException; import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; @@ -139,7 +140,7 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL public void onException(JMSException e) { - if (e.getLinkedException() instanceof AMQDisconnectedException) + if (e.getLinkedException() instanceof AMQDisconnectedException || e.getLinkedException() instanceof AMQConnectionClosedException) { _logger.debug("Received AMQDisconnectedException"); _failoverComplete.countDown(); diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java index d1ba725721..782ca22965 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java @@ -67,14 +67,14 @@ public class ExternalACLTest extends AbstractACLTestCase fail("Connection was not created due to:" + e); } } - + public void testAccessVhostAuthorisedGuestSuccess() throws IOException, Exception { //The 'guest' user has no access to the 'test' vhost, as tested below in testAccessNoRights(), and so - //is unable to perform actions such as connecting (and by extension, creating a queue, and consuming - //from a queue etc). In order to test the vhost-wide 'access' ACL right, the 'guest' user has been given + //is unable to perform actions such as connecting (and by extension, creating a queue, and consuming + //from a queue etc). In order to test the vhost-wide 'access' ACL right, the 'guest' user has been given //this right in the 'test2' vhost. - + try { //get a connection to the 'test2' vhost using the guest user and perform various actions. @@ -106,7 +106,7 @@ public class ExternalACLTest extends AbstractACLTestCase fail("Test failed due to:" + e.getMessage()); } } - + public void testAccessNoRightsFailure() throws Exception { try @@ -115,7 +115,7 @@ public class ExternalACLTest extends AbstractACLTestCase Session sess = conn.createSession(true, Session.SESSION_TRANSACTED); conn.start(); sess.rollback(); - + fail("Connection was created."); } catch (JMSException e) @@ -126,11 +126,11 @@ public class ExternalACLTest extends AbstractACLTestCase Throwable cause = linkedException.getCause(); assertNotNull("Cause was null", cause); assertTrue("Wrong linked exception type", cause instanceof AMQException); - AMQConstant errorCode = isBroker010() ? AMQConstant.CONTEXT_IN_USE : AMQConstant.ACCESS_REFUSED; + AMQConstant errorCode = isBroker010() ? AMQConstant.CONNECTION_FORCED : AMQConstant.ACCESS_REFUSED; assertEquals("Incorrect error code received", errorCode, ((AMQException) cause).getErrorCode()); } } - + public void testClientDeleteQueueSuccess() throws Exception { try @@ -155,7 +155,7 @@ public class ExternalACLTest extends AbstractACLTestCase fail("Test failed due to:" + e.getMessage()); } } - + public void testServerDeleteQueueFailure() throws Exception { try @@ -207,13 +207,13 @@ public class ExternalACLTest extends AbstractACLTestCase try { Connection conn = getConnection("test", "client", "guest"); - + Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); conn.start(); sess.createConsumer(sess.createQueue("IllegalQueue")); - + fail("Test failed as consumer was created."); } catch (JMSException e) @@ -253,10 +253,10 @@ public class ExternalACLTest extends AbstractACLTestCase Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); conn.start(); - + //Create a Named Queue ((AMQSession<?, ?>) sess).createQueue(new AMQShortString("IllegalQueue"), false, false, false); - + fail("Test failed as Queue creation succeded."); //conn will be automatically closed } @@ -385,7 +385,7 @@ public class ExternalACLTest extends AbstractACLTestCase try { Connection conn = getConnection("test", "client", "guest"); - + Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); conn.start(); @@ -405,13 +405,13 @@ public class ExternalACLTest extends AbstractACLTestCase try { Connection conn = getConnection("test", "server", "guest"); - + Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); conn.start(); sess.createConsumer(sess.createTemporaryQueue()); - + fail("Test failed as consumer was created."); } catch (JMSException e) @@ -446,7 +446,7 @@ public class ExternalACLTest extends AbstractACLTestCase try { Connection conn = getConnection("test", "server", "guest"); - + Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); conn.start(); @@ -480,13 +480,13 @@ public class ExternalACLTest extends AbstractACLTestCase check403Exception(e.getLinkedException()); } } - + public void testServerCreateAutoDeleteQueueInvalid() throws NamingException, JMSException, AMQException, Exception { try { Connection connection = getConnection("test", "server", "guest"); - + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); connection.start(); @@ -630,8 +630,8 @@ public class ExternalACLTest extends AbstractACLTestCase check403Exception(e.getLinkedException()); } } - - + + @Override public String getConfig() { diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java index 97d825177c..d6caf05d33 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java @@ -59,7 +59,7 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase _queue = _clientSession.createQueue(getTestQueueName()); _clientSession.createConsumer(_queue).close(); - + //Ensure there are no messages on the queue to start with. checkQueueDepth(0); } @@ -490,7 +490,7 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase } } - assertTrue("We should get atleast " + messages + " msgs.", msgCount >= messages); + assertTrue("We should get atleast " + messages + " msgs (found " + msgCount +").", msgCount >= messages); if (_logger.isDebugEnabled()) { diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java index cec9d292cf..0057422c8f 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java @@ -47,13 +47,15 @@ public class ExceptionListenerTest extends QpidBrokerTestCase { public void onException(JMSException e) { + _logger.debug("&&&&&&&&&&&&&&&&&&&&&&&&&&&& Caught exception &&&&&&&&&&&&&&&&&&&&&&&&&&&& ", e); fired.countDown(); } }); - + _logger.debug("%%%%%%%%%%%%%%%% Stopping Broker %%%%%%%%%%%%%%%%%%%%%"); stopBroker(); + _logger.debug("%%%%%%%%%%%%%%%% Stopped Broker %%%%%%%%%%%%%%%%%%%%%"); - if (!fired.await(3, TimeUnit.SECONDS)) + if (!fired.await(5, TimeUnit.SECONDS)) { fail("exception listener was not fired"); } diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java index 5701b5a1fd..836684c965 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java @@ -25,7 +25,6 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.UnknownHostException; -import org.apache.mina.transport.vmpipe.VmPipeAddress; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.client.protocol.AMQProtocolSession; diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/protocol/TestIoSession.java b/java/systests/src/main/java/org/apache/qpid/test/utils/protocol/TestIoSession.java deleted file mode 100644 index f1eb8159b6..0000000000 --- a/java/systests/src/main/java/org/apache/qpid/test/utils/protocol/TestIoSession.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * - * 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. - * - */ -package org.apache.qpid.test.utils.protocol; - -import java.net.InetSocketAddress; -import java.net.SocketAddress; - -import org.apache.mina.common.IoFilterChain; -import org.apache.mina.common.IoHandler; -import org.apache.mina.common.IoService; -import org.apache.mina.common.IoServiceConfig; -import org.apache.mina.common.IoSessionConfig; -import org.apache.mina.common.TransportType; -import org.apache.mina.common.support.BaseIoSession; - -public class TestIoSession extends BaseIoSession { - - private String _stringLocalAddress; - private int _localPort; - - public SocketAddress getLocalAddress() - { - //create a new address for testing purposes using member variables - return new InetSocketAddress(_stringLocalAddress,_localPort); - } - - protected void updateTrafficMask() { - //dummy - } - - public IoService getService() { - return null; - } - - public IoServiceConfig getServiceConfig() { - return null; - } - - public IoHandler getHandler() { - return null; - } - - public IoSessionConfig getConfig() { - return null; - } - - public IoFilterChain getFilterChain() { - return null; - } - - public TransportType getTransportType() { - return null; - } - - public SocketAddress getRemoteAddress() { - return null; - } - - public SocketAddress getServiceAddress() { - return null; - } - - public int getScheduledWriteRequests() { - return 0; - } - - public int getScheduledWriteBytes() { - return 0; - } - - public String getStringLocalAddress() { - return _stringLocalAddress; - } - - public void setStringLocalAddress(String _stringLocalAddress) { - this._stringLocalAddress = _stringLocalAddress; - } - - public int getLocalPort() { - return _localPort; - } - - public void setLocalPort(int _localPort) { - this._localPort = _localPort; - } -} |