Repository: qpid-broker-j Updated Branches: refs/heads/7.0.x be3325151 -> ce80d1448
[QPID-6933][System Tests] Remove protocol specific tests relying on specific client client classes * Tests are deleted due to changes to client interface ByteBufferSender * Protocol specific tests needs to be implemented to replace deleted system tests Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/ce80d144 Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/ce80d144 Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/ce80d144 Branch: refs/heads/7.0.x Commit: ce80d1448533252e95fac60a004aa2760d33bd9b Parents: be33251 Author: Alex Rudyy <oru...@apache.org> Authored: Mon Nov 13 13:23:06 2017 +0000 Committer: Alex Rudyy <oru...@apache.org> Committed: Mon Nov 13 13:23:06 2017 +0000 ---------------------------------------------------------------------- .../transport/ConnectionEstablishmentTest.java | 323 ---------------- .../apache/qpid/transport/MaxFrameSizeTest.java | 383 ------------------- .../org/apache/qpid/transport/TestSender.java | 90 ----- test-profiles/CPPExcludes | 7 - test-profiles/Java010Excludes | 3 - test-profiles/Java10Excludes | 7 - 6 files changed, 813 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/systests/src/test/java/org/apache/qpid/transport/ConnectionEstablishmentTest.java ---------------------------------------------------------------------- diff --git a/systests/src/test/java/org/apache/qpid/transport/ConnectionEstablishmentTest.java b/systests/src/test/java/org/apache/qpid/transport/ConnectionEstablishmentTest.java deleted file mode 100644 index dabf280..0000000 --- a/systests/src/test/java/org/apache/qpid/transport/ConnectionEstablishmentTest.java +++ /dev/null @@ -1,323 +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 java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.net.SocketTimeoutException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.jms.Connection; -import javax.jms.Destination; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.client.AMQConnectionFactory; -import org.apache.qpid.client.BrokerDetails; -import org.apache.qpid.codec.ClientDecoder; -import org.apache.qpid.configuration.ClientProperties; -import org.apache.qpid.framing.AMQDataBlock; -import org.apache.qpid.framing.AMQFrame; -import org.apache.qpid.framing.AMQFrameDecodingException; -import org.apache.qpid.framing.AMQMethodBodyImpl; -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.framing.ChannelOpenBody; -import org.apache.qpid.framing.ConnectionCloseBody; -import org.apache.qpid.framing.ConnectionOpenBody; -import org.apache.qpid.framing.ConnectionStartBody; -import org.apache.qpid.framing.FrameCreatingMethodProcessor; -import org.apache.qpid.framing.ProtocolVersion; -import org.apache.qpid.framing.QueueDeleteBody; -import org.apache.qpid.jms.ConnectionURL; -import org.apache.qpid.server.model.Protocol; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_8; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_9; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_9_1; -import org.apache.qpid.test.utils.QpidBrokerTestCase; -import org.apache.qpid.test.utils.TestBrokerConfiguration; -import org.apache.qpid.transport.network.Assembler; -import org.apache.qpid.transport.network.Disassembler; -import org.apache.qpid.transport.network.InputHandler; - -public class ConnectionEstablishmentTest extends QpidBrokerTestCase -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionEstablishmentTest.class); - private static final int NUMBER_OF_MESSAGES = 2; - private Connection _utilityConnection; - private Destination _testQueue; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _utilityConnection = getConnection(); - Session session = _utilityConnection.createSession(false, Session.SESSION_TRANSACTED); - _testQueue = getTestQueue(); - session.createConsumer(_testQueue).close(); - sendMessage(session, _testQueue, NUMBER_OF_MESSAGES); - session.close(); - } - - public void testAuthenticationBypass() throws Exception - { - String virtualHost = TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST; - ConnectionURL connectionURL = ((AMQConnectionFactory) getConnectionFactory()).getConnectionURL(); - BrokerDetails brokerDetails = connectionURL.getAllBrokerDetails().get(0); - try (Socket socket = new Socket(brokerDetails.getHost(), brokerDetails.getPort()); - OutputStream os = socket.getOutputStream()) - { - socket.setTcpNoDelay(true); - socket.setSoTimeout(5000); - openConnectionBypassingAuthenticationAndDeleteQueue(virtualHost, socket, os); - } - - // verify that queue still exists - _utilityConnection.start(); - setSystemProperty(ClientProperties.QPID_DECLARE_QUEUES_PROP_NAME, "false"); - Session session = _utilityConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer consumer = session.createConsumer(_testQueue); - Message message = consumer.receive(RECEIVE_TIMEOUT); - for (int i = 0; i < NUMBER_OF_MESSAGES; i++) - { - assertNotNull("Message [" + i + "] not received", message); - } - } - - private void openConnectionBypassingAuthenticationAndDeleteQueue(final String virtualHost, - final Socket socket, - final OutputStream os) - throws Exception - { - if (isBroker010()) - { - open010ConnectionBypassingAuthenticationAndDeleteQueue(socket, os, virtualHost); - } - else - { - openNon010ConnectionBypassingAuthenticationAndDeleteQueue(socket, os, virtualHost); - } - } - - private void open010ConnectionBypassingAuthenticationAndDeleteQueue(Socket socket, - OutputStream os, - final String virtualHost) - throws IOException - { - TestSender sender = new TestSender(os); - Disassembler disassembler = new Disassembler(sender, Constant.MIN_MAX_FRAME_SIZE); - disassembler.send(new ProtocolHeader(1, 0, 10)); - disassembler.send(new ConnectionOpen(virtualHost, null, Option.INSIST)); - byte[] sessionName = "test".getBytes(); - disassembler.send(new SessionAttach(sessionName)); - disassembler.send(new SessionAttached(sessionName)); - disassembler.send(new SessionRequestTimeout(0)); - disassembler.send(new SessionCommandPoint(0, 0)); - disassembler.send(new QueueDelete(getTestQueueName(), Option.SYNC)); - disassembler.send(new SessionFlush()); - disassembler.send(new ExecutionSync(Option.SYNC)); - sender.flush(); - - TestEventReceiver receiver = new TestEventReceiver(); - Assembler assembler = new Assembler(receiver); - InputHandler inputHandler = new InputHandler(assembler, false); - try (InputStream is = socket.getInputStream()) - { - byte[] buffer = new byte[1024]; - int size; - try - { - while ((size = is.read(buffer)) > 0) - { - inputHandler.received(ByteBuffer.wrap(buffer, 0, size)); - if (receiver.isClosed() || receiver.getThrowable() != null || receiver.getEvents().size() > 3) - { - // expected at most 3 events: Header, ConnectionStart, ConnectionClose - break; - } - } - } - catch (SocketTimeoutException e) - { - // ignore - } - } - - boolean closeFound = receiver.isClosed() || receiver.getThrowable() != null; - for (ProtocolEvent event : receiver.getEvents()) - { - if (event instanceof ConnectionClose) - { - closeFound = true; - break; - } - } - - assertTrue("Unauthenticated connection was not closed", closeFound); - } - - private void openNon010ConnectionBypassingAuthenticationAndDeleteQueue(final Socket socket, - final OutputStream os, - final String virtualHost) - throws IOException, AMQFrameDecodingException - { - - byte[] protocolHeader = getProtocolHeaderBytes(); - String versionName = getBrokerProtocol().name().substring(5); - if (versionName.equals("0_9_1")) - { - versionName = "0-91"; - } - ProtocolVersion protocolVersion = ProtocolVersion.parse(versionName.replace('_', '-')); - - os.write(protocolHeader); - try (InputStream is = socket.getInputStream()) - { - receiveFrameOfType(protocolVersion, is, ConnectionStartBody.class, 1); - TestSender sender = new TestSender(os); - - new AMQFrame(0, new ConnectionOpenBody(AMQShortString.valueOf(virtualHost), - AMQShortString.EMPTY_STRING, - true)).writePayload(sender); - new AMQFrame(1, new ChannelOpenBody()).writePayload(sender); - new AMQFrame(1, new QueueDeleteBody(2, - AMQShortString.valueOf(getTestQueueName()), - false, - false, - true)).writePayload(sender); - sender.flush(); - - receiveFrameOfType(protocolVersion, is, ConnectionCloseBody.class, 1); - } - } - - private byte[] getProtocolHeaderBytes() - { - byte[] protocolHeader; - Protocol protocol = getBrokerProtocol(); - switch (protocol) - { - case AMQP_0_8: - protocolHeader = (ProtocolEngineCreator_0_8.getInstance().getHeaderIdentifier()); - break; - case AMQP_0_9: - protocolHeader = (ProtocolEngineCreator_0_9.getInstance().getHeaderIdentifier()); - break; - case AMQP_0_9_1: - protocolHeader = (ProtocolEngineCreator_0_9_1.getInstance().getHeaderIdentifier()); - break; - default: - throw new RuntimeException("Unexpected Protocol Version: " + protocol); - } - return protocolHeader; - } - - private void receiveFrameOfType(ProtocolVersion protocolVersion, InputStream is, - Class<? extends AMQMethodBodyImpl> expectedFrameClass, - int maxNumberOfExpectedFrames) throws IOException, AMQFrameDecodingException - { - final FrameCreatingMethodProcessor methodProcessor = new FrameCreatingMethodProcessor(protocolVersion); - ClientDecoder decoder = new ClientDecoder(methodProcessor); - byte[] buffer = new byte[1024]; - int size; - while ((size = is.read(buffer)) > 0) - { - - decoder.decodeBuffer(ByteBuffer.wrap(buffer, 0, size)); - - List<AMQDataBlock> responseData = methodProcessor.getProcessedMethods(); - LOGGER.info("RECV:" + responseData); - if (containsFrame(responseData, expectedFrameClass) || responseData.size() > maxNumberOfExpectedFrames) - { - break; - } - } - - List<AMQDataBlock> processedMethods = methodProcessor.getProcessedMethods(); - assertTrue("Expected frame of type " + expectedFrameClass.getSimpleName() + " is not received", - containsFrame(processedMethods, expectedFrameClass)); - } - - private boolean containsFrame(final List<AMQDataBlock> frames, - final Class<? extends AMQMethodBodyImpl> frameClass) - { - for (AMQDataBlock block : frames) - { - AMQFrame frame = (AMQFrame) block; - if (frameClass.isInstance(frame.getBodyFrame())) - { - return true; - } - } - return false; - } - - private class TestEventReceiver implements ProtocolEventReceiver - { - private volatile boolean _closed; - private volatile Throwable _throwable; - private final List<ProtocolEvent> _events = new ArrayList<>(); - - @Override - public void received(final ProtocolEvent msg) - { - LOGGER.info("RECV:" + msg); - _events.add(msg); - } - - @Override - public void exception(final Throwable t) - { - _throwable = t; - } - - @Override - public void closed() - { - _closed = true; - } - - public boolean isClosed() - { - return _closed; - } - - public Collection<ProtocolEvent> getEvents() - { - return Collections.unmodifiableCollection(_events); - } - - public Throwable getThrowable() - { - return _throwable; - } - } -} http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java ---------------------------------------------------------------------- diff --git a/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java b/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java deleted file mode 100644 index 46c20f9..0000000 --- a/systests/src/test/java/org/apache/qpid/transport/MaxFrameSizeTest.java +++ /dev/null @@ -1,383 +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 java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.List; - -import javax.naming.NamingException; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; -import javax.security.sasl.Sasl; -import javax.security.sasl.SaslClient; -import javax.security.sasl.SaslException; - -import org.apache.qpid.client.AMQConnectionFactory; -import org.apache.qpid.client.BrokerDetails; -import org.apache.qpid.codec.ClientDecoder; -import org.apache.qpid.framing.AMQDataBlock; -import org.apache.qpid.framing.AMQFrame; -import org.apache.qpid.framing.AMQFrameDecodingException; -import org.apache.qpid.framing.AMQMethodBodyImpl; -import org.apache.qpid.framing.AMQProtocolVersionException; -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.framing.ConnectionCloseBody; -import org.apache.qpid.framing.ConnectionCloseOkBody; -import org.apache.qpid.framing.ConnectionOpenBody; -import org.apache.qpid.framing.ConnectionOpenOkBody; -import org.apache.qpid.framing.ConnectionStartOkBody; -import org.apache.qpid.framing.ConnectionTuneOkBody; -import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.framing.FrameCreatingMethodProcessor; -import org.apache.qpid.framing.ProtocolVersion; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.Protocol; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_8; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_9; -import org.apache.qpid.server.protocol.v0_8.ProtocolEngineCreator_0_9_1; -import org.apache.qpid.test.utils.QpidBrokerTestCase; -import org.apache.qpid.test.utils.TestBrokerConfiguration; - -public class MaxFrameSizeTest extends QpidBrokerTestCase -{ - - @Override - public void startDefaultBroker() throws Exception - { - // broker started by the tests - } - - public void testTooSmallFrameSize() throws Exception - { - - getDefaultBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, - TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, - "secureOnlyMechanisms", - "[]"); - super.startDefaultBroker(); - - if(isBroker010()) - { - Connection conn = new Connection(); - final ConnectionSettings settings = new ConnectionSettings(); - BrokerDetails brokerDetails = ((AMQConnectionFactory)getConnectionFactory()).getConnectionURL().getAllBrokerDetails().get(0); - settings.setHost(brokerDetails.getHost()); - settings.setPort(brokerDetails.getPort()); - settings.setUsername(GUEST_USERNAME); - settings.setPassword(GUEST_PASSWORD); - final ConnectionDelegate clientDelegate = new TestClientDelegate(settings, 1024); - conn.setConnectionDelegate(clientDelegate); - try - { - conn.connect(settings); - fail("Connection should not be possible with a frame size < " + Constant.MIN_MAX_FRAME_SIZE); - } - catch(ConnectionException e) - { - // pass - } - - } - else - { - doAMQP08test(1024, new ResultEvaluator() - { - - @Override - public boolean evaluate(final Socket socket, final List<AMQDataBlock> frames) - { - if(containsFrame(frames, ConnectionOpenOkBody.class)) - { - fail("Connection should not be possible with a frame size < " + Constant.MIN_MAX_FRAME_SIZE); - return false; - } - else if(containsFrame(frames, ConnectionCloseBody.class)) - { - return false; - } - else - { - return true; - } - } - }); - } - } - - private boolean containsFrame(final List<AMQDataBlock> frames, - final Class<? extends AMQMethodBodyImpl> frameClass) - { - for(AMQDataBlock block : frames) - { - AMQFrame frame = (AMQFrame) block; - if(frameClass.isInstance(frame.getBodyFrame())) - { - return true; - } - } - return false; - } - - - public void testTooLargeFrameSize() throws Exception - { - getDefaultBrokerConfiguration().setObjectAttribute(AuthenticationProvider.class, - TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, - "secureOnlyMechanisms", - "[]"); - - super.startDefaultBroker(); - if(isBroker010()) - { - Connection conn = new Connection(); - final ConnectionSettings settings = new ConnectionSettings(); - BrokerDetails brokerDetails = ((AMQConnectionFactory)getConnectionFactory()).getConnectionURL().getAllBrokerDetails().get(0); - settings.setHost(brokerDetails.getHost()); - settings.setPort(brokerDetails.getPort()); - settings.setUsername(GUEST_USERNAME); - settings.setPassword(GUEST_PASSWORD); - final ConnectionDelegate clientDelegate = new TestClientDelegate(settings, 0xffff); - conn.setConnectionDelegate(clientDelegate); - try - { - conn.connect(settings); - fail("Connection should not be possible with a frame size larger than the broker requested"); - } - catch(ConnectionException e) - { - // pass - } - - } - else - { - doAMQP08test(Broker.DEFAULT_NETWORK_BUFFER_SIZE + 1, new ResultEvaluator() - { - - @Override - public boolean evaluate(final Socket socket, final List<AMQDataBlock> frames) - { - if(containsFrame(frames, ConnectionOpenOkBody.class)) - { - fail("Connection should not be possible with a frame size larger than the broker requested"); - return false; - } - else if(containsFrame(frames, ConnectionCloseBody.class)) - { - return false; - } - else - { - return true; - } - } - }); - } - } - - private static interface ResultEvaluator - { - boolean evaluate(Socket socket, List<AMQDataBlock> frames); - } - - private void doAMQP08test(int frameSize, ResultEvaluator evaluator) - throws NamingException, IOException, AMQFrameDecodingException, AMQProtocolVersionException - { - BrokerDetails brokerDetails = ((AMQConnectionFactory)getConnectionFactory()).getConnectionURL().getAllBrokerDetails().get(0); - - Socket socket = new Socket(brokerDetails.getHost(), brokerDetails.getPort()); - socket.setTcpNoDelay(true); - OutputStream os = socket.getOutputStream(); - - byte[] protocolHeader; - ConnectionCloseOkBody closeOk; - - Protocol protocol = getBrokerProtocol(); - switch(protocol) - { - case AMQP_0_8: - protocolHeader = (ProtocolEngineCreator_0_8.getInstance().getHeaderIdentifier()); - closeOk = ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_8; - break; - case AMQP_0_9: - protocolHeader = (ProtocolEngineCreator_0_9.getInstance().getHeaderIdentifier()); - closeOk = ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_9; - break; - case AMQP_0_9_1: - protocolHeader = (ProtocolEngineCreator_0_9_1.getInstance().getHeaderIdentifier()); - closeOk = ConnectionCloseOkBody.CONNECTION_CLOSE_OK_0_9; - break; - default: - throw new RuntimeException("Unexpected Protocol Version: " + protocol); - } - os.write(protocolHeader); - InputStream is = socket.getInputStream(); - - final byte[] response = new byte[2+GUEST_USERNAME.length()+GUEST_PASSWORD.length()]; - int i = 1; - for(byte b : GUEST_USERNAME.getBytes(StandardCharsets.US_ASCII)) - { - response[i++] = b; - } - i++; - for(byte b : GUEST_PASSWORD.getBytes(StandardCharsets.US_ASCII)) - { - response[i++] = b; - } - - ConnectionStartOkBody startOK = new ConnectionStartOkBody(new FieldTable(), AMQShortString.valueOf("PLAIN"), response, AMQShortString.valueOf("en_US")); - TestSender sender = new TestSender(os); - new AMQFrame(0, startOK).writePayload(sender); - sender.flush(); - ConnectionTuneOkBody tuneOk = new ConnectionTuneOkBody(256, frameSize, 0); - new AMQFrame(0, tuneOk).writePayload(sender); - sender.flush(); - ConnectionOpenBody open = new ConnectionOpenBody(AMQShortString.valueOf(""),AMQShortString.EMPTY_STRING, false); - - try - { - new AMQFrame(0, open).writePayload(sender); - sender.flush(); - - socket.setSoTimeout(5000); - } - catch (IOException e) - { - // ignore - the broker may have closed the socket already - } - - final FrameCreatingMethodProcessor methodProcessor = new FrameCreatingMethodProcessor(ProtocolVersion.v0_91); - ClientDecoder decoder = new ClientDecoder(methodProcessor); - - - byte[] buffer = new byte[1024]; - - - int size; - while((size = is.read(buffer)) > 0) - { - decoder.decodeBuffer(ByteBuffer.wrap(buffer, 0, size)); - if(!evaluator.evaluate(socket,methodProcessor.getProcessedMethods())) - { - break; - } - } - - - new AMQFrame(0, closeOk).writePayload(sender); - sender.flush(); - - - } - - private static class TestClientDelegate extends ClientDelegate - { - - private final int _maxFrameSize; - - public TestClientDelegate(final ConnectionSettings settings, final int maxFrameSize) - { - super(settings); - _maxFrameSize = maxFrameSize; - } - - @Override - protected SaslClient createSaslClient(final List<Object> brokerMechs) throws ConnectionException, SaslException - { - final CallbackHandler handler = new CallbackHandler() - { - @Override - public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException - { - for (int i = 0; i < callbacks.length; i++) - { - Callback cb = callbacks[i]; - if (cb instanceof NameCallback) - { - ((NameCallback)cb).setName(GUEST_USERNAME); - } - else if (cb instanceof PasswordCallback) - { - ((PasswordCallback)cb).setPassword(GUEST_PASSWORD.toCharArray()); - } - else - { - throw new UnsupportedCallbackException(cb); - } - } - - } - }; - String[] selectedMechs = {}; - for(String mech : new String[] { "ANONYMOUS", "PLAIN", "CRAM-MD5", "SCRAM-SHA-1", "SCRAM-SHA-256"}) - { - if(brokerMechs.contains(mech)) - { - selectedMechs = new String[] {mech}; - break; - } - } - - - return Sasl.createSaslClient(selectedMechs, - null, - getConnectionSettings().getSaslProtocol(), - getConnectionSettings().getSaslServerName(), - Collections.<String,Object>emptyMap(), - handler); - - } - - @Override - public void connectionTune(Connection conn, ConnectionTune tune) - { - int heartbeatInterval = getConnectionSettings().getHeartbeatInterval010(); - float heartbeatTimeoutFactor = getConnectionSettings().getHeartbeatTimeoutFactor(); - int actualHeartbeatInterval = calculateHeartbeatInterval(heartbeatInterval, - tune.getHeartbeatMin(), - tune.getHeartbeatMax()); - - conn.connectionTuneOk(tune.getChannelMax(), - _maxFrameSize, - actualHeartbeatInterval); - - conn.getNetworkConnection().setMaxReadIdleMillis((long)(1000L * actualHeartbeatInterval*heartbeatTimeoutFactor)); - conn.getNetworkConnection().setMaxWriteIdleMillis(1000L * actualHeartbeatInterval); - conn.setMaxFrameSize(_maxFrameSize); - - int channelMax = tune.getChannelMax(); - conn.setChannelMax(channelMax == 0 ? Connection.MAX_CHANNEL_MAX : channelMax); - - conn.connectionOpen(getConnectionSettings().getVhost(), null, Option.INSIST); - } - - } -} http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/systests/src/test/java/org/apache/qpid/transport/TestSender.java ---------------------------------------------------------------------- diff --git a/systests/src/test/java/org/apache/qpid/transport/TestSender.java b/systests/src/test/java/org/apache/qpid/transport/TestSender.java deleted file mode 100644 index a6729b9..0000000 --- a/systests/src/test/java/org/apache/qpid/transport/TestSender.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; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.qpid.bytebuffer.QpidByteBuffer; - -class TestSender implements ByteBufferSender -{ - private final Collection<QpidByteBuffer> _sentBuffers = new ArrayList<>(); - private final OutputStream _output; - - - TestSender(final OutputStream output) - { - _output = output; - } - - @Override - public boolean isDirectBufferPreferred() - { - return false; - } - - @Override - public void send(final QpidByteBuffer msg) - { - _sentBuffers.add(msg.duplicate()); - msg.position(msg.limit()); - } - - @Override - public void flush() - { - int size = 0; - for (QpidByteBuffer buf : _sentBuffers) - { - size += buf.remaining(); - } - byte[] data = new byte[size]; - int offset = 0; - for (QpidByteBuffer buf : _sentBuffers) - { - int bufSize = buf.remaining(); - buf.get(data, offset, bufSize); - offset += bufSize; - buf.dispose(); - } - try - { - _output.write(data); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - finally - { - _sentBuffers.clear(); - } - } - - @Override - public void close() - { - - } -} http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/test-profiles/CPPExcludes ---------------------------------------------------------------------- diff --git a/test-profiles/CPPExcludes b/test-profiles/CPPExcludes index 7dc98d6..addb31a 100755 --- a/test-profiles/CPPExcludes +++ b/test-profiles/CPPExcludes @@ -184,9 +184,6 @@ org.apache.qpid.server.queue.QueueBindTest#testQueueCanBeReboundOnTopicExchange // Tests queue message durability settings which are a Qpid Broker-J specific feature org.apache.qpid.server.queue.QueueMessageDurabilityTest#* -// QPID-4429 : C++ Broker does not enforce max frame size negotiation rules as per the spec -org.apache.qpid.transport.MaxFrameSizeTest#* - // CPP Broker does not timeout connections with no activity like the Qpid Broker-J org.apache.qpid.transport.ProtocolNegotiationTest#testNoProtocolHeaderSent_BrokerClosesConnection org.apache.qpid.transport.ProtocolNegotiationTest#testNoConnectionOpenSent_BrokerClosesConnection @@ -227,10 +224,6 @@ org.apache.qpid.test.unit.client.temporaryqueue.TemporaryQueueTest#testClosingSe # QPID-7156: Test requires a Broker with a virtualhost org.apache.qpid.test.unit.client.connection.BrokerClosesClientConnectionTest#testClientCloseOnVirtualHostStop -# cpp broker allows anonymous access by default -# the following test requires running broker with authentication enabled -org.apache.qpid.transport.ConnectionEstablishmentTest#testAuthenticationBypass - #Node Creation Policy Tests use Qpid Broker-J Specific Config org.apache.qpid.server.queue.NodeAutoCreationPolicyTest#* http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/test-profiles/Java010Excludes ---------------------------------------------------------------------- diff --git a/test-profiles/Java010Excludes b/test-profiles/Java010Excludes index 0df118e..c67bc36 100755 --- a/test-profiles/Java010Excludes +++ b/test-profiles/Java010Excludes @@ -73,9 +73,6 @@ org.apache.qpid.client.prefetch.PrefetchBehaviourTest#testPrefetchWindowExpandsO org.apache.qpid.client.failover.FailoverBehaviourTest#testConnectionCloseInterruptsFailover org.apache.qpid.client.failover.AddressBasedFailoverBehaviourTest#testConnectionCloseInterruptsFailover -// This test does not make sense because on 0-10 maxFrameSize is 64kB and the Qpid Broker-J sets the networkBufferSize to a minimum of 64kB. -org.apache.qpid.transport.MaxFrameSizeTest#testTooLargeFrameSize - org.apache.qpid.test.unit.basic.PropertyValueTest#testLargeHeader_08091_HeadersFillContentHeaderFrame org.apache.qpid.test.unit.basic.PropertyValueTest#testOverlyLargeHeaderRejected_08091 http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ce80d144/test-profiles/Java10Excludes ---------------------------------------------------------------------- diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes index be5b6df..56ee05a 100644 --- a/test-profiles/Java10Excludes +++ b/test-profiles/Java10Excludes @@ -86,9 +86,6 @@ org.apache.qpid.test.unit.ack.AcknowledgeOnMessageTest#testPreAck // This test is checking features of the 0-x client specific implementation of Session org.apache.qpid.test.unit.client.AMQSessionTest#* -// Low level test on ensuring frames are not bigger than negotiated max - there should probably be an equivalent for 1.0 -org.apache.qpid.transport.MaxFrameSizeTest#* - // This test is concerned with the 0-x client establishing a connection to a supported version org.apache.qpid.transport.ProtocolNegotiationTest#testProtocolNegotiationFromUnsupportedVersion @@ -150,10 +147,6 @@ org.apache.qpid.test.client.message.JMSXUserIDTest#* // Test of 0-x client settings around creating exchanges/queues dynamically org.apache.qpid.test.unit.client.DynamicQueueExchangeCreateTest#* -// This test aims to establish a connection without going through SASL exchanges. The model for 1.0 is different, and -// this should probably be tested in a new protocol specific broker test -org.apache.qpid.transport.ConnectionEstablishmentTest#* - // test of 0-10 client specific behaviour org.apache.qpid.test.client.message.JMSDestinationTest#testReceiveResend // BURL specific tests --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org