diff options
Diffstat (limited to 'qpid/java/common/src/test')
32 files changed, 0 insertions, 7658 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 deleted file mode 100644 index 9fceef337c..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/AMQExceptionTest.java +++ /dev/null @@ -1,120 +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; - -import junit.framework.TestCase; - -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. - * - * There are three cases: - * Re-throwing an AMQException - * Re-throwing a Subclass of AMQException - * Re-throwing a Subclass of AMQException that does not have the default AMQException constructor which will force the - * creation of an AMQException. - */ -public class AMQExceptionTest extends TestCase -{ - /** - * Test that an AMQException will be correctly created and rethrown. - */ - public void testRethrowGeneric() - { - AMQException test = new AMQException(AMQConstant.ACCESS_REFUSED, "refused", new RuntimeException()); - - AMQException e = reThrowException(test); - - assertEquals("Exception not of correct class", AMQException.class, e.getClass()); - - } - - /** - * Test that a subclass of AMQException that has the default constructor will be correctly created and rethrown. - */ - public void testRethrowAMQESubclass() - { - AMQFrameDecodingException test = new AMQFrameDecodingException(AMQConstant.INTERNAL_ERROR, - "Error", - new Exception()); - AMQException e = reThrowException(test); - - assertEquals("Exception not of correct class", AMQFrameDecodingException.class, e.getClass()); - } - - /** - * Test that a subclass of AMQException that doesnot have the default constructor will be correctly rethrown as an - * AMQException - */ - public void testRethrowAMQESubclassNoConstructor() - { - AMQExceptionSubclass test = new AMQExceptionSubclass("Invalid Argument Exception"); - - AMQException e = reThrowException(test); - - assertEquals("Exception not of correct class", AMQException.class, e.getClass()); - } - - /** - * Private method to rethrown and validate the basic values of the rethrown - * @param test Exception to rethrow - * @throws AMQException the rethrown exception - */ - private AMQException reThrowException(AMQException test) - { - AMQException amqe = test.cloneForCurrentThread(); - - assertEquals("Error code does not match.", test.getErrorCode(), amqe.getErrorCode()); - assertTrue("Exception message does not start as expected.", amqe.getMessage().startsWith(test.getMessage())); - assertEquals("Test Exception is not set as the cause", test, amqe.getCause()); - assertEquals("Cause is not correct", test.getCause(), amqe.getCause().getCause()); - - return amqe; - } - - public void testGetMessageAsString() - { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < 25; i++) - { - sb.append("message [" + i + "]"); - } - AMQException e = new AMQException(AMQConstant.INTERNAL_ERROR, sb.toString(), null); - AMQShortString message = AMQShortString.validValueOf(e.getMessage()); - assertEquals(sb.substring(0, AMQShortString.MAX_LENGTH - 3) + "...", message.toString()); - } - - /** - * Private class that extends AMQException but does not have a default exception. - */ - private class AMQExceptionSubclass extends AMQException - { - - public AMQExceptionSubclass(String msg) - { - super(null, msg, null); - } - } -} - 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 deleted file mode 100644 index e597192766..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/codec/AMQDecoderTest.java +++ /dev/null @@ -1,205 +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.codec; - - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.List; -import java.util.Random; - -import junit.framework.TestCase; - -import org.apache.qpid.framing.AMQBody; -import org.apache.qpid.framing.AMQDataBlock; -import org.apache.qpid.framing.AMQFrame; -import org.apache.qpid.framing.AMQFrameDecodingException; -import org.apache.qpid.framing.AMQProtocolVersionException; -import org.apache.qpid.framing.ContentBody; -import org.apache.qpid.framing.FrameCreatingMethodProcessor; -import org.apache.qpid.framing.HeartbeatBody; -import org.apache.qpid.framing.ProtocolVersion; -import org.apache.qpid.util.BytesDataOutput; - -public class AMQDecoderTest extends TestCase -{ - - private AMQDecoder _decoder; - private FrameCreatingMethodProcessor _methodProcessor; - - - public void setUp() - { - _methodProcessor = new FrameCreatingMethodProcessor(ProtocolVersion.v0_91); - _decoder = new ClientDecoder(_methodProcessor); - } - - - private ByteBuffer getHeartbeatBodyBuffer() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - HeartbeatBody.FRAME.writePayload(new DataOutputStream(baos)); - return ByteBuffer.wrap(baos.toByteArray()); - } - - public void testSingleFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException - { - ByteBuffer msg = getHeartbeatBodyBuffer(); - _decoder.decodeBuffer(msg); - List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods(); - if (frames.get(0) instanceof AMQFrame) - { - assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType()); - } - else - { - fail("decode was not a frame"); - } - } - - - public void testDecodeWithManyBuffers() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException - { - Random random = new Random(); - final byte[] payload = new byte[2048]; - random.nextBytes(payload); - final AMQBody body = new ContentBody(payload); - AMQFrame frame = new AMQFrame(1, body); - byte[] outputBuf = new byte[4096]; - BytesDataOutput dataOutput = new BytesDataOutput(outputBuf); - frame.writePayload(dataOutput); - for(int i = 0 ; i < dataOutput.length(); i++) - { - _decoder.decodeBuffer(ByteBuffer.wrap(outputBuf, i, 1)); - - } - List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods(); - if (frames.get(0) instanceof AMQFrame) - { - assertEquals(ContentBody.TYPE, ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType()); - ContentBody decodedBody = (ContentBody) ((AMQFrame) frames.get(0)).getBodyFrame(); - assertTrue("Body was corrupted", Arrays.equals(payload, decodedBody.getPayload())); - } - else - { - fail("decode was not a frame"); - } - } - - public void testPartialFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException - { - ByteBuffer msg = getHeartbeatBodyBuffer(); - ByteBuffer msgA = msg.slice(); - int msgbPos = msg.remaining() / 2; - int msgaLimit = msg.remaining() - msgbPos; - msgA.limit(msgaLimit); - msg.position(msgbPos); - ByteBuffer msgB = msg.slice(); - - _decoder.decodeBuffer(msgA); - List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods(); - assertEquals(0, frames.size()); - - _decoder.decodeBuffer(msgB); - assertEquals(1, frames.size()); - if (frames.get(0) instanceof AMQFrame) - { - assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frames.get(0)).getBodyFrame().getFrameType()); - } - else - { - fail("decode was not a frame"); - } - } - - public void testMultipleFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException - { - ByteBuffer msgA = getHeartbeatBodyBuffer(); - ByteBuffer msgB = getHeartbeatBodyBuffer(); - ByteBuffer msg = ByteBuffer.allocate(msgA.remaining() + msgB.remaining()); - msg.put(msgA); - msg.put(msgB); - msg.flip(); - _decoder.decodeBuffer(msg); - List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods(); - assertEquals(2, frames.size()); - for (AMQDataBlock frame : frames) - { - if (frame instanceof AMQFrame) - { - assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frame).getBodyFrame().getFrameType()); - } - else - { - fail("decode was not a frame"); - } - } - } - - public void testMultiplePartialFrameDecode() throws AMQProtocolVersionException, AMQFrameDecodingException, IOException - { - ByteBuffer msgA = getHeartbeatBodyBuffer(); - ByteBuffer msgB = getHeartbeatBodyBuffer(); - ByteBuffer msgC = getHeartbeatBodyBuffer(); - - ByteBuffer sliceA = ByteBuffer.allocate(msgA.remaining() + msgB.remaining() / 2); - sliceA.put(msgA); - int limit = msgB.limit(); - int pos = msgB.remaining() / 2; - msgB.limit(pos); - sliceA.put(msgB); - sliceA.flip(); - msgB.limit(limit); - msgB.position(pos); - - ByteBuffer sliceB = ByteBuffer.allocate(msgB.remaining() + pos); - sliceB.put(msgB); - msgC.limit(pos); - sliceB.put(msgC); - sliceB.flip(); - msgC.limit(limit); - - _decoder.decodeBuffer(sliceA); - List<AMQDataBlock> frames = _methodProcessor.getProcessedMethods(); - assertEquals(1, frames.size()); - frames.clear(); - _decoder.decodeBuffer(sliceB); - assertEquals(1, frames.size()); - frames.clear(); - _decoder.decodeBuffer(msgC); - assertEquals(1, frames.size()); - for (AMQDataBlock frame : frames) - { - if (frame instanceof AMQFrame) - { - assertEquals(HeartbeatBody.FRAME.getBodyFrame().getFrameType(), ((AMQFrame) frame).getBodyFrame().getFrameType()); - } - else - { - fail("decode was not a frame"); - } - } - } - -} 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 deleted file mode 100644 index 335270264c..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/configuration/QpidPropertyTest.java +++ /dev/null @@ -1,185 +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.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); - } - - public void testFloatValueReadFromSystemProperty() throws Exception - { - float expectedValue = 1.5f; - setTestSystemProperty(_systemPropertyName, Float.valueOf(expectedValue).toString()); - assertSystemPropertiesSet(_systemPropertyName); - - float propertyValue = QpidProperty.floatProperty(1.5f, _systemPropertyName).get(); - assertEquals(expectedValue, propertyValue, 0.1); - } - - public void testFloatValueIsDefaultWhenOneSystemPropertyIsNotSet() throws Exception - { - float expectedValue = 1.5f; - assertSystemPropertiesNotSet(_systemPropertyName); - - float propertyValue = QpidProperty.floatProperty(expectedValue, _systemPropertyName).get(); - assertEquals(expectedValue, propertyValue, 0.1); - } - - 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 deleted file mode 100644 index 61ac04213e..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/AMQShortStringTest.java +++ /dev/null @@ -1,349 +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.framing; - -import junit.framework.TestCase; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -public class AMQShortStringTest extends TestCase -{ - - public static final AMQShortString HELLO = new AMQShortString("Hello"); - public static final AMQShortString HELL = new AMQShortString("Hell"); - public static final AMQShortString GOODBYE = new AMQShortString("Goodbye"); - public static final AMQShortString GOOD = new AMQShortString("Good"); - public static final AMQShortString BYE = new AMQShortString("BYE"); - - public void testStartsWith() - { - assertTrue(HELLO.startsWith(HELL)); - - assertFalse(HELL.startsWith(HELLO)); - - assertTrue(GOODBYE.startsWith(GOOD)); - - assertFalse(GOOD.startsWith(GOODBYE)); - } - - public void testEndWith() - { - assertFalse(HELL.endsWith(HELLO)); - - assertTrue(GOODBYE.endsWith(new AMQShortString("bye"))); - - assertFalse(GOODBYE.endsWith(BYE)); - } - - - public void testTokenize() - { - AMQShortString dotSeparatedWords = new AMQShortString("this.is.a.test.with.1.2.3.-numbers-and-then--dashes-"); - AMQShortStringTokenizer dotTokenizer = dotSeparatedWords.tokenize((byte) '.'); - - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(new AMQShortString("this"),(dotTokenizer.nextToken())); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(new AMQShortString("is"),(dotTokenizer.nextToken())); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(new AMQShortString("a"),(dotTokenizer.nextToken())); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(new AMQShortString("test"),(dotTokenizer.nextToken())); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(new AMQShortString("with"),(dotTokenizer.nextToken())); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(dotTokenizer.nextToken().toIntValue() , 1); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(dotTokenizer.nextToken().toIntValue() , 2); - assertTrue(dotTokenizer.hasMoreTokens()); - assertEquals(dotTokenizer.nextToken().toIntValue() , 3); - assertTrue(dotTokenizer.hasMoreTokens()); - AMQShortString dashString = dotTokenizer.nextToken(); - assertEquals(new AMQShortString("-numbers-and-then--dashes-"),(dashString)); - - AMQShortStringTokenizer dashTokenizer = dashString.tokenize((byte)'-'); - assertEquals(dashTokenizer.countTokens(), 7); - - AMQShortString[] expectedResults = new AMQShortString[] - { AMQShortString.EMPTY_STRING, - new AMQShortString("numbers"), - new AMQShortString("and"), - new AMQShortString("then"), - AMQShortString.EMPTY_STRING, - new AMQShortString("dashes"), - AMQShortString.EMPTY_STRING }; - - for(int i = 0; i < 7; i++) - { - assertTrue(dashTokenizer.hasMoreTokens()); - assertEquals(dashTokenizer.nextToken(), expectedResults[i]); - } - - assertFalse(dotTokenizer.hasMoreTokens()); - } - - - public void testEquals() - { - assertEquals(GOODBYE, new AMQShortString("Goodbye")); - assertEquals(new AMQShortString("A"), new AMQShortString("A")); - assertFalse(new AMQShortString("A").equals(new AMQShortString("a"))); - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(byte[])}. - */ - public void testCreateAMQShortStringByteArray() - { - byte[] bytes = null; - try - { - bytes = "test".getBytes("UTF-8"); - } - catch (UnsupportedEncodingException e) - { - fail("UTF-8 encoding is not supported anymore by JVM:" + e.getMessage()); - } - AMQShortString string = new AMQShortString(bytes); - assertEquals("constructed amq short string length differs from expected", 4, string.length()); - assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test")); - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.String)} - * <p> - * Tests short string construction from string with length less than 255. - */ - public void testCreateAMQShortStringString() - { - AMQShortString string = new AMQShortString("test"); - assertEquals("constructed amq short string length differs from expected", 4, string.length()); - assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test")); - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(char[])}. - * <p> - * Tests short string construction from char array with length less than 255. - */ - public void testCreateAMQShortStringCharArray() - { - char[] chars = "test".toCharArray(); - AMQShortString string = new AMQShortString(chars); - assertEquals("constructed amq short string length differs from expected", 4, string.length()); - assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test")); - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.CharSequence)} - * <p> - * Tests short string construction from char sequence with length less than 255. - */ - public void testCreateAMQShortStringCharSequence() - { - AMQShortString string = new AMQShortString((CharSequence) "test"); - assertEquals("constructed amq short string length differs from expected", 4, string.length()); - assertTrue("constructed amq short string differs from expected", string.equalsCharSequence("test")); - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(byte[])}. - * <p> - * Tests an attempt to create an AMQP short string from byte array with length over 255. - */ - public void testCreateAMQShortStringByteArrayOver255() - { - String test = buildString('a', 256); - byte[] bytes = null; - try - { - bytes = test.getBytes("UTF-8"); - } - catch (UnsupportedEncodingException e) - { - fail("UTF-8 encoding is not supported anymore by JVM:" + e.getMessage()); - } - try - { - new AMQShortString(bytes); - fail("It should not be possible to create AMQShortString with length over 255"); - } - catch (IllegalArgumentException e) - { - assertEquals("Exception message differs from expected", - "Cannot create AMQShortString with number of octets over 255!", e.getMessage()); - } - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.String)} - * <p> - * Tests an attempt to create an AMQP short string from string with length over 255 - */ - public void testCreateAMQShortStringStringOver255() - { - String test = buildString('a', 256); - try - { - new AMQShortString(test); - fail("It should not be possible to create AMQShortString with length over 255"); - } - catch (IllegalArgumentException e) - { - assertEquals("Exception message differs from expected", - "Cannot create AMQShortString with number of octets over 255!", e.getMessage()); - } - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(char[])}. - * <p> - * Tests an attempt to create an AMQP short string from char array with length over 255. - */ - public void testCreateAMQShortStringCharArrayOver255() - { - String test = buildString('a', 256); - char[] chars = test.toCharArray(); - try - { - new AMQShortString(chars); - fail("It should not be possible to create AMQShortString with length over 255"); - } - catch (IllegalArgumentException e) - { - assertEquals("Exception message differs from expected", - "Cannot create AMQShortString with number of octets over 255!", e.getMessage()); - } - } - - /** - * Test method for - * {@link org.apache.qpid.framing.AMQShortString#AMQShortString(java.lang.CharSequence)} - * <p> - * Tests an attempt to create an AMQP short string from char sequence with length over 255. - */ - public void testCreateAMQShortStringCharSequenceOver255() - { - String test = buildString('a', 256); - try - { - new AMQShortString((CharSequence) test); - fail("It should not be possible to create AMQShortString with length over 255"); - } - catch (IllegalArgumentException e) - { - assertEquals("Exception message differs from expected", - "Cannot create AMQShortString with number of octets over 255!", e.getMessage()); - } - } - - /** - * Tests joining of short strings into a short string with length over 255. - */ - public void testJoinOverflow() - { - List<AMQShortString> data = new ArrayList<AMQShortString>(); - for (int i = 0; i < 25; i++) - { - data.add(new AMQShortString("test data!")); - } - try - { - AMQShortString.join(data, new AMQShortString(" ")); - fail("It should not be possible to create AMQShortString with length over 255"); - } - catch (IllegalArgumentException e) - { - assertEquals("Exception message differs from expected", - "Cannot create AMQShortString with number of octets over 255!", e.getMessage()); - } - } - - /** - * Tests joining of short strings into a short string with length less than 255. - */ - public void testJoin() - { - StringBuilder expected = new StringBuilder(); - List<AMQShortString> data = new ArrayList<AMQShortString>(); - data.add(new AMQShortString("test data 1")); - expected.append("test data 1"); - data.add(new AMQShortString("test data 2")); - expected.append(" test data 2"); - AMQShortString result = AMQShortString.join(data, new AMQShortString(" ")); - assertEquals("join result differs from expected", expected.toString(), result.asString()); - } - - public void testValueOf() - { - String string = buildString('a', 255); - AMQShortString shortString = AMQShortString.valueOf(string, true, true); - assertEquals("Unexpected string from valueOf", string, shortString.asString()); - } - - public void testValueOfTruncated() - { - String string = buildString('a', 256); - AMQShortString shortString = AMQShortString.valueOf(string, true, true); - assertEquals("Unexpected truncated string from valueOf", string.substring(0, AMQShortString.MAX_LENGTH -3) + "...", shortString.asString()); - } - - public void testValueOfNulAsEmptyString() - { - AMQShortString shortString = AMQShortString.valueOf(null, true, true); - assertEquals("Unexpected empty string from valueOf", AMQShortString.EMPTY_STRING, shortString); - } - - public void testValueOfNullAsNull() - { - AMQShortString shortString = AMQShortString.valueOf(null, true, false); - assertEquals("Unexpected null string from valueOf", null, shortString); - } - - /** - * A helper method to generate a string with given length containing given - * character - * - * @param ch - * char to build string with - * @param length - * target string length - * @return string - */ - private String buildString(char ch, int length) - { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < length; i++) - { - sb.append(ch); - } - return sb.toString(); - } - -} 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 deleted file mode 100644 index 4902e8ad64..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java +++ /dev/null @@ -1,194 +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.framing; - -import junit.framework.TestCase; - -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 -{ - - 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 - */ - public BasicContentHeaderPropertiesTest() - { - _testProperties = new BasicContentHeaderProperties(); - } - - public void setUp() - { - _testTable = new FieldTable(); - _testTable.setString("TestString", _testString); - _testTable.setInteger("Testint", _testint); - _testProperties = new BasicContentHeaderProperties(); - _testProperties.setHeaders(_testTable); - } - - public void testGetPropertyListSize() - { - //needs a better test but at least we're exercising the code ! - // FT length is encoded in an int - int expectedSize = EncodingUtils.encodedIntegerLength(); - - expectedSize += EncodingUtils.encodedShortStringLength("TestInt"); - // 1 is for the Encoding Letter. here an 'i' - expectedSize += 1 + EncodingUtils.encodedIntegerLength(); - - expectedSize += EncodingUtils.encodedShortStringLength("TestString"); - // 1 is for the Encoding Letter. here an 'S' - expectedSize += 1 + EncodingUtils.encodedLongStringLength(_testString); - - - int size = _testProperties.getPropertyListSize(); - - assertEquals(expectedSize, size); - } - - public void testGetSetPropertyFlags() - { - _testProperties.setPropertyFlags(99); - assertEquals(99, _testProperties.getPropertyFlags()); - } - - public void testWritePropertyListPayload() throws IOException - { - _testProperties.writePropertyListPayload(new DataOutputStream(new ByteArrayOutputStream(300))); - } - - public void testPopulatePropertiesFromBuffer() throws Exception - { - DataInputStream buf = new DataInputStream(new ByteArrayInputStream(new byte[300])); - _testProperties.populatePropertiesFromBuffer(buf, 99, 99); - } - - public void testSetGetContentType() - { - String contentType = "contentType"; - _testProperties.setContentType(contentType); - assertEquals(contentType, _testProperties.getContentTypeAsString()); - } - - public void testSetGetEncoding() - { - String encoding = "encoding"; - _testProperties.setEncoding(encoding); - assertEquals(encoding, _testProperties.getEncodingAsString()); - } - - public void testSetGetHeaders() - { - _testProperties.setHeaders(_testTable); - assertEquals(_testTable, _testProperties.getHeaders()); - } - - public void testSetGetDeliveryMode() - { - byte deliveryMode = 1; - _testProperties.setDeliveryMode(deliveryMode); - assertEquals(deliveryMode, _testProperties.getDeliveryMode()); - } - - public void testSetGetPriority() - { - byte priority = 1; - _testProperties.setPriority(priority); - assertEquals(priority, _testProperties.getPriority()); - } - - public void testSetGetCorrelationId() - { - String correlationId = "correlationId"; - _testProperties.setCorrelationId(correlationId); - assertEquals(correlationId, _testProperties.getCorrelationIdAsString()); - } - - public void testSetGetReplyTo() - { - String replyTo = "replyTo"; - _testProperties.setReplyTo(replyTo); - assertEquals(replyTo, _testProperties.getReplyToAsString()); - } - - public void testSetGetExpiration() - { - long expiration = 999999999; - _testProperties.setExpiration(expiration); - assertEquals(expiration, _testProperties.getExpiration()); - expiration = 0l; - _testProperties.setExpiration(expiration); - assertEquals(expiration, _testProperties.getExpiration()); - } - - public void testSetGetMessageId() - { - String messageId = "messageId"; - _testProperties.setMessageId(messageId); - assertEquals(messageId, _testProperties.getMessageIdAsString()); - } - - public void testSetGetTimestamp() - { - long timestamp = System.currentTimeMillis(); - _testProperties.setTimestamp(timestamp); - assertEquals(timestamp, _testProperties.getTimestamp()); - } - - public void testSetGetType() - { - String type = "type"; - _testProperties.setType(type); - assertEquals(type, _testProperties.getTypeAsString()); - } - - public void testSetGetUserId() - { - String userId = "userId"; - _testProperties.setUserId(userId); - assertEquals(userId, _testProperties.getUserIdAsString()); - } - - public void testSetGetAppId() - { - String appId = "appId"; - _testProperties.setAppId(appId); - assertEquals(appId, _testProperties.getAppIdAsString()); - } - - public void testSetGetClusterId() - { - String clusterId = "clusterId"; - _testProperties.setClusterId(clusterId); - assertEquals(clusterId, _testProperties.getClusterIdAsString()); - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java deleted file mode 100644 index 5c05adf997..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/FieldTableTest.java +++ /dev/null @@ -1,949 +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.framing; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import junit.framework.TestCase; -import org.junit.Assert; - -import org.apache.qpid.AMQPInvalidClassException; - -public class FieldTableTest extends TestCase -{ - /** - * Test that setting a similar named value replaces any previous value set on that name - */ - public void testReplacement() - { - FieldTable table1 = new FieldTable(); - // Set a boolean value - table1.setBoolean("value", true); - // Check length of table is correct (<Value length> + <type> + <Boolean length>) - int size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedBooleanLength(); - Assert.assertEquals(size, table1.getEncodedSize()); - - // reset value to an integer - table1.setInteger("value", Integer.MAX_VALUE); - - // Check the length has changed accordingly (<Value length> + <type> + <Integer length>) - size = EncodingUtils.encodedShortStringLength("value") + 1 + EncodingUtils.encodedIntegerLength(); - Assert.assertEquals(size, table1.getEncodedSize()); - - // Check boolean value is null - Assert.assertEquals(null, table1.getBoolean("value")); - // ... and integer value is good - Assert.assertEquals((Integer) Integer.MAX_VALUE, table1.getInteger("value")); - } - - /** - * Set a boolean and check that we can only get it back as a boolean and a string - * Check that attempting to lookup a non existent value returns null - */ - public void testBoolean() - { - FieldTable table1 = new FieldTable(); - table1.setBoolean("value", true); - Assert.assertTrue(table1.propertyExists("value")); - - // Test Getting right value back - Assert.assertEquals((Boolean) true, table1.getBoolean("value")); - - // Check we don't get anything back for other gets - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // except value as a string - Assert.assertEquals("true", table1.getString("value")); - - table1.remove("value"); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getBoolean("Rubbish")); - } - - /** - * Set a byte and check that we can only get it back as a byte and a string - * Check that attempting to lookup a non existent value returns null - */ - public void testByte() - { - FieldTable table1 = new FieldTable(); - table1.setByte("value", Byte.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tests lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Byte.MAX_VALUE, table1.getString("value")); - - table1.remove("value"); - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getByte("Rubbish")); - } - - /** - * Set a short and check that we can only get it back as a short and a string - * Check that attempting to lookup a non existent value returns null - */ - public void testShort() - { - FieldTable table1 = new FieldTable(); - table1.setShort("value", Short.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tests lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Short.MAX_VALUE, table1.getString("value")); - - table1.remove("value"); - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getShort("Rubbish")); - } - - /** - * Set a char and check that we can only get it back as a char - * Check that attempting to lookup a non existent value returns null - */ - public void testChar() - { - FieldTable table1 = new FieldTable(); - table1.setChar("value", 'c'); - Assert.assertTrue(table1.propertyExists("value")); - - // Tests lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(Character.valueOf('c'), table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("c", table1.getString("value")); - - table1.remove("value"); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getCharacter("Rubbish")); - } - - /** - * Set a double and check that we can only get it back as a double - * Check that attempting to lookup a non existent value returns null - */ - public void testDouble() - { - FieldTable table1 = new FieldTable(); - table1.setDouble("value", Double.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tests lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Double.MAX_VALUE, table1.getString("value")); - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getDouble("Rubbish")); - } - - /** - * Set a float and check that we can only get it back as a float - * Check that attempting to lookup a non existent value returns null - */ - public void testFloat() - { - FieldTable table1 = new FieldTable(); - table1.setFloat("value", Float.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tests lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Float.MAX_VALUE, table1.getString("value")); - - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getFloat("Rubbish")); - } - - /** - * Set an int and check that we can only get it back as an int - * Check that attempting to lookup a non existent value returns null - */ - public void testInt() - { - FieldTable table1 = new FieldTable(); - table1.setInteger("value", Integer.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tets lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Integer.MAX_VALUE, table1.getString("value")); - - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getInteger("Rubbish")); - } - - /** - * Set a long and check that we can only get it back as a long - * Check that attempting to lookup a non existent value returns null - */ - public void testLong() - { - FieldTable table1 = new FieldTable(); - table1.setLong("value", Long.MAX_VALUE); - Assert.assertTrue(table1.propertyExists("value")); - - // Tets lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - - // ... and a the string value of it. - Assert.assertEquals("" + Long.MAX_VALUE, table1.getString("value")); - - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getLong("Rubbish")); - } - - /** - * Set a double and check that we can only get it back as a double - * Check that attempting to lookup a non existent value returns null - */ - public void testBytes() - { - byte[] bytes = { 99, 98, 97, 96, 95 }; - - FieldTable table1 = new FieldTable(); - table1.setBytes("value", bytes); - Assert.assertTrue(table1.propertyExists("value")); - - // Tets lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - assertBytesEqual(bytes, table1.getBytes("value")); - - // ... and a the string value of it is null - Assert.assertEquals(null, table1.getString("value")); - - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - // Table should now have zero length for encoding - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getBytes("Rubbish")); - } - - /** - * Calls all methods that can be used to check the table is empty - * - getEncodedSize - * - isEmpty - * - length - * - * @param table to check is empty - */ - private void checkEmpty(FieldTable table) - { - Assert.assertEquals(0, table.getEncodedSize()); - Assert.assertTrue(table.isEmpty()); - Assert.assertEquals(0, table.size()); - - Assert.assertEquals(0, table.keySet().size()); - } - - /** - * Set a String and check that we can only get it back as a String - * Check that attempting to lookup a non existent value returns null - */ - public void testString() - { - FieldTable table1 = new FieldTable(); - table1.setString("value", "Hello"); - Assert.assertTrue(table1.propertyExists("value")); - - // Test lookups we shouldn't get anything back for other gets - // we should get right value back for this type .... - Assert.assertEquals(null, table1.getBoolean("value")); - Assert.assertEquals(null, table1.getByte("value")); - Assert.assertEquals(null, table1.getShort("value")); - Assert.assertEquals(null, table1.getCharacter("value")); - Assert.assertEquals(null, table1.getDouble("value")); - Assert.assertEquals(null, table1.getFloat("value")); - Assert.assertEquals(null, table1.getInteger("value")); - Assert.assertEquals(null, table1.getLong("value")); - Assert.assertEquals(null, table1.getBytes("value")); - Assert.assertEquals("Hello", table1.getString("value")); - - // Try setting a null value and read it back - table1.setString("value", null); - - Assert.assertEquals(null, table1.getString("value")); - - // but still contains the value - Assert.assertTrue(table1.containsKey("value")); - - table1.remove("value"); - // but after a removeKey it doesn't - Assert.assertFalse(table1.containsKey("value")); - - checkEmpty(table1); - - // Looking up an invalid value returns null - Assert.assertEquals(null, table1.getString("Rubbish")); - - // Additional Test that haven't been covered for string - table1.setObject("value", "Hello"); - // Check that it was set correctly - Assert.assertEquals("Hello", table1.getString("value")); - } - - /** Check that a nested field table parameter correctly encodes and decodes to a byte buffer. */ - public void testNestedFieldTable() throws IOException - { - byte[] testBytes = new byte[] { 0, 1, 2, 3, 4, 5 }; - - FieldTable outerTable = new FieldTable(); - FieldTable innerTable = new FieldTable(); - - // Put some stuff in the inner table. - innerTable.setBoolean("bool", true); - innerTable.setByte("byte", Byte.MAX_VALUE); - innerTable.setBytes("bytes", testBytes); - innerTable.setChar("char", 'c'); - innerTable.setDouble("double", Double.MAX_VALUE); - innerTable.setFloat("float", Float.MAX_VALUE); - innerTable.setInteger("int", Integer.MAX_VALUE); - innerTable.setLong("long", Long.MAX_VALUE); - innerTable.setShort("short", Short.MAX_VALUE); - innerTable.setString("string", "hello"); - innerTable.setString("null-string", null); - innerTable.setFieldArray("field-array",Arrays.asList("hello",Integer.valueOf(42), Collections.emptyList())); - - // Put the inner table in the outer one. - outerTable.setFieldTable("innerTable", innerTable); - - // Write the outer table into the buffer. - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - outerTable.writeToBuffer(new DataOutputStream(baos)); - - byte[] data = baos.toByteArray(); - - // Extract the table back from the buffer again. - try - { - FieldTable extractedOuterTable = EncodingUtils.readFieldTable(new DataInputStream(new ByteArrayInputStream(data))); - - FieldTable extractedTable = extractedOuterTable.getFieldTable("innerTable"); - - Assert.assertEquals(Boolean.TRUE, extractedTable.getBoolean("bool")); - Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), extractedTable.getByte("byte")); - assertBytesEqual(testBytes, extractedTable.getBytes("bytes")); - Assert.assertEquals(Character.valueOf('c'), extractedTable.getCharacter("char")); - Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), extractedTable.getDouble("double")); - Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), extractedTable.getFloat("float")); - Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), extractedTable.getInteger("int")); - Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), extractedTable.getLong("long")); - Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), extractedTable.getShort("short")); - Assert.assertEquals("hello", extractedTable.getString("string")); - Assert.assertNull(extractedTable.getString("null-string")); - Collection fieldArray = (Collection) extractedTable.get("field-array"); - Assert.assertEquals(3, fieldArray.size()); - Iterator iter = fieldArray.iterator(); - assertEquals("hello",iter.next()); - assertEquals(Integer.valueOf(42), iter.next()); - assertTrue(((Collection)iter.next()).isEmpty()); - } - catch (AMQFrameDecodingException e) - { - fail("Failed to decode field table with nested inner table."); - } - } - - public void testValues() - { - FieldTable table = new FieldTable(); - table.setBoolean("bool", true); - table.setByte("byte", Byte.MAX_VALUE); - byte[] bytes = { 99, 98, 97, 96, 95 }; - table.setBytes("bytes", bytes); - table.setChar("char", 'c'); - table.setDouble("double", Double.MAX_VALUE); - table.setFloat("float", Float.MAX_VALUE); - table.setInteger("int", Integer.MAX_VALUE); - table.setLong("long", Long.MAX_VALUE); - table.setShort("short", Short.MAX_VALUE); - table.setString("string", "Hello"); - table.setString("null-string", null); - - table.setObject("object-bool", true); - table.setObject("object-byte", Byte.MAX_VALUE); - table.setObject("object-bytes", bytes); - table.setObject("object-char", 'c'); - table.setObject("object-double", Double.MAX_VALUE); - table.setObject("object-float", Float.MAX_VALUE); - table.setObject("object-int", Integer.MAX_VALUE); - table.setObject("object-long", Long.MAX_VALUE); - table.setObject("object-short", Short.MAX_VALUE); - table.setObject("object-string", "Hello"); - - try - { - table.setObject("Null-object", null); - fail("null values are not allowed"); - } - catch (AMQPInvalidClassException aice) - { - assertEquals("Null values are not allowed to be set", - AMQPInvalidClassException.INVALID_OBJECT_MSG + "null", aice.getMessage()); - } - - try - { - table.setObject("Unsupported-object", new Exception()); - fail("Non primitive values are not allowed"); - } - catch (AMQPInvalidClassException aice) - { - assertEquals("Non primitive values are not allowed to be set", - AMQPInvalidClassException.INVALID_OBJECT_MSG + Exception.class, aice.getMessage()); - } - - Assert.assertEquals(Boolean.TRUE, table.getBoolean("bool")); - Assert.assertEquals(Byte.valueOf(Byte.MAX_VALUE), table.getByte("byte")); - assertBytesEqual(bytes, table.getBytes("bytes")); - Assert.assertEquals(Character.valueOf('c'), table.getCharacter("char")); - Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table.getDouble("double")); - Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table.getFloat("float")); - Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table.getInteger("int")); - Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table.getLong("long")); - Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table.getShort("short")); - Assert.assertEquals("Hello", table.getString("string")); - Assert.assertNull(table.getString("null-string")); - - Assert.assertEquals(true, table.getObject("object-bool")); - Assert.assertEquals(Byte.MAX_VALUE, table.getObject("object-byte")); - assertBytesEqual(bytes, (byte[]) table.getObject("object-bytes")); - Assert.assertEquals('c', table.getObject("object-char")); - Assert.assertEquals(Double.MAX_VALUE, table.getObject("object-double")); - Assert.assertEquals(Float.MAX_VALUE, table.getObject("object-float")); - Assert.assertEquals(Integer.MAX_VALUE, table.getObject("object-int")); - Assert.assertEquals(Long.MAX_VALUE, table.getObject("object-long")); - Assert.assertEquals(Short.MAX_VALUE, table.getObject("object-short")); - Assert.assertEquals("Hello", table.getObject("object-string")); - } - - public void testWriteBuffer() throws IOException - { - byte[] bytes = { 99, 98, 97, 96, 95 }; - - FieldTable table = new FieldTable(); - table.setBoolean("bool", true); - table.setByte("byte", Byte.MAX_VALUE); - - table.setBytes("bytes", bytes); - table.setChar("char", 'c'); - table.setInteger("int", Integer.MAX_VALUE); - table.setLong("long", Long.MAX_VALUE); - table.setDouble("double", Double.MAX_VALUE); - table.setFloat("float", Float.MAX_VALUE); - table.setShort("short", Short.MAX_VALUE); - table.setString("string", "hello"); - table.setString("null-string", null); - - - ByteArrayOutputStream baos = new ByteArrayOutputStream((int) table.getEncodedSize() + 4); - table.writeToBuffer(new DataOutputStream(baos)); - - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - DataInputStream dis = new DataInputStream(bais); - - - long length = dis.readInt() & 0xFFFFFFFFL; - - FieldTable table2 = new FieldTable(dis, length); - - Assert.assertEquals((Boolean) true, table2.getBoolean("bool")); - Assert.assertEquals((Byte) Byte.MAX_VALUE, table2.getByte("byte")); - assertBytesEqual(bytes, table2.getBytes("bytes")); - Assert.assertEquals((Character) 'c', table2.getCharacter("char")); - Assert.assertEquals(Double.valueOf(Double.MAX_VALUE), table2.getDouble("double")); - Assert.assertEquals(Float.valueOf(Float.MAX_VALUE), table2.getFloat("float")); - Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), table2.getInteger("int")); - Assert.assertEquals(Long.valueOf(Long.MAX_VALUE), table2.getLong("long")); - Assert.assertEquals(Short.valueOf(Short.MAX_VALUE), table2.getShort("short")); - Assert.assertEquals("hello", table2.getString("string")); - Assert.assertNull(table2.getString("null-string")); - } - - public void testEncodingSize() - { - FieldTable result = new FieldTable(); - int size = 0; - - result.setBoolean("boolean", true); - size += 1 + EncodingUtils.encodedShortStringLength("boolean") + EncodingUtils.encodedBooleanLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setByte("byte", (byte) Byte.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("byte") + EncodingUtils.encodedByteLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - byte[] _bytes = { 99, 98, 97, 96, 95 }; - - result.setBytes("bytes", _bytes); - size += 1 + EncodingUtils.encodedShortStringLength("bytes") + 4 + _bytes.length; - Assert.assertEquals(size, result.getEncodedSize()); - - result.setChar("char", (char) 'c'); - size += 1 + EncodingUtils.encodedShortStringLength("char") + EncodingUtils.encodedCharLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setDouble("double", (double) Double.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("double") + EncodingUtils.encodedDoubleLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setFloat("float", (float) Float.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("float") + EncodingUtils.encodedFloatLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setInteger("int", (int) Integer.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("int") + EncodingUtils.encodedIntegerLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setLong("long", (long) Long.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("long") + EncodingUtils.encodedLongLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setShort("short", (short) Short.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("short") + EncodingUtils.encodedShortLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setString("result", "Hello"); - size += 1 + EncodingUtils.encodedShortStringLength("result") + EncodingUtils.encodedLongStringLength("Hello"); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-bool", true); - size += 1 + EncodingUtils.encodedShortStringLength("object-bool") + EncodingUtils.encodedBooleanLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-byte", Byte.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-byte") + EncodingUtils.encodedByteLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-bytes", _bytes); - size += 1 + EncodingUtils.encodedShortStringLength("object-bytes") + 4 + _bytes.length; - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-char", 'c'); - size += 1 + EncodingUtils.encodedShortStringLength("object-char") + EncodingUtils.encodedCharLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-double", Double.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-double") + EncodingUtils.encodedDoubleLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-float", Float.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-float") + EncodingUtils.encodedFloatLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-int", Integer.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-int") + EncodingUtils.encodedIntegerLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-long", Long.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-long") + EncodingUtils.encodedLongLength(); - Assert.assertEquals(size, result.getEncodedSize()); - - result.setObject("object-short", Short.MAX_VALUE); - size += 1 + EncodingUtils.encodedShortStringLength("object-short") + EncodingUtils.encodedShortLength(); - Assert.assertEquals(size, result.getEncodedSize()); - } - - /** - * Additional test for setObject - */ - public void testSetObject() - { - FieldTable table = new FieldTable(); - - // Try setting a non primative object - - try - { - table.setObject("value", this); - fail("Only primative values allowed in setObject"); - } - catch (AMQPInvalidClassException iae) - { - // normal path - } - // so length should be zero - Assert.assertEquals(0, table.getEncodedSize()); - } - - /** - * Additional test checkPropertyName doesn't accept Null - */ - public void testCheckPropertyNameasNull() - { - FieldTable table = new FieldTable(); - - try - { - table.setObject((String) null, "String"); - fail("Null property name is not allowed"); - } - catch (IllegalArgumentException iae) - { - // normal path - } - // so length should be zero - Assert.assertEquals(0, table.getEncodedSize()); - } - - /** - * Additional test checkPropertyName doesn't accept an empty String - */ - public void testCheckPropertyNameasEmptyString() - { - FieldTable table = new FieldTable(); - - try - { - table.setObject("", "String"); - fail("empty property name is not allowed"); - } - catch (IllegalArgumentException iae) - { - // normal path - } - // so length should be zero - Assert.assertEquals(0, table.getEncodedSize()); - } - - /** - * Additional test checkPropertyName doesn't accept an empty String - */ - public void testCheckPropertyNamehasMaxLength() - { - FieldTable table = new FieldTable(true); - - StringBuffer longPropertyName = new StringBuffer(129); - - for (int i = 0; i < 129; i++) - { - longPropertyName.append("x"); - } - - try - { - table.setObject(longPropertyName.toString(), "String"); - fail("property name must be < 128 characters"); - } - catch (IllegalArgumentException iae) - { - // normal path - } - // so length should be zero - Assert.assertEquals(0, table.getEncodedSize()); - } - - /** - * Additional test checkPropertyName starts with a letter - */ - public void testCheckPropertyNameStartCharacterIsLetter() - { - FieldTable table = new FieldTable(true); - - // Try a name that starts with a number - try - { - table.setObject("1", "String"); - fail("property name must start with a letter"); - } - catch (IllegalArgumentException iae) - { - // normal path - } - // so length should be zero - Assert.assertEquals(0, table.getEncodedSize()); - } - - /** - * Additional test checkPropertyName starts with a hash or a dollar - */ - public void testCheckPropertyNameStartCharacterIsHashorDollar() - { - FieldTable table = new FieldTable(true); - - // Try a name that starts with a number - try - { - table.setObject("#", "String"); - table.setObject("$", "String"); - } - catch (IllegalArgumentException iae) - { - fail("property name are allowed to start with # and $s"); - } - } - - /** - * Additional test to test the contents of the table - */ - public void testContents() - { - FieldTable table = new FieldTable(); - - table.setObject("StringProperty", "String"); - - Assert.assertEquals("String", table.getString("StringProperty")); - - // Test Clear - - table.clear(); - - checkEmpty(table); - } - - /** - * Test the contents of the sets - */ - public void testSets() - { - - FieldTable table = new FieldTable(); - - table.setObject("n1", "1"); - table.setObject("n2", "2"); - table.setObject("n3", "3"); - - Assert.assertEquals("1", table.getObject("n1")); - Assert.assertEquals("2", table.getObject("n2")); - Assert.assertEquals("3", table.getObject("n3")); - } - - public void testAddAll() - { - final FieldTable table1 = new FieldTable(); - table1.setInteger("int1", 1); - table1.setInteger("int2", 2); - assertEquals("Unexpected number of entries in table1", 2, table1.size()); - - final FieldTable table2 = new FieldTable(); - table2.setInteger("int3", 3); - table2.setInteger("int4", 4); - assertEquals("Unexpected number of entries in table2", 2, table2.size()); - - table1.addAll(table2); - assertEquals("Unexpected number of entries in table1 after addAll", 4, table1.size()); - assertEquals(Integer.valueOf(3), table1.getInteger("int3")); - } - - public void testAddAllWithEmptyFieldTable() - { - final FieldTable table1 = new FieldTable(); - table1.setInteger("int1", 1); - table1.setInteger("int2", 2); - assertEquals("Unexpected number of entries in table1", 2, table1.size()); - - final FieldTable emptyFieldTable = new FieldTable(); - - table1.addAll(emptyFieldTable); - assertEquals("Unexpected number of entries in table1 after addAll", 2, table1.size()); - } - - /** - * Tests that when copying properties into a new FielTable using the addAll() method, the - * properties are successfully added to the destination table when the source FieldTable - * was created from encoded input bytes, - */ - public void testAddingAllFromFieldTableCreatedUsingEncodedBytes() throws Exception - { - AMQShortString myBooleanTestProperty = new AMQShortString("myBooleanTestProperty"); - - //Create a new FieldTable and use it to encode data into a byte array. - FieldTable encodeTable = new FieldTable(); - encodeTable.put(myBooleanTestProperty, true); - byte[] data = encodeTable.getDataAsBytes(); - int length = data.length; - - //Verify we got the expected mount of encoded data (1B type hdr + 21B for name + 1B type hdr + 1B for boolean) - assertEquals("unexpected data length", 24, length); - - //Create a second FieldTable from the encoded bytes - FieldTable tableFromBytes = new FieldTable(new DataInputStream(new ByteArrayInputStream(data)), length); - - //Create a final FieldTable and addAll() from the table created with encoded bytes - FieldTable destinationTable = new FieldTable(); - assertTrue("unexpected size", destinationTable.isEmpty()); - destinationTable.addAll(tableFromBytes); - - //Verify that the destination table now contains the expected entry - assertEquals("unexpected size", 1, destinationTable.size()); - assertTrue("expected property not present", destinationTable.containsKey(myBooleanTestProperty)); - assertTrue("unexpected property value", destinationTable.getBoolean(myBooleanTestProperty)); - } - - private void assertBytesEqual(byte[] expected, byte[] actual) - { - Assert.assertEquals(expected.length, actual.length); - - for (int index = 0; index < expected.length; index++) - { - Assert.assertEquals(expected[index], actual[index]); - } - } - - public static junit.framework.Test suite() - { - return new junit.framework.TestSuite(FieldTableTest.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 deleted file mode 100644 index aece8ed4e2..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java +++ /dev/null @@ -1,100 +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.framing.abstraction; - -import junit.framework.TestCase; - -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.framing.MessagePublishInfo; - -public class MessagePublishInfoImplTest extends TestCase -{ - private MessagePublishInfo _mpi; - private final AMQShortString _exchange = new AMQShortString("exchange"); - private final AMQShortString _routingKey = new AMQShortString("routingKey"); - - public void setUp() - { - _mpi = new MessagePublishInfo(_exchange, true, true, _routingKey); - } - - /** Test that we can update the exchange value. */ - public void testExchange() - { - assertEquals(_exchange, _mpi.getExchange()); - AMQShortString newExchange = new AMQShortString("newExchange"); - //Check we can update the exchange - _mpi.setExchange(newExchange); - assertEquals(newExchange, _mpi.getExchange()); - //Ensure that the new exchange doesn't equal the old one - assertFalse(_exchange.equals(_mpi.getExchange())); - } - - /** - * Check that the immedate value is set correctly and defaulted correctly - */ - public void testIsImmediate() - { - //Check that the set value is correct - assertTrue("Set value for immediate not as expected", _mpi.isImmediate()); - - MessagePublishInfo mpi = new MessagePublishInfo(); - - assertFalse("Default value for immediate should be false", mpi.isImmediate()); - - mpi.setImmediate(true); - - assertTrue("Updated value for immediate not as expected", mpi.isImmediate()); - - } - - /** - * Check that the mandatory value is set correctly and defaulted correctly - */ - public void testIsMandatory() - { - assertTrue("Set value for mandatory not as expected", _mpi.isMandatory()); - - MessagePublishInfo mpi = new MessagePublishInfo(); - - assertFalse("Default value for mandatory should be false", mpi.isMandatory()); - - mpi.setMandatory(true); - - assertTrue("Updated value for mandatory not as expected", mpi.isMandatory()); - } - - /** - * Check that the routingKey value is perserved - */ - public void testRoutingKey() - { - assertEquals(_routingKey, _mpi.getRoutingKey()); - AMQShortString newRoutingKey = new AMQShortString("newRoutingKey"); - - //Check we can update the routingKey - _mpi.setRoutingKey(newRoutingKey); - assertEquals(newRoutingKey, _mpi.getRoutingKey()); - //Ensure that the new routingKey doesn't equal the old one - assertFalse(_routingKey.equals(_mpi.getRoutingKey())); - - } -} 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 deleted file mode 100644 index de73a2ff88..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/pool/ReferenceCountingExecutorServiceTest.java +++ /dev/null @@ -1,159 +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.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; - - -public class ReferenceCountingExecutorServiceTest extends TestCase -{ - - - private ReferenceCountingExecutorService _executorService = ReferenceCountingExecutorService.getInstance(); // Class under test - private ThreadFactory _beforeExecutorThreadFactory; - - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _beforeExecutorThreadFactory = _executorService.getThreadFactory(); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - _executorService.setThreadFactory(_beforeExecutorThreadFactory); - } - - - - /** - * Tests that the ReferenceCountingExecutorService correctly manages the reference count. - */ - public void testReferenceCounting() throws Exception - { - final int countBefore = _executorService.getReferenceCount(); - - try - { - _executorService.acquireExecutorService(); - _executorService.acquireExecutorService(); - - assertEquals("Reference count should now be +2", countBefore + 2, _executorService.getReferenceCount()); - } - finally - { - _executorService.releaseExecutorService(); - _executorService.releaseExecutorService(); - } - assertEquals("Reference count should have returned to the initial value", countBefore, _executorService.getReferenceCount()); - } - - /** - * Tests that the executor creates and executes a task using the default thread pool. - */ - public void testExecuteCommandWithDefaultExecutorThreadFactory() throws Exception - { - final CountDownLatch latch = new CountDownLatch(1); - final Set<ThreadGroup> threadGroups = new HashSet<ThreadGroup>(); - - _executorService.acquireExecutorService(); - - try - { - _executorService.getPool().execute(createRunnable(latch, threadGroups)); - - latch.await(3, TimeUnit.SECONDS); - - assertTrue("Expect that executor created a thread using default thread factory", - threadGroups.contains(Thread.currentThread().getThreadGroup())); - } - finally - { - _executorService.releaseExecutorService(); - } - } - - /** - * Tests that the executor creates and executes a task using an overridden thread pool. - */ - public void testExecuteCommandWithOverriddenExecutorThreadFactory() throws Exception - { - final CountDownLatch latch = new CountDownLatch(1); - final ThreadGroup expectedThreadGroup = new ThreadGroup("junit"); - _executorService.setThreadFactory(new ThreadGroupChangingThreadFactory(expectedThreadGroup)); - _executorService.acquireExecutorService(); - - final Set<ThreadGroup> threadGroups = new HashSet<ThreadGroup>(); - - try - { - _executorService.getPool().execute(createRunnable(latch, threadGroups)); - - latch.await(3, TimeUnit.SECONDS); - - assertTrue("Expect that executor created a thread using overridden thread factory", - threadGroups.contains(expectedThreadGroup)); - } - finally - { - _executorService.releaseExecutorService(); - } - } - - private Runnable createRunnable(final CountDownLatch latch, final Set<ThreadGroup> threadGroups) - { - return new Runnable() - { - - public void run() - { - threadGroups.add(Thread.currentThread().getThreadGroup()); - latch.countDown(); - } - - }; - } - - private final class ThreadGroupChangingThreadFactory implements ThreadFactory - { - private final ThreadGroup _newGroup; - - private ThreadGroupChangingThreadFactory(final ThreadGroup newGroup) - { - this._newGroup = newGroup; - } - - public Thread newThread(Runnable r) - { - return new Thread(_newGroup, r); - } - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java deleted file mode 100644 index b8cf8a40b0..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/pool/SuppressingInheritedAccessControlContextThreadFactoryTest.java +++ /dev/null @@ -1,95 +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.pool; - - -import javax.security.auth.Subject; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.Principal; -import java.security.PrivilegedAction; -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class SuppressingInheritedAccessControlContextThreadFactoryTest extends QpidTestCase -{ - public void testAccessControlContextIsNotInheritedByThread() throws Exception - { - final String principalName = getName(); - final CountDownLatch latch = new CountDownLatch(1); - - final AtomicReference<AccessControlContext> threadAccessControlContextCapturer = new AtomicReference<>(); - final AtomicReference<AccessControlContext> callerAccessControlContextCapturer = new AtomicReference<>(); - - final Set<Principal> principals = Collections.<Principal>singleton(new Principal() - { - @Override - public String getName() - { - return principalName; - } - - @Override - public String toString() - { - return "Principal{" + getName() + "}"; - } - }); - - Subject subject = new Subject(false, principals, Collections.EMPTY_SET, Collections.EMPTY_SET); - - Subject.doAs(subject, new PrivilegedAction<Void>() - { - @Override - public Void run() - { - callerAccessControlContextCapturer.set(AccessController.getContext()); - SuppressingInheritedAccessControlContextThreadFactory factory = new SuppressingInheritedAccessControlContextThreadFactory(); - factory.newThread(new Runnable() - { - - public void run() - { - threadAccessControlContextCapturer.set(AccessController.getContext()); - latch.countDown(); - } - - }).start(); - return null; - } - }); - - latch.await(3, TimeUnit.SECONDS); - - Subject callerSubject = Subject.getSubject(callerAccessControlContextCapturer.get()); - Subject threadSubject = Subject.getSubject(threadAccessControlContextCapturer.get()); - - assertEquals("Unexpected subject in main thread", callerSubject, subject); - assertNull("Unexpected subject in executor thread", threadSubject); - - } - -} 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 deleted file mode 100644 index c5fa852f95..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/ssl/SSLContextFactoryTest.java +++ /dev/null @@ -1,70 +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.ssl; - -import org.apache.qpid.test.utils.QpidTestCase; - -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManagerFactory; - -import java.io.IOException; - -public class SSLContextFactoryTest extends QpidTestCase -{ - private static final String BROKER_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_keystore.jks"; - 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 STORE_TYPE = "JKS"; - 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 testTrustStoreDoesNotExist() throws Exception - { - try - { - SSLContextFactory.buildClientContext("/path/to/nothing", STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_KEY_MANAGER_ALGORITHM, null); - fail("Exception was not thrown due to incorrect path"); - } - catch (IOException e) - { - //expected - } - } - - public void testBuildClientContextForSSLEncryptionOnly() throws Exception - { - SSLContext context = SSLContextFactory.buildClientContext(CLIENT_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, null, 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, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, 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, STORE_TYPE, DEFAULT_TRUST_MANAGER_ALGORITHM, CLIENT_KEYSTORE_PATH, STORE_PASSWORD, STORE_TYPE, 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/ssl/TrustManagerTest.java b/qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java deleted file mode 100644 index 3b76d81e42..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/ssl/TrustManagerTest.java +++ /dev/null @@ -1,344 +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.ssl; - -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Arrays; -import java.util.Enumeration; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; - -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager; -import org.apache.qpid.transport.network.security.ssl.QpidPeersOnlyTrustManager; -import org.apache.qpid.transport.network.security.ssl.SSLUtil; - -public class TrustManagerTest extends QpidTestCase -{ - private static final String BROKER_TRUSTSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_truststore.jks"; - private static final String BROKER_PEERSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_broker_peerstore.jks"; - private static final String CLIENT_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_keystore.jks"; - private static final String CLIENT_UNTRUSTED_KEYSTORE_PATH = TEST_RESOURCES_DIR + "/ssl/java_client_untrusted_keystore.jks"; - private static final String STORE_PASSWORD = "password"; - private static final String STORE_TYPE = "JKS"; - private static final String DEFAULT_TRUST_MANAGER_ALGORITHM = TrustManagerFactory.getDefaultAlgorithm(); - private static final String CERT_ALIAS_APP1 = "app1"; - private static final String CERT_ALIAS_APP2 = "app2"; - private static final String CERT_ALIAS_UNTRUSTED_CLIENT = "untrusted_client"; - - // retrieves the client certificate's chain from store and returns it as an array - private X509Certificate[] getClientChain(final String storePath, final String alias) throws Exception - { - final KeyStore ks = SSLUtil.getInitializedKeyStore(storePath, STORE_PASSWORD, STORE_TYPE); - final Certificate[] chain = ks.getCertificateChain(alias); - return Arrays.copyOf(chain, chain.length, X509Certificate[].class); - } - - // verifies that peer store is loaded only with client's (peer's) app1 certificate (no CA) - private void noCAinPeerStore(final KeyStore ps) throws KeyStoreException - { - final Enumeration<String> aliases = ps.aliases(); - while (aliases.hasMoreElements()) - { - final String alias = aliases.nextElement(); - if (!alias.equalsIgnoreCase(CERT_ALIAS_APP1)) - { - fail("Broker's peer store contains other certificate than client's app1 public key"); - } - } - } - - /** - * Tests that the QpidPeersOnlyTrustManager gives the expected behaviour when loaded separately - * with the broker peerstore and truststore. - */ - public void testQpidPeersOnlyTrustManager() throws Exception - { - // first let's check that peer manager loaded with the PEERstore succeeds - final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - this.noCAinPeerStore(ps); - final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - pmf.init(ps); - final TrustManager[] delegatePeerManagers = pmf.getTrustManagers(); - - X509TrustManager peerManager = null; - for (final TrustManager tm : delegatePeerManagers) - { - if (tm instanceof X509TrustManager) - { - // peer manager is supposed to trust only clients which peers certificates - // are directly in the store. CA signing will not be considered. - peerManager = new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm); - } - } - - try - { - // since broker's peerstore contains the client's app1 certificate, the check should succeed - peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA"); - } - catch (CertificateException e) - { - fail("Trusted client's validation against the broker's peer store manager failed."); - } - - try - { - // since broker's peerstore does not contain the client's app2 certificate, the check should fail - peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA"); - fail("Untrusted client's validation against the broker's peer store manager succeeded."); - } - catch (CertificateException e) - { - //expected - } - - // now let's check that peer manager loaded with the brokers TRUSTstore fails because - // it does not have the clients certificate in it (though it does have a CA-cert that - // would otherwise trust the client cert when using the regular trust manager). - final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - tmf.init(ts); - final TrustManager[] delegateTrustManagers = tmf.getTrustManagers(); - - peerManager = null; - for (final TrustManager tm : delegateTrustManagers) - { - if (tm instanceof X509TrustManager) - { - // peer manager is supposed to trust only clients which peers certificates - // are directly in the store. CA signing will not be considered. - peerManager = new QpidPeersOnlyTrustManager(ts, (X509TrustManager) tm); - } - } - - try - { - // since broker's truststore doesn't contain the client's app1 certificate, the check should fail - // despite the fact that the truststore does have a CA that would otherwise trust the cert - peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA"); - fail("Client's validation against the broker's peer store manager didn't fail."); - } - catch (CertificateException e) - { - // expected - } - - try - { - // since broker's truststore doesn't contain the client's app2 certificate, the check should fail - // despite the fact that the truststore does have a CA that would otherwise trust the cert - peerManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA"); - fail("Client's validation against the broker's peer store manager didn't fail."); - } - catch (CertificateException e) - { - // expected - } - } - - /** - * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a - * regular TrustManager against the broker truststore. - */ - public void testQpidMultipleTrustManagerWithRegularTrustStore() throws Exception - { - final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager(); - final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - tmf.init(ts); - final TrustManager[] delegateTrustManagers = tmf.getTrustManagers(); - boolean trustManagerAdded = false; - for (final TrustManager tm : delegateTrustManagers) - { - if (tm instanceof X509TrustManager) - { - // add broker's trust manager - mulTrustManager.addTrustManager((X509TrustManager) tm); - trustManagerAdded = true; - } - } - assertTrue("The regular trust manager for the trust store was not added", trustManagerAdded); - - try - { - // verify the CA-trusted app1 cert (should succeed) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA"); - } - catch (CertificateException ex) - { - fail("Trusted client's validation against the broker's multi store manager failed."); - } - - try - { - // verify the CA-trusted app2 cert (should succeed) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA"); - } - catch (CertificateException ex) - { - fail("Trusted client's validation against the broker's multi store manager failed."); - } - - try - { - // verify the untrusted cert (should fail) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA"); - fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed."); - } - catch (CertificateException ex) - { - // expected - } - } - - /** - * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a - * QpidPeersOnlyTrustManager against the broker peerstore. - */ - public void testQpidMultipleTrustManagerWithPeerStore() throws Exception - { - final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager(); - final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - pmf.init(ps); - final TrustManager[] delegatePeerManagers = pmf.getTrustManagers(); - boolean peerManagerAdded = false; - for (final TrustManager tm : delegatePeerManagers) - { - if (tm instanceof X509TrustManager) - { - // add broker's peer manager - mulTrustManager.addTrustManager(new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm)); - peerManagerAdded = true; - } - } - assertTrue("The QpidPeersOnlyTrustManager for the peerstore was not added", peerManagerAdded); - - try - { - // verify the trusted app1 cert (should succeed as the key is in the peerstore) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA"); - } - catch (CertificateException ex) - { - fail("Trusted client's validation against the broker's multi store manager failed."); - } - - try - { - // verify the untrusted app2 cert (should fail as the key is not in the peerstore) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA"); - fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed."); - } - catch (CertificateException ex) - { - // expected - } - - try - { - // verify the untrusted cert (should fail as the key is not in the peerstore) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA"); - fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed."); - } - catch (CertificateException ex) - { - // expected - } - } - - /** - * Tests that the QpidMultipleTrustManager gives the expected behaviour when wrapping a - * QpidPeersOnlyTrustManager against the broker peerstore, a regular TrustManager - * against the broker truststore. - */ - public void testQpidMultipleTrustManagerWithTrustAndPeerStores() throws Exception - { - final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager(); - final KeyStore ts = SSLUtil.getInitializedKeyStore(BROKER_TRUSTSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - final TrustManagerFactory tmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - tmf.init(ts); - final TrustManager[] delegateTrustManagers = tmf.getTrustManagers(); - boolean trustManagerAdded = false; - for (final TrustManager tm : delegateTrustManagers) - { - if (tm instanceof X509TrustManager) - { - // add broker's trust manager - mulTrustManager.addTrustManager((X509TrustManager) tm); - trustManagerAdded = true; - } - } - assertTrue("The regular trust manager for the trust store was not added", trustManagerAdded); - - final KeyStore ps = SSLUtil.getInitializedKeyStore(BROKER_PEERSTORE_PATH, STORE_PASSWORD, STORE_TYPE); - final TrustManagerFactory pmf = TrustManagerFactory.getInstance(DEFAULT_TRUST_MANAGER_ALGORITHM); - pmf.init(ps); - final TrustManager[] delegatePeerManagers = pmf.getTrustManagers(); - boolean peerManagerAdded = false; - for (final TrustManager tm : delegatePeerManagers) - { - if (tm instanceof X509TrustManager) - { - // add broker's peer manager - mulTrustManager.addTrustManager(new QpidPeersOnlyTrustManager(ps, (X509TrustManager) tm)); - peerManagerAdded = true; - } - } - assertTrue("The QpidPeersOnlyTrustManager for the peerstore was not added", peerManagerAdded); - - try - { - // verify the CA-trusted app1 cert (should succeed) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP1), "RSA"); - } - catch (CertificateException ex) - { - fail("Trusted client's validation against the broker's multi store manager failed."); - } - - try - { - // verify the CA-trusted app2 cert (should succeed) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_KEYSTORE_PATH, CERT_ALIAS_APP2), "RSA"); - } - catch (CertificateException ex) - { - fail("Trusted client's validation against the broker's multi store manager failed."); - } - - try - { - // verify the untrusted cert (should fail) - mulTrustManager.checkClientTrusted(this.getClientChain(CLIENT_UNTRUSTED_KEYSTORE_PATH, CERT_ALIAS_UNTRUSTED_CLIENT), "RSA"); - fail("Untrusted client's validation against the broker's multi store manager unexpectedly passed."); - } - catch (CertificateException ex) - { - // expected - } - } -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java deleted file mode 100644 index 7b0f93700a..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.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.thread; - -import junit.framework.TestCase; - -/** - * Tests the ThreadFactory. - */ -public class ThreadFactoryTest extends TestCase -{ - public void testThreadFactory() - { - Class<? extends ThreadFactory> threadFactoryClass = null; - try - { - threadFactoryClass = Class.forName(System.getProperty("qpid.thread_factory", - "org.apache.qpid.thread.DefaultThreadFactory")).asSubclass(ThreadFactory.class); - } - // If the thread factory class was wrong it will flagged way before it gets here. - catch(Exception e) - { - fail("Invalid thread factory class"); - } - - assertEquals(threadFactoryClass, Threading.getThreadFactory().getClass()); - } - - /** - * Tests creating a thread without a priority. Also verifies that the factory sets the - * uncaught exception handler so uncaught exceptions are logged to SLF4J. - */ - public void testCreateThreadWithDefaultPriority() - { - Runnable r = createRunnable(); - - Thread t = null; - try - { - t = Threading.getThreadFactory().createThread(r); - } - catch(Exception e) - { - fail("Error creating thread using Qpid thread factory"); - } - - assertNotNull(t); - assertEquals(Thread.NORM_PRIORITY, t.getPriority()); - assertTrue(t.getUncaughtExceptionHandler() instanceof LoggingUncaughtExceptionHandler); - } - - /** - * Tests creating thread with a priority. Also verifies that the factory sets the - * uncaught exception handler so uncaught exceptions are logged to SLF4J. - */ - public void testCreateThreadWithSpecifiedPriority() - { - Runnable r = createRunnable(); - - Thread t = null; - try - { - t = Threading.getThreadFactory().createThread(r, 4); - } - catch(Exception e) - { - fail("Error creating thread using Qpid thread factory"); - } - - assertNotNull(t); - assertEquals(4, t.getPriority()); - assertTrue(t.getUncaughtExceptionHandler() instanceof LoggingUncaughtExceptionHandler); - } - - private Runnable createRunnable() - { - Runnable r = new Runnable(){ - - public void run(){ - - } - }; - return r; - } -} 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 deleted file mode 100644 index d031842f9d..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java +++ /dev/null @@ -1,211 +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.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 -{ - private static final String TEST_ALGORITHM_NAME = "algorithmName"; - - private ConnectionSettings _conConnectionSettings; - - protected void setUp() throws Exception - { - super.setUp(); - _conConnectionSettings = new ConnectionSettings(); - } - - public void testTcpNoDelayDefault() - { - assertTrue("Default for isTcpNodelay() should be true", _conConnectionSettings.isTcpNodelay()); - } - - public void testTcpNoDelayOverrideTrue() - { - systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, true); - } - - public void testTcpNoDelayOverrideFalse() - { - systemPropertyOverrideForTcpDelay(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, false); - } - - @SuppressWarnings("deprecation") - public void testTcpNoDelayLegacyOverrideTrue() - { - systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, true); - } - - @SuppressWarnings("deprecation") - public void testTcpNoDelayLegacyOverrideFalse() - { - systemPropertyOverrideForTcpDelay(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, false); - } - - public void testKeyManagerFactoryAlgorithmDefault() - { - assertEquals(KeyManagerFactory.getDefaultAlgorithm(), _conConnectionSettings.getKeyManagerFactoryAlgorithm()); - } - - 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 testReceiveBufferSizeOverriddenLegacyOverridden() - { - systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true); - } - - public void testHeartbeatingDefaults() - { - assertNull(_conConnectionSettings.getHeartbeatInterval08()); - assertEquals(ClientProperties.QPID_HEARTBEAT_INTERVAL_010_DEFAULT,_conConnectionSettings.getHeartbeatInterval010()); - assertEquals(2.0, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1); - } - - public void testHeartbeatingOverridden() - { - resetSystemProperty(ClientProperties.QPID_HEARTBEAT_INTERVAL, "60"); - resetSystemProperty(ClientProperties.QPID_HEARTBEAT_TIMEOUT_FACTOR, "2.5"); - - assertEquals(Integer.valueOf(60), _conConnectionSettings.getHeartbeatInterval08()); - assertEquals(60, _conConnectionSettings.getHeartbeatInterval010()); - assertEquals(2.5, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1); - } - - @SuppressWarnings("deprecation") - public void testHeartbeatingOverriddenUsingAmqjLegacyOption() - { - resetSystemProperty(ClientProperties.AMQJ_HEARTBEAT_DELAY, "30"); - resetSystemProperty(ClientProperties.AMQJ_HEARTBEAT_TIMEOUT_FACTOR, "1.5"); - - assertEquals(Integer.valueOf(30), _conConnectionSettings.getHeartbeatInterval08()); - assertEquals(30, _conConnectionSettings.getHeartbeatInterval010()); - assertEquals(1.5, _conConnectionSettings.getHeartbeatTimeoutFactor(), 0.1); - } - - @SuppressWarnings("deprecation") - public void testHeartbeatingOverriddenUsingOlderLegacyOption() - { - resetSystemProperty(ClientProperties.IDLE_TIMEOUT_PROP_NAME, "30000"); - - assertEquals(Integer.valueOf(30), _conConnectionSettings.getHeartbeatInterval08()); - assertEquals(30, _conConnectionSettings.getHeartbeatInterval010()); - } - - 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 deleted file mode 100644 index 3a6006c338..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java +++ /dev/null @@ -1,473 +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.transport; - -import static org.apache.qpid.transport.Option.EXPECTED; -import static org.apache.qpid.transport.Option.NONE; -import static org.apache.qpid.transport.Option.SYNC; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -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 - */ -public class ConnectionTest extends QpidTestCase implements SessionListener -{ - private static final Logger _logger = LoggerFactory.getLogger(ConnectionTest.class); - private int port; - private volatile boolean queue = false; - private List<MessageTransfer> messages = new ArrayList<MessageTransfer>(); - private List<MessageTransfer> incoming = new ArrayList<MessageTransfer>(); - - private IoAcceptor _ioa = null; - - - protected void setUp() throws Exception - { - super.setUp(); - - port = findFreePort(); - } - - protected void tearDown() throws Exception - { - if (_ioa != null) - { - _ioa.close(); - } - - super.tearDown(); - } - - public void opened(Session ssn) {} - - public void resumed(Session ssn) {} - - public void message(final Session ssn, MessageTransfer xfr) - { - if (queue) - { - messages.add(xfr); - ssn.processed(xfr); - return; - } - - String body = xfr.getBodyString(); - - if (body.startsWith("CLOSE")) - { - ssn.getConnection().close(); - } - else if (body.startsWith("DELAYED_CLOSE")) - { - ssn.processed(xfr); - new Thread() - { - public void run() - { - try - { - sleep(3000); - } - catch (InterruptedException e) - { - throw new RuntimeException(e); - } - ssn.getConnection().close(); - } - }.start(); - } - else if (body.startsWith("ECHO")) - { - int id = xfr.getId(); - ssn.invoke(xfr); - ssn.processed(id); - } - else if (body.startsWith("SINK")) - { - ssn.processed(xfr); - } - else if (body.startsWith("DROP")) - { - // do nothing - } - else if (body.startsWith("EXCP")) - { - ExecutionException exc = new ExecutionException(); - exc.setDescription("intentional exception for testing"); - ssn.invoke(exc); - ssn.close(); - } - else - { - throw new IllegalArgumentException - ("unrecognized message: " + body); - } - } - - public void exception(Session ssn, SessionException exc) - { - throw exc; - } - - public void closed(Session ssn) {} - - private void send(Session ssn, String msg) - { - send(ssn, msg, false); - } - - private void send(Session ssn, String msg, boolean sync) - { - ssn.messageTransfer - ("xxx", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, - null, msg, sync ? SYNC : NONE); - } - - private Connection connect(final CountDownLatch closed) - { - final Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.addConnectionListener(new ConnectionListener() - { - public void opened(Connection conn) {} - public void exception(Connection conn, ConnectionException exc) - { - exc.printStackTrace(); - } - public void closed(Connection conn) - { - if (closed != null) - { - closed.countDown(); - } - } - - @Override - public boolean redirect(final String host, final List<Object> knownHosts) - { - return false; - } - }); - conn.connect("localhost", port, null, "guest", "guest", false, null); - return conn; - } - - public void testProtocolNegotiationExceptionOverridesCloseException() throws Exception - { - // Force os.name to be windows to exercise code in IoReceiver - // that looks for the value of os.name - setTestSystemProperty("os.name","windows"); - - // Start server as 0-9 to force a ProtocolVersionException - startServer(new ProtocolHeader(1, 0, 9)); - - CountDownLatch closed = new CountDownLatch(1); - - try - { - connect(closed); - fail("ProtocolVersionException expected"); - } - catch (ProtocolVersionException pve) - { - //Expected code path - } - catch (Exception e) - { - fail("ProtocolVersionException expected. Got:" + e.getMessage()); - } - } - - private void startServer() - { - startServer(new ProtocolHeader(1, 0, 10)); - } - - private void startServer(final ProtocolHeader protocolHeader) - { - ConnectionDelegate server = new ServerDelegate() - { - @Override - public void init(Connection conn, ProtocolHeader hdr) - { - conn.send(protocolHeader); - List<Object> utf8 = new ArrayList<Object>(); - utf8.add("utf8"); - conn.connectionStart(null, Collections.emptyList(), utf8); - } - - @Override - public Session getSession(Connection conn, SessionAttach atc) - { - Session ssn = super.getSession(conn, atc); - ssn.setSessionListener(ConnectionTest.this); - return ssn; - } - - @Override - public void connectionStartOk(Connection conn, ConnectionStartOk ok) - { - tuneAuthorizedConnection(conn); - } - }; - - try - { - _ioa = new IoAcceptor("localhost", port, ConnectionBinding.get(server)); - } - catch (IOException e) - { - fail("Unable to start Server for test due to:" + e.getMessage()); - } - - _ioa.start(); - } - - public void testClosedNotificationAndWriteToClosed() throws Exception - { - startServer(); - - CountDownLatch closed = new CountDownLatch(1); - Connection conn = connect(closed); - - Session ssn = conn.createSession(1); - send(ssn, "CLOSE"); - - if (!closed.await(3, TimeUnit.SECONDS)) - { - fail("never got notified of connection close"); - } - - try - { - conn.connectionCloseOk(); - fail("writing to a closed socket succeeded"); - } - catch (TransportException e) - { - // expected - } - } - - - - public void testResumeNonemptyReplayBuffer() throws Exception - { - startServer(); - - Connection conn = new Connection(); - conn.addConnectionListener(new FailoverConnectionListener()); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.connect("localhost", port, null, "guest", "guest", false, null); - Session ssn = conn.createSession(1); - ssn.setSessionListener(new TestSessionListener()); - - send(ssn, "SINK 0"); - send(ssn, "ECHO 1"); - send(ssn, "ECHO 2"); - - ssn.sync(); - - String[] msgs = { "DROP 3", "DROP 4", "DROP 5", "CLOSE 6", "SINK 7" }; - for (String m : msgs) - { - send(ssn, m); - } - - ssn.sync(); - - assertEquals(msgs.length, messages.size()); - for (int i = 0; i < msgs.length; i++) - { - assertEquals(msgs[i], messages.get(i).getBodyString()); - } - - queue = false; - - send(ssn, "ECHO 8"); - send(ssn, "ECHO 9"); - - synchronized (incoming) - { - Waiter w = new Waiter(incoming, 30000); - while (w.hasTime() && incoming.size() < 4) - { - w.await(); - } - - assertEquals(4, incoming.size()); - assertEquals("ECHO 1", incoming.get(0).getBodyString()); - assertEquals(0, incoming.get(0).getId()); - assertEquals("ECHO 2", incoming.get(1).getBodyString()); - assertEquals(1, incoming.get(1).getId()); - assertEquals("ECHO 8", incoming.get(2).getBodyString()); - assertEquals(0, incoming.get(0).getId()); - assertEquals("ECHO 9", incoming.get(3).getBodyString()); - assertEquals(1, incoming.get(1).getId()); - } - } - - public void testResumeEmptyReplayBuffer() throws InterruptedException - { - startServer(); - - Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.addConnectionListener(new FailoverConnectionListener()); - conn.connect("localhost", port, null, "guest", "guest", false, null); - Session ssn = conn.createSession(1); - ssn.setSessionListener(new TestSessionListener()); - - send(ssn, "SINK 0"); - send(ssn, "SINK 1"); - send(ssn, "DELAYED_CLOSE 2"); - ssn.sync(); - Thread.sleep(6000); - send(ssn, "SINK 3"); - ssn.sync(); - if (_logger.isDebugEnabled()) - { - _logger.debug(String.valueOf(messages)); - } - assertEquals(1, messages.size()); - assertEquals("SINK 3", messages.get(0).getBodyString()); - } - - public void testFlushExpected() throws InterruptedException - { - startServer(); - - Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.connect("localhost", port, null, "guest", "guest", false, null); - Session ssn = conn.createSession(); - ssn.sessionFlush(EXPECTED); - send(ssn, "SINK 0"); - ssn.sessionFlush(EXPECTED); - send(ssn, "SINK 1"); - ssn.sync(); - } - - public void testHeartbeat() - { - startServer(); - Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.connect("localhost", port, null, "guest", "guest", false, null); - conn.connectionHeartbeat(); - conn.close(); - } - - public void testExecutionExceptionInvoke() throws Exception - { - startServer(); - - Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.connect("localhost", port, null, "guest", "guest", false, null); - Session ssn = conn.createSession(); - send(ssn, "EXCP 0"); - Thread.sleep(3000); - try - { - send(ssn, "SINK 1"); - } - catch (SessionException exc) - { - assertNotNull(exc.getException()); - } - } - - public void testExecutionExceptionSync() throws Exception - { - startServer(); - - Connection conn = new Connection(); - conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); - conn.connect("localhost", port, null, "guest", "guest", false, null); - Session ssn = conn.createSession(); - send(ssn, "EXCP 0", true); - try - { - ssn.sync(); - fail("this should have failed"); - } - catch (SessionException exc) - { - assertNotNull(exc.getException()); - } - } - - class FailoverConnectionListener implements ConnectionListener - { - public void opened(Connection conn) {} - - public void exception(Connection conn, ConnectionException e) - { - throw e; - } - - public void closed(Connection conn) - { - queue = true; - conn.connect("localhost", port, null, "guest", "guest", false, null); - conn.resume(); - } - - @Override - public boolean redirect(final String host, final List<Object> knownHosts) - { - return false; - } - } - - class TestSessionListener implements SessionListener - { - public void opened(Session s) {} - public void resumed(Session s) {} - public void exception(Session s, SessionException e) {} - public void message(Session s, MessageTransfer xfr) - { - synchronized (incoming) - { - incoming.add(xfr); - incoming.notifyAll(); - } - - s.processed(xfr); - } - public void closed(Session s) {} - } -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java deleted file mode 100644 index 512a0a29a6..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/GenTest.java +++ /dev/null @@ -1,44 +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.transport; - -import junit.framework.TestCase; - -/** - * GenTest - * - */ - -public class GenTest extends TestCase -{ - - public void testBooleans() - { - QueueDeclare qd = new QueueDeclare().queue("test-queue").durable(false); - assertEquals(qd.getQueue(), "test-queue"); - assertFalse("durable should be false", qd.getDurable()); - qd.setDurable(true); - assertTrue("durable should be true", qd.getDurable()); - qd.setDurable(false); - assertFalse("durable should be false again", qd.getDurable()); - } - -} 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 deleted file mode 100644 index 14589eb541..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/RangeSetTest.java +++ /dev/null @@ -1,353 +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.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; - -/** - * RangeSetTest - * - */ - -public class RangeSetTest extends TestCase -{ - - private void check(RangeSet ranges) - { - List<Integer> posts = new ArrayList<Integer>(); - for (Range range : ranges) - { - posts.add(range.getLower()); - posts.add(range.getUpper()); - } - - List<Integer> sorted = new ArrayList<Integer>(posts); - Collections.sort(sorted, COMPARATOR); - - assertEquals(posts, sorted); - - int idx = 1; - while (idx + 1 < posts.size()) - { - assertTrue(!eq(posts.get(idx) + 1, posts.get(idx+1))); - idx += 2; - } - } - - public void test1() - { - RangeSet ranges = RangeSetFactory.createRangeSet(); - ranges.add(5, 10); - check(ranges); - ranges.add(15, 20); - check(ranges); - ranges.add(23, 25); - check(ranges); - ranges.add(12, 14); - check(ranges); - ranges.add(0, 1); - check(ranges); - ranges.add(3, 11); - check(ranges); - } - - public void test2() - { - RangeSet rs = RangeSetFactory.createRangeSet(); - check(rs); - - rs.add(1); - assertTrue(rs.includes(1)); - assertTrue(!rs.includes(2)); - assertTrue(!rs.includes(0)); - check(rs); - - rs.add(2); - assertTrue(!rs.includes(0)); - assertTrue(rs.includes(1)); - assertTrue(rs.includes(2)); - assertTrue(!rs.includes(3)); - check(rs); - - rs.add(0); - - assertTrue(!rs.includes(-1)); - assertTrue(rs.includes(0)); - assertTrue(rs.includes(1)); - assertTrue(rs.includes(2)); - assertTrue(!rs.includes(3)); - check(rs); - - rs.add(37); - - assertTrue(!rs.includes(-1)); - assertTrue(rs.includes(0)); - assertTrue(rs.includes(1)); - assertTrue(rs.includes(2)); - assertTrue(!rs.includes(3)); - assertTrue(!rs.includes(36)); - assertTrue(rs.includes(37)); - assertTrue(!rs.includes(38)); - check(rs); - - rs.add(-1); - check(rs); - - rs.add(-3); - check(rs); - - rs.add(1, 20); - assertTrue(!rs.includes(21)); - assertTrue(rs.includes(20)); - check(rs); - } - - public void testAddSelf() - { - RangeSet a = RangeSetFactory.createRangeSet(); - a.add(0, 8); - check(a); - a.add(0, 8); - check(a); - assertEquals(a.size(), 1); - Range range = a.iterator().next(); - assertEquals(range.getLower(), 0); - assertEquals(range.getUpper(), 8); - } - - public void testIntersect1() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(9, 20); - Range i1 = a.intersect(b); - Range i2 = b.intersect(a); - assertEquals(i1.getUpper(), 10); - assertEquals(i2.getUpper(), 10); - assertEquals(i1.getLower(), 9); - assertEquals(i2.getLower(), 9); - } - - public void testIntersect2() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(11, 20); - assertNull(a.intersect(b)); - assertNull(b.intersect(a)); - } - - public void testIntersect3() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(3, 5); - Range i1 = a.intersect(b); - Range i2 = b.intersect(a); - assertEquals(i1.getUpper(), 5); - assertEquals(i2.getUpper(), 5); - assertEquals(i1.getLower(), 3); - assertEquals(i2.getLower(), 3); - } - - public void testSubtract1() - { - Range a = Range.newInstance(0, 10); - assertTrue(a.subtract(a).isEmpty()); - } - - public void testSubtract2() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(20, 30); - List<Range> ranges = a.subtract(b); - assertEquals(ranges.size(), 1); - Range d = ranges.get(0); - assertEquals(d.getLower(), a.getLower()); - assertEquals(d.getUpper(), a.getUpper()); - } - - public void testSubtract3() - { - Range a = Range.newInstance(20, 30); - Range b = Range.newInstance(0, 10); - List<Range> ranges = a.subtract(b); - assertEquals(ranges.size(), 1); - Range d = ranges.get(0); - assertEquals(d.getLower(), a.getLower()); - assertEquals(d.getUpper(), a.getUpper()); - } - - public void testSubtract4() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(3, 5); - List<Range> ranges = a.subtract(b); - assertEquals(ranges.size(), 2); - Range low = ranges.get(0); - Range high = ranges.get(1); - assertEquals(low.getLower(), 0); - assertEquals(low.getUpper(), 2); - assertEquals(high.getLower(), 6); - assertEquals(high.getUpper(), 10); - } - - public void testSubtract5() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(3, 20); - List<Range> ranges = a.subtract(b); - assertEquals(ranges.size(), 1); - Range d = ranges.get(0); - assertEquals(d.getLower(), 0); - assertEquals(d.getUpper(), 2); - } - - public void testSubtract6() - { - Range a = Range.newInstance(0, 10); - Range b = Range.newInstance(-10, 5); - List<Range> ranges = a.subtract(b); - assertEquals(ranges.size(), 1); - Range d = ranges.get(0); - assertEquals(d.getLower(), 6); - 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/SessionTimeoutTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java deleted file mode 100644 index 5f1c1254a2..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/SessionTimeoutTest.java +++ /dev/null @@ -1,81 +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.transport; - -import org.apache.qpid.configuration.ClientProperties; -import org.apache.qpid.test.utils.QpidTestCase; - - -public class SessionTimeoutTest extends QpidTestCase -{ - public void testSessionTimeout() - { - try - { - long timeout = 1; - setTestSystemProperty("qpid.sync_op_timeout", Long.toString(timeout)); - assertSessionTimeout(timeout); - } - finally - { - revertTestSystemProperties(); - } - } - - public void testSessionTimeoutSetWith_amqj_default_syncwrite_timeout() - { - try - { - long timeout = 1; - setTestSystemProperty("amqj.default_syncwrite_timeout", Long.toString(timeout)); - setTestSystemProperty("qpid.sync_op_timeout", null); - assertSessionTimeout(timeout); - } - finally - { - revertTestSystemProperties(); - } - } - - private void assertSessionTimeout(long timeout) - { - Session session = new TestSession(null, null, 0); - long startTime = System.currentTimeMillis(); - try - { - session.awaitOpen(); - fail("SessionTimeoutException is expected!"); - } - catch (SessionException e) - { - long elapsedTime = System.currentTimeMillis() - startTime; - assertTrue("Expected timeout should happened in " + timeout + " ms but timeout occured in " - + elapsedTime + " ms!", elapsedTime >= timeout && elapsedTime < ClientProperties.DEFAULT_SYNC_OPERATION_TIMEOUT); - } - } - - class TestSession extends Session - { - public TestSession(Connection connection, Binary name, long expiry) - { - super(connection, name, expiry); - } - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java deleted file mode 100644 index 79bf184fe2..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/codec/BBEncoderTest.java +++ /dev/null @@ -1,47 +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.transport.codec; - -import junit.framework.TestCase; - -import java.nio.ByteBuffer; - -/** - * BBEncoderTest - * - */ - -public class BBEncoderTest extends TestCase -{ - - public void testGrow() - { - BBEncoder enc = new BBEncoder(4); - enc.writeInt32(0xDEADBEEF); - ByteBuffer buf = enc.buffer(); - assertEquals(0xDEADBEEF, buf.getInt(0)); - enc.writeInt32(0xBEEFDEAD); - buf = enc.buffer(); - assertEquals(0xDEADBEEF, buf.getInt(0)); - assertEquals(0xBEEFDEAD, buf.getInt(4)); - } - -} 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 deleted file mode 100644 index 3da2a03f42..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java +++ /dev/null @@ -1,166 +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.transport.network; - - -import java.util.Set; - -import javax.net.ssl.SSLContext; - -import org.apache.qpid.framing.ProtocolVersion; -import org.apache.qpid.protocol.ProtocolEngineFactory; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.transport.ByteBufferReceiver; -import org.apache.qpid.transport.ConnectionSettings; -import org.apache.qpid.transport.NetworkTransportConfiguration; -import org.apache.qpid.transport.TransportException; -import org.apache.qpid.transport.network.io.IoNetworkTransport; - -public class TransportTest extends QpidTestCase -{ - - - - public void testDefaultGetOutgoingTransportForv0_8() throws Exception - { - final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof IoNetworkTransport); - } - - public void testGloballyOverriddenOutgoingTransportForv0_8() throws Exception - { - setTestSystemProperty(Transport.QPID_TRANSPORT_PROPNAME, TestOutgoingNetworkTransport.class.getName()); - - final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof TestOutgoingNetworkTransport); - } - - public void testProtocolSpecificOverriddenOutgoingTransportForv0_8() throws Exception - { - setTestSystemProperty(Transport.QPID_TRANSPORT_V0_8_PROPNAME, TestOutgoingNetworkTransport.class.getName()); - - final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v8_0); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof TestOutgoingNetworkTransport); - } - - public void testDefaultGetOutgoingTransportForv0_10() throws Exception - { - final OutgoingNetworkTransport networkTransport = Transport.getOutgoingTransportInstance(ProtocolVersion.v0_10); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof IoNetworkTransport); - } - - public void testDefaultGetIncomingTransport() throws Exception - { - final IncomingNetworkTransport networkTransport = Transport.getIncomingTransportInstance(); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof IoNetworkTransport); - } - - public void testOverriddenGetIncomingTransport() throws Exception - { - setTestSystemProperty(Transport.QPID_BROKER_TRANSPORT_PROPNAME, TestIncomingNetworkTransport.class.getName()); - - final IncomingNetworkTransport networkTransport = Transport.getIncomingTransportInstance(); - assertNotNull(networkTransport); - assertTrue(networkTransport instanceof TestIncomingNetworkTransport); - } - - public void testInvalidOutgoingTransportClassName() throws Exception - { - setTestSystemProperty(Transport.QPID_TRANSPORT_PROPNAME, "invalid"); - - try - { - Transport.getOutgoingTransportInstance(ProtocolVersion.v0_10); - fail("Should have failed to load the invalid class"); - } - catch(TransportException te) - { - //expected, ignore - } - } - - public void testInvalidOutgoingTransportProtocolVersion() throws Exception - { - try - { - Transport.getOutgoingTransportInstance(new ProtocolVersion((byte)0, (byte)0)); - fail("Should have failed to load the transport for invalid protocol version"); - } - catch(IllegalArgumentException iae) - { - //expected, ignore - } - } - - public static class TestOutgoingNetworkTransport implements OutgoingNetworkTransport - { - - public void close() - { - throw new UnsupportedOperationException(); - } - - public NetworkConnection getConnection() - { - throw new UnsupportedOperationException(); - } - - public NetworkConnection connect(ConnectionSettings settings, - ByteBufferReceiver delegate, - TransportActivity transportActivity) - { - throw new UnsupportedOperationException(); - } - } - - public static class TestIncomingNetworkTransport implements IncomingNetworkTransport - { - - public void close() - { - throw new UnsupportedOperationException(); - } - - public NetworkConnection getConnection() - { - throw new UnsupportedOperationException(); - } - - public void accept(NetworkTransportConfiguration config, - ProtocolEngineFactory factory, - SSLContext sslContext, - final Set<TransportEncryption> encryptionSet) - { - throw new UnsupportedOperationException(); - } - - @Override - public int getAcceptingPort() - { - return -1; - } - } -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java deleted file mode 100644 index 69724438ec..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IdleTimeoutTickerTest.java +++ /dev/null @@ -1,250 +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.transport.network.io; - -import java.net.SocketAddress; -import java.security.Principal; - -import junit.framework.TestCase; - -import org.apache.qpid.transport.ByteBufferSender; -import org.apache.qpid.transport.network.NetworkConnection; -import org.apache.qpid.transport.network.TransportActivity; - -public class IdleTimeoutTickerTest extends TestCase implements TransportActivity, NetworkConnection -{ - private IdleTimeoutTicker _ticker; - private static final int DEFAULT_TIMEOUT = 567890; - private long _lastReadTime; - private long _lastWriteTime; - private long _currentTime; - private int _maxWriteIdle; - private int _maxReadIdle; - private boolean _readerIdle; - private boolean _writerIdle; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _ticker = new IdleTimeoutTicker(this, DEFAULT_TIMEOUT); - _ticker.setConnection(this); - _readerIdle = false; - _writerIdle = false; - _lastReadTime = 0l; - _lastWriteTime = 0l; - _maxReadIdle = 0; - _maxWriteIdle = 0; - } - - public void testNoIdle() throws Exception - { - _maxReadIdle = 4; - _maxWriteIdle = 2; - _lastReadTime = 0; - _lastWriteTime = 1500; - _currentTime = 3000; - // Current time = 3s, - // last read = 0s, max read idle = 4s, should check in 1s - // last write = 1.5s, max write idle = 2s, should check in 0.5s - long nextTime = _ticker.tick(_currentTime); - assertEquals("Incorrect next tick calculation", 500l, nextTime); - assertFalse("Incorrectly caused reader idle", _readerIdle); - assertFalse("Incorrectly caused writer idle", _writerIdle); - - - // Current time = 3.4s, - // last read = 0s, max read idle = 4s, should check in 0.6s - // last write = 3.1s, max write idle = 2s, should check in 1.7s - _lastWriteTime = 3100; - _currentTime = 3400; - nextTime = _ticker.tick(_currentTime); - assertEquals("Incorrect next tick calculation", 600l, nextTime); - assertFalse("Incorrectly caused reader idle", _readerIdle); - assertFalse("Incorrectly caused writer idle", _writerIdle); - - _maxReadIdle = 0; - nextTime = _ticker.tick(_currentTime); - assertEquals("Incorrect next tick calculation", 1700l, nextTime); - assertFalse("Incorrectly caused reader idle", _readerIdle); - assertFalse("Incorrectly caused writer idle", _writerIdle); - - _maxWriteIdle = 0; - nextTime = _ticker.tick(_currentTime); - assertEquals("Incorrect next tick calculation", DEFAULT_TIMEOUT, nextTime); - assertFalse("Incorrectly caused reader idle", _readerIdle); - assertFalse("Incorrectly caused writer idle", _writerIdle); - - } - - public void testReaderIdle() throws Exception - { - _maxReadIdle = 4; - _maxWriteIdle = 0; - _lastReadTime = 0; - _lastWriteTime = 2500; - _currentTime = 4000; - // Current time = 4s, - // last read = 0s, max read idle = 4s, reader idle - long nextTime = _ticker.tick(_currentTime); - - assertTrue(_readerIdle); - assertFalse(_writerIdle); - - _readerIdle = false; - - // last write = 2.5s, max write idle = 2s, should check in 0.5s - _maxWriteIdle = 2; - nextTime = _ticker.tick(_currentTime); - assertTrue(_readerIdle); - assertFalse(_writerIdle); - - _readerIdle = false; - // last write = 1.5s, max write idle = 2s, should check in 0.5s - - _lastWriteTime = 1500; - nextTime = _ticker.tick(_currentTime); - - assertTrue(_readerIdle); - assertTrue(_writerIdle); - - } - - public void testWriterIdle() throws Exception - { - _maxReadIdle = 0; - _maxWriteIdle = 2; - _lastReadTime = 0; - _lastWriteTime = 1500; - _currentTime = 4000; - // Current time = 4s, - // last write = 1.5s, max write idle = 2s, writer idle - long nextTime = _ticker.tick(_currentTime); - - assertTrue(_writerIdle); - assertFalse(_readerIdle); - assertEquals(2000l,nextTime); - - _writerIdle = false; - _lastWriteTime = 1500; - _maxReadIdle = 5; - - nextTime = _ticker.tick(_currentTime); - - assertTrue(_writerIdle); - assertFalse(_readerIdle); - assertEquals(1000l,nextTime); - - } - - //------------------------------------------------------------------------- - // Implement TransportActivity methods - //------------------------------------------------------------------------- - - @Override - public long getLastReadTime() - { - return _lastReadTime; - } - - @Override - public long getLastWriteTime() - { - return _lastWriteTime; - } - - @Override - public void writerIdle() - { - _writerIdle = true; - _lastWriteTime = _currentTime; - } - - @Override - public void readerIdle() - { - _readerIdle = true; - } - - //------------------------------------------------------------------------- - // Implement NetworkConnection methods - // Only actually use those relating to idle timeouts - //------------------------------------------------------------------------- - - @Override - public ByteBufferSender getSender() - { - return null; - } - - @Override - public void start() - { - } - - @Override - public void close() - { - } - - @Override - public SocketAddress getRemoteAddress() - { - return null; - } - - @Override - public SocketAddress getLocalAddress() - { - return null; - } - - @Override - public void setMaxWriteIdle(int sec) - { - _maxWriteIdle = sec; - } - - @Override - public void setMaxReadIdle(int sec) - { - _maxReadIdle = sec; - } - - @Override - public Principal getPeerPrincipal() - { - return null; - } - - @Override - public int getMaxReadIdle() - { - return _maxReadIdle; - } - - @Override - public int getMaxWriteIdle() - { - return _maxWriteIdle; - } -} 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 deleted file mode 100644 index f1492273c8..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoAcceptor.java +++ /dev/null @@ -1,122 +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.transport.network.io; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketAddress; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.transport.Binding; - - -/** - * IoAcceptor - * - */ - -public class IoAcceptor<E> extends Thread -{ - private static final Logger _logger = LoggerFactory.getLogger(IoAcceptor.class); - - private volatile boolean _closed = false; - - private ServerSocket socket; - private Binding<E> binding; - - public IoAcceptor(SocketAddress address, Binding<E> binding) - throws IOException - { - socket = new ServerSocket(); - socket.setReuseAddress(true); - socket.bind(address); - this.binding = binding; - - setName(String.format("IoAcceptor - %s", socket.getInetAddress())); - } - - /** - Close the underlying ServerSocket if it has not already been closed. - */ - public void close() throws IOException - { - _closed = true; - - if (!socket.isClosed()) - { - socket.close(); - } - } - - public IoAcceptor(String host, int port, Binding<E> binding) - throws IOException - { - this(new InetSocketAddress(host, port), binding); - } - - public void run() - { - while (!_closed) - { - try - { - Socket sock = socket.accept(); - IoTransport<E> transport = new IoTransport<E>(sock, binding); - } - catch (IOException e) - { - if (!_closed) - { - _logger.error("Error in IoAcceptor thread", e); - closeSocketIfNecessary(socket); - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) - { - _logger.debug("Stopping io acceptor due to interrupt request"); - _closed = true; - } - } - } - } - } - - private void closeSocketIfNecessary(final ServerSocket socket) - { - if(socket != null) - { - try - { - socket.close(); - } - catch (IOException e) - { - _logger.debug("Exception while closing socket", e); - } - } - } -} 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 deleted file mode 100644 index 4b5b4448ee..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/io/IoTransport.java +++ /dev/null @@ -1,90 +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.transport.network.io; - -import java.net.Socket; - -import org.apache.qpid.transport.Binding; -import org.apache.qpid.transport.ByteBufferSender; -import org.apache.qpid.transport.util.Logger; - -/** - * This class provides a socket based transport using the java.io - * classes. - * - * The following params are configurable via JVM arguments - * TCP_NO_DELAY - amqj.tcpNoDelay - * SO_RCVBUF - amqj.receiveBufferSize - * SO_SNDBUF - amqj.sendBufferSize - */ -public final class IoTransport<E> -{ - - - private static final Logger log = Logger.get(IoTransport.class); - - private static int DEFAULT_READ_WRITE_BUFFER_SIZE = 64 * 1024; - private static int readBufferSize = Integer.getInteger - ("amqj.receiveBufferSize", DEFAULT_READ_WRITE_BUFFER_SIZE); - private static int writeBufferSize = Integer.getInteger - ("amqj.sendBufferSize", DEFAULT_READ_WRITE_BUFFER_SIZE); - - private Socket socket; - private ByteBufferSender sender; - private E endpoint; - private IoReceiver receiver; - private long timeout = 60000; - - IoTransport(Socket socket, Binding<E> binding) - { - this.socket = socket; - setupTransport(socket, binding); - } - - private void setupTransport(Socket socket, Binding<E> binding) - { - IoSender ios = new IoSender(socket, 2*writeBufferSize, timeout); - ios.initiate(); - - this.sender = ios; - this.endpoint = binding.endpoint(sender); - this.receiver = new IoReceiver(socket, binding.receiver(endpoint), - 2*readBufferSize, timeout); - this.receiver.initiate(); - - ios.setReceiver(this.receiver); - } - - public ByteBufferSender getSender() - { - return sender; - } - - public IoReceiver getReceiver() - { - return receiver; - } - - public Socket getSocket() - { - return socket; - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java deleted file mode 100644 index 4c91ccc406..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/network/security/ssl/SSLUtilTest.java +++ /dev/null @@ -1,1274 +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.transport.network.security.ssl; - -import java.io.ByteArrayInputStream; -import java.nio.ByteBuffer; -import java.security.KeyStore; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLEngineResult; -import javax.net.ssl.TrustManagerFactory; -import javax.xml.bind.DatatypeConverter; - -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.transport.TransportException; - -public class SSLUtilTest extends QpidTestCase -{ - public void testGetIdFromSubjectDN() - { - // "normal" dn - assertEquals("user@somewhere.example.org",SSLUtil.getIdFromSubjectDN("cn=user,dc=somewhere,dc=example,dc=org")); - // quoting of values, case of types, spacing all ignored - assertEquals("user2@somewhere.example.org",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,cn=\"user2\",dc=org")); - // only first cn is used - assertEquals("user@somewhere.example.org",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,cn=\"user\",dc=org, cn=user2")); - // no cn, no Id - assertEquals("",SSLUtil.getIdFromSubjectDN("DC=somewhere, dc=example,dc=org")); - // cn in value is ignored - assertEquals("",SSLUtil.getIdFromSubjectDN("C=CZ,O=Scholz,OU=\"JAKUB CN=USER1\"")); - // cn with no dc gives just user - assertEquals("someone",SSLUtil.getIdFromSubjectDN("ou=someou, CN=\"someone\"")); - // null results in empty string - assertEquals("",SSLUtil.getIdFromSubjectDN(null)); - // invalid name results in empty string - assertEquals("",SSLUtil.getIdFromSubjectDN("ou=someou, =")); - // component containing whitespace - assertEquals("me@example.com",SSLUtil.getIdFromSubjectDN("CN=me,DC=example, DC=com, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB")); - // empty CN - assertEquals("",SSLUtil.getIdFromSubjectDN("CN=,DC=somewhere, dc=example,dc=org")); - - - } - - public void testWildCardAndSubjectAltNameMatchingWorks() throws Exception - { - doNameMatchingTest(KEYSTORE_1, - Arrays.asList("amqp.example.com"), - Arrays.asList("amqp.example.net", "example.com", "*.example.com")); - - doNameMatchingTest(KEYSTORE_2, - Arrays.asList("amqp.example.com", "amqp1.example.com"), - Arrays.asList("amqp.example.net", "example.com", "*.example.com")); - - doNameMatchingTest(KEYSTORE_3, - Arrays.asList("amqp.example.com", "amqp1.example.com", "amqp2.example.com"), - Arrays.asList("amqp.example.net", "example.com", "*.example.com")); - - doNameMatchingTest(KEYSTORE_4, - Arrays.asList("amqp.example.com", "amqp1.example.com", "amqp2.example.com", "foo.example.com"), - Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com")); - - doNameMatchingTest(KEYSTORE_5, - Arrays.asList("amqp.example.com", "foo.example.com"), - Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org")); - - doNameMatchingTest(KEYSTORE_6, - Arrays.asList("amqp.example.com"), - Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org", "foo")); - - doNameMatchingTest(KEYSTORE_7, - Arrays.asList("amqp.example.org", "amqp1.example.org", "amqp2.example.org"), - Arrays.asList("amqp.example.net", "example.com", "foo.bar.example.com", "foo.org", "foo")); - - doNameMatchingTest(KEYSTORE_8, - Arrays.asList("amqp.example.org", "example.org"), - Arrays.asList("amqp1.example.org", "example.com", "foo.bar.example.com", "foo.org", "foo")); - - doNameMatchingTest(KEYSTORE_9, - Arrays.asList("amqp.example.org"), - Arrays.asList("amqp1.example.org", "example.org", "*.example.org")); - - doNameMatchingTest(KEYSTORE_10, - Arrays.asList("amqp.example.org", "amqp1.example.org"), - Arrays.asList("example.org", "a.mqp.example.org")); - - doNameMatchingTest(KEYSTORE_11, - Collections.<String>emptyList(), - Arrays.asList("example.org", "a.mqp.example.org", "org")); - - doNameMatchingTest(KEYSTORE_12, - Collections.<String>emptyList(), - Arrays.asList("example.org", "a.mqp.example.org", "org")); - - doNameMatchingTest(KEYSTORE_13, - Collections.<String>emptyList(), - Arrays.asList("example.org", "a.mqp.example.org", "org")); - } - - private void doNameMatchingTest(byte[] keystoreBytes, List<String> validAddresses, List<String> invalidAddresses) throws Exception - { - KeyStore keyStore = KeyStore.getInstance("JKS"); - keyStore.load(new ByteArrayInputStream(keystoreBytes), "password".toCharArray()); - - - KeyStore trustStore = KeyStore.getInstance("JKS"); - trustStore.load(new ByteArrayInputStream(TRUSTSTORE), "password".toCharArray()); - - for(String validAddress : validAddresses) - { - try - { - SSLUtil.verifyHostname(getSSLEngineAfterHandshake(keyStore, trustStore, validAddress, 5672), - validAddress); - } - catch(TransportException e) - { - fail("The address " + validAddress + " should validate but does not"); - } - } - - for(String invalidAddress : invalidAddresses) - { - try - { - SSLUtil.verifyHostname(getSSLEngineAfterHandshake(keyStore, trustStore, invalidAddress, 5672), - invalidAddress); - fail("The address " + invalidAddress + " should not validate but it does"); - } - catch(TransportException e) - { - // pass - } - } - } - - private SSLEngine getSSLEngineAfterHandshake(final KeyStore keyStore, - final KeyStore trustStore, - String host, - int port) - throws Exception - { - SSLContext sslContext = SSLContext.getInstance("TLS"); - KeyManagerFactory keyManager = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - keyManager.init(keyStore, "password".toCharArray()); - sslContext.init(keyManager.getKeyManagers(), null,null); - - SSLEngine serverEngine = sslContext.createSSLEngine(); - serverEngine.setUseClientMode(false); - - - SSLContext clientContext = SSLContext.getInstance("TLS"); - TrustManagerFactory trustManager = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManager.init(trustStore); - - clientContext.init(null, trustManager.getTrustManagers(), null); - - SSLEngine clientEngine = clientContext.createSSLEngine(host, port); - - clientEngine.setUseClientMode(true); - clientEngine.beginHandshake(); - - byte[] clientInput = new byte[0]; - byte[] clientOutput = new byte[0]; - - SSLEngineResult.HandshakeStatus clientStatus; - while((clientStatus = clientEngine.getHandshakeStatus()) != SSLEngineResult.HandshakeStatus.FINISHED - && clientStatus != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) - { - switch (clientStatus) - { - case NEED_TASK: - clientEngine.getDelegatedTask().run(); - break; - case NEED_WRAP: - ByteBuffer dst = ByteBuffer.allocate(1024*1024); - clientEngine.wrap(ByteBuffer.allocate(0), dst); - dst.flip(); - byte[] output = new byte[clientOutput.length+dst.remaining()]; - System.arraycopy(clientOutput,0,output,0,clientOutput.length); - dst.get(output, clientOutput.length, dst.remaining()); - clientOutput = output; - break; - case NEED_UNWRAP: - ByteBuffer unwrapDst = ByteBuffer.allocate(1024*1024); - ByteBuffer src = ByteBuffer.wrap(clientInput); - clientEngine.unwrap(src, unwrapDst); - byte[] input = new byte[src.remaining()]; - src.get(input,0,src.remaining()); - clientInput = input; - default: - break; - } - - SSLEngineResult.HandshakeStatus serverStatus = serverEngine.getHandshakeStatus(); - switch (serverStatus) - { - case NEED_TASK: - serverEngine.getDelegatedTask().run(); - break; - case NEED_WRAP: - ByteBuffer dst = ByteBuffer.allocate(1024*1024); - serverEngine.wrap(ByteBuffer.allocate(0), dst); - dst.flip(); - byte[] serverOutput = new byte[clientInput.length+dst.remaining()]; - System.arraycopy(clientInput,0,serverOutput,0,clientInput.length); - dst.get(serverOutput, clientInput.length, dst.remaining()); - clientInput = serverOutput; - break; - - case NOT_HANDSHAKING: - case NEED_UNWRAP: - ByteBuffer unwrapDst = ByteBuffer.allocate(1024*1024); - ByteBuffer src = ByteBuffer.wrap(clientOutput); - serverEngine.unwrap(src, unwrapDst); - byte[] input = new byte[src.remaining()]; - src.get(input,0,src.remaining()); - clientOutput = input; - } - } - return clientEngine; - } - - private static byte[] TRUSTSTORE = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAACAAAAAgAGcm9vdGNhAAABSDadDw4ABVguNTA5AAADyjCCA8Yw" - + "ggKuoAMCAQICAQUwDQYJKoZIhvcNAQEFBQAwdDETMBEGCgmSJomT8ixkARkWA29y" - + "ZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxlIEluYzEX" - + "MBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBSb290IENB" - + "MB4XDTE0MDkwMjExMTc1OFoXDTI0MDkwMTExMTc1OFowdDETMBEGCgmSJomT8ixk" - + "ARkWA29yZzEWMBQGCgmSJomT8ixkARkWBnNpbXBsZTETMBEGA1UECgwKU2ltcGxl" - + "IEluYzEXMBUGA1UECwwOU2ltcGxlIFJvb3QgQ0ExFzAVBgNVBAMMDlNpbXBsZSBS" - + "b290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnbksOuGOSUBv" - + "kbnUvWrgGOQeXQ7QoAMJEPhaxzW5aGZwpxf3F07yEyLKfyFH3URQOrXyl92xoH/u" - + "b8RDjK8plBFQ93eteTK+k582REQdHHx7zdLAyaNDE/RHGJJV8WDbGj4mzguZGkDi" - + "MGRS+j/UnQct6v5XXl/Ux2zahb16ZyoVtDlydKNVl8UR0aNn7esgfFw0x2OmplhN" - + "0A8xqX//sQfVTi2rptBSo73whitUg29abcgtVXZnIQM5kssiJxA9ZewKLWc9K/g+" - + "S2DOiPkNgVsliBaQUA7C5xlaCHrsyerUh8oOdvBe1eW8jfU3SwvejUvTfhMtu/sh" - + "6Wu7GD44pQIDAQABo2MwYT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XB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3ko1IfKsVa5Qge/W0" - + "O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9bD3uo4zqZImrRhru" - + "Y4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBjBvKvBsAtetyenE9f" - + "kXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwjC0WwHJMrnDGolhbE" - + "d9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbiNK+UGlcnKwMyBpnU" - + "EPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAG" - + "AQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9hzAfBgNVHSMEGDAW" - + "gBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUFAAOCAQEAFYmn/VQf" - + "Fk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQbf1R2vAwlEHTb" - + "lNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZP5UIxOSaTIOd" - + "rl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbNqyrABtg3cw+f" - + "eyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fPC2y/+o8PjybK" - + "YKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1o4zlEa2U5LVU" - + "I3xqsv1yM8JAKxuM8c3bu5LSXhqzhY/jpvuIiYo0" - ); - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com - // X509v3 Subject Alternative Name: - // DNS:amqp.example.com - - private static byte[] KEYSTORE_1 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l8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0wDQYJKoZIhvcNAQEFBQADggEBABWJ" - +"p/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxkG39UdrwM" - +"JRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h52T+VCMTk" - +"mkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIWzasqwAbY" - +"N3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qP" - +"D48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V39aOM5RGt" - +"lOS1VCN8arL9cjPCQCtHcAG+C//izulJLlMNMysvRmoUAA==" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com - // X509v3 Subject Alternative Name: - // DNS:amqp1.example.com - private static byte[] KEYSTORE_2 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l8mPAAAFATCCBP0wDgYKKwYBBAEqAhEB" - +"AQUABIIE6bP7B77bLs+focStL+3OxLuo6IqvAwjHc1hMv6ohPE5M73BwnOx8/b0k" - +"Xk1UVdqcoFlk7a+BkrCkXlGqxCtqJ6+C4cwFxEWjD8hTTzq3zLv602hL9K+h5cdU" - +"MYoKfDLyJbpK4RvlsFYm1k27yfzbLbQd4JOP9fCowBlp/Ybg73WTXBTbU4k4Bt8/" - +"FWDGxz0b+Ov+wPfzsvdkpvnIYHP7/fhm3rFC/GVy7ua7+Y0hsQWJmoQ+7hQ4NGvr" - +"Vmku9atTe9QtiDKqA6Ch3qxvJxD2Xn1d4RCyML0vQdA1enK2uJUkUjKx+fLKTA5Y" - +"tK1SaPQNVmbqaXNmKlUNZBhr/4YeEry5e+Z1Nf3x8QqKdLOy31kefl99ErcSu3Lw" - +"AHsbNQtfdvgmcEWxRuCqjLiqYXtZkYokeFz8K74T5cmailD2H53DyA7ufm6Ip+4E" -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BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62nW" - +"a9VvAA/A5o84lwdFLLTl5yBIy/u0G1ng5aYF+TKeMvPolfr8WiPMd5KNSHyrFWuU" - +"IHv1tDuL1QReH+gm7PSwc1M5UnliUj3RqloZ9JwS6yIJzG0piMuJPWw97qOM6mSJ" - +"q0Ya7mOBghrnPudTFoyA0wMf1HrWmIBZOhru9tsiQZjsc2d1iZsgYwbyrwbALXrc" - +"npxPX5F7YeFyRjoqkGM1tURoajqBRW4fdhgf+f9KkB5GzLH4q4LsIwtFsByTK5wx" - +"qJYWxHfUqWuEujLQ2x0vzyntwtuw94pJJ3N71LQ4xpqU2H0goQRW4jSvlBpXJysD" - +"MgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/" - +"BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcwHwYDVR0j" - +"BBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQADggEBABWJ" - +"p/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxkG39UdrwM" - +"JRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h52T+VCMTk" - +"mkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIWzasqwAbY" - +"N3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qP" - +"D48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V39aOM5RGt" - +"lOS1VCN8arL9cjPCQCs/TOYuPh7fygTHDAeqoBJ70T98Iw==" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com - // X509v3 Subject Alternative Name: - // DNS:amqp1.example.com, DNS:amqp2.example.com - private static byte[] KEYSTORE_3 =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CAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2nVtME" - +"7uRNydZhGuqs/P7WPYcwHwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0w" - +"DQYJKoZIhvcNAQEFBQADggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF" - +"89NqWvIBsZ22M9y5rcxkG39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3CbULD" - +"nnJwO2Hr9QVKorMaw3h52T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XISnSB" - +"EfxulOS+MdokJCxxZmIWzasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uP" - +"kHAeWcgwLZd+PeD6kuP3zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KLkkS6" - +"sRWASdbq2NZG/44H8/V39aOM5RGtlOS1VCN8arL9cjPCQCvCXf4pd3xvKYuWrd8V" - +"hGx16B8uYQ==" - ); - - - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com - // X509v3 Subject Alternative Name: - // DNS:amqp1.example.com, DNS:*.example.com - private static byte[] KEYSTORE_4 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l80rAAAFAzCCBP8wDgYKKwYBBAEqAhEB" - +"AQUABIIE61DeikCVpX4o8NE02fBn0FNrubcRZ2RkdGV2pyYXJBm+Sz+VdeFdhYwB" - +"eEl9otrz/r+5k5RUrZDxVmRFXGGil2z6dOxMbJXdyF3d5/0vaiGEyHvtBvPPWaL3" - +"4Q0JGMSemiXkrt8b50V1bwQTODYVE3nX/SifoAxhRofmDGRsTx/JG/cA5uthamna" - +"WA573ZdaFaIhGQGB3JkoyyRclD2HBym02/U+ZfIZjOACF7sn7A+9361o9/YHwXoz" - +"7GzyFwcjvoVataqOAG8YjlpvD3d51mSSqJJP1SCuzqcJUZgdh39rCpr121rdzYiU" - +"ndPWTdGmJzvC8wJBaZr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xqsv1yM8JAK5mCNuauka9csZWHFYKP0W/Q" - +"vx7F" - ); - - - // Subject: C=US, ST=private, L=province, O=city, CN=*.example.com - // X509v3 Subject Alternative Name: - // DNS:amqp1.example.net, DNS:*.org - private static byte[] KEYSTORE_5 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l87/AAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6gOUc8kP6zRRbndvTajWGz4qluUI2KftA4cCyrLFMMjUN3NzDsATlG13" - +"ONTxuPkgRwcUX2ilHnCoSyC2lS+WIeiIOclXF2hRLcJsFh2tF+f/f2fndvHPhzJR" - +"hwf+32Ic6YXJt9b2daMM7tnWb73hvcJIHMMH48+fJFpBSdVzA+n7s1vVcjSnXuzc" - +"nSUz8LIxg3MKXR8A2RQw6CgE9+BfJg77DNbTTr4bGSoMN6+I98rjTBzQHiPBLrtl" - +"+DJSlBUa91681uI+Lq1NXD7EVzr1t5RGwnCo3efxs/7jWrZ02ZSMLIbt1RwMNt2H" - +"c7/taIIoTpbQcHVbZcf3KHrfkeI7hHVvNdp+mPdczRXdK7jHzvm/RK1VS43QwqHw" - +"POOMugeyfqzUkdrdB3JiwYKH4RsQOwOO7CAswxSeQ32SU3IVXNvpJSHdtanyOjNR" - +"TcFCQEP/gs/uNh3NMIiKRBgKJOvPZ3wQem6rPkTBVky36291ai5Wb9/++B5R9Djm" - +"iZO95chm0yKe+yOEknFxSGiIVVAKLcIE5mgrD3V7rjx2JW5pWnYD8uvShGLqm3XN" - +"a8Yq/YpTtdkUh5So38GfILu5LdzprUtls/gEtLx6Nh+xR5kfosWkLNURTCTzxrHt" - +"zalnPqgIIkS/WR9WBuGMi/Y2Wk+7D1QI44rOloJvvfhydmh77Fds/G4X+rdFKZtd" - +"zX7/SLvuZwJTlnNGjyHg7b7y88tlPB4EgUf+E0nSNJKT2RsdkT029/GWxC92dM8X" - +"ycAXuzOKn9xN2jSpo7q/vRoqhxS0TLvA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mpTYfSChBFbiNK+U" - +"GlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNV" - +"HRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9hzAf" - +"BgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUFAAOC" - +"AQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQb" - +"f1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZ" - +"P5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbN" - +"qyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fP" - +"C2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1" - +"o4zlEa2U5LVUI3xqsv1yM8JAK9xE2TT/3My6zv50mEYVm+Q9Or2m" - ); - - - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.com - // X509v3 Subject Alternative Name: - // DNS:* - private static byte[] KEYSTORE_6 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6+zQqAAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6jRPeljruu54AV3tCXcgQtCkk1iLW44cv8PNY1s47/SKLBsR76vD2lkX" - +"6H0C/IDmFFKu91BAJnuSycOp6fj86K05nrgG1zfGHq/fP7nGrHIb13fAx7ODZeMB" - +"jHtPlvnz7rXJGw/GPvGi4W0Evr55xFY86VA2Hz3dv3FNL58wP6HEnQfY4UNQywX5" - +"DwvA0Fmxbfoy11bGuk/370HgQFl3P1MA/HTpVB/rhfrA3gKDKVV3Zy5CIBRR7HrZ" - +"O/dnetk/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S1VCN8arL9cjPCQCs0" - +"JJw3oAO8wr8AKRM7MuukYfesjw==" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=* - // X509v3 Subject Alternative Name: - // DNS:amqp.example.org, DNS:amqp1.example.org, DNS:amqp2.example.org - private static byte[] KEYSTORE_7 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6/IKyAAAFAzCCBP8wDgYKKwYBBAEqAhEB" - +"AQUABIIE6xPeRrIQPV5WZeUis8cSobRcuNJs0or2dJXdHeWJ04IEqEIjryGaM0mk" - +"FgGn6pqFWldORIxRUs7Wuv8BDrkZdQvruzON0NU+ZMw2jb0SxmgezuZN0P7GqFFh" - +"T/VCdo/6ACPYE35oruu/04ll+cNuXRUpOnle8UJO255+6gANjc2UXvePw78zhx97" - +"4l5Oly5iJv15vyS3og1bn7DbMewzATC/kIzp7sOx1jyxgrGGS5+NtSMomovEtZC3" - +"qFgEipt7yjncalnhD6xI6wIyoAILhgbVmzrTV8z0PQptlMIF5RdH4z3kwePw5De5" - +"nr3mKb2bY7L7MiyWoTDdi+Gjpq1gXhoqF670Gw2bX3E4ekn7XByhFvpeT15eJ/SE" - +"t9MeLEx1hjxEsdNdEucca7hCLBLr/7Msq/w9jytYEtRUBp7i9vKtjNEuE9eiisNB" - +"JdyISKuXwilyGkHvpjy5kySkJqgLLPPa0WXbveNuoyTD8n2eU59EeFiut3/F5Irn" - +"bj8c8gKHvGQUDlN/RW/OVr5dxVoysG5PBqNVcPfrzDBoo6ZNa6l3C76AoarWsqv8" - +"meMSuIGBdhWVFaOP8tgspyoHZOX5MmcNuLcipLxlU533+B5fv0YSdEtcIqUxFMl3" - +"PFJJ4XD8O+6Gw1fR/zLckJgXtwsuKbtHjFYe48oueJ/KyD2XxOmgpjIEcMDXVysK" - +"2+p39G0Y47voLE5/aNLQJsokr0wk/EVj9Ibdmib7R/j18lsiOy8pvX3s/wkNVw5o" - +"RjEYDBe8FDY2TfvJvfBu/s7W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w94pJ" - +"J3N71LQ4xpqU2H0goQRW4jSvlBpXJysDMgaZ1BDzVXYzKQ1QmwIDAQABo2YwZDAO" - +"BgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUrX2n" - +"VtME7uRNydZhGuqs/P7WPYcwHwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4" - +"vc0wDQYJKoZIhvcNAQEFBQADggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/c" - +"faKF89NqWvIBsZ22M9y5rcxkG39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3C" - +"bULDnnJwO2Hr9QVKorMaw3h52T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XI" - +"SnSBEfxulOS+MdokJCxxZmIWzasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuH" - +"I0uPkHAeWcgwLZd+PeD6kuP3zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KL" - +"kkS6sRWASdbq2NZG/44H8/V39aOM5RGtlOS1VCN8arL9cjPCQCtx4aFLK6xAD0Uj" - +"jQ15cQCSY9N44A==" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=* - // X509v3 Subject Alternative Name: - // DNS:amqp.example.org, DNS:example.org - private static byte[] KEYSTORE_8 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg6/PpoAAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6vr3QPQOVRlUDdw7s/OhTAL9KGNH+qX2s1QAv2T8Uu8OSn1tdmZG1FO+" - +"VJP1/lrx9RkyoM7ObMZ29Ic4LR4A5n/qMPPRNUG2gtcGJGZGBULCQlvfX2TCR58h" - +"rvopvvXPRsxPaHkhwBu7Yt4MCTem7nYOBFcSkE0TkYIqHizBbiQQ5mBZvdXo8olZ" - +"L4KuH9Eeueemvp7hXTRnDezUOwxldRIb4JP2/faoQ7KT1SSM/dNnQ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IMC2Xfj3g+pLj988LbL/6jw+P" - +"JspgobqBcodvNge4965sIxms7GtCi5JEurEVgEnW6tjWRv+OB/P1d/WjjOURrZTk" - +"tVQjfGqy/XIzwkArUVeR0qcBd2hG0EwOWN/Sj4i5rM4=" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=amqp.example.org - private static byte[] KEYSTORE_9 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9Y0AAAFATCCBP0wDgYKKwYBBAEqAhEB" - +"AQUABIIE6ZHuMlKfegj23VzIn/Ld1KvgIk8ODWj6++FFAILf7T1fuoWRC/9yUIyR" - +"yIJc8RMlz7zDn9TZci8kY6ECpnQJ4w9MZpGjgg5IQMui/a8ovtEqx11SUHRfQCGA" - +"b1m9HJ8KHz015PAP12m9ZQOQXfIFZfbYuTA5yqVo98NBXVYEBQ5cw28RGUQ89Jpk" - +"9HB4jNplmpbvK/huGldAWWR5QDiIFj0Mgq6IPHTnDCi7Hh+2ubfMUKO6iV4nJV4h" - +"+JF0Cx6jdNmRP42yGXpaOeKahNSzAPUwyEUIDPZQE5nVuDtl8rZqOfCnQ7GYEAMF" - +"EpccRHSD9RxvS3xDh8qxB5i63fpllE+yh+nVL+B0htkUNQu6ZAAl9hsE7b76xcGo" - +"p62n0B7kzBrLC3cV5AcWu43x36g1YlyH8fX6gdIrvi4qjhOTQNcifQtFoLRG32No" - +"0NEuuvBFWEDNZQHb94ahXiHnT4dIe/i2MLiQlVl+AFLgI1YK4H4lkDxw6E46X7+o" - +"/NF2Zi+JxiHDEafetn6EuhXZ6gZQ0fr5GuZw9i+tYBDROUrU8XvtEe0/4lAyG3db" - +"VPSAiaqgQWuEqrUI1xRMSENF/uA72BBl+pusKttIsYjMMrbp+8VRcidBRck/logJ" - +"jUNK0K2H340vWuQAHIBJAjA1UzEDDz4wjwivvPMs1azps6kVNOESDO90fm0O++aN" - +"reQadK9I5UouEtUEke+N/zteKz3ZRXPRqlYWCKfiSu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KSSdze9S0OMaa" - +"lNh9IKEEVuI0r5QaVycrAzIGmdQQ81V2MykNUJsCAwEAAaNmMGQwDgYDVR0PAQH/" - +"BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFK19p1bTBO7kTcnW" - +"YRrqrPz+1j2HMB8GA1UdIwQYMBaAFFqZYjXzLqU0BM9LXe9BQwBcuL3NMA0GCSqG" - +"SIb3DQEBBQUAA4IBAQAViaf9VB8WTouaBckWHOo14aj0yaUFvx3/3H2ihfPTalry" - +"AbGdtjPcua3MZBt/VHa8DCUQdNuU1YF+OSFND2PPUil2qUPxixLtwm1Cw55ycDth" - +"6/UFSqKzGsN4edk/lQjE5JpMg52uXXphLm6F0e5rrdalXYNr8duFyEp0gRH8bpTk" - +"vjHaJCQscWZiFs2rKsAG2DdzD597JaVkleQ/FWaxOfcAaasPB58LhyNLj5BwHlnI" - +"MC2Xfj3g+pLj988LbL/6jw+PJspgobqBcodvNge4965sIxms7GtCi5JEurEVgEnW" - +"6tjWRv+OB/P1d/WjjOURrZTktVQjfGqy/XIzwkArZq9d5Dleg7IfF4il2Y2B3ACA" - +"xAU=" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=*.example.org - private static byte[] KEYSTORE_10 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9f2AAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6l7GDh04s5YLo4/+WM3II4qELbDv4C/LVCeTsUus2xYUkKLG4Ys8AwAa" - +"PTQw2A8a/Rr4gn+ocx9V+xwXaG5Zf+Lp7jJ2zLR43LH1PxrPs1dN0jz1Ucz9f5Jr" - +"QrfGKuWxuPuf8XCYJxuxHQThHkmz6ppTQtDkCgk3QmP77OY5a4aOP+fTbWHUPUKF" - +"r01/rgkHSI1mHjBY5SJAX4ROaC208eLyNBW6KECkOp0pgkAjKU2doI+P4VUU54M1" - +"VLQ9eeqTJHjzUVKQfkG4Dh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VUI3xqsv1yM8JAK6gw7LJ/3sVVgIpQRDfUT5zUTBhc" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=*.org - private static byte[] KEYSTORE_11 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9nJAAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6oO0QMJXLxMfEkyCq7PrV65no5vS0X2QejueGEex71obiMP4ZkbwJTb6" - +"B4ZvlmZKeHJ4m0E7ty+wh09Cr5cSIDSkQLp5oleA9dDMeGeAHOTnM3+J3dyRihnG" - +"qRjlu5rWjZEGKx37e4gvtvm10875xCpYqcqACucbZIaJOW6N+oYUo6cV1G5qTFB+" - +"sC8llSwpOotaLoTvEtAQIrd65tIHWxGZInWpqOO9frAMHTIafQzMVlBkPQZa0GTr" - +"HqSawglNq2iCOyz/3ISL3LawI8p02mZRsD2NmcqDnexnJzLoLqF/J60gOltgiwOm" - +"0L9/l0JaBkWQ4Z6xmgduftxCIJzEXJRuRKXTw3Sl51gKRwllmMpMyKm5Xa4HoMzE" - +"v4O2IhqInvhAj4sP0RbcbGL13K8G5DCZIhEnjMBnotgHzQzmNllZq0vYOlck8FJL" - +"f9Lg2raxdm/rCMUxcqGAXirevUnryfFjJrOtQp5uxj5Xcz4UkqcEUdvBC7ZL33yd" - +"l2EG0VHn+yOmX1tztnEIF/KOC/04OsBEFtA2Ha+/2a1tdH5jkQIouEFQGHhbrvee" - +"QwTeS2CncxN7lkqZ6MrS+FqVdWDFuOVznNPSpNLuCfY2Q+Z+UqQEbtHOsnnQH+UM" - +"aXJEaYpil8fR5lvWhC0y+PjV/JinvFe+Cx20vE1htGBFAuiDCx4THCTmN0Omifgn" - +"VEwS5BPWGTgJFuTldMLOI53zVcHuV+mLDoG0U5XxlmzkHgjDI/WuyHc12c4ATZPt" - +"IQ+dXvRshQGrBpsBM3MNxZpwsvFm+0++5s7psZSEdVpAwMlSUSyMks4tu+0pcVAo" - +"lKjyy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AdBgNVHQ4EFgQUrX2nVtME7uRNydZhGuqs/P7WPYcw" - +"HwYDVR0jBBgwFoAUWpliNfMupTQEz0td70FDAFy4vc0wDQYJKoZIhvcNAQEFBQAD" - +"ggEBABWJp/1UHxZOi5oFyRYc6jXhqPTJpQW/Hf/cfaKF89NqWvIBsZ22M9y5rcxk" - +"G39UdrwMJRB025TVgX45IU0PY89SKXapQ/GLEu3CbULDnnJwO2Hr9QVKorMaw3h5" - +"2T+VCMTkmkyDna5demEuboXR7mut1qVdg2vx24XISnSBEfxulOS+MdokJCxxZmIW" - +"zasqwAbYN3MPn3slpWSV5D8VZrE59wBpqw8HnwuHI0uPkHAeWcgwLZd+PeD6kuP3" - +"zwtsv/qPD48mymChuoFyh282B7j3rmwjGazsa0KLkkS6sRWASdbq2NZG/44H8/V3" - +"9aOM5RGtlOS1VCN8arL9cjPCQCsgdwVU/RVDFxE/lntqxKBUgsne0A==" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=*.*.org - private static byte[] KEYSTORE_12 = DatatypeConverter.parseBase64Binary( - "/u3+7QAAAAIAAAABAAAAAQABMQAAAUg2l9u4AAAFAjCCBP4wDgYKKwYBBAEqAhEB" - +"AQUABIIE6p4HqnSbHITrIX+wJDIMbnFuJiQMvi5ArsqwCBMMuBg7/BYlJxQECWBG" - +"7EuxN/IuuhnexSeDxZReOtOZ4saM8k6Li5GlEFN/nVvZ/xrPOsG0Vo/bhCEUNp/w" - +"4akQmpLIndJWGBrjCu46CH9p2h4hwRUOzeM4JYcyjv4R6jNL3EeMDdzHnuc1zv+t" - +"tadcyPthFFAYT7eLZoGDTJiUy1l0GouAgGKMGSsyRUd3NyEwQx1NgRzx/tMNIkCV" - +"AFFec5gzchLS8lR8mV9GJ2XQXOK0TKILfGK4/akKlphTGANiCU0q1U0kVJzAGg4j" - +"gE22x2d2Sy/NQMxEOg8u8kGy97ISaWAvHPtpsZrFf1KqvbTWNjWgvFehDirk1xj+" - +"lp79OnlkODK+Kb0m8lB2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NpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK" - +"AoIBAQDradZr1W8AD8DmjziXB0UstOXnIEjL+7QbWeDlpgX5Mp4y8+iV+vxaI8x3" - +"ko1IfKsVa5Qge/W0O4vVBF4f6Cbs9LBzUzlSeWJSPdGqWhn0nBLrIgnMbSmIy4k9" - +"bD3uo4zqZImrRhruY4GCGuc+51MWjIDTAx/UetaYgFk6Gu722yJBmOxzZ3WJmyBj" - +"BvKvBsAtetyenE9fkXth4XJGOiqQYzW1RGhqOoFFbh92GB/5/0qQHkbMsfirguwj" - +"C0WwHJMrnDGolhbEd9Spa4S6MtDbHS/PKe3C27D3ikknc3vUtDjGmpTYfSChBFbi" - +"NK+UGlcnKwMyBpnUEPNVdjMpDVCbAgMBAAGjZjBkMA4GA1UdDwEB/wQEAwIBBjAS" - +"BgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBStfadW0wTu5E3J1mEa6qz8/tY9" - +"hzAfBgNVHSMEGDAWgBRamWI18y6lNATPS13vQUMAXLi9zTANBgkqhkiG9w0BAQUF" - +"AAOCAQEAFYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3Lmt" - +"zGQbf1R2vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrD" - +"eHnZP5UIxOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFm" - +"YhbNqyrABtg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS" - +"4/fPC2y/+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz" - +"9Xf1o4zlEa2U5LVUI3xqsv1yM8JAK44kbn5woKcmKSS6+GvVtU+kemw0" - ); - - // Subject: C=US, ST=private, L=province, O=city, CN=* - private static byte[] KEYSTORE_13 = DatatypeConverter.parseBase64Binary( - "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AAOCAQEA" - +"FYmn/VQfFk6LmgXJFhzqNeGo9MmlBb8d/9x9ooXz02pa8gGxnbYz3LmtzGQbf1R2" - +"vAwlEHTblNWBfjkhTQ9jz1IpdqlD8YsS7cJtQsOecnA7Yev1BUqisxrDeHnZP5UI" - +"xOSaTIOdrl16YS5uhdHua63WpV2Da/HbhchKdIER/G6U5L4x2iQkLHFmYhbNqyrA" - +"Btg3cw+feyWlZJXkPxVmsTn3AGmrDwefC4cjS4+QcB5ZyDAtl3494PqS4/fPC2y/" - +"+o8PjybKYKG6gXKHbzYHuPeubCMZrOxrQouSRLqxFYBJ1urY1kb/jgfz9Xf1o4zl" - +"Ea2U5LVUI3xqsv1yM8JAK7QGe+SIq7OzY799930MjoSSK6HI" - ); - - -} 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 deleted file mode 100644 index 53626b6658..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/ByteBufferInputStreamTest.java +++ /dev/null @@ -1,111 +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.util; - -import junit.framework.TestCase; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Arrays; - -public class ByteBufferInputStreamTest extends TestCase -{ - private byte[] _data = {2, 1, 5, 3, 4}; - private ByteBufferInputStream _inputStream; - - public void setUp() throws Exception - { - _inputStream = new ByteBufferInputStream(ByteBuffer.wrap(_data)); - } - - public void testRead() throws IOException - { - for (int i = 0; i < _data.length; i++) - { - assertEquals("Unexpected byte at position " + i, _data[i], _inputStream.read()); - } - assertEquals("EOF not reached", -1, _inputStream.read()); - } - - public void testReadByteArray() throws IOException - { - byte[] readBytes = new byte[_data.length]; - int length = _inputStream.read(readBytes, 0, 2); - - byte[] expected = new byte[_data.length]; - System.arraycopy(_data, 0, expected, 0, 2); - - assertTrue("Unexpected data", Arrays.equals(expected, readBytes)); - assertEquals("Unexpected length", 2, length); - - length = _inputStream.read(readBytes, 2, 3); - - assertTrue("Unexpected data", Arrays.equals(_data, readBytes)); - assertEquals("Unexpected length", 3, length); - - length = _inputStream.read(readBytes); - assertEquals("EOF not reached", -1, length); - } - - public void testSkip() throws IOException - { - _inputStream.skip(3); - byte[] readBytes = new byte[_data.length - 3]; - int length = _inputStream.read(readBytes); - - byte[] expected = new byte[_data.length - 3]; - System.arraycopy(_data, 3, expected, 0, _data.length - 3); - - assertTrue("Unexpected data", Arrays.equals(expected, readBytes)); - assertEquals("Unexpected length", _data.length - 3, length); - } - - public void testAvailable() throws IOException - { - int available = _inputStream.available(); - assertEquals("Unexpected number of available bytes", _data.length, available); - byte[] readBytes = new byte[_data.length]; - _inputStream.read(readBytes); - available = _inputStream.available(); - assertEquals("Unexpected number of available bytes", 0, available); - } - - public void testMarkReset() throws IOException - { - _inputStream.mark(0); - byte[] readBytes = new byte[_data.length]; - int length = _inputStream.read(readBytes); - assertEquals("Unexpected length", _data.length, length); - assertEquals("Unexpected number of available bytes", 0, _inputStream.available()); - - _inputStream.reset(); - readBytes = new byte[_data.length]; - length = _inputStream.read(readBytes); - assertEquals("Unexpected length", _data.length, length); - assertEquals("Unexpected number of available bytes", 0, _inputStream.available()); - } - - public void testMarkSupported() throws IOException - { - assertTrue("Unexpected mark supported", _inputStream.markSupported()); - } - -} 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 deleted file mode 100644 index 7ba5038faa..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java +++ /dev/null @@ -1,555 +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.util; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Properties; - -/** - * Unit tests the {@link CommandLineParser} class. - * - * <p><table id="crc"><caption>CRC Card</caption> - * <tr><th> Responsibilities <th> Collaborations - * <tr><td> Check that parsing a single flag works ok. - * <tr><td> Check that parsing multiple flags condensed together works ok. - * <tr><td> Check that parsing an option with a space between it and its argument works ok. - * <tr><td> Check that parsing an option with no space between it and its argument works ok. - * <tr><td> Check that parsing an option with specific argument format works ok. - * <tr><td> Check that parsing an option with specific argument format fails on bad argument. - * <tr><td> Check that parsing a flag condensed together with an option fails. - * <tr><td> Check that parsing a free argument works ok. - * <tr><td> Check that parsing a free argument with specific format works ok. - * <tr><td> Check that parsing a free argument with specific format fails on bad argument. - * <tr><td> Check that parsing a mandatory option works ok. - * <tr><td> Check that parsing a mandatory free argument works ok. - * <tr><td> Check that parsing a mandatory option fails when no option is set. - * <tr><td> Check that parsing a mandatory free argument fails when no argument is specified. - * <tr><td> Check that parsing an unknown option works when unknowns not errors. - * <tr><td> Check that parsing an unknown flag fails when unknowns are to be reported as errors. - * <tr><td> Check that parsing an unknown option fails when unknowns are to be reported as errors. - * <tr><td> Check that get errors returns a string on errors. - * <tr><td> Check that get errors returns an empty string on no errors. - * <tr><td> Check that get usage returns a string. - * <tr><td> Check that get options in force returns an empty string before parsing. - * <tr><td> Check that get options in force return a non-empty string after parsing. - * </table> - */ -public class CommandLineParserTest extends TestCase -{ - private static final Logger log = LoggerFactory.getLogger(CommandLineParserTest.class); - - public CommandLineParserTest(String name) - { - super(name); - } - - /** - * Compile all the tests for the default test implementation of a traversable state into a test suite. - */ - public static Test suite() - { - // Build a new test suite - TestSuite suite = new TestSuite("CommandLineParser Tests"); - - // Add all the tests defined in this class (using the default constructor) - suite.addTestSuite(CommandLineParserTest.class); - - return suite; - } - - /** Check that get errors returns an empty string on no errors. */ - public void testGetErrorsReturnsEmptyStringOnNoErrors() throws Exception - { - // Create a command line parser for some flags and options. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); - - // Do some legal parsing. - parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" }); - - // Check that the get errors message returns an empty string. - assertTrue("The errors method did not return an empty string.", "".equals(parser.getErrors())); - } - - /** Check that get errors returns a string on errors. */ - public void testGetErrorsReturnsStringOnErrors() throws Exception - { - // Create a command line parser for some flags and options. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); - - try - { - // Do some illegal parsing. - parser.parseCommandLine(new String[] { "-t1", "-t1t2test", "-t4fail" }); - } - catch (IllegalArgumentException e) - { } - - // Check that the get errors message returns a string. - assertTrue("The errors method returned an empty string.", - !((parser.getErrors() == null) || "".equals(parser.getErrors()))); - - } - - /** Check that get options in force returns an empty string before parsing. */ - public void testGetOptionsInForceReturnsEmptyStringBeforeParsing() throws Exception - { - // Create a command line parser for some flags and options. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); - - // Check that the options in force method returns an empty string. - assertTrue("The options in force method did not return an empty string.", "".equals(parser.getOptionsInForce())); - } - - /** Check that get options in force return a non-empty string after parsing. */ - public void testGetOptionsInForceReturnsNonEmptyStringAfterParsing() throws Exception - { - // Create a command line parser for some flags and options. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); - - // Do some parsing. - parser.parseCommandLine(new String[] { "-t1", "-t2test", "-t3test", "-t4test" }); - - // Check that the options in force method returns a string. - assertTrue("The options in force method did not return a non empty string.", - !((parser.getOptionsInForce() == null) || "".equals(parser.getOptionsInForce()))); - } - - /** Check that get usage returns a string. */ - public void testGetUsageReturnsString() throws Exception - { - // Create a command line parser for some flags and options. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" }, - { "t3", "Test Option 3.", "test", "true" }, - { "t4", "Test Option 4.", "test", null, "^test$" } - }); - - // Check that the usage method returns a string. - assertTrue("The usage method did not return a non empty string.", - !((parser.getUsage() == null) || "".equals(parser.getUsage()))); - } - - /** Check that parsing multiple flags condensed together works ok. */ - public void testParseCondensedFlagsOk() throws Exception - { - // Create a command line parser for multiple flags. - CommandLineParser parser = - new CommandLineParser( - new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Flag 2." }, - { "t3", "Test Flag 3." } - }); - - // Parse a command line with the flags set and condensed together. - Properties testProps = parser.parseCommandLine(new String[] { "-t1t2t3" }); - - // Check that the flags were set in the parsed properties. - assertTrue("The t1 flag was not \"true\", it was: " + testProps.get("t1"), "true".equals(testProps.get("t1"))); - assertTrue("The t2 flag was not \"true\", it was: " + testProps.get("t2"), "true".equals(testProps.get("t2"))); - assertTrue("The t3 flag was not \"true\", it was: " + testProps.get("t3"), "true".equals(testProps.get("t3"))); - } - - /** Check that parsing a flag condensed together with an option fails. */ - public void testParseFlagCondensedWithOptionFails() throws Exception - { - // Create a command line parser for a flag and an option. - CommandLineParser parser = - new CommandLineParser(new String[][] - { - { "t1", "Test Flag 1." }, - { "t2", "Test Option 2.", "test" } - }); - - // Check that the parser reports an error. - boolean testPassed = false; - - try - { - // Parse a command line with the flag and option condensed together. - Properties testProps = parser.parseCommandLine(new String[] { "-t1t2" }); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - assertTrue("IllegalArgumentException not thrown when a flag and option are condensed together.", testPassed); - } - - /** Check that parsing a free argument with specific format fails on bad argument. */ - public void testParseFormattedFreeArgumentFailsBadArgument() throws Exception - { - // Create a command line parser for a formatted free argument. - CommandLineParser parser = - new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test", null, "^test$" } - }); - - // Check that the parser signals an error for a badly formatted argument. - boolean testPassed = false; - - try - { - // Parse a command line with this option set incorrectly. - Properties testProps = parser.parseCommandLine(new String[] { "fail" }); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - assertTrue("IllegalArgumentException not thrown when a badly formatted argument was set.", testPassed); - } - - /** Check that parsing a free argument with specific format works ok. */ - public void testParseFormattedFreeArgumentOk() throws Exception - { - // Create a command line parser for a formatted free argument. - CommandLineParser parser = - new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test", null, "^test$" } - }); - - // Parse a command line with this argument set correctly. - Properties testProps = parser.parseCommandLine(new String[] { "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); - } - - /** Check that parsing an option with specific argument format fails on bad argument. */ - public void testParseFormattedOptionArgumentFailsBadArgument() throws Exception - { - // Create a command line parser for a formatted option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", null, "^test$" } - }); - - // Check that the parser signals an error for a badly formatted argument. - boolean testPassed = false; - - try - { - // Parse a command line with this option set incorrectly. - Properties testProps = parser.parseCommandLine(new String[] { "-t", "fail" }); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - assertTrue("IllegalArgumentException not thrown when a badly formatted argument was set.", testPassed); - } - - /** Check that parsing an option with specific argument format works ok. */ - public void testParseFormattedOptionArgumentOk() throws Exception - { - // Create a command line parser for a formatted option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", null, "^test$" } - }); - - // Parse a command line with this option set correctly. - Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), - "test".equals(testProps.get("t"))); - } - - /** Check that parsing a free argument works ok. */ - public void testParseFreeArgumentOk() throws Exception - { - // Create a command line parser for a free argument. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Free Argument.", "test" } - }); - - // Parse a command line with this argument set. - Properties testProps = parser.parseCommandLine(new String[] { "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); - } - - /** Check that parsing a mandatory option works ok. */ - public void testParseMandatoryOptionOk() throws Exception - { - // Create a command line parser for a mandatory option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", "true" } - }); - - // Parse a command line with this option set correctly. - Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), - "test".equals(testProps.get("t"))); - } - - /** Check that parsing a mandatory free argument works ok. */ - public void testParseMandatoryFreeArgumentOk() throws Exception - { - // Create a command line parser for a mandatory free argument. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Option.", "test", "true" } - }); - - // Parse a command line with this argument set. - Properties testProps = parser.parseCommandLine(new String[] { "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The first free argument was not equal to \"test\" but was: " + testProps.get("1"), - "test".equals(testProps.get("1"))); - } - - /** Check that parsing a mandatory free argument fails when no argument is specified. */ - public void testParseManadatoryFreeArgumentFailsNoArgument() throws Exception - { - // Create a command line parser for a mandatory free argument. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "1", "Test Option.", "test", "true" } - }); - - // Check that parsing fails when this mandatory free argument is missing. - boolean testPassed = false; - - try - { - // Parse a command line with this free argument not set. - Properties testProps = parser.parseCommandLine(new String[] {}); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("IllegalArgumentException not thrown for a missing mandatory option.", testPassed); - } - - /** Check that parsing a mandatory option fails when no option is set. */ - public void testParseMandatoryFailsNoOption() throws Exception - { - // Create a command line parser for a mandatory option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test", "true" } - }); - - // Check that parsing fails when this mandatory option is missing. - boolean testPassed = false; - - try - { - // Parse a command line with this option not set. - Properties testProps = parser.parseCommandLine(new String[] {}); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("IllegalArgumentException not thrown for a missing mandatory option.", testPassed); - } - - /** Check that parsing an option with no space between it and its argument works ok. */ - public void testParseOptionWithNoSpaceOk() throws Exception - { - // Create a command line parser for an option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test" } - }); - - // Parse a command line with this option set with no space. - Properties testProps = parser.parseCommandLine(new String[] { "-ttest" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), - "test".equals(testProps.get("t"))); - } - - /** Check that parsing an option with a space between it and its argument works ok. */ - public void testParseOptionWithSpaceOk() throws Exception - { - // Create a command line parser for an option. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Option.", "test" } - }); - - // Parse a command line with this option set with a space. - Properties testProps = parser.parseCommandLine(new String[] { "-t", "test" }); - - // Check that the resultant properties contains the correctly parsed option. - assertTrue("The test option was not equal to \"test\" but was: " + testProps.get("t"), - "test".equals(testProps.get("t"))); - } - - /** Check that parsing a single flag works ok. */ - public void testParseSingleFlagOk() throws Exception - { - // Create a command line parser for a single flag. - CommandLineParser parser = new CommandLineParser(new String[][] - { - { "t", "Test Flag." } - }); - - // Parse a command line with the single flag set. - Properties testProps = parser.parseCommandLine(new String[] { "-t" }); - - // Check that the flag is set in the parsed properties. - assertTrue("The t flag was not \"true\", it was: " + testProps.get("t"), "true".equals(testProps.get("t"))); - - // Reset the parser. - parser.reset(); - - // Parse a command line with the single flag not set. - testProps = parser.parseCommandLine(new String[] {}); - - // Check that the flag is cleared in the parsed properties. - assertTrue("The t flag was not \"false\", it was: " + testProps.get("t"), "false".equals(testProps.get("t"))); - } - - /** Check that parsing an unknown option works when unknowns not errors. */ - public void testParseUnknownOptionOk() throws Exception - { - // Create a command line parser for no flags or options - CommandLineParser parser = new CommandLineParser(new String[][] {}); - - // Check that parsing does not fail on an unknown flag. - try - { - parser.parseCommandLine(new String[] { "-t" }); - } - catch (IllegalArgumentException e) - { - fail("The parser threw an IllegalArgumentException on an unknown flag when errors on unkowns is off."); - } - } - - /** Check that parsing an unknown flag fails when unknowns are to be reported as errors. */ - public void testParseUnknownFlagFailsWhenUnknownsAreErrors() throws Exception - { - // Create a command line parser for no flags or options - CommandLineParser parser = new CommandLineParser(new String[][] {}); - - // Turn on fail on unknowns mode. - parser.setErrorsOnUnknowns(true); - - // Check that parsing fails on an unknown flag. - boolean testPassed = false; - - try - { - parser.parseCommandLine(new String[] { "-t" }); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - assertTrue("IllegalArgumentException not thrown for an unknown flag when errors on unknowns mode is on.", - testPassed); - } - - /** Check that parsing an unknown option fails when unknowns are to be reported as errors. */ - public void testParseUnknownOptionFailsWhenUnknownsAreErrors() throws Exception - { - // Create a command line parser for no flags or options - CommandLineParser parser = new CommandLineParser(new String[][] {}); - - // Turn on fail on unknowns mode. - parser.setErrorsOnUnknowns(true); - - // Check that parsing fails on an unknown flag. - boolean testPassed = false; - - try - { - parser.parseCommandLine(new String[] { "-t", "test" }); - } - catch (IllegalArgumentException e) - { - testPassed = true; - } - - assertTrue("IllegalArgumentException not thrown for an unknown option when errors on unknowns mode is on.", - testPassed); - } -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java deleted file mode 100644 index d6767eb9c0..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java +++ /dev/null @@ -1,694 +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.util; - -import junit.framework.TestCase; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; - -public class FileUtilsTest extends TestCase -{ - private static final String COPY = "-Copy"; - private static final String SUB = "-Sub"; - - /** - * Additional test for the copy method. - * Ensures that the directory count did increase by more than 1 after the copy. - */ - public void testCopyFile() - { - final String TEST_DATA = "FileUtilsTest-testCopy-TestDataTestDataTestDataTestDataTestDataTestData"; - String fileName = "FileUtilsTest-testCopy"; - String fileNameCopy = fileName + COPY; - - File[] beforeCopyFileList = null; - - //Create initial file - File test = createTestFile(fileName, TEST_DATA); - - try - { - //Check number of files before copy - beforeCopyFileList = test.getAbsoluteFile().getParentFile().listFiles(); - int beforeCopy = beforeCopyFileList.length; - - //Perform Copy - File destination = new File(fileNameCopy); - FileUtils.copy(test, destination); - //Ensure the JVM cleans up if cleanup failues - destination.deleteOnExit(); - - //Retrieve counts after copy - int afterCopy = test.getAbsoluteFile().getParentFile().listFiles().length; - - int afterCopyFromCopy = new File(fileNameCopy).getAbsoluteFile().getParentFile().listFiles().length; - - // Validate the copy counts - assertEquals("The file listing from the original and the copy differ in length.", afterCopy, afterCopyFromCopy); - assertEquals("The number of files did not increase.", beforeCopy + 1, afterCopy); - assertEquals("The number of files did not increase.", beforeCopy + 1, afterCopyFromCopy); - - //Validate copy - // Load content - String copiedFileContent = FileUtils.readFileAsString(fileNameCopy); - assertEquals(TEST_DATA, copiedFileContent); - } - finally // Ensure clean - { - //Clean up - assertTrue("Unable to cleanup", FileUtils.deleteFile(fileNameCopy)); - - //Check file list after cleanup - File[] afterCleanup = new File(test.getAbsoluteFile().getParent()).listFiles(); - checkFileLists(beforeCopyFileList, afterCleanup); - - //Remove original file - assertTrue("Unable to cleanup", test.delete()); - } - } - - /** - * Create and Copy the following structure: - * - * testDirectory --+ - * +-- testSubDirectory --+ - * +-- testSubFile - * +-- File - * - * to testDirectory-Copy - * - * Validate that the file count in the copy is correct and contents of the copied files is correct. - */ - public void testCopyRecursive() - { - final String TEST_DATA = "FileUtilsTest-testDirectoryCopy-TestDataTestDataTestDataTestDataTestDataTestData"; - String fileName = "FileUtilsTest-testCopy"; - String TEST_DIR = "testDirectoryCopy"; - - //Create Initial Structure - File testDir = new File(TEST_DIR); - - //Check number of files before copy - File[] beforeCopyFileList = testDir.getAbsoluteFile().getParentFile().listFiles(); - - try - { - //Create Directories - assertTrue("Test directory already exists cannot test.", !testDir.exists()); - - if (!testDir.mkdir()) - { - fail("Unable to make test Directory"); - } - - File testSubDir = new File(TEST_DIR + File.separator + TEST_DIR + SUB); - if (!testSubDir.mkdir()) - { - fail("Unable to make test sub Directory"); - } - - //Create Files - createTestFile(testDir.toString() + File.separator + fileName, TEST_DATA); - createTestFile(testSubDir.toString() + File.separator + fileName + SUB, TEST_DATA); - - //Ensure the JVM cleans up if cleanup failues - testSubDir.deleteOnExit(); - testDir.deleteOnExit(); - - //Perform Copy - File copyDir = new File(testDir.toString() + COPY); - try - { - FileUtils.copyRecursive(testDir, copyDir); - } - catch (FileNotFoundException e) - { - fail(e.getMessage()); - } - catch (FileUtils.UnableToCopyException e) - { - fail(e.getMessage()); - } - - //Validate Copy - assertEquals("Copied directory should only have one file and one directory in it.", 2, copyDir.listFiles().length); - - //Validate Copy File Contents - String copiedFileContent = FileUtils.readFileAsString(copyDir.toString() + File.separator + fileName); - assertEquals(TEST_DATA, copiedFileContent); - - //Validate Name of Sub Directory - assertTrue("Expected subdirectory is not a directory", new File(copyDir.toString() + File.separator + TEST_DIR + SUB).isDirectory()); - - //Assert that it contains only one item - assertEquals("Copied sub directory should only have one directory in it.", 1, new File(copyDir.toString() + File.separator + TEST_DIR + SUB).listFiles().length); - - //Validate content of Sub file - copiedFileContent = FileUtils.readFileAsString(copyDir.toString() + File.separator + TEST_DIR + SUB + File.separator + fileName + SUB); - assertEquals(TEST_DATA, copiedFileContent); - } - finally - { - //Clean up source and copy directory. - assertTrue("Unable to cleanup", FileUtils.delete(testDir, true)); - assertTrue("Unable to cleanup", FileUtils.delete(new File(TEST_DIR + COPY), true)); - - //Check file list after cleanup - File[] afterCleanup = testDir.getAbsoluteFile().getParentFile().listFiles(); - checkFileLists(beforeCopyFileList, afterCleanup); - } - } - - - /** - * Helper method to create a temporary file with test content. - * - * @param test_data The data to store in the file - * - * @return The File reference - */ - private File createTestFileInTmpDir(final String testData) throws Exception - { - final File tmpFile = File.createTempFile("test", "tmp"); - - return createTestFile(tmpFile.getCanonicalPath(), testData); - } - /** - * Helper method to create a test file with a string content - * - * @param fileName The fileName to use in the creation - * @param test_data The data to store in the file - * - * @return The File reference - */ - private File createTestFile(String fileName, String test_data) - { - File test = new File(fileName); - - try - { - test.createNewFile(); - //Ensure the JVM cleans up if cleanup failues - test.deleteOnExit(); - } - catch (IOException e) - { - fail(e.getMessage()); - } - - BufferedWriter writer = null; - try - { - writer = new BufferedWriter(new FileWriter(test)); - try - { - writer.write(test_data); - } - catch (IOException e) - { - fail(e.getMessage()); - } - } - catch (IOException e) - { - fail(e.getMessage()); - } - finally - { - try - { - if (writer != null) - { - writer.close(); - } - } - catch (IOException e) - { - fail(e.getMessage()); - } - } - - return test; - } - - /** Test that deleteFile only deletes the specified file */ - public void testDeleteFile() - { - File test = new File("FileUtilsTest-testDelete"); - //Record file count in parent directory to check it is not changed by delete - String path = test.getAbsolutePath(); - File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountBefore = filesBefore.length; - - try - { - test.createNewFile(); - //Ensure the JVM cleans up if cleanup failues - test.deleteOnExit(); - } - catch (IOException e) - { - fail(e.getMessage()); - } - - assertTrue("File does not exists", test.exists()); - assertTrue("File is not a file", test.isFile()); - - //Check that file creation can be seen on disk - int fileCountCreated = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles().length; - assertEquals("File creation was no registered", fileCountBefore + 1, fileCountCreated); - - //Perform Delete - assertTrue("Unable to cleanup", FileUtils.deleteFile("FileUtilsTest-testDelete")); - - assertTrue("File exists after delete", !test.exists()); - - //Check that after deletion the file count is now accurate - File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountAfter = filesAfter.length; - assertEquals("File creation was no registered", fileCountBefore, fileCountAfter); - - checkFileLists(filesBefore, filesAfter); - } - - public void testDeleteNonExistentFile() - { - File test = new File("FileUtilsTest-testDelete-" + System.currentTimeMillis()); - - assertTrue("File exists", !test.exists()); - assertFalse("File is a directory", test.isDirectory()); - - assertTrue("Delete Succeeded ", !FileUtils.delete(test, true)); - } - - public void testDeleteNull() - { - try - { - FileUtils.delete(null, true); - fail("Delete with null value should throw NPE."); - } - catch (NullPointerException npe) - { - // expected path - } - } - - /** - * Tests that openFileOrDefaultResource can open a file on the filesystem. - * - */ - public void testOpenFileOrDefaultResourceOpensFileOnFileSystem() throws Exception - { - final File testFile = createTestFileInTmpDir("src=tmpfile"); - final String filenameOnFilesystem = testFile.getCanonicalPath(); - final String defaultResource = "org/apache/qpid/util/default.properties"; - - - final InputStream is = FileUtils.openFileOrDefaultResource(filenameOnFilesystem, defaultResource, this.getClass().getClassLoader()); - assertNotNull("Stream must not be null", is); - final Properties p = new Properties(); - p.load(is); - assertEquals("tmpfile", p.getProperty("src")); - } - - /** - * Tests that openFileOrDefaultResource can open a file on the classpath. - * - */ - public void testOpenFileOrDefaultResourceOpensFileOnClasspath() throws Exception - { - final String mydefaultsResource = "org/apache/qpid/util/mydefaults.properties"; - final String defaultResource = "org/apache/qpid/util/default.properties"; - - - final InputStream is = FileUtils.openFileOrDefaultResource(mydefaultsResource, defaultResource, this.getClass().getClassLoader()); - assertNotNull("Stream must not be null", is); - final Properties p = new Properties(); - p.load(is); - assertEquals("mydefaults", p.getProperty("src")); - } - - /** - * Tests that openFileOrDefaultResource returns the default resource when file cannot be found. - */ - public void testOpenFileOrDefaultResourceOpensDefaultResource() throws Exception - { - final File fileThatDoesNotExist = new File("/does/not/exist.properties"); - assertFalse("Test must not exist", fileThatDoesNotExist.exists()); - - final String defaultResource = "org/apache/qpid/util/default.properties"; - - final InputStream is = FileUtils.openFileOrDefaultResource(fileThatDoesNotExist.getCanonicalPath(), defaultResource, this.getClass().getClassLoader()); - assertNotNull("Stream must not be null", is); - Properties p = new Properties(); - p.load(is); - assertEquals("default.properties", p.getProperty("src")); - } - - /** - * Tests that openFileOrDefaultResource returns null if neither the file nor - * the default resource can be found.. - */ - public void testOpenFileOrDefaultResourceReturnsNullWhenNeitherCanBeFound() throws Exception - { - - final String mydefaultsResource = "org/apache/qpid/util/doesnotexisteiether.properties"; - final String defaultResource = "org/apache/qpid/util/doesnotexisteiether.properties"; - - final InputStream is = FileUtils.openFileOrDefaultResource(mydefaultsResource, defaultResource, this.getClass().getClassLoader()); - assertNull("Stream must be null", is); - } - - /** - * Given two lists of File arrays ensure they are the same length and all entries in Before are in After - * - * @param filesBefore File[] - * @param filesAfter File[] - */ - private void checkFileLists(File[] filesBefore, File[] filesAfter) - { - assertNotNull("Before file list cannot be null", filesBefore); - assertNotNull("After file list cannot be null", filesAfter); - - assertEquals("File lists are unequal", filesBefore.length, filesAfter.length); - - for (File fileBefore : filesBefore) - { - boolean found = false; - - for (File fileAfter : filesAfter) - { - if (fileBefore.getAbsolutePath().equals(fileAfter.getAbsolutePath())) - { - found = true; - break; - } - } - - assertTrue("File'" + fileBefore.getName() + "' was not in directory afterwards", found); - } - } - - public void testNonRecursiveNonEmptyDirectoryDeleteFails() - { - String directoryName = "FileUtilsTest-testRecursiveDelete"; - File test = new File(directoryName); - - //Record file count in parent directory to check it is not changed by delete - String path = test.getAbsolutePath(); - File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountBefore = filesBefore.length; - - assertTrue("Directory exists", !test.exists()); - - test.mkdir(); - - //Create a file in the directory - String fileName = test.getAbsolutePath() + File.separatorChar + "testFile"; - File subFile = new File(fileName); - try - { - subFile.createNewFile(); - //Ensure the JVM cleans up if cleanup failues - subFile.deleteOnExit(); - } - catch (IOException e) - { - fail(e.getMessage()); - } - //Ensure the JVM cleans up if cleanup failues - // This must be after the subFile as the directory must be empty before - // the delete is performed - test.deleteOnExit(); - - //Try and delete the non-empty directory - assertFalse("Non Empty Directory was successfully deleted.", FileUtils.deleteDirectory(directoryName)); - - //Check directory is still there - assertTrue("Directory was deleted.", test.exists()); - - // Clean up - assertTrue("Unable to cleanup", FileUtils.delete(test, true)); - - //Check that after deletion the file count is now accurate - File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountAfter = filesAfter.length; - assertEquals("File creation was no registered", fileCountBefore, fileCountAfter); - - checkFileLists(filesBefore, filesAfter); - } - - /** Test that an empty directory can be deleted with deleteDirectory */ - public void testEmptyDirectoryDelete() - { - String directoryName = "FileUtilsTest-testRecursiveDelete"; - File test = new File(directoryName); - - //Record file count in parent directory to check it is not changed by delete - String path = test.getAbsolutePath(); - File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountBefore = filesBefore.length; - - assertTrue("Directory exists", !test.exists()); - - test.mkdir(); - //Ensure the JVM cleans up if cleanup failues - test.deleteOnExit(); - - //Try and delete the empty directory - assertTrue("Non Empty Directory was successfully deleted.", FileUtils.deleteDirectory(directoryName)); - - //Check directory is still there - assertTrue("Directory was deleted.", !test.exists()); - - //Check that after deletion the file count is now accurate - File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountAfter = filesAfter.length; - assertEquals("File creation was no registered", fileCountBefore, fileCountAfter); - - checkFileLists(filesBefore, filesAfter); - - } - - /** Test that deleteDirectory on a non empty directory to complete */ - public void testNonEmptyDirectoryDelete() - { - String directoryName = "FileUtilsTest-testRecursiveDelete"; - File test = new File(directoryName); - - assertTrue("Directory exists", !test.exists()); - - //Record file count in parent directory to check it is not changed by delete - String path = test.getAbsolutePath(); - File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountBefore = filesBefore.length; - - test.mkdir(); - - //Create a file in the directory - String fileName = test.getAbsolutePath() + File.separatorChar + "testFile"; - File subFile = new File(fileName); - try - { - subFile.createNewFile(); - //Ensure the JVM cleans up if cleanup failues - subFile.deleteOnExit(); - } - catch (IOException e) - { - fail(e.getMessage()); - } - - // Ensure the JVM cleans up if cleanup failues - // This must be after the subFile as the directory must be empty before - // the delete is performed - test.deleteOnExit(); - - //Try and delete the non-empty directory non-recursively - assertFalse("Non Empty Directory was successfully deleted.", FileUtils.delete(test, false)); - - //Check directory is still there - assertTrue("Directory was deleted.", test.exists()); - - // Clean up - assertTrue("Unable to cleanup", FileUtils.delete(test, true)); - - //Check that after deletion the file count is now accurate - File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountAfter = filesAfter.length; - assertEquals("File creation was no registered", fileCountBefore, fileCountAfter); - - checkFileLists(filesBefore, filesAfter); - - } - - /** Test that a recursive delete successeds */ - public void testRecursiveDelete() - { - String directoryName = "FileUtilsTest-testRecursiveDelete"; - File test = new File(directoryName); - - assertTrue("Directory exists", !test.exists()); - - //Record file count in parent directory to check it is not changed by delete - String path = test.getAbsolutePath(); - File[] filesBefore = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountBefore = filesBefore.length; - - test.mkdir(); - - createSubDir(directoryName, 2, 4); - - //Ensure the JVM cleans up if cleanup failues - // This must be after the sub dir creation as the delete order is - // recorded and the directory must be empty to be deleted. - test.deleteOnExit(); - - assertFalse("Non recursive delete was able to directory", FileUtils.delete(test, false)); - - assertTrue("File does not exist after non recursive delete", test.exists()); - - assertTrue("Unable to cleanup", FileUtils.delete(test, true)); - - assertTrue("File exist after recursive delete", !test.exists()); - - //Check that after deletion the file count is now accurate - File[] filesAfter = new File(path.substring(0, path.lastIndexOf(File.separator))).listFiles(); - int fileCountAfter = filesAfter.length; - assertEquals("File creation was no registered", fileCountBefore, fileCountAfter); - - checkFileLists(filesBefore, filesAfter); - - } - - private void createSubDir(String path, int directories, int files) - { - File directory = new File(path); - - assertTrue("Directory" + path + " does not exists", directory.exists()); - - for (int dir = 0; dir < directories; dir++) - { - String subDirName = path + File.separatorChar + "sub" + dir; - File subDir = new File(subDirName); - - subDir.mkdir(); - - createSubDir(subDirName, directories - 1, files); - //Ensure the JVM cleans up if cleanup failues - // This must be after the sub dir creation as the delete order is - // recorded and the directory must be empty to be deleted. - subDir.deleteOnExit(); - } - - for (int file = 0; file < files; file++) - { - String subDirName = path + File.separatorChar + "file" + file; - File subFile = new File(subDirName); - try - { - subFile.createNewFile(); - //Ensure the JVM cleans up if cleanup failues - subFile.deleteOnExit(); - } - catch (IOException e) - { - fail(e.getMessage()); - } - } - } - - public static final String SEARCH_STRING = "testSearch"; - - /** - * Test searchFile(File file, String search) will find a match when it - * exists. - * - * @throws java.io.IOException if unable to perform test setup - */ - public void testSearchSucceed() throws IOException - { - File _logfile = File.createTempFile("FileUtilsTest-testSearchSucceed", ".out"); - - prepareFileForSearchTest(_logfile); - - List<String> results = FileUtils.searchFile(_logfile, SEARCH_STRING); - - assertNotNull("Null result set returned", results); - - assertEquals("Results do not contain expected count", 1, results.size()); - } - - /** - * Test searchFile(File file, String search) will not find a match when the - * test string does not exist. - * - * @throws java.io.IOException if unable to perform test setup - */ - public void testSearchFail() throws IOException - { - File _logfile = File.createTempFile("FileUtilsTest-testSearchFail", ".out"); - - prepareFileForSearchTest(_logfile); - - List<String> results = FileUtils.searchFile(_logfile, "Hello"); - - assertNotNull("Null result set returned", results); - - //Validate we only got one message - if (results.size() > 0) - { - System.err.println("Unexpected messages"); - - for (String msg : results) - { - System.err.println(msg); - } - } - - assertEquals("Results contains data when it was not expected", - 0, results.size()); - } - - /** - * Write the SEARCH_STRING in to the given file. - * - * @param logfile The file to write the SEARCH_STRING into - * - * @throws IOException if an error occurs - */ - private void prepareFileForSearchTest(File logfile) throws IOException - { - BufferedWriter writer = new BufferedWriter(new FileWriter(logfile)); - writer.append(SEARCH_STRING); - writer.flush(); - writer.close(); - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java deleted file mode 100644 index 60e80da15f..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/GZIPUtilsTest.java +++ /dev/null @@ -1,102 +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.util; - - -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.Arrays; - -import junit.framework.TestCase; - -public class GZIPUtilsTest extends TestCase -{ - public void testCompressUncompress() throws Exception - { - byte[] data = new byte[1024]; - Arrays.fill(data, (byte)'a'); - byte[] compressed = GZIPUtils.compressBufferToArray(ByteBuffer.wrap(data)); - assertTrue("Compression didn't compress", compressed.length < data.length); - byte[] uncompressed = GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(compressed)); - assertTrue("Compression not reversible", Arrays.equals(data,uncompressed)); - } - - public void testUncompressNonZipReturnsNull() throws Exception - { - byte[] data = new byte[1024]; - Arrays.fill(data, (byte)'a'); - assertNull("Non zipped data should not uncompress", GZIPUtils.uncompressBufferToArray(ByteBuffer.wrap(data))); - } - - public void testUncompressStreamWithErrorReturnsNull() throws Exception - { - InputStream is = new InputStream() - { - @Override - public int read() throws IOException - { - throw new IOException(); - } - }; - assertNull("Stream error should return null", GZIPUtils.uncompressStreamToArray(is)); - } - - - public void testUncompressNullStreamReturnsNull() throws Exception - { - assertNull("Null Stream should return null", GZIPUtils.uncompressStreamToArray(null)); - } - public void testUncompressNullBufferReturnsNull() throws Exception - { - assertNull("Null buffer should return null", GZIPUtils.uncompressBufferToArray(null)); - } - - public void testCompressNullArrayReturnsNull() - { - assertNull(GZIPUtils.compressBufferToArray(null)); - } - - public void testNonHeapBuffers() throws Exception - { - - byte[] data = new byte[1024]; - Arrays.fill(data, (byte)'a'); - ByteBuffer directBuffer = ByteBuffer.allocateDirect(1024); - directBuffer.put(data); - directBuffer.flip(); - - byte[] compressed = GZIPUtils.compressBufferToArray(directBuffer); - - assertTrue("Compression didn't compress", compressed.length < data.length); - - directBuffer.clear(); - directBuffer.position(1); - directBuffer = directBuffer.slice(); - directBuffer.put(compressed); - directBuffer.flip(); - - byte[] uncompressed = GZIPUtils.uncompressBufferToArray(directBuffer); - - assertTrue("Compression not reversible", Arrays.equals(data,uncompressed)); - - } -} 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 deleted file mode 100644 index c5464aab79..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/PropertyUtilsTest.java +++ /dev/null @@ -1,43 +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.util; - -import org.apache.qpid.configuration.PropertyException; -import org.apache.qpid.configuration.PropertyUtils; -import org.apache.qpid.test.utils.QpidTestCase; - -public class PropertyUtilsTest extends QpidTestCase -{ - public void testSimpleExpansion() throws PropertyException - { - System.setProperty("banana", "fruity"); - String expandedProperty = PropertyUtils.replaceProperties("${banana}"); - assertEquals(expandedProperty, "fruity"); - } - - public void testDualExpansion() throws PropertyException - { - System.setProperty("banana", "fruity"); - System.setProperty("concrete", "horrible"); - String expandedProperty = PropertyUtils.replaceProperties("${banana}xyz${concrete}"); - assertEquals(expandedProperty, "fruityxyzhorrible"); - } -} 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 deleted file mode 100644 index c3fcf73b38..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/SerialTest.java +++ /dev/null @@ -1,78 +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.util; - - -import junit.framework.TestCase; - -/** - *Junit tests for the Serial class - */ -public class SerialTest extends TestCase -{ - - /** - * Test the key boundaries where wraparound occurs. - */ - public void testBoundaries() - { - assertTrue(Serial.gt(1, 0)); - assertTrue(Serial.lt(0, 1)); - - assertTrue(Serial.gt(Integer.MAX_VALUE+1, Integer.MAX_VALUE)); - assertTrue(Serial.lt(Integer.MAX_VALUE, Integer.MAX_VALUE+1)); - - assertTrue(Serial.gt(0xFFFFFFFF + 1, 0xFFFFFFFF)); - assertTrue(Serial.lt(0xFFFFFFFF, 0xFFFFFFFF + 1)); - } - - /** - * Test the first Corollary of RFC 1982 - * For any sequence number s and any integer n such that addition of n - * to s is well defined, (s + n) >= s. Further (s + n) == s only when - * n == 0, in all other defined cases, (s + n) > s. - */ - public void testCorollary1() - { - int wrapcount = 0; - - int s = 0; - - for (int i = 0; i < 67108664; i++) - { - for (int n = 1; n < 4096; n += 512) - { - assertTrue(Serial.gt(s+n, s)); - assertTrue(Serial.lt(s, s+n)); - } - - s += 1024; - - if (s == 0) - { - wrapcount += 1; - } - } - - assertTrue(wrapcount > 0); - } - -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java deleted file mode 100644 index e513b488e6..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/StringsTest.java +++ /dev/null @@ -1,48 +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.util; - -import java.util.Collections; -import java.util.LinkedHashMap; - -import junit.framework.TestCase; - -public class StringsTest extends TestCase -{ - public void testSubstitutionResolver() - { - Strings.MapResolver mapResolver = - new Strings.MapResolver(Collections.singletonMap("test", "C:\\TEMP\\\"Hello World\"")); - - Strings.Resolver jsonResolver = Strings.createSubstitutionResolver("json:", - new LinkedHashMap<String, String>() - { - { - put("\\", "\\\\"); - put("\"", "\\\""); - } - }); - - assertEquals("{ \"path\" : \"C:\\\\TEMP\\\\\\\"Hello World\\\"\\foo\" }", - Strings.expand("{ \"path\" : \"${json:test}\\foo\" }",Strings.chain(jsonResolver,mapResolver))); - - } -} diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties b/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties deleted file mode 100644 index 8214cc1fee..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/default.properties +++ /dev/null @@ -1,21 +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. -# - -# Used by FileUtilsTests -src=default.properties
\ No newline at end of file diff --git a/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties b/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties deleted file mode 100644 index c0a21d08d1..0000000000 --- a/qpid/java/common/src/test/java/org/apache/qpid/util/mydefaults.properties +++ /dev/null @@ -1,21 +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. -# - -# Used by FileUtilsTests -src=mydefaults
\ No newline at end of file |
