entry : inner.entrySet()) {
+ properties.put(pd.getName() + "." + entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ /**
+ * Find a specific property getter in a given object based on a property name.
+ *
+ * @param object the object to search.
+ * @param name the property name to search for.
+ * @return the result of invoking the specific property get method.
+ * @throws Exception if an error occurs while searching the object's bean info.
+ */
+ public static Object getProperty(Object object, String name) throws Exception {
+ BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ if (propertyDescriptors != null) {
+ for (int i = 0; i < propertyDescriptors.length; i++) {
+ PropertyDescriptor pd = propertyDescriptors[i];
+ if (pd.getReadMethod() != null && pd.getName().equals(name)) {
+ return pd.getReadMethod().invoke(object);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set a property named property on a given Object.
+ *
+ * The object is searched for an set method that would match the given named
+ * property and if one is found. If necessary an attempt will be made to convert
+ * the new value to an acceptable type.
+ *
+ * @param target The object whose property is to be set.
+ * @param name The name of the property to set.
+ * @param value The new value to set for the named property.
+ * @return true if the property was able to be set on the target object.
+ */
+ public static boolean setProperty(Object target, String name, Object value) {
+ try {
+ int dotPos = name.indexOf(".");
+ while (dotPos >= 0) {
+ String getterName = name.substring(0, dotPos);
+ target = getProperty(target, getterName);
+ name = name.substring(dotPos + 1);
+ dotPos = name.indexOf(".");
+ }
+
+ Class> clazz = target.getClass();
+ Method setter = findSetterMethod(clazz, name);
+ if (setter == null) {
+ return false;
+ }
+ // If the type is null or it matches the needed type, just use the
+ // value directly
+ if (value == null || value.getClass() == setter.getParameterTypes()[0]) {
+ setter.invoke(target, new Object[]{value});
+ }
+ else {
+ setter.invoke(target, new Object[]{convert(value, setter.getParameterTypes()[0])});
+ }
+ return true;
+ }
+ catch (Throwable ignore) {
+ return false;
+ }
+ }
+
+ /**
+ * Return a String minus the given prefix. If the string does not start
+ * with the given prefix the original string value is returned.
+ *
+ * @param value The String whose prefix is to be removed.
+ * @param prefix The prefix string to remove from the target string.
+ * @return stripped version of the original input string.
+ */
+ public static String stripPrefix(String value, String prefix) {
+ if (value != null && prefix != null && value.startsWith(prefix)) {
+ return value.substring(prefix.length());
+ }
+ return value;
+ }
+
+ /**
+ * Return a portion of a String value by looking beyond the given
+ * character.
+ *
+ * @param value The string value to split
+ * @param c The character that marks the split point.
+ * @return the sub-string value starting beyond the given character.
+ */
+ public static String stripUpto(String value, char c) {
+ String result = null;
+ if (value != null) {
+ int index = value.indexOf(c);
+ if (index > 0) {
+ result = value.substring(index + 1);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return a String up to and including character
+ *
+ * @param value The string value to split
+ * @param c The character that marks the start of split point.
+ * @return the sub-string value starting from the given character.
+ */
+ public static String stripBefore(String value, char c) {
+ String result = value;
+ if (value != null) {
+ int index = value.indexOf(c);
+ if (index > 0) {
+ result = value.substring(0, index);
+ }
+ }
+ return result;
+ }
+
+ private static Method findSetterMethod(Class> clazz, String name) {
+ // Build the method name.
+ name = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
+ Method[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ Class>[] params = method.getParameterTypes();
+ if (method.getName().equals(name) && params.length == 1) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ private static Object convert(Object value, Class> type) throws Exception {
+ if (value == null) {
+ if (boolean.class.isAssignableFrom(type)) {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
+
+ if (type.isAssignableFrom(value.getClass())) {
+ return type.cast(value);
+ }
+
+ // special for String[] as we do not want to use a PropertyEditor for that
+ if (type.isAssignableFrom(String[].class)) {
+ return StringArrayConverter.convertToStringArray(value);
+ }
+
+ if (type == URI.class) {
+ return new URI(value.toString());
+ }
+
+ return TypeConversionSupport.convert(value, type);
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/StringArrayConverter.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/StringArrayConverter.java
new file mode 100644
index 0000000000..3fc9eb40f5
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/StringArrayConverter.java
@@ -0,0 +1,64 @@
+/*
+ * 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.activemq.transport.amqp.client.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * Class for converting to/from String[] to be used instead of a
+ * {@link java.beans.PropertyEditor} which otherwise causes memory leaks as the
+ * JDK {@link java.beans.PropertyEditorManager} is a static class and has strong
+ * references to classes, causing problems in hot-deployment environments.
+ */
+public class StringArrayConverter {
+
+ public static String[] convertToStringArray(Object value) {
+ if (value == null) {
+ return null;
+ }
+
+ String text = value.toString();
+ if (text == null || text.isEmpty()) {
+ return null;
+ }
+
+ StringTokenizer stok = new StringTokenizer(text, ",");
+ final List list = new ArrayList<>();
+
+ while (stok.hasMoreTokens()) {
+ list.add(stok.nextToken());
+ }
+
+ String[] array = list.toArray(new String[list.size()]);
+ return array;
+ }
+
+ public static String convertToString(String[] value) {
+ if (value == null || value.length == 0) {
+ return null;
+ }
+
+ StringBuffer result = new StringBuffer(String.valueOf(value[0]));
+ for (int i = 1; i < value.length; i++) {
+ result.append(",").append(value[i]);
+ }
+
+ return result.toString();
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java
new file mode 100644
index 0000000000..7d075510e8
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java
@@ -0,0 +1,218 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import java.util.Date;
+import java.util.HashMap;
+
+public final class TypeConversionSupport {
+
+ static class ConversionKey {
+
+ final Class> from;
+ final Class> to;
+ final int hashCode;
+
+ ConversionKey(Class> from, Class> to) {
+ this.from = from;
+ this.to = to;
+ this.hashCode = from.hashCode() ^ (to.hashCode() << 1);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || o.getClass() != this.getClass()) {
+ return false;
+ }
+
+ ConversionKey x = (ConversionKey) o;
+ return x.from == from && x.to == to;
+ }
+
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+ }
+
+ interface Converter {
+
+ Object convert(Object value);
+ }
+
+ private static final HashMap CONVERSION_MAP = new HashMap<>();
+
+ static {
+ Converter toStringConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return value.toString();
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Boolean.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Integer.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Long.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Float.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Double.class, String.class), toStringConverter);
+
+ CONVERSION_MAP.put(new ConversionKey(String.class, Boolean.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Boolean.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Byte.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Byte.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Short.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Short.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Integer.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Integer.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Long.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Float.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Float.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Double.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Double.valueOf((String) value);
+ }
+ });
+
+ Converter longConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf(((Number) value).longValue());
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Integer.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Date.class, Long.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf(((Date) value).getTime());
+ }
+ });
+
+ Converter intConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Integer.valueOf(((Number) value).intValue());
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Integer.class), intConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, Integer.class), intConverter);
+
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Short.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Short.valueOf(((Number) value).shortValue());
+ }
+ });
+
+ CONVERSION_MAP.put(new ConversionKey(Float.class, Double.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return new Double(((Number) value).doubleValue());
+ }
+ });
+ }
+
+ public static Object convert(Object value, Class> toClass) {
+
+ assert value != null && toClass != null;
+
+ if (value.getClass() == toClass) {
+ return value;
+ }
+
+ Class> fromClass = value.getClass();
+
+ if (fromClass.isPrimitive()) {
+ fromClass = convertPrimitiveTypeToWrapperType(fromClass);
+ }
+
+ if (toClass.isPrimitive()) {
+ toClass = convertPrimitiveTypeToWrapperType(toClass);
+ }
+
+ Converter c = CONVERSION_MAP.get(new ConversionKey(fromClass, toClass));
+ if (c == null) {
+ return null;
+ }
+
+ return c.convert(value);
+ }
+
+ private static Class> convertPrimitiveTypeToWrapperType(Class> type) {
+ Class> rc = type;
+ if (type.isPrimitive()) {
+ if (type == int.class) {
+ rc = Integer.class;
+ }
+ else if (type == long.class) {
+ rc = Long.class;
+ }
+ else if (type == double.class) {
+ rc = Double.class;
+ }
+ else if (type == float.class) {
+ rc = Float.class;
+ }
+ else if (type == short.class) {
+ rc = Short.class;
+ }
+ else if (type == byte.class) {
+ rc = Byte.class;
+ }
+ else if (type == boolean.class) {
+ rc = Boolean.class;
+ }
+ }
+
+ return rc;
+ }
+
+ private TypeConversionSupport() {
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableConnection.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableConnection.java
new file mode 100644
index 0000000000..32003a4fb5
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableConnection.java
@@ -0,0 +1,202 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import java.util.EnumSet;
+import java.util.Map;
+
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.transport.ErrorCondition;
+import org.apache.qpid.proton.engine.Collector;
+import org.apache.qpid.proton.engine.Connection;
+import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Record;
+import org.apache.qpid.proton.engine.Session;
+import org.apache.qpid.proton.engine.Transport;
+import org.apache.qpid.proton.reactor.Reactor;
+
+/**
+ * Unmodifiable Connection wrapper used to prevent test code from accidentally
+ * modifying Connection state.
+ */
+public class UnmodifiableConnection implements Connection {
+
+ private final Connection connection;
+
+ public UnmodifiableConnection(Connection connection) {
+ this.connection = connection;
+ }
+
+ @Override
+ public EndpointState getLocalState() {
+ return connection.getLocalState();
+ }
+
+ @Override
+ public EndpointState getRemoteState() {
+ return connection.getRemoteState();
+ }
+
+ @Override
+ public ErrorCondition getCondition() {
+ return connection.getCondition();
+ }
+
+ @Override
+ public void setCondition(ErrorCondition condition) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public ErrorCondition getRemoteCondition() {
+ return connection.getRemoteCondition();
+ }
+
+ @Override
+ public void free() {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public void open() {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public void close() {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public Session session() {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public Session sessionHead(EnumSet local, EnumSet remote) {
+ Session head = connection.sessionHead(local, remote);
+ if (head != null) {
+ head = new UnmodifiableSession(head);
+ }
+
+ return head;
+ }
+
+ @Override
+ public Link linkHead(EnumSet local, EnumSet remote) {
+ // TODO - If implemented this method should return an unmodifiable link isntance.
+ return null;
+ }
+
+ @Override
+ public Delivery getWorkHead() {
+ // TODO - If implemented this method should return an unmodifiable delivery isntance.
+ return null;
+ }
+
+ @Override
+ public void setContainer(String container) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public void setHostname(String hostname) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public String getHostname() {
+ return connection.getHostname();
+ }
+
+ @Override
+ public String getRemoteContainer() {
+ return connection.getRemoteContainer();
+ }
+
+ @Override
+ public String getRemoteHostname() {
+ return connection.getRemoteHostname();
+ }
+
+ @Override
+ public void setOfferedCapabilities(Symbol[] capabilities) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public void setDesiredCapabilities(Symbol[] capabilities) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public Symbol[] getRemoteOfferedCapabilities() {
+ return connection.getRemoteOfferedCapabilities();
+ }
+
+ @Override
+ public Symbol[] getRemoteDesiredCapabilities() {
+ return connection.getRemoteDesiredCapabilities();
+ }
+
+ @Override
+ public Map getRemoteProperties() {
+ return connection.getRemoteProperties();
+ }
+
+ @Override
+ public void setProperties(Map properties) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public Object getContext() {
+ return connection.getContext();
+ }
+
+ @Override
+ public void setContext(Object context) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public void collect(Collector collector) {
+ throw new UnsupportedOperationException("Cannot alter the Connection");
+ }
+
+ @Override
+ public String getContainer() {
+ return connection.getContainer();
+ }
+
+ @Override
+ public Transport getTransport() {
+ return new UnmodifiableTransport(connection.getTransport());
+ }
+
+ @Override
+ public Record attachments() {
+ return connection.attachments();
+ }
+
+ @Override
+ public Reactor getReactor() {
+ return connection.getReactor();
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableDelivery.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableDelivery.java
new file mode 100644
index 0000000000..9f48b41f98
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableDelivery.java
@@ -0,0 +1,170 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import org.apache.qpid.proton.amqp.transport.DeliveryState;
+import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Receiver;
+import org.apache.qpid.proton.engine.Record;
+import org.apache.qpid.proton.engine.Sender;
+
+/**
+ * Unmodifiable Delivery wrapper used to prevent test code from accidentally
+ * modifying Delivery state.
+ */
+public class UnmodifiableDelivery implements Delivery {
+
+ private final Delivery delivery;
+
+ public UnmodifiableDelivery(Delivery delivery) {
+ this.delivery = delivery;
+ }
+
+ @Override
+ public byte[] getTag() {
+ return delivery.getTag();
+ }
+
+ @Override
+ public Link getLink() {
+ if (delivery.getLink() instanceof Sender) {
+ return new UnmodifiableSender((Sender) delivery.getLink());
+ }
+ else if (delivery.getLink() instanceof Receiver) {
+ return new UnmodifiableReceiver((Receiver) delivery.getLink());
+ }
+ else {
+ throw new IllegalStateException("Delivery has unknown link type");
+ }
+ }
+
+ @Override
+ public DeliveryState getLocalState() {
+ return delivery.getLocalState();
+ }
+
+ @Override
+ public DeliveryState getRemoteState() {
+ return delivery.getRemoteState();
+ }
+
+ @Override
+ public int getMessageFormat() {
+ return delivery.getMessageFormat();
+ }
+
+ @Override
+ public void disposition(DeliveryState state) {
+ throw new UnsupportedOperationException("Cannot alter the Delivery state");
+ }
+
+ @Override
+ public void settle() {
+ throw new UnsupportedOperationException("Cannot alter the Delivery state");
+ }
+
+ @Override
+ public boolean isSettled() {
+ return delivery.isSettled();
+ }
+
+ @Override
+ public boolean remotelySettled() {
+ return delivery.remotelySettled();
+ }
+
+ @Override
+ public void free() {
+ throw new UnsupportedOperationException("Cannot alter the Delivery state");
+ }
+
+ @Override
+ public Delivery getWorkNext() {
+ return new UnmodifiableDelivery(delivery.getWorkNext());
+ }
+
+ @Override
+ public Delivery next() {
+ return new UnmodifiableDelivery(delivery.next());
+ }
+
+ @Override
+ public boolean isWritable() {
+ return delivery.isWritable();
+ }
+
+ @Override
+ public boolean isReadable() {
+ return delivery.isReadable();
+ }
+
+ @Override
+ public void setContext(Object o) {
+ throw new UnsupportedOperationException("Cannot alter the Delivery state");
+ }
+
+ @Override
+ public Object getContext() {
+ return delivery.getContext();
+ }
+
+ @Override
+ public boolean isUpdated() {
+ return delivery.isUpdated();
+ }
+
+ @Override
+ public void clear() {
+ throw new UnsupportedOperationException("Cannot alter the Delivery state");
+ }
+
+ @Override
+ public boolean isPartial() {
+ return delivery.isPartial();
+ }
+
+ @Override
+ public int pending() {
+ return delivery.pending();
+ }
+
+ @Override
+ public boolean isBuffered() {
+ return delivery.isBuffered();
+ }
+
+ @Override
+ public Record attachments() {
+ return delivery.attachments();
+ }
+
+ @Override
+ public DeliveryState getDefaultDeliveryState() {
+ return delivery.getDefaultDeliveryState();
+ }
+
+ @Override
+ public void setDefaultDeliveryState(DeliveryState state) {
+ throw new UnsupportedOperationException("Cannot alter the Delivery");
+ }
+
+ @Override
+ public void setMessageFormat(int messageFormat) {
+ throw new UnsupportedOperationException("Cannot alter the Delivery");
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableLink.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableLink.java
new file mode 100644
index 0000000000..a58bfe76d3
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableLink.java
@@ -0,0 +1,276 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import java.util.EnumSet;
+import java.util.Map;
+
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.transport.ErrorCondition;
+import org.apache.qpid.proton.amqp.transport.ReceiverSettleMode;
+import org.apache.qpid.proton.amqp.transport.SenderSettleMode;
+import org.apache.qpid.proton.amqp.transport.Source;
+import org.apache.qpid.proton.amqp.transport.Target;
+import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Receiver;
+import org.apache.qpid.proton.engine.Record;
+import org.apache.qpid.proton.engine.Sender;
+import org.apache.qpid.proton.engine.Session;
+
+/**
+ * Unmodifiable Session wrapper used to prevent test code from accidentally
+ * modifying Session state.
+ */
+public class UnmodifiableLink implements Link {
+
+ private final Link link;
+
+ public UnmodifiableLink(Link link) {
+ this.link = link;
+ }
+
+ @Override
+ public EndpointState getLocalState() {
+ return link.getLocalState();
+ }
+
+ @Override
+ public EndpointState getRemoteState() {
+ return link.getRemoteState();
+ }
+
+ @Override
+ public ErrorCondition getCondition() {
+ return link.getCondition();
+ }
+
+ @Override
+ public void setCondition(ErrorCondition condition) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public ErrorCondition getRemoteCondition() {
+ return link.getRemoteCondition();
+ }
+
+ @Override
+ public void free() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void open() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void close() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void setContext(Object o) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Object getContext() {
+ return link.getContext();
+ }
+
+ @Override
+ public String getName() {
+ return link.getName();
+ }
+
+ @Override
+ public Delivery delivery(byte[] tag) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Delivery delivery(byte[] tag, int offset, int length) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Delivery head() {
+ return new UnmodifiableDelivery(link.head());
+ }
+
+ @Override
+ public Delivery current() {
+ return new UnmodifiableDelivery(link.current());
+ }
+
+ @Override
+ public boolean advance() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Source getSource() {
+ // TODO Figure out a simple way to wrap the odd Source types in Proton-J
+ return link.getSource();
+ }
+
+ @Override
+ public Target getTarget() {
+ // TODO Figure out a simple way to wrap the odd Source types in Proton-J
+ return link.getTarget();
+ }
+
+ @Override
+ public void setSource(Source address) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void setTarget(Target address) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Source getRemoteSource() {
+ // TODO Figure out a simple way to wrap the odd Source types in Proton-J
+ return link.getRemoteSource();
+ }
+
+ @Override
+ public Target getRemoteTarget() {
+ // TODO Figure out a simple way to wrap the odd Target types in Proton-J
+ return link.getRemoteTarget();
+ }
+
+ @Override
+ public Link next(EnumSet local, EnumSet remote) {
+ Link next = link.next(local, remote);
+
+ if (next != null) {
+ if (next instanceof Sender) {
+ next = new UnmodifiableSender((Sender) next);
+ }
+ else {
+ next = new UnmodifiableReceiver((Receiver) next);
+ }
+ }
+
+ return next;
+ }
+
+ @Override
+ public int getCredit() {
+ return link.getCredit();
+ }
+
+ @Override
+ public int getQueued() {
+ return link.getQueued();
+ }
+
+ @Override
+ public int getUnsettled() {
+ return link.getUnsettled();
+ }
+
+ @Override
+ public Session getSession() {
+ return new UnmodifiableSession(link.getSession());
+ }
+
+ @Override
+ public SenderSettleMode getSenderSettleMode() {
+ return link.getSenderSettleMode();
+ }
+
+ @Override
+ public void setSenderSettleMode(SenderSettleMode senderSettleMode) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public SenderSettleMode getRemoteSenderSettleMode() {
+ return link.getRemoteSenderSettleMode();
+ }
+
+ @Override
+ public ReceiverSettleMode getReceiverSettleMode() {
+ return link.getReceiverSettleMode();
+ }
+
+ @Override
+ public void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public ReceiverSettleMode getRemoteReceiverSettleMode() {
+ return link.getRemoteReceiverSettleMode();
+ }
+
+ @Override
+ public void setRemoteSenderSettleMode(SenderSettleMode remoteSenderSettleMode) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public int drained() {
+ return link.drained(); // TODO - Is this a mutating call?
+ }
+
+ @Override
+ public int getRemoteCredit() {
+ return link.getRemoteCredit();
+ }
+
+ @Override
+ public boolean getDrain() {
+ return link.getDrain();
+ }
+
+ @Override
+ public void detach() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public boolean detached() {
+ return link.detached();
+ }
+
+ public Record attachments() {
+ return link.attachments();
+ }
+
+ @Override
+ public Map getProperties() {
+ return link.getProperties();
+ }
+
+ @Override
+ public void setProperties(Map properties) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public Map getRemoteProperties() {
+ return link.getRemoteProperties();
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableReceiver.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableReceiver.java
new file mode 100644
index 0000000000..92760db337
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableReceiver.java
@@ -0,0 +1,59 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import org.apache.qpid.proton.engine.Receiver;
+
+/**
+ * Unmodifiable Receiver wrapper used to prevent test code from accidentally
+ * modifying Receiver state.
+ */
+public class UnmodifiableReceiver extends UnmodifiableLink implements Receiver {
+
+ private final Receiver receiver;
+
+ public UnmodifiableReceiver(Receiver receiver) {
+ super(receiver);
+
+ this.receiver = receiver;
+ }
+
+ @Override
+ public void flow(int credits) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public int recv(byte[] bytes, int offset, int size) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void drain(int credit) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public boolean draining() {
+ return receiver.draining();
+ }
+
+ @Override
+ public void setDrain(boolean drain) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSender.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSender.java
new file mode 100644
index 0000000000..89742cb517
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSender.java
@@ -0,0 +1,45 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import org.apache.qpid.proton.engine.Sender;
+
+/**
+ * Unmodifiable Sender wrapper used to prevent test code from accidentally
+ * modifying Sender state.
+ */
+public class UnmodifiableSender extends UnmodifiableLink implements Sender {
+
+ public UnmodifiableSender(Sender sender) {
+ super(sender);
+ }
+
+ @Override
+ public void offer(int credits) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public int send(byte[] bytes, int offset, int length) {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+
+ @Override
+ public void abort() {
+ throw new UnsupportedOperationException("Cannot alter the Link state");
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSession.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSession.java
new file mode 100644
index 0000000000..a44028e0e5
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableSession.java
@@ -0,0 +1,150 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import java.util.EnumSet;
+
+import org.apache.qpid.proton.amqp.transport.ErrorCondition;
+import org.apache.qpid.proton.engine.Connection;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Receiver;
+import org.apache.qpid.proton.engine.Record;
+import org.apache.qpid.proton.engine.Sender;
+import org.apache.qpid.proton.engine.Session;
+
+/**
+ * Unmodifiable Session wrapper used to prevent test code from accidentally
+ * modifying Session state.
+ */
+public class UnmodifiableSession implements Session {
+
+ private final Session session;
+
+ public UnmodifiableSession(Session session) {
+ this.session = session;
+ }
+
+ @Override
+ public EndpointState getLocalState() {
+ return session.getLocalState();
+ }
+
+ @Override
+ public EndpointState getRemoteState() {
+ return session.getRemoteState();
+ }
+
+ @Override
+ public ErrorCondition getCondition() {
+ return session.getCondition();
+ }
+
+ @Override
+ public void setCondition(ErrorCondition condition) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public ErrorCondition getRemoteCondition() {
+ return session.getRemoteCondition();
+ }
+
+ @Override
+ public void free() {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public void open() {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public void close() {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public void setContext(Object o) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public Object getContext() {
+ return session.getContext();
+ }
+
+ @Override
+ public Sender sender(String name) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public Receiver receiver(String name) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public Session next(EnumSet local, EnumSet remote) {
+ Session next = session.next(local, remote);
+ if (next != null) {
+ next = new UnmodifiableSession(next);
+ }
+
+ return next;
+ }
+
+ @Override
+ public Connection getConnection() {
+ return new UnmodifiableConnection(session.getConnection());
+ }
+
+ @Override
+ public int getIncomingCapacity() {
+ return session.getIncomingCapacity();
+ }
+
+ @Override
+ public void setIncomingCapacity(int bytes) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+
+ @Override
+ public int getIncomingBytes() {
+ return session.getIncomingBytes();
+ }
+
+ @Override
+ public int getOutgoingBytes() {
+ return session.getOutgoingBytes();
+ }
+
+ @Override
+ public Record attachments() {
+ return session.attachments();
+ }
+
+ @Override
+ public long getOutgoingWindow() {
+ return session.getOutgoingWindow();
+ }
+
+ @Override
+ public void setOutgoingWindow(long outgoingWindowSize) {
+ throw new UnsupportedOperationException("Cannot alter the Session");
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableTransport.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableTransport.java
new file mode 100644
index 0000000000..5e305f4d11
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/UnmodifiableTransport.java
@@ -0,0 +1,274 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+import java.nio.ByteBuffer;
+
+import org.apache.qpid.proton.amqp.transport.ErrorCondition;
+import org.apache.qpid.proton.engine.Connection;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Record;
+import org.apache.qpid.proton.engine.Sasl;
+import org.apache.qpid.proton.engine.Ssl;
+import org.apache.qpid.proton.engine.SslDomain;
+import org.apache.qpid.proton.engine.SslPeerDetails;
+import org.apache.qpid.proton.engine.Transport;
+import org.apache.qpid.proton.engine.TransportException;
+import org.apache.qpid.proton.engine.TransportResult;
+
+/**
+ * Unmodifiable Transport wrapper used to prevent test code from accidentally
+ * modifying Transport state.
+ */
+public class UnmodifiableTransport implements Transport {
+
+ private final Transport transport;
+
+ public UnmodifiableTransport(Transport transport) {
+ this.transport = transport;
+ }
+
+ @Override
+ public void close() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void free() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public Object getContext() {
+ return null;
+ }
+
+ @Override
+ public EndpointState getLocalState() {
+ return transport.getLocalState();
+ }
+
+ @Override
+ public ErrorCondition getRemoteCondition() {
+ return transport.getRemoteCondition();
+ }
+
+ @Override
+ public EndpointState getRemoteState() {
+ return transport.getRemoteState();
+ }
+
+ @Override
+ public void open() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void setCondition(ErrorCondition arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void setContext(Object arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void bind(Connection arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public int capacity() {
+ return transport.capacity();
+ }
+
+ @Override
+ public void close_head() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void close_tail() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public int getChannelMax() {
+ return transport.getChannelMax();
+ }
+
+ @Override
+ public ErrorCondition getCondition() {
+ return transport.getCondition();
+ }
+
+ @Override
+ public int getIdleTimeout() {
+ return transport.getIdleTimeout();
+ }
+
+ @Override
+ public ByteBuffer getInputBuffer() {
+ return null;
+ }
+
+ @Override
+ public int getMaxFrameSize() {
+ return transport.getMaxFrameSize();
+ }
+
+ @Override
+ public ByteBuffer getOutputBuffer() {
+ return null;
+ }
+
+ @Override
+ public int getRemoteChannelMax() {
+ return transport.getRemoteChannelMax();
+ }
+
+ @Override
+ public int getRemoteIdleTimeout() {
+ return transport.getRemoteIdleTimeout();
+ }
+
+ @Override
+ public int getRemoteMaxFrameSize() {
+ return transport.getRemoteMaxFrameSize();
+ }
+
+ @Override
+ public ByteBuffer head() {
+ return null;
+ }
+
+ @Override
+ public int input(byte[] arg0, int arg1, int arg2) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public boolean isClosed() {
+ return transport.isClosed();
+ }
+
+ @Override
+ public int output(byte[] arg0, int arg1, int arg2) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void outputConsumed() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public int pending() {
+ return transport.pending();
+ }
+
+ @Override
+ public void pop(int arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void process() throws TransportException {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public TransportResult processInput() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public Sasl sasl() throws IllegalStateException {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void setChannelMax(int arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void setIdleTimeout(int arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void setMaxFrameSize(int arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public Ssl ssl(SslDomain arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public Ssl ssl(SslDomain arg0, SslPeerDetails arg1) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public ByteBuffer tail() {
+ return null;
+ }
+
+ @Override
+ public long tick(long arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void trace(int arg0) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public void unbind() {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public Record attachments() {
+ return transport.attachments();
+ }
+
+ @Override
+ public long getFramesInput() {
+ return transport.getFramesInput();
+ }
+
+ @Override
+ public long getFramesOutput() {
+ return transport.getFramesOutput();
+ }
+
+ @Override
+ public void setEmitFlowEventOnSend(boolean emitFlowEventOnSend) {
+ throw new UnsupportedOperationException("Cannot alter the Transport");
+ }
+
+ @Override
+ public boolean isEmitFlowEventOnSend() {
+ return transport.isEmitFlowEventOnSend();
+ }
+}
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/WrappedAsyncResult.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/WrappedAsyncResult.java
new file mode 100644
index 0000000000..bfe9a80773
--- /dev/null
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/WrappedAsyncResult.java
@@ -0,0 +1,59 @@
+/**
+ * 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.activemq.transport.amqp.client.util;
+
+/**
+ * Base class used to wrap one AsyncResult with another.
+ */
+public abstract class WrappedAsyncResult implements AsyncResult {
+
+ protected final AsyncResult wrapped;
+
+ /**
+ * Create a new WrappedAsyncResult for the target AsyncResult
+ */
+ public WrappedAsyncResult(AsyncResult wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ @Override
+ public void onFailure(Throwable result) {
+ if (wrapped != null) {
+ wrapped.onFailure(result);
+ }
+ }
+
+ @Override
+ public void onSuccess() {
+ if (wrapped != null) {
+ wrapped.onSuccess();
+ }
+ }
+
+ @Override
+ public boolean isComplete() {
+ if (wrapped != null) {
+ return wrapped.isComplete();
+ }
+
+ return false;
+ }
+
+ public AsyncResult getWrappedRequest() {
+ return wrapped;
+ }
+}
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index 752e288235..5d7617cc78 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -340,6 +340,11 @@
org.apache.karaf.shell.console
${karaf.version}
+
+ org.apache.activemq.tests
+ artemis-test-support
+ ${project.version}
+
diff --git a/tests/pom.xml b/tests/pom.xml
index 6a9c0003ed..a2efeacdf9 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -46,6 +46,13 @@
1.2
+
+ org.apache.qpid
+ qpid-jms-client
+ 0.10.0
+
+
+
@@ -122,5 +129,6 @@
soak-tests
stress-tests
performance-tests
+ artemis-test-support