summaryrefslogtreecommitdiff
path: root/qpid/java/common/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/common/src/test/java/org')
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java3
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java12
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java4
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java166
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java4
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java14
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java14
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java8
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java4
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java21
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java17
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java133
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java26
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java123
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/TestNetworkConnection.java15
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java7
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java2
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java6
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java4
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java5
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java5
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java4
22 files changed, 488 insertions, 109 deletions
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java b/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java
index f65427e583..575058b7f8 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java
@@ -21,9 +21,10 @@
package org.apache.qpid;
import junit.framework.TestCase;
-import org.apache.qpid.protocol.AMQConstant;
+
import org.apache.qpid.framing.AMQFrameDecodingException;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.protocol.AMQConstant;
/**
* This test is to ensure that when an AMQException is rethrown that the specified exception is correctly wrapped up.
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java b/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
index 272eb75800..6540e053b1 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java
@@ -21,12 +21,6 @@ package org.apache.qpid.codec;
*/
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-
import junit.framework.TestCase;
import org.apache.qpid.framing.AMQDataBlock;
@@ -35,6 +29,12 @@ import org.apache.qpid.framing.AMQFrameDecodingException;
import org.apache.qpid.framing.AMQProtocolVersionException;
import org.apache.qpid.framing.HeartbeatBody;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
public class AMQDecoderTest extends TestCase
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java b/qpid/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java
index 401848c21d..3a95ca330f 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/codec/MockAMQVersionAwareProtocolSession.java
@@ -21,8 +21,6 @@ package org.apache.qpid.codec;
*/
-import java.nio.ByteBuffer;
-
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQDataBlock;
import org.apache.qpid.framing.AMQMethodBody;
@@ -34,6 +32,8 @@ import org.apache.qpid.framing.ProtocolVersion;
import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
import org.apache.qpid.transport.Sender;
+import java.nio.ByteBuffer;
+
public class MockAMQVersionAwareProtocolSession implements AMQVersionAwareProtocolSession
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java b/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java
new file mode 100644
index 0000000000..2a8c177f64
--- /dev/null
+++ b/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java
@@ -0,0 +1,166 @@
+/* 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.configuration;
+
+import org.apache.qpid.test.utils.QpidTestCase;
+
+public class QpidPropertyTest extends QpidTestCase
+{
+ private static final String TEST_VALUE1 = "TEST_VALUE1";
+ private static final String TEST_VALUE2 = "TEST_VALUE2";
+ private static final String DEFAULT_VALUE = "DEFAULT_VALUE";
+
+ private String _systemPropertyName;
+ private String _deprecatedSystemPropertyName;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _systemPropertyName = getName() + ".current";
+ _deprecatedSystemPropertyName = getName() + ".deprecated";
+ }
+
+ public void testValueReadFromSystemProperty() throws Exception
+ {
+ setTestSystemProperty(_systemPropertyName, TEST_VALUE1);
+ assertSystemPropertiesSet(_systemPropertyName);
+
+ String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
+ assertEquals(TEST_VALUE1, propertyValue);
+ }
+
+ public void testValueReadFromSecondChoiceSystemPropertyWhenFirstChoiceNotSet() throws Exception
+ {
+ setTestSystemProperty(_deprecatedSystemPropertyName, TEST_VALUE2);
+ assertSystemPropertiesSet(_deprecatedSystemPropertyName);
+ assertSystemPropertiesNotSet(_systemPropertyName);
+
+ String propertyValue = QpidProperty.stringProperty("default", _systemPropertyName, _deprecatedSystemPropertyName).get();
+ assertEquals(TEST_VALUE2, propertyValue);
+ }
+
+ public void testValueReadFromFirstChoiceSystemPropertyWhenBothFirstAndSecondChoiceSet() throws Exception
+ {
+ setTestSystemProperty(_systemPropertyName, TEST_VALUE1);
+ setTestSystemProperty(_deprecatedSystemPropertyName, TEST_VALUE2);
+ assertSystemPropertiesSet(_systemPropertyName, _deprecatedSystemPropertyName);
+
+ String propertyValue = QpidProperty.stringProperty("default", _systemPropertyName, _deprecatedSystemPropertyName).get();
+ assertEquals(TEST_VALUE1, propertyValue);
+ }
+
+ public void testValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
+ {
+ assertSystemPropertiesNotSet(_systemPropertyName);
+
+ String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
+ assertEquals(DEFAULT_VALUE, propertyValue);
+ }
+
+ public void testValueIsDefaultWhenTwoSystemPropertiesAreNotSet() throws Exception
+ {
+ assertSystemPropertiesNotSet(_systemPropertyName, _deprecatedSystemPropertyName);
+
+ String propertyValue = QpidProperty.stringProperty(DEFAULT_VALUE, _systemPropertyName).get();
+ assertEquals(DEFAULT_VALUE, propertyValue);
+ }
+
+ public void testValueIsNullWhenNoDefaultAndNoSystemPropertiesAreSet() throws Exception
+ {
+ assertSystemPropertiesNotSet(_systemPropertyName, _deprecatedSystemPropertyName);
+
+ String nullString = null;
+ String propertyValue = QpidProperty.stringProperty(nullString, _systemPropertyName).get();
+ assertNull(propertyValue);
+ }
+
+ public void testBooleanValueReadFromSystemProperty() throws Exception
+ {
+ setTestSystemProperty(_systemPropertyName, Boolean.FALSE.toString());
+ assertSystemPropertiesSet(_systemPropertyName);
+
+ boolean propertyValue = QpidProperty.booleanProperty(Boolean.TRUE, _systemPropertyName).get();
+ assertFalse(propertyValue);
+ }
+
+ public void testBooleanValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
+ {
+ assertSystemPropertiesNotSet(_systemPropertyName);
+
+ Boolean propertyValue = QpidProperty.booleanProperty(Boolean.TRUE, _systemPropertyName).get();
+ assertTrue(propertyValue);
+ }
+
+ public void testIntegerValueReadFromSystemProperty() throws Exception
+ {
+ int expectedValue = 15;
+ setTestSystemProperty(_systemPropertyName, Integer.valueOf(expectedValue).toString());
+ assertSystemPropertiesSet(_systemPropertyName);
+
+ int propertyValue = QpidProperty.intProperty(14, _systemPropertyName).get();
+ assertEquals(expectedValue, propertyValue);
+ }
+
+ public void testIntegerValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
+ {
+ int expectedValue = 15;
+ assertSystemPropertiesNotSet(_systemPropertyName);
+
+ int propertyValue = QpidProperty.intProperty(expectedValue, _systemPropertyName).get();
+ assertEquals(expectedValue, propertyValue);
+ }
+
+ public void testLongValueReadFromSystemProperty() throws Exception
+ {
+ long expectedValue = 15;
+ setTestSystemProperty(_systemPropertyName, Long.valueOf(expectedValue).toString());
+ assertSystemPropertiesSet(_systemPropertyName);
+
+ long propertyValue = QpidProperty.longProperty(14l, _systemPropertyName).get();
+ assertEquals(expectedValue, propertyValue);
+ }
+
+ public void testLongValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception
+ {
+ long expectedValue = 15;
+ assertSystemPropertiesNotSet(_systemPropertyName);
+
+ long propertyValue = QpidProperty.longProperty(expectedValue, _systemPropertyName).get();
+ assertEquals(expectedValue, propertyValue);
+ }
+
+ private void assertSystemPropertiesSet(String... systemPropertyNames)
+ {
+ for (String systemPropertyName : systemPropertyNames)
+ {
+ assertTrue("System property " + systemPropertyName + " should be set",
+ System.getProperties().containsKey(systemPropertyName));
+ }
+ }
+
+ private void assertSystemPropertiesNotSet(String... systemPropertyNames)
+ {
+ for (String systemPropertyName : systemPropertyNames)
+ {
+ assertFalse("System property " + systemPropertyName + " should not be set",
+ System.getProperties().containsKey(systemPropertyName));
+ }
+ }
+
+}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java
index 9a805d87b3..bcdabfcb3f 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java
@@ -20,11 +20,11 @@
package org.apache.qpid.framing;
+import junit.framework.TestCase;
+
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-
-import junit.framework.TestCase;
public class AMQShortStringTest extends TestCase
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
index 5e7783f492..1a2c5283b0 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java
@@ -22,16 +22,20 @@ package org.apache.qpid.framing;
import junit.framework.TestCase;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
public class BasicContentHeaderPropertiesTest extends TestCase
{
- BasicContentHeaderProperties _testProperties;
- FieldTable _testTable;
- String _testString = "This is a test string";
- int _testint = 666;
+ private BasicContentHeaderProperties _testProperties;
+ private FieldTable _testTable;
+ private String _testString = "This is a test string";
+ private int _testint = 666;
/**
* Currently only test setting/getting String, int and boolean props
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
index cb9a9468bb..16f35613d8 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
@@ -20,19 +20,19 @@
*/
package org.apache.qpid.framing;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.qpid.AMQPInvalidClassException;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.qpid.AMQPInvalidClassException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class PropertyFieldTableTest extends TestCase
{
private static final Logger _logger = LoggerFactory.getLogger(PropertyFieldTableTest.class);
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java
index 3243136287..5a57db1650 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java
@@ -21,14 +21,14 @@
package org.apache.qpid.framing.abstraction;
import junit.framework.TestCase;
+
import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.abstraction.MessagePublishInfoImpl;
public class MessagePublishInfoImplTest extends TestCase
{
- MessagePublishInfoImpl _mpi;
- final AMQShortString _exchange = new AMQShortString("exchange");
- final AMQShortString _routingKey = new AMQShortString("routingKey");
+ private MessagePublishInfoImpl _mpi;
+ private final AMQShortString _exchange = new AMQShortString("exchange");
+ private final AMQShortString _routingKey = new AMQShortString("routingKey");
public void setUp()
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java b/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java
index 35998de3a1..de73a2ff88 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java
@@ -20,14 +20,14 @@
*/
package org.apache.qpid.pool;
+import junit.framework.TestCase;
+
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import junit.framework.TestCase;
-
public class ReferenceCountingExecutorServiceTest extends TestCase
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java
index 288946e064..69b04c9979 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java
@@ -17,11 +17,13 @@
*/
package org.apache.qpid.ssl;
-import java.io.IOException;
+import org.apache.qpid.test.utils.QpidTestCase;
+import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
-import org.apache.qpid.test.utils.QpidTestCase;
+import java.io.IOException;
public class SSLContextFactoryTest extends QpidTestCase
{
@@ -29,12 +31,13 @@ public class SSLContextFactoryTest extends QpidTestCase
private static final String CLIENT_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_keystore.jks";
private static final String CLIENT_TRUSTSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_truststore.jks";
private static final String STORE_PASSWORD = "password";
- private static final String CERT_TYPE = "SunX509";
+ private static final String DEFAULT_KEY_MANAGER_ALGORITHM = KeyManagerFactory.getDefaultAlgorithm();
+ private static final String DEFAULT_TRUST_MANAGER_ALGORITHM = TrustManagerFactory.getDefaultAlgorithm();
private static final String CERT_ALIAS_APP1 = "app1";
public void testBuildServerContext() throws Exception
{
- SSLContext context = SSLContextFactory.buildServerContext(BROKER_KEYSTORE_PATH, STORE_PASSWORD, CERT_TYPE);
+ SSLContext context = SSLContextFactory.buildServerContext(BROKER_KEYSTORE_PATH, STORE_PASSWORD, DEFAULT_KEY_MANAGER_ALGORITHM);
assertNotNull("SSLContext should not be null", context);
}
@@ -42,7 +45,7 @@ public class SSLContextFactoryTest extends QpidTestCase
{
try
{
- SSLContextFactory.buildServerContext(BROKER_KEYSTORE_PATH, "sajdklsad", CERT_TYPE);
+ SSLContextFactory.buildServerContext(BROKER_KEYSTORE_PATH, "sajdklsad", DEFAULT_KEY_MANAGER_ALGORITHM);
fail("Exception was not thrown due to incorrect password");
}
catch (IOException e)
@@ -55,7 +58,7 @@ public class SSLContextFactoryTest extends QpidTestCase
{
try
{
- SSLContextFactory.buildClientContext("/path/to/nothing", STORE_PASSWORD, CERT_TYPE, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, CERT_TYPE, null);
+ SSLContextFactory.buildClientContext("/path/to/nothing", STORE_PASSWORD, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, DEFAULT_KEY_MANAGER_ALGORITHM, null);
fail("Exception was not thrown due to incorrect path");
}
catch (IOException e)
@@ -66,19 +69,19 @@ public class SSLContextFactoryTest extends QpidTestCase
public void testBuildClientContextForSSLEncryptionOnly() throws Exception
{
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, CERT_TYPE, null, null, null, null);
+ SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, DEFAULT_TRUST_MANAGER_ALGORITHM, null, null, null, null);
assertNotNull("SSLContext should not be null", context);
}
public void testBuildClientContextWithForClientAuth() throws Exception
{
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, CERT_TYPE, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, CERT_TYPE, null);
+ SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, DEFAULT_KEY_MANAGER_ALGORITHM, null);
assertNotNull("SSLContext should not be null", context);
}
public void testBuildClientContextWithForClientAuthWithCertAlias() throws Exception
{
- SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, CERT_TYPE, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, CERT_TYPE, CERT_ALIAS_APP1);
+ SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, DEFAULT_KEY_MANAGER_ALGORITHM, CERT_ALIAS_APP1);
assertNotNull("SSLContext should not be null", context);
}
}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java
index e69f95f916..94db7d8dde 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/test/utils/QpidTestCase.java
@@ -20,19 +20,22 @@
*/
package org.apache.qpid.test.utils;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.ServerSocket;
-import java.util.*;
-
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
public class QpidTestCase extends TestCase
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java
index 57c0549193..fc4f5374f0 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java
@@ -20,12 +20,17 @@
*/
package org.apache.qpid.transport;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.TrustManagerFactory;
+
import org.apache.qpid.configuration.ClientProperties;
import org.apache.qpid.test.utils.QpidTestCase;
public class ConnectionSettingsTest extends QpidTestCase
{
- ConnectionSettings _conConnectionSettings;
+ private static final String TEST_ALGORITHM_NAME = "algorithmName";
+
+ private ConnectionSettings _conConnectionSettings;
protected void setUp() throws Exception
{
@@ -33,37 +38,137 @@ public class ConnectionSettingsTest extends QpidTestCase
_conConnectionSettings = new ConnectionSettings();
}
- public void testDefaultTCP_NODELAY()
+ public void testTcpNoDelayDefault()
{
assertTrue("Default for isTcpNodelay() should be true", _conConnectionSettings.isTcpNodelay());
}
- public void testSystemPropertyOverrideTrueForTCP_NODELAY()
+ public void testTcpNoDelayOverrideTrue()
{
- systemPropertyOverrideForTCP_NODELAYImpl(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, true);
+ systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, true);
}
- public void testSystemPropertyOverrideFalseForTCP_NODELAY()
+ public void testTcpNoDelayOverrideFalse()
{
- systemPropertyOverrideForTCP_NODELAYImpl(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, false);
+ systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, false);
}
- public void testLegacySystemPropertyOverrideTrueForTCP_NODELAY()
+ @SuppressWarnings("deprecation")
+ public void testTcpNoDelayLegacyOverrideTrue()
{
- systemPropertyOverrideForTCP_NODELAYImpl(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, true);
+ systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, true);
}
- public void testLegacySystemPropertyOverrideFalseForTCP_NODELAY()
+ @SuppressWarnings("deprecation")
+ public void testTcpNoDelayLegacyOverrideFalse()
{
- systemPropertyOverrideForTCP_NODELAYImpl(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, false);
+ systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, false);
}
- private void systemPropertyOverrideForTCP_NODELAYImpl(String propertyName, boolean value)
+ public void testKeyManagerFactoryAlgorithmDefault()
{
- //set the default via system property
- setTestSystemProperty(propertyName, String.valueOf(value));
+ assertEquals(KeyManagerFactory.getDefaultAlgorithm(), _conConnectionSettings.getKeyManagerFactoryAlgorithm());
+ }
- _conConnectionSettings = new ConnectionSettings();
+ public void testKeyManagerFactoryAlgorithmOverridden()
+ {
+ String algorithmName = TEST_ALGORITHM_NAME;
+ systemPropertyOverrideForKeyFactoryAlgorithm(ClientProperties.QPID_SSL_KEY_MANAGER_FACTORY_ALGORITHM_PROP_NAME, algorithmName);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testKeyManagerFactoryAlgorithmLegacyOverridden()
+ {
+ String algorithmName = TEST_ALGORITHM_NAME;
+ systemPropertyOverrideForKeyFactoryAlgorithm(ClientProperties.QPID_SSL_KEY_STORE_CERT_TYPE_PROP_NAME, algorithmName);
+ }
+
+ public void testTrustManagerFactoryAlgorithmDefault()
+ {
+ assertEquals(TrustManagerFactory.getDefaultAlgorithm(), _conConnectionSettings.getTrustManagerFactoryAlgorithm());
+ }
+
+ public void testTrustManagerFactoryAlgorithmOverridden()
+ {
+ String algorithmName = TEST_ALGORITHM_NAME;
+ systemPropertyOverrideForTrustFactoryAlgorithm(ClientProperties.QPID_SSL_TRUST_MANAGER_FACTORY_ALGORITHM_PROP_NAME, algorithmName);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testTrustManagerFactoryAlgorithmLegacyOverridden()
+ {
+ String algorithmName = TEST_ALGORITHM_NAME;
+ systemPropertyOverrideForTrustFactoryAlgorithm(ClientProperties.QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME, algorithmName);
+ }
+
+ public void testSendBufferSizeDefault()
+ {
+ assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getWriteBufferSize());
+ }
+
+ public void testSendBufferSizeOverridden()
+ {
+ systemPropertyOverrideForSocketBufferSize(ClientProperties.SEND_BUFFER_SIZE_PROP_NAME, 1024, false);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testtestSendBufferSizeOverriddenLegacyOverridden()
+ {
+ systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_SEND_BUFFER_SIZE_PROP_NAME, 1024, false);
+ }
+
+ public void testReceiveBufferSizeDefault()
+ {
+ assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getReadBufferSize());
+ }
+
+ public void testReceiveBufferSizeOverridden()
+ {
+ systemPropertyOverrideForSocketBufferSize(ClientProperties.RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testtestReceiveBufferSizeOverriddenLegacyOverridden()
+ {
+ systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true);
+ }
+
+ private void systemPropertyOverrideForTcpDelay(String propertyName, boolean value)
+ {
+ resetSystemProperty(propertyName, String.valueOf(value));
assertEquals("Value for isTcpNodelay() is incorrect", value, _conConnectionSettings.isTcpNodelay());
}
+
+ private void systemPropertyOverrideForKeyFactoryAlgorithm(String propertyName, String value)
+ {
+ resetSystemProperty(propertyName, value);
+ assertEquals(value, _conConnectionSettings.getKeyManagerFactoryAlgorithm());
+ }
+
+ private void systemPropertyOverrideForTrustFactoryAlgorithm(String propertyName, String value)
+ {
+ resetSystemProperty(propertyName, value);
+ assertEquals(value, _conConnectionSettings.getTrustManagerFactoryAlgorithm());
+ }
+
+
+ private void systemPropertyOverrideForSocketBufferSize(String propertyName, int value, boolean read)
+ {
+ resetSystemProperty(propertyName, String.valueOf(value));
+ if(read)
+ {
+ assertEquals("unexpected value for receive buffer", value, _conConnectionSettings.getReadBufferSize());
+ }
+ else
+ {
+ assertEquals("unexpected value for send buffer", value, _conConnectionSettings.getWriteBufferSize());
+ }
+ }
+
+ private void resetSystemProperty(String propertyName, String value)
+ {
+ setTestSystemProperty(propertyName, value);
+
+ _conConnectionSettings = new ConnectionSettings();
+ }
}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java
index 49f6a08007..f3715f351e 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java
@@ -20,6 +20,11 @@
*/
package org.apache.qpid.transport;
+import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.transport.network.ConnectionBinding;
+import org.apache.qpid.transport.network.io.IoAcceptor;
+import org.apache.qpid.transport.util.Waiter;
+
import static org.apache.qpid.transport.Option.EXPECTED;
import static org.apache.qpid.transport.Option.NONE;
import static org.apache.qpid.transport.Option.SYNC;
@@ -31,11 +36,6 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.transport.network.ConnectionBinding;
-import org.apache.qpid.transport.network.io.IoAcceptor;
-import org.apache.qpid.transport.util.Waiter;
-
/**
* ConnectionTest
*/
@@ -170,7 +170,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
}
}
});
- conn.connect("localhost", port, null, "guest", "guest", false);
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
return conn;
}
@@ -275,7 +275,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
Connection conn = new Connection();
conn.addConnectionListener(new FailoverConnectionListener());
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
Session ssn = conn.createSession(1);
ssn.setSessionListener(new TestSessionListener());
@@ -331,7 +331,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
Connection conn = new Connection();
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
conn.addConnectionListener(new FailoverConnectionListener());
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
Session ssn = conn.createSession(1);
ssn.setSessionListener(new TestSessionListener());
@@ -353,7 +353,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
Connection conn = new Connection();
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
Session ssn = conn.createSession();
ssn.sessionFlush(EXPECTED);
send(ssn, "SINK 0");
@@ -367,7 +367,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
startServer();
Connection conn = new Connection();
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
conn.connectionHeartbeat();
conn.close();
}
@@ -378,7 +378,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
Connection conn = new Connection();
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
Session ssn = conn.createSession();
send(ssn, "EXCP 0");
Thread.sleep(3000);
@@ -398,7 +398,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
Connection conn = new Connection();
conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings()));
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
Session ssn = conn.createSession();
send(ssn, "EXCP 0", true);
try
@@ -424,7 +424,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener
public void closed(Connection conn)
{
queue = true;
- conn.connect("localhost", port, null, "guest", "guest");
+ conn.connect("localhost", port, null, "guest", "guest", false, null);
conn.resume();
}
}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java
index 889250e004..14589eb541 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java
@@ -20,14 +20,16 @@
*/
package org.apache.qpid.transport;
+import junit.framework.TestCase;
+
+import static org.apache.qpid.util.Serial.COMPARATOR;
+import static org.apache.qpid.util.Serial.eq;
+
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
-import static org.apache.qpid.util.Serial.*;
-
/**
* RangeSetTest
*
@@ -235,4 +237,117 @@ public class RangeSetTest extends TestCase
assertEquals(d.getUpper(), 10);
}
+ public void testSetSubtract1()
+ {
+ final RangeSet orig = createRangeSet(0, 10) ;
+ final RangeSet update = createRangeSet(3, 15) ;
+ orig.subtract(update) ;
+ checkRange(orig, 0, 2) ;
+ }
+
+ public void testSetSubtract2()
+ {
+ final RangeSet orig = createRangeSet(0, 10) ;
+ final RangeSet update = createRangeSet(3, 10) ;
+ orig.subtract(update) ;
+ checkRange(orig, 0, 2) ;
+ }
+
+ public void testSetSubtract3()
+ {
+ final RangeSet orig = createRangeSet(0, 10) ;
+ final RangeSet update = createRangeSet(3, 4) ;
+ orig.subtract(update) ;
+ checkRange(orig, 0, 2, 5, 10) ;
+ }
+
+ public void testSetSubtract4()
+ {
+ final RangeSet orig = createRangeSet(3, 15) ;
+ final RangeSet update = createRangeSet(0, 10) ;
+ orig.subtract(update) ;
+ checkRange(orig, 11, 15) ;
+ }
+
+ public void testSetSubtract5()
+ {
+ final RangeSet orig = createRangeSet(3, 10) ;
+ final RangeSet update = createRangeSet(0, 10) ;
+ orig.subtract(update) ;
+ checkRange(orig) ;
+ }
+
+ public void testSetSubtract6()
+ {
+ final RangeSet orig = createRangeSet(3, 10) ;
+ final RangeSet update = createRangeSet(0, 15) ;
+ orig.subtract(update) ;
+ checkRange(orig) ;
+ }
+
+ public void testSetSubtract7()
+ {
+ final RangeSet orig = createRangeSet(0, 10) ;
+ final RangeSet update = createRangeSet(0, 15) ;
+ orig.subtract(update) ;
+ checkRange(orig) ;
+ }
+
+ public void testSetSubtract8()
+ {
+ final RangeSet orig = createRangeSet(0, 15) ;
+ final RangeSet update = createRangeSet(0, 10) ;
+ orig.subtract(update) ;
+ checkRange(orig, 11, 15) ;
+ }
+
+ public void testSetSubtract9()
+ {
+ final RangeSet orig = createRangeSet(0, 15, 20, 30) ;
+ final RangeSet update = createRangeSet(2, 3, 5, 6, 8, 9, 22, 23, 27, 28) ;
+ orig.subtract(update) ;
+ checkRange(orig, 0, 1, 4, 4, 7, 7, 10, 15, 20, 21, 24, 26, 29, 30) ;
+ }
+
+ public void testSetSubtract10()
+ {
+ final RangeSet orig = createRangeSet(0, 15, 20, 30) ;
+ final RangeSet update = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
+ orig.subtract(update) ;
+ checkRange(orig, 3, 3, 7, 9, 23, 23, 25, 26) ;
+ }
+
+ public void testSetSubtract11()
+ {
+ final RangeSet orig = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
+ final RangeSet update = createRangeSet(0, 2, 4, 6, 10, 22, 24, 24, 27, 30) ;
+ orig.subtract(update) ;
+ checkRange(orig) ;
+ }
+
+ private RangeSet createRangeSet(int ... bounds)
+ {
+ RangeSet set = RangeSetFactory.createRangeSet();
+ final int length = (bounds == null ? 0 : bounds.length) ;
+ int count = 0 ;
+ while(count < length)
+ {
+ set.add(bounds[count++], bounds[count++]) ;
+ }
+ return set ;
+ }
+
+ private void checkRange(final RangeSet rangeSet, int ... bounds)
+ {
+ final int length = (bounds == null ? 0 : bounds.length) ;
+ assertEquals("Range count", length/2, rangeSet.size()) ;
+ final Iterator<Range> iter = rangeSet.iterator() ;
+ int count = 0 ;
+ while(count < length)
+ {
+ final Range range = iter.next() ;
+ assertEquals("Range lower", bounds[count++], range.getLower()) ;
+ assertEquals("Range upper", bounds[count++], range.getUpper()) ;
+ }
+ }
}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/TestNetworkConnection.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/TestNetworkConnection.java
index 8533c64fab..548e8dab12 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/TestNetworkConnection.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/TestNetworkConnection.java
@@ -20,17 +20,16 @@
*/
package org.apache.qpid.transport;
+import org.apache.qpid.protocol.ProtocolEngineFactory;
+import org.apache.qpid.ssl.SSLContextFactory;
+import org.apache.qpid.transport.network.NetworkConnection;
+
import java.net.BindException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
-import org.apache.qpid.protocol.ProtocolEngine;
-import org.apache.qpid.protocol.ProtocolEngineFactory;
-import org.apache.qpid.ssl.SSLContextFactory;
-import org.apache.qpid.transport.network.NetworkConnection;
-
/**
* Test implementation of IoSession, which is required for some tests. Methods not being used are not implemented,
* so if this class is being used and some methods are to be used, then please update those.
@@ -67,12 +66,6 @@ public class TestNetworkConnection implements NetworkConnection
return (_remoteAddress != null) ? _remoteAddress : new InetSocketAddress(_remoteHost, _port);
}
- public void open(int port, InetAddress destination, ProtocolEngine engine, NetworkTransportConfiguration config,
- SSLContextFactory sslFactory) throws OpenException
- {
-
- }
-
public void setMaxReadIdle(int idleTime)
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
index 7039b904e3..c882d3437e 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
@@ -21,10 +21,6 @@
package org.apache.qpid.transport.network;
-import java.nio.ByteBuffer;
-
-import javax.net.ssl.SSLContext;
-
import org.apache.qpid.framing.ProtocolVersion;
import org.apache.qpid.protocol.ProtocolEngineFactory;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -34,6 +30,9 @@ import org.apache.qpid.transport.Receiver;
import org.apache.qpid.transport.TransportException;
import org.apache.qpid.transport.network.io.IoNetworkTransport;
+import javax.net.ssl.SSLContext;
+import java.nio.ByteBuffer;
+
public class TransportTest extends QpidTestCase
{
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java
index e075681acb..641bc5fa34 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java
@@ -24,12 +24,10 @@ import org.apache.qpid.transport.Binding;
import org.apache.qpid.transport.TransportException;
import java.io.IOException;
-
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
-
import java.nio.ByteBuffer;
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java
index 215c6d9931..e9005ab2e4 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java
@@ -19,13 +19,13 @@
package org.apache.qpid.transport.network.io;
-import java.net.Socket;
-import java.nio.ByteBuffer;
-
import org.apache.qpid.transport.Binding;
import org.apache.qpid.transport.Sender;
import org.apache.qpid.transport.util.Logger;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+
/**
* This class provides a socket based transport using the java.io
* classes.
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java
index 0b393a489f..53626b6658 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java
@@ -20,12 +20,12 @@
*/
package org.apache.qpid.util;
+import junit.framework.TestCase;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
-import junit.framework.TestCase;
-
public class ByteBufferInputStreamTest extends TestCase
{
private byte[] _data = {2, 1, 5, 3, 4};
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
index 942901f1c0..7ba5038faa 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
@@ -21,8 +21,9 @@
package org.apache.qpid.util;
-import junit.framework.*;
-
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java
index 9fd18d461a..c5464aab79 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java
@@ -40,9 +40,4 @@ public class PropertyUtilsTest extends QpidTestCase
String expandedProperty = PropertyUtils.replaceProperties("${banana}xyz${concrete}");
assertEquals(expandedProperty, "fruityxyzhorrible");
}
-
- public static junit.framework.Test suite()
- {
- return new junit.framework.TestSuite(PropertyUtilsTest.class);
- }
}
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java
index b2578563e0..ef8e7de61c 100644
--- a/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java
+++ b/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java
@@ -23,10 +23,6 @@ package org.apache.qpid.util;
import junit.framework.TestCase;
-import java.util.Random;
-
-import org.apache.qpid.SerialException;
-
/**
*Junit tests for the Serial class
*/