[jboss-cvs] JBoss Messaging SVN: r5613 - in trunk: tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 12 08:46:10 EST 2009


Author: ataylor
Date: 2009-01-12 08:46:10 -0500 (Mon, 12 Jan 2009)
New Revision: 5613

Modified:
   trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java
Log:
addressImpl fix and extra tests

Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java	2009-01-10 23:07:50 UTC (rev 5612)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/AddressImpl.java	2009-01-12 13:46:10 UTC (rev 5613)
@@ -120,7 +120,8 @@
       {
          if(pos >= addressParts.length)
          {
-            return false;
+            //test for # as last address part
+            return pos + 1 == add.getAddressParts().length && add.getAddressParts()[pos].equals(ANY_WORDS_SIMPLESTRING);
          }
          SimpleString curr = addressParts[pos];
          SimpleString next = addressParts.length > pos + 1 ? addressParts[pos + 1] : null;

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java	2009-01-10 23:07:50 UTC (rev 5612)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/AddressImplTest.java	2009-01-12 13:46:10 UTC (rev 5613)
@@ -189,4 +189,95 @@
       assertTrue(a1.matches(w));
       assertFalse(a2.matches(w));
    }
+
+   public void testM()
+   {
+      SimpleString s1 = new SimpleString("a.b.c");
+      SimpleString s2 = new SimpleString("a.b.x.e");
+      SimpleString s3 = new SimpleString("a.b.c.#");
+      Address a1 = new AddressImpl(s1);
+      Address a2 = new AddressImpl(s2);
+      Address w = new AddressImpl(s3);
+      assertTrue(a1.matches(w));
+      assertFalse(a2.matches(w));
+   }
+
+   public void testN()
+   {
+      SimpleString s1 = new SimpleString("usd.stock");
+      SimpleString s2 = new SimpleString("a.b.x.e");
+      SimpleString s3 = new SimpleString("*.stock.#");
+      Address a1 = new AddressImpl(s1);
+      Address a2 = new AddressImpl(s2);
+      Address w = new AddressImpl(s3);
+      assertTrue(a1.matches(w));
+      assertFalse(a2.matches(w));
+   }
+
+   public void testO()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s2 = new SimpleString("a.b.x.e");
+      SimpleString s3 = new SimpleString("a.b.c.*");
+      Address a1 = new AddressImpl(s1);
+      Address a2 = new AddressImpl(s2);
+      Address w = new AddressImpl(s3);
+      assertTrue(a1.matches(w));
+      assertFalse(a2.matches(w));
+   }
+
+   public void testP()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("a.b.c#");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
+   public void testQ()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("#a.b.c");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
+    public void testR()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("#*a.b.c");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
+   public void testS()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("a.b.c*");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
+   public void testT()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("*a.b.c");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
+   public void testU()
+   {
+      SimpleString s1 = new SimpleString("a.b.c.d");
+      SimpleString s3 = new SimpleString("*a.b.c");
+      Address a1 = new AddressImpl(s1);
+      Address w = new AddressImpl(s3);
+      assertFalse(a1.matches(w));
+   }
+
 }




More information about the jboss-cvs-commits mailing list