You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2014/09/23 20:20:31 UTC
[07/27] Initial drop of donated AMQP Client Code.
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/describedtypes/sections/generate-list-sections.xsl
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/describedtypes/sections/generate-list-sections.xsl b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/describedtypes/sections/generate-list-sections.xsl
new file mode 100644
index 0000000..82ae80b
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/describedtypes/sections/generate-list-sections.xsl
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl">
+
+<!-- Used to generate the Java classes in this package.
+ Changes to these classes should be effected by modifying this stylesheet then re-running it,
+ using a stylesheet processor that understands the exsl directives such as xsltproc -->
+
+<xsl:template match="/">
+ <xsl:variable name="license">/*
+ * 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.
+ *
+ */
+</xsl:variable>
+
+ <xsl:for-each select="descendant-or-self::node()[name()='type']">
+ <xsl:variable name="classname"><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="@name"/></xsl:call-template>DescribedType</xsl:variable>
+ <xsl:if test="@provides = 'section'">
+ <xsl:if test="@name = 'header' or @name='properties'">
+ <xsl:call-template name="typeClass">
+ <xsl:with-param name="license" select="$license"/>
+ <xsl:with-param name="classname" select="$classname"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+
+ </xsl:for-each>
+</xsl:template>
+
+
+<!-- *************************************************************************************************************** -->
+
+<xsl:template name="typeClass">
+ <xsl:param name="license"/>
+ <xsl:param name="classname"/>
+ <exsl:document href="{$classname}.java" method="text">
+ <xsl:value-of select="$license"/>
+package org.apache.qpid.jms.test.testpeer.describedtypes.sections;
+
+import org.apache.qpid.jms.test.testpeer.ListDescribedType;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+
+/**
+ * Generated by generate-list-sections.xsl, which resides in this package.
+ */
+public class <xsl:value-of select="$classname"/> extends ListDescribedType
+{
+ public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("<xsl:value-of select="descendant::node()[name()='descriptor']/@name"/>");
+ public static final UnsignedLong DESCRIPTOR_CODE = UnsignedLong.valueOf(<xsl:value-of select="concat(substring(descendant::node()[name()='descriptor']/@code,1,10),substring(descendant::node()[name()='descriptor']/@code,14))"/>L);
+
+<xsl:for-each select="descendant::node()[name()='field']">
+ private static final int FIELD_<xsl:call-template name="toUpperDashToUnderscore"><xsl:with-param name="input" select="@name"/></xsl:call-template> = <xsl:value-of select="count(preceding-sibling::node()[name()='field'])"/>;</xsl:for-each>
+
+ public <xsl:value-of select="$classname"/>(Object... fields)
+ {
+ super(<xsl:value-of select="count(descendant::node()[name()='field'])"/>);
+ int i = 0;
+ for(Object field : fields)
+ {
+ getFields()[i++] = field;
+ }
+ }
+
+ @Override
+ public Symbol getDescriptor()
+ {
+ return DESCRIPTOR_SYMBOL;
+ }
+<xsl:for-each select="descendant::node()[name()='field']">
+ public <xsl:value-of select="$classname"/> set<xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="@name"/></xsl:call-template>(Object o)
+ {
+ getFields()[FIELD_<xsl:call-template name="toUpperDashToUnderscore"><xsl:with-param name="input" select="@name"/></xsl:call-template>] = o;
+ return this;
+ }
+</xsl:for-each>
+}
+
+</exsl:document>
+
+</xsl:template>
+
+<!-- *************************************************************************************************************** -->
+
+<xsl:template name="constructFromLiteral">
+ <xsl:param name="type"/>
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="$type = 'string'">"<xsl:value-of select="$value"/></xsl:when>
+ <xsl:when test="$type = 'symbol'">Symbol.valueOf("<xsl:value-of select="$value"/>")</xsl:when>
+ <xsl:when test="$type = 'ubyte'">UnsignedByte.valueOf((byte) <xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'ushort'">UnsignedShort.valueOf((short) <xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'uint'">UnsignedInteger.valueOf(<xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'ulong'">UnsignedLong.valueOf(<xsl:value-of select="$value"/>L)</xsl:when>
+ <xsl:when test="$type = 'long'"><xsl:value-of select="$value"/>L</xsl:when>
+ <xsl:when test="$type = 'short'">(short)<xsl:value-of select="$value"/></xsl:when>
+ <xsl:when test="$type = 'short'">(byte)<xsl:value-of select="$value"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- *************************************************************************************************************** -->
+<xsl:template name="substringAfterLast"><xsl:param name="input"/><xsl:param name="arg"/>
+ <xsl:choose>
+ <xsl:when test="contains($input,$arg)"><xsl:call-template name="substringAfterLast"><xsl:with-param name="input"><xsl:value-of select="substring-after($input,$arg)"/></xsl:with-param><xsl:with-param name="arg"><xsl:value-of select="$arg"/></xsl:with-param></xsl:call-template></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$input"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="initCap"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+
+ <xsl:template name="initLower"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+
+ <xsl:template name="toUpper"><xsl:param name="input"/><xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/></xsl:template>
+
+ <xsl:template name="toUpperDashToUnderscore"><xsl:param name="input"/><xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz-','ABCDEFGHIJKLMNOPQRSTUVWXYZ_')"/></xsl:template>
+
+ <xsl:template name="dashToCamel">
+ <xsl:param name="input"/>
+ <xsl:choose>
+ <xsl:when test="contains($input,'-')"><xsl:call-template name="initCap"><xsl:with-param name="input" select="substring-before($input,'-')"/></xsl:call-template><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="substring-after($input,'-')"/></xsl:call-template></xsl:when>
+ <xsl:otherwise><xsl:call-template name="initCap"><xsl:with-param name="input" select="$input"/></xsl:call-template></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="dashToLowerCamel">
+ <xsl:param name="input"/>
+ <xsl:call-template name="initLower"><xsl:with-param name="input"><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="$input"/></xsl:call-template></xsl:with-param></xsl:call-template>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/AttachMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/AttachMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/AttachMatcher.java
new file mode 100644
index 0000000..edd62cd
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/AttachMatcher.java
@@ -0,0 +1,231 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class AttachMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ NAME,
+ HANDLE,
+ ROLE,
+ SND_SETTLE_MODE,
+ RCV_SETTLE_MODE,
+ SOURCE,
+ TARGET,
+ UNSETTLED,
+ INCOMPLETE_UNSETTLED,
+ INITIAL_DELIVERY_COUNT,
+ MAX_MESSAGE_SIZE,
+ OFFERED_CAPABILITIES,
+ DESIRED_CAPABILITIES,
+ PROPERTIES,
+ }
+
+ public AttachMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000012L),
+ Symbol.valueOf("amqp:attach:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public AttachMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public AttachMatcher withName(Matcher<?> m)
+ {
+ getMatchers().put(Field.NAME, m);
+ return this;
+ }
+
+ public AttachMatcher withHandle(Matcher<?> m)
+ {
+ getMatchers().put(Field.HANDLE, m);
+ return this;
+ }
+
+ public AttachMatcher withRole(Matcher<?> m)
+ {
+ getMatchers().put(Field.ROLE, m);
+ return this;
+ }
+
+ public AttachMatcher withSndSettleMode(Matcher<?> m)
+ {
+ getMatchers().put(Field.SND_SETTLE_MODE, m);
+ return this;
+ }
+
+ public AttachMatcher withRcvSettleMode(Matcher<?> m)
+ {
+ getMatchers().put(Field.RCV_SETTLE_MODE, m);
+ return this;
+ }
+
+ public AttachMatcher withSource(Matcher<?> m)
+ {
+ getMatchers().put(Field.SOURCE, m);
+ return this;
+ }
+
+ public AttachMatcher withTarget(Matcher<?> m)
+ {
+ getMatchers().put(Field.TARGET, m);
+ return this;
+ }
+
+ public AttachMatcher withUnsettled(Matcher<?> m)
+ {
+ getMatchers().put(Field.UNSETTLED, m);
+ return this;
+ }
+
+ public AttachMatcher withIncompleteUnsettled(Matcher<?> m)
+ {
+ getMatchers().put(Field.INCOMPLETE_UNSETTLED, m);
+ return this;
+ }
+
+ public AttachMatcher withInitialDeliveryCount(Matcher<?> m)
+ {
+ getMatchers().put(Field.INITIAL_DELIVERY_COUNT, m);
+ return this;
+ }
+
+ public AttachMatcher withMaxMessageSize(Matcher<?> m)
+ {
+ getMatchers().put(Field.MAX_MESSAGE_SIZE, m);
+ return this;
+ }
+
+ public AttachMatcher withOfferedCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.OFFERED_CAPABILITIES, m);
+ return this;
+ }
+
+ public AttachMatcher withDesiredCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.DESIRED_CAPABILITIES, m);
+ return this;
+ }
+
+ public AttachMatcher withProperties(Matcher<?> m)
+ {
+ getMatchers().put(Field.PROPERTIES, m);
+ return this;
+ }
+
+ public Object getReceivedName()
+ {
+ return getReceivedFields().get(Field.NAME);
+ }
+
+ public Object getReceivedHandle()
+ {
+ return getReceivedFields().get(Field.HANDLE);
+ }
+
+ public Object getReceivedRole()
+ {
+ return getReceivedFields().get(Field.ROLE);
+ }
+
+ public Object getReceivedSndSettleMode()
+ {
+ return getReceivedFields().get(Field.SND_SETTLE_MODE);
+ }
+
+ public Object getReceivedRcvSettleMode()
+ {
+ return getReceivedFields().get(Field.RCV_SETTLE_MODE);
+ }
+
+ public Object getReceivedSource()
+ {
+ return getReceivedFields().get(Field.SOURCE);
+ }
+
+ public Object getReceivedTarget()
+ {
+ return getReceivedFields().get(Field.TARGET);
+ }
+
+ public Object getReceivedUnsettled()
+ {
+ return getReceivedFields().get(Field.UNSETTLED);
+ }
+
+ public Object getReceivedIncompleteUnsettled()
+ {
+ return getReceivedFields().get(Field.INCOMPLETE_UNSETTLED);
+ }
+
+ public Object getReceivedInitialDeliveryCount()
+ {
+ return getReceivedFields().get(Field.INITIAL_DELIVERY_COUNT);
+ }
+
+ public Object getReceivedMaxMessageSize()
+ {
+ return getReceivedFields().get(Field.MAX_MESSAGE_SIZE);
+ }
+
+ public Object getReceivedOfferedCapabilities()
+ {
+ return getReceivedFields().get(Field.OFFERED_CAPABILITIES);
+ }
+
+ public Object getReceivedDesiredCapabilities()
+ {
+ return getReceivedFields().get(Field.DESIRED_CAPABILITIES);
+ }
+
+ public Object getReceivedProperties()
+ {
+ return getReceivedFields().get(Field.PROPERTIES);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/BeginMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/BeginMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/BeginMatcher.java
new file mode 100644
index 0000000..ede5a31
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/BeginMatcher.java
@@ -0,0 +1,159 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class BeginMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ REMOTE_CHANNEL,
+ NEXT_OUTGOING_ID,
+ INCOMING_WINDOW,
+ OUTGOING_WINDOW,
+ HANDLE_MAX,
+ OFFERED_CAPABILITIES,
+ DESIRED_CAPABILITIES,
+ PROPERTIES,
+ }
+
+ public BeginMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000011L),
+ Symbol.valueOf("amqp:begin:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public BeginMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public BeginMatcher withRemoteChannel(Matcher<?> m)
+ {
+ getMatchers().put(Field.REMOTE_CHANNEL, m);
+ return this;
+ }
+
+ public BeginMatcher withNextOutgoingId(Matcher<?> m)
+ {
+ getMatchers().put(Field.NEXT_OUTGOING_ID, m);
+ return this;
+ }
+
+ public BeginMatcher withIncomingWindow(Matcher<?> m)
+ {
+ getMatchers().put(Field.INCOMING_WINDOW, m);
+ return this;
+ }
+
+ public BeginMatcher withOutgoingWindow(Matcher<?> m)
+ {
+ getMatchers().put(Field.OUTGOING_WINDOW, m);
+ return this;
+ }
+
+ public BeginMatcher withHandleMax(Matcher<?> m)
+ {
+ getMatchers().put(Field.HANDLE_MAX, m);
+ return this;
+ }
+
+ public BeginMatcher withOfferedCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.OFFERED_CAPABILITIES, m);
+ return this;
+ }
+
+ public BeginMatcher withDesiredCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.DESIRED_CAPABILITIES, m);
+ return this;
+ }
+
+ public BeginMatcher withProperties(Matcher<?> m)
+ {
+ getMatchers().put(Field.PROPERTIES, m);
+ return this;
+ }
+
+ public Object getReceivedRemoteChannel()
+ {
+ return getReceivedFields().get(Field.REMOTE_CHANNEL);
+ }
+
+ public Object getReceivedNextOutgoingId()
+ {
+ return getReceivedFields().get(Field.NEXT_OUTGOING_ID);
+ }
+
+ public Object getReceivedIncomingWindow()
+ {
+ return getReceivedFields().get(Field.INCOMING_WINDOW);
+ }
+
+ public Object getReceivedOutgoingWindow()
+ {
+ return getReceivedFields().get(Field.OUTGOING_WINDOW);
+ }
+
+ public Object getReceivedHandleMax()
+ {
+ return getReceivedFields().get(Field.HANDLE_MAX);
+ }
+
+ public Object getReceivedOfferedCapabilities()
+ {
+ return getReceivedFields().get(Field.OFFERED_CAPABILITIES);
+ }
+
+ public Object getReceivedDesiredCapabilities()
+ {
+ return getReceivedFields().get(Field.DESIRED_CAPABILITIES);
+ }
+
+ public Object getReceivedProperties()
+ {
+ return getReceivedFields().get(Field.PROPERTIES);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/CloseMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/CloseMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/CloseMatcher.java
new file mode 100644
index 0000000..ac03a5c
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/CloseMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class CloseMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ ERROR,
+ }
+
+ public CloseMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000018L),
+ Symbol.valueOf("amqp:close:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public CloseMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public CloseMatcher withError(Matcher<?> m)
+ {
+ getMatchers().put(Field.ERROR, m);
+ return this;
+ }
+
+ public Object getReceivedError()
+ {
+ return getReceivedFields().get(Field.ERROR);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DetachMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DetachMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DetachMatcher.java
new file mode 100644
index 0000000..dc5d2f1
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DetachMatcher.java
@@ -0,0 +1,99 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DetachMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ HANDLE,
+ CLOSED,
+ ERROR,
+ }
+
+ public DetachMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000016L),
+ Symbol.valueOf("amqp:detach:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public DetachMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public DetachMatcher withHandle(Matcher<?> m)
+ {
+ getMatchers().put(Field.HANDLE, m);
+ return this;
+ }
+
+ public DetachMatcher withClosed(Matcher<?> m)
+ {
+ getMatchers().put(Field.CLOSED, m);
+ return this;
+ }
+
+ public DetachMatcher withError(Matcher<?> m)
+ {
+ getMatchers().put(Field.ERROR, m);
+ return this;
+ }
+
+ public Object getReceivedHandle()
+ {
+ return getReceivedFields().get(Field.HANDLE);
+ }
+
+ public Object getReceivedClosed()
+ {
+ return getReceivedFields().get(Field.CLOSED);
+ }
+
+ public Object getReceivedError()
+ {
+ return getReceivedFields().get(Field.ERROR);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DispositionMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DispositionMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DispositionMatcher.java
new file mode 100644
index 0000000..3d41fee
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DispositionMatcher.java
@@ -0,0 +1,135 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DispositionMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ ROLE,
+ FIRST,
+ LAST,
+ SETTLED,
+ STATE,
+ BATCHABLE,
+ }
+
+ public DispositionMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000015L),
+ Symbol.valueOf("amqp:disposition:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public DispositionMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public DispositionMatcher withRole(Matcher<?> m)
+ {
+ getMatchers().put(Field.ROLE, m);
+ return this;
+ }
+
+ public DispositionMatcher withFirst(Matcher<?> m)
+ {
+ getMatchers().put(Field.FIRST, m);
+ return this;
+ }
+
+ public DispositionMatcher withLast(Matcher<?> m)
+ {
+ getMatchers().put(Field.LAST, m);
+ return this;
+ }
+
+ public DispositionMatcher withSettled(Matcher<?> m)
+ {
+ getMatchers().put(Field.SETTLED, m);
+ return this;
+ }
+
+ public DispositionMatcher withState(Matcher<?> m)
+ {
+ getMatchers().put(Field.STATE, m);
+ return this;
+ }
+
+ public DispositionMatcher withBatchable(Matcher<?> m)
+ {
+ getMatchers().put(Field.BATCHABLE, m);
+ return this;
+ }
+
+ public Object getReceivedRole()
+ {
+ return getReceivedFields().get(Field.ROLE);
+ }
+
+ public Object getReceivedFirst()
+ {
+ return getReceivedFields().get(Field.FIRST);
+ }
+
+ public Object getReceivedLast()
+ {
+ return getReceivedFields().get(Field.LAST);
+ }
+
+ public Object getReceivedSettled()
+ {
+ return getReceivedFields().get(Field.SETTLED);
+ }
+
+ public Object getReceivedState()
+ {
+ return getReceivedFields().get(Field.STATE);
+ }
+
+ public Object getReceivedBatchable()
+ {
+ return getReceivedFields().get(Field.BATCHABLE);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/EndMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/EndMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/EndMatcher.java
new file mode 100644
index 0000000..460bbaa
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/EndMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class EndMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ ERROR,
+ }
+
+ public EndMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000017L),
+ Symbol.valueOf("amqp:end:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public EndMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public EndMatcher withError(Matcher<?> m)
+ {
+ getMatchers().put(Field.ERROR, m);
+ return this;
+ }
+
+ public Object getReceivedError()
+ {
+ return getReceivedFields().get(Field.ERROR);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/FlowMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/FlowMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/FlowMatcher.java
new file mode 100644
index 0000000..9f6f74b
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/FlowMatcher.java
@@ -0,0 +1,195 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class FlowMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ NEXT_INCOMING_ID,
+ INCOMING_WINDOW,
+ NEXT_OUTGOING_ID,
+ OUTGOING_WINDOW,
+ HANDLE,
+ DELIVERY_COUNT,
+ LINK_CREDIT,
+ AVAILABLE,
+ DRAIN,
+ ECHO,
+ PROPERTIES,
+ }
+
+ public FlowMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000013L),
+ Symbol.valueOf("amqp:flow:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public FlowMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public FlowMatcher withNextIncomingId(Matcher<?> m)
+ {
+ getMatchers().put(Field.NEXT_INCOMING_ID, m);
+ return this;
+ }
+
+ public FlowMatcher withIncomingWindow(Matcher<?> m)
+ {
+ getMatchers().put(Field.INCOMING_WINDOW, m);
+ return this;
+ }
+
+ public FlowMatcher withNextOutgoingId(Matcher<?> m)
+ {
+ getMatchers().put(Field.NEXT_OUTGOING_ID, m);
+ return this;
+ }
+
+ public FlowMatcher withOutgoingWindow(Matcher<?> m)
+ {
+ getMatchers().put(Field.OUTGOING_WINDOW, m);
+ return this;
+ }
+
+ public FlowMatcher withHandle(Matcher<?> m)
+ {
+ getMatchers().put(Field.HANDLE, m);
+ return this;
+ }
+
+ public FlowMatcher withDeliveryCount(Matcher<?> m)
+ {
+ getMatchers().put(Field.DELIVERY_COUNT, m);
+ return this;
+ }
+
+ public FlowMatcher withLinkCredit(Matcher<?> m)
+ {
+ getMatchers().put(Field.LINK_CREDIT, m);
+ return this;
+ }
+
+ public FlowMatcher withAvailable(Matcher<?> m)
+ {
+ getMatchers().put(Field.AVAILABLE, m);
+ return this;
+ }
+
+ public FlowMatcher withDrain(Matcher<?> m)
+ {
+ getMatchers().put(Field.DRAIN, m);
+ return this;
+ }
+
+ public FlowMatcher withEcho(Matcher<?> m)
+ {
+ getMatchers().put(Field.ECHO, m);
+ return this;
+ }
+
+ public FlowMatcher withProperties(Matcher<?> m)
+ {
+ getMatchers().put(Field.PROPERTIES, m);
+ return this;
+ }
+
+ public Object getReceivedNextIncomingId()
+ {
+ return getReceivedFields().get(Field.NEXT_INCOMING_ID);
+ }
+
+ public Object getReceivedIncomingWindow()
+ {
+ return getReceivedFields().get(Field.INCOMING_WINDOW);
+ }
+
+ public Object getReceivedNextOutgoingId()
+ {
+ return getReceivedFields().get(Field.NEXT_OUTGOING_ID);
+ }
+
+ public Object getReceivedOutgoingWindow()
+ {
+ return getReceivedFields().get(Field.OUTGOING_WINDOW);
+ }
+
+ public Object getReceivedHandle()
+ {
+ return getReceivedFields().get(Field.HANDLE);
+ }
+
+ public Object getReceivedDeliveryCount()
+ {
+ return getReceivedFields().get(Field.DELIVERY_COUNT);
+ }
+
+ public Object getReceivedLinkCredit()
+ {
+ return getReceivedFields().get(Field.LINK_CREDIT);
+ }
+
+ public Object getReceivedAvailable()
+ {
+ return getReceivedFields().get(Field.AVAILABLE);
+ }
+
+ public Object getReceivedDrain()
+ {
+ return getReceivedFields().get(Field.DRAIN);
+ }
+
+ public Object getReceivedEcho()
+ {
+ return getReceivedFields().get(Field.ECHO);
+ }
+
+ public Object getReceivedProperties()
+ {
+ return getReceivedFields().get(Field.PROPERTIES);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/OpenMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/OpenMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/OpenMatcher.java
new file mode 100644
index 0000000..fd0bf61
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/OpenMatcher.java
@@ -0,0 +1,183 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class OpenMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ CONTAINER_ID,
+ HOSTNAME,
+ MAX_FRAME_SIZE,
+ CHANNEL_MAX,
+ IDLE_TIME_OUT,
+ OUTGOING_LOCALES,
+ INCOMING_LOCALES,
+ OFFERED_CAPABILITIES,
+ DESIRED_CAPABILITIES,
+ PROPERTIES,
+ }
+
+ public OpenMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000010L),
+ Symbol.valueOf("amqp:open:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public OpenMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public OpenMatcher withContainerId(Matcher<?> m)
+ {
+ getMatchers().put(Field.CONTAINER_ID, m);
+ return this;
+ }
+
+ public OpenMatcher withHostname(Matcher<?> m)
+ {
+ getMatchers().put(Field.HOSTNAME, m);
+ return this;
+ }
+
+ public OpenMatcher withMaxFrameSize(Matcher<?> m)
+ {
+ getMatchers().put(Field.MAX_FRAME_SIZE, m);
+ return this;
+ }
+
+ public OpenMatcher withChannelMax(Matcher<?> m)
+ {
+ getMatchers().put(Field.CHANNEL_MAX, m);
+ return this;
+ }
+
+ public OpenMatcher withIdleTimeOut(Matcher<?> m)
+ {
+ getMatchers().put(Field.IDLE_TIME_OUT, m);
+ return this;
+ }
+
+ public OpenMatcher withOutgoingLocales(Matcher<?> m)
+ {
+ getMatchers().put(Field.OUTGOING_LOCALES, m);
+ return this;
+ }
+
+ public OpenMatcher withIncomingLocales(Matcher<?> m)
+ {
+ getMatchers().put(Field.INCOMING_LOCALES, m);
+ return this;
+ }
+
+ public OpenMatcher withOfferedCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.OFFERED_CAPABILITIES, m);
+ return this;
+ }
+
+ public OpenMatcher withDesiredCapabilities(Matcher<?> m)
+ {
+ getMatchers().put(Field.DESIRED_CAPABILITIES, m);
+ return this;
+ }
+
+ public OpenMatcher withProperties(Matcher<?> m)
+ {
+ getMatchers().put(Field.PROPERTIES, m);
+ return this;
+ }
+
+ public Object getReceivedContainerId()
+ {
+ return getReceivedFields().get(Field.CONTAINER_ID);
+ }
+
+ public Object getReceivedHostname()
+ {
+ return getReceivedFields().get(Field.HOSTNAME);
+ }
+
+ public Object getReceivedMaxFrameSize()
+ {
+ return getReceivedFields().get(Field.MAX_FRAME_SIZE);
+ }
+
+ public Object getReceivedChannelMax()
+ {
+ return getReceivedFields().get(Field.CHANNEL_MAX);
+ }
+
+ public Object getReceivedIdleTimeOut()
+ {
+ return getReceivedFields().get(Field.IDLE_TIME_OUT);
+ }
+
+ public Object getReceivedOutgoingLocales()
+ {
+ return getReceivedFields().get(Field.OUTGOING_LOCALES);
+ }
+
+ public Object getReceivedIncomingLocales()
+ {
+ return getReceivedFields().get(Field.INCOMING_LOCALES);
+ }
+
+ public Object getReceivedOfferedCapabilities()
+ {
+ return getReceivedFields().get(Field.OFFERED_CAPABILITIES);
+ }
+
+ public Object getReceivedDesiredCapabilities()
+ {
+ return getReceivedFields().get(Field.DESIRED_CAPABILITIES);
+ }
+
+ public Object getReceivedProperties()
+ {
+ return getReceivedFields().get(Field.PROPERTIES);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslChallengeMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslChallengeMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslChallengeMatcher.java
new file mode 100644
index 0000000..08b0bc7
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslChallengeMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class SaslChallengeMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ CHALLENGE,
+ }
+
+ public SaslChallengeMatcher()
+ {
+ super(FrameType.SASL,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000042L),
+ Symbol.valueOf("amqp:sasl-challenge:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public SaslChallengeMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public SaslChallengeMatcher withChallenge(Matcher<?> m)
+ {
+ getMatchers().put(Field.CHALLENGE, m);
+ return this;
+ }
+
+ public Object getReceivedChallenge()
+ {
+ return getReceivedFields().get(Field.CHALLENGE);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslInitMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslInitMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslInitMatcher.java
new file mode 100644
index 0000000..7284edb
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslInitMatcher.java
@@ -0,0 +1,99 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class SaslInitMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ MECHANISM,
+ INITIAL_RESPONSE,
+ HOSTNAME,
+ }
+
+ public SaslInitMatcher()
+ {
+ super(FrameType.SASL,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000041L),
+ Symbol.valueOf("amqp:sasl-init:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public SaslInitMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public SaslInitMatcher withMechanism(Matcher<?> m)
+ {
+ getMatchers().put(Field.MECHANISM, m);
+ return this;
+ }
+
+ public SaslInitMatcher withInitialResponse(Matcher<?> m)
+ {
+ getMatchers().put(Field.INITIAL_RESPONSE, m);
+ return this;
+ }
+
+ public SaslInitMatcher withHostname(Matcher<?> m)
+ {
+ getMatchers().put(Field.HOSTNAME, m);
+ return this;
+ }
+
+ public Object getReceivedMechanism()
+ {
+ return getReceivedFields().get(Field.MECHANISM);
+ }
+
+ public Object getReceivedInitialResponse()
+ {
+ return getReceivedFields().get(Field.INITIAL_RESPONSE);
+ }
+
+ public Object getReceivedHostname()
+ {
+ return getReceivedFields().get(Field.HOSTNAME);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslMechanismsMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslMechanismsMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslMechanismsMatcher.java
new file mode 100644
index 0000000..63fd913
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslMechanismsMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class SaslMechanismsMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ SASL_SERVER_MECHANISMS,
+ }
+
+ public SaslMechanismsMatcher()
+ {
+ super(FrameType.SASL,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000040L),
+ Symbol.valueOf("amqp:sasl-mechanisms:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public SaslMechanismsMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public SaslMechanismsMatcher withSaslServerMechanisms(Matcher<?> m)
+ {
+ getMatchers().put(Field.SASL_SERVER_MECHANISMS, m);
+ return this;
+ }
+
+ public Object getReceivedSaslServerMechanisms()
+ {
+ return getReceivedFields().get(Field.SASL_SERVER_MECHANISMS);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslOutcomeMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslOutcomeMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslOutcomeMatcher.java
new file mode 100644
index 0000000..22355d1
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslOutcomeMatcher.java
@@ -0,0 +1,87 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class SaslOutcomeMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ CODE,
+ ADDITIONAL_DATA,
+ }
+
+ public SaslOutcomeMatcher()
+ {
+ super(FrameType.SASL,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000044L),
+ Symbol.valueOf("amqp:sasl-outcome:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public SaslOutcomeMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public SaslOutcomeMatcher withCode(Matcher<?> m)
+ {
+ getMatchers().put(Field.CODE, m);
+ return this;
+ }
+
+ public SaslOutcomeMatcher withAdditionalData(Matcher<?> m)
+ {
+ getMatchers().put(Field.ADDITIONAL_DATA, m);
+ return this;
+ }
+
+ public Object getReceivedCode()
+ {
+ return getReceivedFields().get(Field.CODE);
+ }
+
+ public Object getReceivedAdditionalData()
+ {
+ return getReceivedFields().get(Field.ADDITIONAL_DATA);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslResponseMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslResponseMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslResponseMatcher.java
new file mode 100644
index 0000000..c5fb865
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/SaslResponseMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithNoPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class SaslResponseMatcher extends FrameWithNoPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ RESPONSE,
+ }
+
+ public SaslResponseMatcher()
+ {
+ super(FrameType.SASL,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000043L),
+ Symbol.valueOf("amqp:sasl-response:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public SaslResponseMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public SaslResponseMatcher withResponse(Matcher<?> m)
+ {
+ getMatchers().put(Field.RESPONSE, m);
+ return this;
+ }
+
+ public Object getReceivedResponse()
+ {
+ return getReceivedFields().get(Field.RESPONSE);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/TransferMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/TransferMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/TransferMatcher.java
new file mode 100644
index 0000000..d7274a1
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/TransferMatcher.java
@@ -0,0 +1,195 @@
+/*
+ * 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.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.FrameWithPayloadMatchingHandler;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class TransferMatcher extends FrameWithPayloadMatchingHandler
+{
+ /** Note that the ordinals of the Field enums match the order specified in the spec */
+ public enum Field
+ {
+ HANDLE,
+ DELIVERY_ID,
+ DELIVERY_TAG,
+ MESSAGE_FORMAT,
+ SETTLED,
+ MORE,
+ RCV_SETTLE_MODE,
+ STATE,
+ RESUME,
+ ABORTED,
+ BATCHABLE,
+ }
+
+ public TransferMatcher()
+ {
+ super(FrameType.AMQP,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(0x0000000000000014L),
+ Symbol.valueOf("amqp:transfer:list"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public TransferMatcher onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+
+ public TransferMatcher withHandle(Matcher<?> m)
+ {
+ getMatchers().put(Field.HANDLE, m);
+ return this;
+ }
+
+ public TransferMatcher withDeliveryId(Matcher<?> m)
+ {
+ getMatchers().put(Field.DELIVERY_ID, m);
+ return this;
+ }
+
+ public TransferMatcher withDeliveryTag(Matcher<?> m)
+ {
+ getMatchers().put(Field.DELIVERY_TAG, m);
+ return this;
+ }
+
+ public TransferMatcher withMessageFormat(Matcher<?> m)
+ {
+ getMatchers().put(Field.MESSAGE_FORMAT, m);
+ return this;
+ }
+
+ public TransferMatcher withSettled(Matcher<?> m)
+ {
+ getMatchers().put(Field.SETTLED, m);
+ return this;
+ }
+
+ public TransferMatcher withMore(Matcher<?> m)
+ {
+ getMatchers().put(Field.MORE, m);
+ return this;
+ }
+
+ public TransferMatcher withRcvSettleMode(Matcher<?> m)
+ {
+ getMatchers().put(Field.RCV_SETTLE_MODE, m);
+ return this;
+ }
+
+ public TransferMatcher withState(Matcher<?> m)
+ {
+ getMatchers().put(Field.STATE, m);
+ return this;
+ }
+
+ public TransferMatcher withResume(Matcher<?> m)
+ {
+ getMatchers().put(Field.RESUME, m);
+ return this;
+ }
+
+ public TransferMatcher withAborted(Matcher<?> m)
+ {
+ getMatchers().put(Field.ABORTED, m);
+ return this;
+ }
+
+ public TransferMatcher withBatchable(Matcher<?> m)
+ {
+ getMatchers().put(Field.BATCHABLE, m);
+ return this;
+ }
+
+ public Object getReceivedHandle()
+ {
+ return getReceivedFields().get(Field.HANDLE);
+ }
+
+ public Object getReceivedDeliveryId()
+ {
+ return getReceivedFields().get(Field.DELIVERY_ID);
+ }
+
+ public Object getReceivedDeliveryTag()
+ {
+ return getReceivedFields().get(Field.DELIVERY_TAG);
+ }
+
+ public Object getReceivedMessageFormat()
+ {
+ return getReceivedFields().get(Field.MESSAGE_FORMAT);
+ }
+
+ public Object getReceivedSettled()
+ {
+ return getReceivedFields().get(Field.SETTLED);
+ }
+
+ public Object getReceivedMore()
+ {
+ return getReceivedFields().get(Field.MORE);
+ }
+
+ public Object getReceivedRcvSettleMode()
+ {
+ return getReceivedFields().get(Field.RCV_SETTLE_MODE);
+ }
+
+ public Object getReceivedState()
+ {
+ return getReceivedFields().get(Field.STATE);
+ }
+
+ public Object getReceivedResume()
+ {
+ return getReceivedFields().get(Field.RESUME);
+ }
+
+ public Object getReceivedAborted()
+ {
+ return getReceivedFields().get(Field.ABORTED);
+ }
+
+ public Object getReceivedBatchable()
+ {
+ return getReceivedFields().get(Field.BATCHABLE);
+ }
+
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/generate-matchers.xsl
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/generate-matchers.xsl b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/generate-matchers.xsl
new file mode 100644
index 0000000..263c87f
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/generate-matchers.xsl
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl">
+
+<!-- Used to generate the Java classes in this package.
+ Changes to these classes should be effected by modifying this stylesheet then re-running it,
+ using a stylesheet processor that understands the exsl directives such as xsltproc -->
+
+<xsl:template match="/">
+ <xsl:variable name="license">/*
+ * 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.
+ *
+ */
+</xsl:variable>
+
+ <xsl:for-each select="descendant-or-self::node()[name()='type']">
+ <xsl:variable name="classname"><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="@name"/></xsl:call-template>Matcher</xsl:variable>
+ <xsl:variable name="superclass">
+ <xsl:choose>
+ <xsl:when test="@name = 'transfer'">FrameWithPayloadMatchingHandler</xsl:when>
+ <xsl:otherwise>FrameWithNoPayloadMatchingHandler</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="@provides = 'frame' or @provides = 'sasl-frame'">
+ <xsl:call-template name="typeClass">
+ <xsl:with-param name="license" select="$license"/>
+ <xsl:with-param name="classname" select="$classname"/>
+ <xsl:with-param name="superclass" select="$superclass"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ </xsl:for-each>
+</xsl:template>
+
+
+<!-- *************************************************************************************************************** -->
+
+<xsl:template name="typeClass">
+ <xsl:param name="license"/>
+ <xsl:param name="classname"/>
+ <xsl:param name="superclass"/>
+ <exsl:document href="{$classname}.java" method="text">
+ <xsl:value-of select="$license"/>
+package org.apache.qpid.jms.test.testpeer.matchers;
+
+import java.util.HashMap;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.jms.test.testpeer.FrameType;
+import org.apache.qpid.jms.test.testpeer.<xsl:value-of select="$superclass"/>;
+import org.hamcrest.Matcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class <xsl:value-of select="$classname"/> extends <xsl:value-of select="$superclass"/>
+{
+ /** Note that the ordinals of the Field enums match the order specified in the AMQP spec */
+ public enum Field
+ {
+<xsl:for-each select="descendant::node()[name()='field']">
+<xsl:text> </xsl:text><xsl:call-template name="toUpperDashToUnderscore"><xsl:with-param name="input" select="@name"/></xsl:call-template>,
+</xsl:for-each> }
+
+ public <xsl:value-of select="$classname"/>()
+ {
+ super(FrameType.<xsl:choose><xsl:when test="@provides='sasl-frame'">SASL</xsl:when><xsl:otherwise>AMQP</xsl:otherwise></xsl:choose>,
+ ANY_CHANNEL,
+ UnsignedLong.valueOf(<xsl:value-of select="concat(substring(descendant::node()[name()='descriptor']/@code,1,10),substring(descendant::node()[name()='descriptor']/@code,14))"/>L),
+ Symbol.valueOf("<xsl:value-of select="descendant::node()[name()='descriptor']/@name"/>"),
+ new HashMap<Enum<?>, Matcher<?>>(),
+ null);
+ }
+
+ @Override
+ public <xsl:value-of select="$classname"/> onSuccess(Runnable onSuccessAction)
+ {
+ super.onSuccess(onSuccessAction);
+ return this;
+ }
+<xsl:for-each select="descendant::node()[name()='field']">
+ public <xsl:value-of select="$classname"/> with<xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="@name"/></xsl:call-template>(Matcher<?> m)
+ {
+ getMatchers().put(Field.<xsl:call-template name="toUpperDashToUnderscore"><xsl:with-param name="input" select="@name"/></xsl:call-template>, m);
+ return this;
+ }
+</xsl:for-each>
+<xsl:for-each select="descendant::node()[name()='field']">
+ public Object getReceived<xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="@name"/></xsl:call-template>()
+ {
+ return getReceivedFields().get(Field.<xsl:call-template name="toUpperDashToUnderscore"><xsl:with-param name="input" select="@name"/></xsl:call-template>);
+ }
+</xsl:for-each>
+ @Override
+ protected Enum<?> getField(int fieldIndex)
+ {
+ return Field.values()[fieldIndex];
+ }
+}
+
+</exsl:document>
+
+</xsl:template>
+
+<!-- *************************************************************************************************************** -->
+
+<xsl:template name="constructFromLiteral">
+ <xsl:param name="type"/>
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="$type = 'string'">"<xsl:value-of select="$value"/></xsl:when>
+ <xsl:when test="$type = 'symbol'">Symbol.valueOf("<xsl:value-of select="$value"/>")</xsl:when>
+ <xsl:when test="$type = 'ubyte'">UnsignedByte.valueOf((byte) <xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'ushort'">UnsignedShort.valueOf((short) <xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'uint'">UnsignedInteger.valueOf(<xsl:value-of select="$value"/>)</xsl:when>
+ <xsl:when test="$type = 'ulong'">UnsignedLong.valueOf(<xsl:value-of select="$value"/>L)</xsl:when>
+ <xsl:when test="$type = 'long'"><xsl:value-of select="$value"/>L</xsl:when>
+ <xsl:when test="$type = 'short'">(short)<xsl:value-of select="$value"/></xsl:when>
+ <xsl:when test="$type = 'short'">(byte)<xsl:value-of select="$value"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- *************************************************************************************************************** -->
+<xsl:template name="substringAfterLast"><xsl:param name="input"/><xsl:param name="arg"/>
+ <xsl:choose>
+ <xsl:when test="contains($input,$arg)"><xsl:call-template name="substringAfterLast"><xsl:with-param name="input"><xsl:value-of select="substring-after($input,$arg)"/></xsl:with-param><xsl:with-param name="arg"><xsl:value-of select="$arg"/></xsl:with-param></xsl:call-template></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$input"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="initCap"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+
+ <xsl:template name="initLower"><xsl:param name="input"/><xsl:value-of select="translate(substring($input,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/><xsl:value-of select="substring($input,2)"/></xsl:template>
+
+ <xsl:template name="toUpper"><xsl:param name="input"/><xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/></xsl:template>
+
+ <xsl:template name="toUpperDashToUnderscore"><xsl:param name="input"/><xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz-','ABCDEFGHIJKLMNOPQRSTUVWXYZ_')"/></xsl:template>
+
+ <xsl:template name="dashToCamel">
+ <xsl:param name="input"/>
+ <xsl:choose>
+ <xsl:when test="contains($input,'-')"><xsl:call-template name="initCap"><xsl:with-param name="input" select="substring-before($input,'-')"/></xsl:call-template><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="substring-after($input,'-')"/></xsl:call-template></xsl:when>
+ <xsl:otherwise><xsl:call-template name="initCap"><xsl:with-param name="input" select="$input"/></xsl:call-template></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="dashToLowerCamel">
+ <xsl:param name="input"/>
+ <xsl:call-template name="initLower"><xsl:with-param name="input"><xsl:call-template name="dashToCamel"><xsl:with-param name="input" select="$input"/></xsl:call-template></xsl:with-param></xsl:call-template>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/AbstractMessageSectionMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/AbstractMessageSectionMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/AbstractMessageSectionMatcher.java
new file mode 100644
index 0000000..133a452
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/AbstractMessageSectionMatcher.java
@@ -0,0 +1,138 @@
+/*
+ * 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.jms.test.testpeer.matchers.sections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Map;
+
+import org.apache.qpid.proton.Proton;
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.DescribedType;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.codec.Data;
+import org.hamcrest.Matcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractMessageSectionMatcher
+{
+ private final Logger _logger = LoggerFactory.getLogger(getClass());
+
+ private final UnsignedLong _numericDescriptor;
+ private final Symbol _symbolicDescriptor;
+
+ private final Map<Object, Matcher<?>> _fieldMatchers;
+ private Map<Object, Object> _receivedFields;
+
+ private final boolean _expectTrailingBytes;
+
+ protected AbstractMessageSectionMatcher(UnsignedLong numericDescriptor,
+ Symbol symbolicDescriptor,
+ Map<Object, Matcher<?>> fieldMatchers,
+ boolean expectTrailingBytes)
+ {
+ _numericDescriptor = numericDescriptor;
+ _symbolicDescriptor = symbolicDescriptor;
+ _fieldMatchers = fieldMatchers;
+ _expectTrailingBytes = expectTrailingBytes;
+ }
+
+ protected Map<Object, Matcher<?>> getMatchers()
+ {
+ return _fieldMatchers;
+ }
+
+ protected Map<Object, Object> getReceivedFields()
+ {
+ return _receivedFields;
+ }
+
+ /**
+ * @return the number of bytes consumed from the provided Binary
+ * @throws RuntimeException if the provided Binary does not match expectation in some way
+ */
+ public int verify(Binary receivedBinary) throws RuntimeException
+ {
+ int length = receivedBinary.getLength();
+ Data data = Proton.data(length);
+ long decoded = data.decode(receivedBinary.asByteBuffer());
+ if(decoded > Integer.MAX_VALUE)
+ {
+ throw new IllegalStateException("Decoded more bytes than Binary supports holding");
+ }
+
+ if(decoded < length && !_expectTrailingBytes)
+ {
+ throw new IllegalArgumentException("Expected to consume all bytes, but trailing bytes remain: Got "
+ + length + ", consumed "+ decoded);
+ }
+
+ DescribedType decodedDescribedType = data.getDescribedType();
+ verifyReceivedDescribedType(decodedDescribedType);
+
+ //Need to cast to int, but verified earlier that it is < Integer.MAX_VALUE
+ return (int) decoded;
+ }
+
+ private void verifyReceivedDescribedType(DescribedType decodedDescribedType)
+ {
+ Object descriptor = decodedDescribedType.getDescriptor();
+ if(!(_symbolicDescriptor.equals(descriptor) || _numericDescriptor.equals(descriptor)))
+ {
+ throw new IllegalArgumentException("Unexpected section type descriptor. Expected "
+ + _symbolicDescriptor + " or " + _numericDescriptor + ", but got: " + descriptor);
+ }
+
+ verifyReceivedDescribedObject(decodedDescribedType.getDescribed());
+ }
+
+ /**
+ * sub-classes should implement depending on the expected content of the particular section type.
+ */
+ protected abstract void verifyReceivedDescribedObject(Object describedObject);
+
+ /**
+ * Utility method for use by sub-classes that expect field-based sections, i.e lists or maps.
+ */
+ protected void verifyReceivedFields(Map<Object, Object> valueMap)
+ {
+ _receivedFields = valueMap;
+
+ _logger.debug("About to check the fields of the section."
+ + "\n Received:" + valueMap
+ + "\n Expectations: " + _fieldMatchers);
+ for(Map.Entry<Object, Matcher<?>> entry : _fieldMatchers.entrySet())
+ {
+ @SuppressWarnings("unchecked")
+ Matcher<Object> matcher = (Matcher<Object>) entry.getValue();
+ Object field = entry.getKey();
+ assertThat("Field " + field + " value should match", valueMap.get(field), matcher);
+ }
+ }
+
+ /**
+ * Intended to be overridden in most cases that use the above method (but not necessarily all - hence not marked as abstract)
+ */
+ protected Enum<?> getField(int fieldIndex)
+ {
+ throw new UnsupportedOperationException("getFieldName is expected to be overridden by subclass if it is required");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/ApplicationPropertiesSectionMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/ApplicationPropertiesSectionMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/ApplicationPropertiesSectionMatcher.java
new file mode 100644
index 0000000..87735fc
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/ApplicationPropertiesSectionMatcher.java
@@ -0,0 +1,53 @@
+/*
+ * 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.jms.test.testpeer.matchers.sections;
+
+import java.util.HashMap;
+
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.hamcrest.Matcher;
+
+public class ApplicationPropertiesSectionMatcher extends MessageMapSectionMatcher
+{
+ public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:application-properties:map");
+ public static final UnsignedLong DESCRIPTOR_CODE = UnsignedLong.valueOf(0x0000000000000074L);
+
+ public ApplicationPropertiesSectionMatcher(boolean expectTrailingBytes)
+ {
+ super(DESCRIPTOR_CODE,
+ DESCRIPTOR_SYMBOL,
+ new HashMap<Object, Matcher<?>>(),
+ expectTrailingBytes);
+ }
+
+ @Override
+ public ApplicationPropertiesSectionMatcher withEntry(Object key, Matcher<?> m)
+ {
+ if(!(key instanceof String))
+ {
+ throw new RuntimeException("ApplicationProperties maps must use non-null String keys");
+ }
+
+ return (ApplicationPropertiesSectionMatcher) super.withEntry(key, m);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/MessageAnnotationsSectionMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/MessageAnnotationsSectionMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/MessageAnnotationsSectionMatcher.java
new file mode 100644
index 0000000..754d32a
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/sections/MessageAnnotationsSectionMatcher.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jms.test.testpeer.matchers.sections;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.hamcrest.Matcher;
+
+public class MessageAnnotationsSectionMatcher extends MessageMapSectionMatcher
+{
+ public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:message-annotations:map");
+ public static final UnsignedLong DESCRIPTOR_CODE = UnsignedLong.valueOf(0x0000000000000072L);
+
+ public MessageAnnotationsSectionMatcher(boolean expectTrailingBytes)
+ {
+ super(DESCRIPTOR_CODE,
+ DESCRIPTOR_SYMBOL,
+ new HashMap<Object, Matcher<?>>(),
+ expectTrailingBytes);
+ }
+
+ @Override
+ public MessageAnnotationsSectionMatcher withEntry(Object key, Matcher<?> m)
+ {
+ validateType(key);
+
+ return (MessageAnnotationsSectionMatcher) super.withEntry(key, m);
+ }
+
+ private void validateType(Object key)
+ {
+ if(!(key instanceof Long || key instanceof Symbol))
+ {
+ throw new IllegalArgumentException("Message Annotation keys must be of type Symbol or long (reserved)");
+ }
+ }
+
+ public boolean keyExistsInReceivedAnnotations(Object key)
+ {
+ validateType(key);
+
+ Map<Object, Object> receivedFields = super.getReceivedFields();
+
+ if(receivedFields != null)
+ {
+ return receivedFields.containsKey(key);
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org