qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [1/2] qpid-jms git commit: add support to the test peer for matching lifetime policies in the dynamic node properties
Date Mon, 05 Jan 2015 15:32:58 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 5c09dbf7c -> 372f0f2ee


add support to the test peer for matching lifetime policies in the dynamic node properties


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/382cfa20
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/382cfa20
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/382cfa20

Branch: refs/heads/master
Commit: 382cfa203ade5a07d9085b44479ab1f83d3e084e
Parents: 5c09dbf
Author: Robert Gemmell <robbie@apache.org>
Authored: Mon Jan 5 12:45:27 2015 +0000
Committer: Robert Gemmell <robbie@apache.org>
Committed: Mon Jan 5 12:45:33 2015 +0000

----------------------------------------------------------------------
 .../testpeer/matchers/DeleteOnCloseMatcher.java | 126 +++++++++++++++++++
 .../matchers/DeleteOnNoLinksMatcher.java        | 126 +++++++++++++++++++
 .../DeleteOnNoLinksOrMessagesMatcher.java       | 126 +++++++++++++++++++
 .../matchers/DeleteOnNoMessagesMatcher.java     | 126 +++++++++++++++++++
 .../testpeer/matchers/generate-matchers.xsl     |   4 +-
 5 files changed, 506 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/382cfa20/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnCloseMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnCloseMatcher.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnCloseMatcher.java
new file mode 100644
index 0000000..b5a116d
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnCloseMatcher.java
@@ -0,0 +1,126 @@
+/*
+ * 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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
+import java.util.List;
+
+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.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DeleteOnCloseMatcher extends TypeSafeMatcher<Object>
+{
+    private DeleteOnCloseMatcherCore coreMatcher = new DeleteOnCloseMatcherCore();
+    private String mismatchTextAddition;
+    private Object described;
+    private Object descriptor;
+
+    public DeleteOnCloseMatcher()
+    {
+    }
+
+    @Override
+    protected boolean matchesSafely(Object received)
+    {
+        try
+        {
+            assertThat(received, instanceOf(DescribedType.class));
+            descriptor = ((DescribedType)received).getDescriptor();
+            if(!coreMatcher.descriptorMatches(descriptor))
+            {
+                mismatchTextAddition = "Descriptor mismatch";
+                return false;
+            }
+
+            described = ((DescribedType)received).getDescribed();
+            assertThat(described, instanceOf(List.class));
+            @SuppressWarnings("unchecked")
+            List<Object> fields = (List<Object>) described;
+
+            coreMatcher.verifyFields(fields);
+        }
+        catch (AssertionError ae)
+        {
+            mismatchTextAddition = "AssertionFailure: " + ae.getMessage();
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void describeMismatchSafely(Object item, Description mismatchDescription)
+    {
+        mismatchDescription.appendText("\nActual form: ").appendValue(item);
+
+        mismatchDescription.appendText("\nExpected descriptor: ")
+                .appendValue(coreMatcher.getSymbolicDescriptor())
+                .appendText(" / ")
+                .appendValue(coreMatcher.getNumericDescriptor());
+
+        if(mismatchTextAddition != null)
+        {
+            mismatchDescription.appendText("\nAdditional info: ").appendValue(mismatchTextAddition);
+        }
+    }
+
+    public void describeTo(Description description)
+    {
+        description
+            .appendText("DeleteOnClose which matches: ")
+            .appendValue(coreMatcher.getMatchers());
+    }
+
+
+
+
+    //Inner core matching class
+    public static class DeleteOnCloseMatcherCore extends AbstractFieldAndDescriptorMatcher
+    {
+        /** Note that the ordinals of the Field enums match the order specified in the AMQP
spec */
+        public enum Field
+        {
+        }
+
+        public DeleteOnCloseMatcherCore()
+        {
+            super(UnsignedLong.valueOf(0x000000000000002bL),
+                  Symbol.valueOf("amqp:delete-on-close:list"));
+        }
+
+
+        @Override
+        protected Enum<?> getField(int fieldIndex)
+        {
+            return Field.values()[fieldIndex];
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/382cfa20/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksMatcher.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksMatcher.java
new file mode 100644
index 0000000..73b121d
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksMatcher.java
@@ -0,0 +1,126 @@
+/*
+ * 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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
+import java.util.List;
+
+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.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DeleteOnNoLinksMatcher extends TypeSafeMatcher<Object>
+{
+    private DeleteOnNoLinksMatcherCore coreMatcher = new DeleteOnNoLinksMatcherCore();
+    private String mismatchTextAddition;
+    private Object described;
+    private Object descriptor;
+
+    public DeleteOnNoLinksMatcher()
+    {
+    }
+
+    @Override
+    protected boolean matchesSafely(Object received)
+    {
+        try
+        {
+            assertThat(received, instanceOf(DescribedType.class));
+            descriptor = ((DescribedType)received).getDescriptor();
+            if(!coreMatcher.descriptorMatches(descriptor))
+            {
+                mismatchTextAddition = "Descriptor mismatch";
+                return false;
+            }
+
+            described = ((DescribedType)received).getDescribed();
+            assertThat(described, instanceOf(List.class));
+            @SuppressWarnings("unchecked")
+            List<Object> fields = (List<Object>) described;
+
+            coreMatcher.verifyFields(fields);
+        }
+        catch (AssertionError ae)
+        {
+            mismatchTextAddition = "AssertionFailure: " + ae.getMessage();
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void describeMismatchSafely(Object item, Description mismatchDescription)
+    {
+        mismatchDescription.appendText("\nActual form: ").appendValue(item);
+
+        mismatchDescription.appendText("\nExpected descriptor: ")
+                .appendValue(coreMatcher.getSymbolicDescriptor())
+                .appendText(" / ")
+                .appendValue(coreMatcher.getNumericDescriptor());
+
+        if(mismatchTextAddition != null)
+        {
+            mismatchDescription.appendText("\nAdditional info: ").appendValue(mismatchTextAddition);
+        }
+    }
+
+    public void describeTo(Description description)
+    {
+        description
+            .appendText("DeleteOnNoLinks which matches: ")
+            .appendValue(coreMatcher.getMatchers());
+    }
+
+
+
+
+    //Inner core matching class
+    public static class DeleteOnNoLinksMatcherCore extends AbstractFieldAndDescriptorMatcher
+    {
+        /** Note that the ordinals of the Field enums match the order specified in the AMQP
spec */
+        public enum Field
+        {
+        }
+
+        public DeleteOnNoLinksMatcherCore()
+        {
+            super(UnsignedLong.valueOf(0x000000000000002cL),
+                  Symbol.valueOf("amqp:delete-on-no-links:list"));
+        }
+
+
+        @Override
+        protected Enum<?> getField(int fieldIndex)
+        {
+            return Field.values()[fieldIndex];
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/382cfa20/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksOrMessagesMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksOrMessagesMatcher.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksOrMessagesMatcher.java
new file mode 100644
index 0000000..1b73c27
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoLinksOrMessagesMatcher.java
@@ -0,0 +1,126 @@
+/*
+ * 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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
+import java.util.List;
+
+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.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DeleteOnNoLinksOrMessagesMatcher extends TypeSafeMatcher<Object>
+{
+    private DeleteOnNoLinksOrMessagesMatcherCore coreMatcher = new DeleteOnNoLinksOrMessagesMatcherCore();
+    private String mismatchTextAddition;
+    private Object described;
+    private Object descriptor;
+
+    public DeleteOnNoLinksOrMessagesMatcher()
+    {
+    }
+
+    @Override
+    protected boolean matchesSafely(Object received)
+    {
+        try
+        {
+            assertThat(received, instanceOf(DescribedType.class));
+            descriptor = ((DescribedType)received).getDescriptor();
+            if(!coreMatcher.descriptorMatches(descriptor))
+            {
+                mismatchTextAddition = "Descriptor mismatch";
+                return false;
+            }
+
+            described = ((DescribedType)received).getDescribed();
+            assertThat(described, instanceOf(List.class));
+            @SuppressWarnings("unchecked")
+            List<Object> fields = (List<Object>) described;
+
+            coreMatcher.verifyFields(fields);
+        }
+        catch (AssertionError ae)
+        {
+            mismatchTextAddition = "AssertionFailure: " + ae.getMessage();
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void describeMismatchSafely(Object item, Description mismatchDescription)
+    {
+        mismatchDescription.appendText("\nActual form: ").appendValue(item);
+
+        mismatchDescription.appendText("\nExpected descriptor: ")
+                .appendValue(coreMatcher.getSymbolicDescriptor())
+                .appendText(" / ")
+                .appendValue(coreMatcher.getNumericDescriptor());
+
+        if(mismatchTextAddition != null)
+        {
+            mismatchDescription.appendText("\nAdditional info: ").appendValue(mismatchTextAddition);
+        }
+    }
+
+    public void describeTo(Description description)
+    {
+        description
+            .appendText("DeleteOnNoLinksOrMessages which matches: ")
+            .appendValue(coreMatcher.getMatchers());
+    }
+
+
+
+
+    //Inner core matching class
+    public static class DeleteOnNoLinksOrMessagesMatcherCore extends AbstractFieldAndDescriptorMatcher
+    {
+        /** Note that the ordinals of the Field enums match the order specified in the AMQP
spec */
+        public enum Field
+        {
+        }
+
+        public DeleteOnNoLinksOrMessagesMatcherCore()
+        {
+            super(UnsignedLong.valueOf(0x000000000000002eL),
+                  Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"));
+        }
+
+
+        @Override
+        protected Enum<?> getField(int fieldIndex)
+        {
+            return Field.values()[fieldIndex];
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/382cfa20/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoMessagesMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoMessagesMatcher.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoMessagesMatcher.java
new file mode 100644
index 0000000..f4ffdb2
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/DeleteOnNoMessagesMatcher.java
@@ -0,0 +1,126 @@
+/*
+ * 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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+
+import java.util.List;
+
+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.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+
+/**
+ * Generated by generate-matchers.xsl, which resides in this package.
+ */
+public class DeleteOnNoMessagesMatcher extends TypeSafeMatcher<Object>
+{
+    private DeleteOnNoMessagesMatcherCore coreMatcher = new DeleteOnNoMessagesMatcherCore();
+    private String mismatchTextAddition;
+    private Object described;
+    private Object descriptor;
+
+    public DeleteOnNoMessagesMatcher()
+    {
+    }
+
+    @Override
+    protected boolean matchesSafely(Object received)
+    {
+        try
+        {
+            assertThat(received, instanceOf(DescribedType.class));
+            descriptor = ((DescribedType)received).getDescriptor();
+            if(!coreMatcher.descriptorMatches(descriptor))
+            {
+                mismatchTextAddition = "Descriptor mismatch";
+                return false;
+            }
+
+            described = ((DescribedType)received).getDescribed();
+            assertThat(described, instanceOf(List.class));
+            @SuppressWarnings("unchecked")
+            List<Object> fields = (List<Object>) described;
+
+            coreMatcher.verifyFields(fields);
+        }
+        catch (AssertionError ae)
+        {
+            mismatchTextAddition = "AssertionFailure: " + ae.getMessage();
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void describeMismatchSafely(Object item, Description mismatchDescription)
+    {
+        mismatchDescription.appendText("\nActual form: ").appendValue(item);
+
+        mismatchDescription.appendText("\nExpected descriptor: ")
+                .appendValue(coreMatcher.getSymbolicDescriptor())
+                .appendText(" / ")
+                .appendValue(coreMatcher.getNumericDescriptor());
+
+        if(mismatchTextAddition != null)
+        {
+            mismatchDescription.appendText("\nAdditional info: ").appendValue(mismatchTextAddition);
+        }
+    }
+
+    public void describeTo(Description description)
+    {
+        description
+            .appendText("DeleteOnNoMessages which matches: ")
+            .appendValue(coreMatcher.getMatchers());
+    }
+
+
+
+
+    //Inner core matching class
+    public static class DeleteOnNoMessagesMatcherCore extends AbstractFieldAndDescriptorMatcher
+    {
+        /** Note that the ordinals of the Field enums match the order specified in the AMQP
spec */
+        public enum Field
+        {
+        }
+
+        public DeleteOnNoMessagesMatcherCore()
+        {
+            super(UnsignedLong.valueOf(0x000000000000002dL),
+                  Symbol.valueOf("amqp:delete-on-no-messages:list"));
+        }
+
+
+        @Override
+        protected Enum<?> getField(int fieldIndex)
+        {
+            return Field.values()[fieldIndex];
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/382cfa20/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
index 52bbea1..b90aaea 100644
--- 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
@@ -46,7 +46,7 @@
           </xsl:call-template>
         </xsl:if>
 
-        <xsl:if test="@provides = 'source' or @provides = 'target' or @name='transactional-state'
 or @provides='delivery-state, outcome'">
+        <xsl:if test="@provides = 'source' or @provides = 'target' or @name='transactional-state'
or @provides='delivery-state, outcome' or @provides = 'lifetime-policy'">
           <xsl:variable name="typename"><xsl:call-template name="dashToCamel"><xsl:with-param
name="input" select="@name"/></xsl:call-template></xsl:variable>
           <xsl:call-template name="fieldClass">
               <xsl:with-param name="license" select="$license"/>
@@ -143,7 +143,7 @@ import java.util.List;
 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.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;<xsl:if test="@name
!= 'accepted' and @name != 'released'">
+import org.apache.qpid.jms.test.testpeer.AbstractFieldAndDescriptorMatcher;<xsl:if test="@name
!= 'accepted' and @name != 'released' and @provides != 'lifetime-policy'">
 import org.hamcrest.Matcher;</xsl:if>
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeMatcher;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message