You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/07/03 17:51:46 UTC

svn commit: r1142453 [12/12] - in /incubator/airavata/ws-messaging/trunk/messagebroker: ./ .settings/ customLibs/ customLibs/activeMQ/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/airavata/ src/mai...

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPISubscriptionsTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPISubscriptionsTest.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPISubscriptionsTest.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPISubscriptionsTest.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,290 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class WseClientAPISubscriptionsTest extends TestCase {
+
+    static Properties configs = new Properties();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    // basic subscription test
+    @Test
+    public final void testSubscribe() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topic = "SimpleTopicWSE";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topic);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testSubscribeWithURLBasedTopic() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topic = "MytopicFromURLWSE";
+
+            EndpointReference brokerEprWithTopic = WseClientAPI.createEndpointReference(brokerEPR, topic);
+
+            String subscriptionID = clientApi.subscribe(brokerEprWithTopic.getAddress(), consumerEPR, null);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    // check for duplicate subscription
+    @Test
+    public final void testSubscribeSameSubcription() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topic = "DuplicateSubscriptionTestWSE";
+
+            String subscriptionIDFirst = clientApi.subscribe(brokerEPR, consumerEPR, topic);
+
+            assertNotNull(subscriptionIDFirst);
+
+            String subscriptionIDSecond = clientApi.subscribe(brokerEPR, consumerEPR, topic);
+
+            assertEquals(subscriptionIDFirst, subscriptionIDSecond);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    // check for Xpath subscription
+    @Test
+    public final void testSubscribeXpath() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = null;
+            String xpathExpression = "/test/wse";
+
+            clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    // check for Xpath subscription
+    @Test
+    public final void testSubscribeTopicAndXpath() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "testTopicAndXpathWSE";
+            String xpathExpression = "/test/wse1";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testSubscribeURLTopicAndXpath() {
+
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "testTopicURLAndXpathWSE";
+            String xpathExpression = "/wse/xpath";
+
+            WseClientAPI.createEndpointReference(brokerEPR, topicExpression);
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, null, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeSimpleTopic() {
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "testUnsubscribeTopicWSE";
+            String xpathExpression = null;
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeXpathTopic() {
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = null;
+            String xpathExpression = "/www/xpath/wse";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (Exception e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeSimpleAndXpathTopic() {
+        try {
+            WseClientAPI clientApi = new WseClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "unsubscribeSimpleAndTopicTestWSE";
+            String xpathExpression = "/wse/test/xpath";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (Exception e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPITest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPITest.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPITest.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WseClientAPITest.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class WseClientAPITest extends TestCase {
+
+    static class ConfigKeys {
+        static String BROKER_EPR = "broker.epr";
+        static String CONSUMER_EPR = "consumer.location";
+        static String CONSUMER_PORT = "consumer.port";
+        static String TOPIC_SIME = "topic.simple";
+        static String TOPIC_XPATH = "topic.xpath";
+    }
+
+    static Properties configs = new Properties();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+
+        URL configURL = ClassLoader.getSystemResource("unit_tests.properties");
+        configs.load(configURL.openStream());
+
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testSubscribe() {
+        WseClientAPI clientApi = new WseClientAPI();
+        try {
+            clientApi.subscribe(configs.getProperty(ConfigKeys.BROKER_EPR),
+                    configs.getProperty(ConfigKeys.CONSUMER_EPR), configs.getProperty(ConfigKeys.TOPIC_SIME));
+        } catch (AxisFault e) {
+
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIConsumerTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIConsumerTest.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIConsumerTest.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIConsumerTest.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,98 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Properties;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WsntClientAPI;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class WsntClientAPIConsumerTest extends TestCase {
+
+    static Properties configs = new Properties();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    // basic subscription test
+    @Test
+    public final void testConsumerService() {
+
+        ConsumerNotificationHandler handler = new ConsumerNotificationHandler() {
+
+            public void handleNotification(SOAPEnvelope msgEnvelope) {
+                try {
+                    System.out.println(msgEnvelope.toStringWithConsume());
+                } catch (XMLStreamException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        };
+
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            clientApi.startConsumerService(consumerPort, handler);
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to start consumer service: " + e.toString());
+        }
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIPublishTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIPublishTest.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIPublishTest.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIPublishTest.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.airavata.wsmg.client.WsntClientAPI;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class WsntClientAPIPublishTest extends TestCase {
+
+    static Properties configs = new Properties();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    // basic pubilsh test
+    @Test
+    public final void testPublishWithBrokerURL() {
+
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String topic = "MYSimpleTOPIC";
+
+            String message = "<msg> test message </msg>";
+            // should throw an exception
+            clientApi.publish(brokerEPR, topic, message);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to publish: " + e.toString());
+        }
+
+    }
+
+    // basic publish test
+    @Test(expected = AxisFault.class)
+    public final void testPublishInvalidBrokerLocation() {
+
+        WseClientAPI clientApi = new WseClientAPI();
+
+        String brokerEPR = "http://invalid/url/";
+        String topic = "MYSimpleTOPIC";
+
+        String message = "<msg> test message </msg>";
+        // should throw an exception
+        try {
+            clientApi.publish(brokerEPR, topic, message);
+            fail("didn't throw an exception");
+        } catch (AxisFault e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+    }
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIRoundTripTests.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIRoundTripTests.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIRoundTripTests.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPIRoundTripTests.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,241 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WsntClientAPI;
+import org.apache.airavata.wsmg.commons.WsmgNameSpaceConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class WsntClientAPIRoundTripTests extends TestCase implements ConsumerNotificationHandler {
+
+    static Properties configs = new Properties();
+
+    BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+    public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+        queue.add(msgEnvelope);
+        System.out.println(msgEnvelope);
+    }
+
+    BlockingQueue<SOAPEnvelope> getMsgQueue() {
+        return queue;
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testRoundTrip() {
+
+        try {
+
+            long value = System.currentTimeMillis();
+            String msg = String.format("<msg> current time is : %d </msg>", value);
+
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String[] consumerEPRs = clientApi.startConsumerService(consumerPort, this);
+
+            assertTrue(consumerEPRs.length > 0);
+
+            String topic = "WsntRoundTripTestTopic";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPRs[0], topic);
+
+            clientApi.publish(brokerEPR, topic, msg);
+
+            while (true) {
+                try {
+                    SOAPEnvelope env = getMsgQueue().take();
+
+                    OMElement element = extractRawMessage(env);
+                    String text = element.getText();
+
+                    if (text.indexOf(new Long(value).toString()) > 0) {
+                        break;
+                    }
+
+                    fail("round trip of message failed" + " - due to invalid messege content");
+
+                } catch (InterruptedException e) {
+                    fail("interrupted while waiting for message");
+                }
+            }
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+
+    @Test
+    public final void testMessageCount() {
+
+        try {
+            // messages might be returned out of sequence;
+
+            Integer totalMsgCount = 2;
+
+            List<Integer> recievedSequences = new LinkedList<Integer>();
+            String msgFormat = "<msg>%d</msg>";
+            String topic = "WsntRoundTripMsgCountTestTopic";
+
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String[] consumerEPRs = clientApi.startConsumerService(consumerPort, this);
+
+            assertTrue("consumer should have at least one epr", consumerEPRs.length > 0);
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPRs[0], topic);
+
+            for (int i = 1; i <= totalMsgCount; i++) {
+
+                String currentMsg = String.format(msgFormat, i);
+                clientApi.publish(brokerEPR, topic, currentMsg);
+            }
+
+            while (recievedSequences.size() < totalMsgCount) {
+                try {
+                    SOAPEnvelope env = getMsgQueue().take();
+
+                    OMElement element = extractRawMessage(env);
+
+                    int currentSequence = Integer.parseInt(element.getText());
+
+                    assertFalse("duplicate message recieved", recievedSequences.contains(currentSequence));
+
+                    recievedSequences.add(currentSequence);
+
+                } catch (InterruptedException e) {
+                    fail("interrupted while waiting for message");
+                }
+            }
+
+            try {
+                Thread.sleep(5000);
+
+                assertTrue("duplicate and/or invalid messages recieved", getMsgQueue().isEmpty());
+
+            } catch (InterruptedException e) {
+                fail("test case was interrupted");
+            }
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+
+    private OMElement extractRawMessage(SOAPEnvelope env) {
+
+        QName notify = new QName(WsmgNameSpaceConstants.WSNT_NS.getNamespaceURI(), "Notify",
+                WsmgNameSpaceConstants.WSNT_NS.getPrefix());
+
+        QName notifyMsg = new QName(WsmgNameSpaceConstants.WSNT_NS.getNamespaceURI(), "NotificationMessage",
+                WsmgNameSpaceConstants.WSNT_NS.getPrefix());
+
+        QName msg = new QName(WsmgNameSpaceConstants.WSNT_NS.getNamespaceURI(), "Message",
+                WsmgNameSpaceConstants.WSNT_NS.getPrefix());
+
+        assertNotNull("envelope can't be null", env);
+        assertNotNull("envelope don't have a body", env.getBody());
+
+        Iterator ite = env.getBody().getChildrenWithName(notify);
+
+        assertTrue(notify.getLocalPart() + " tag is not found", ite.hasNext());
+
+        OMElement ele = (OMElement) ite.next();
+        ite = ele.getChildrenWithName(notifyMsg);
+
+        assertTrue(notifyMsg.getLocalPart() + " tag is not found", ite.hasNext());
+
+        ele = (OMElement) ite.next();
+
+        ite = ele.getChildrenWithName(msg);
+        assertTrue(msg.getLocalPart() + " tag is not found", ite.hasNext());
+
+        ele = (OMElement) ite.next();
+
+        assertNotNull("raw message was not found", ele.getFirstElement());
+
+        return ele.getFirstElement();
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,240 @@
+/*
+ *
+ * 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 wsmg.client;
+
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.WsntClientAPI;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class WsntClientAPISubscriptionTests extends TestCase {
+
+    static Properties configs = new Properties();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testSimpleSubscribe() {
+
+        WsntClientAPI clientApi = new WsntClientAPI();
+
+        String brokerLocation = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+        String consumerLocation = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+        String topicExpression = "SimpleTopicWSNT";
+
+        try {
+            clientApi.setTimeOutInMilliSeconds(0);
+            String subscriptionID = clientApi.subscribe(brokerLocation, consumerLocation, topicExpression);
+
+            assertNotNull("subscription id can't be null", subscriptionID);
+            assertTrue(subscriptionID.trim().length() > 0);
+
+        } catch (AxisFault e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            fail("test case failed - unable to subscribe");
+        }
+
+    }
+
+    // check for duplicate subscription
+    @Test
+    public final void testSubscribeSameSubcription() {
+
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topic = "DuplicateWSNTSubscriptionTest";
+
+            String subscriptionIDFirst = clientApi.subscribe(brokerEPR, consumerEPR, topic);
+
+            assertNotNull(subscriptionIDFirst);
+
+            String subscriptionIDSecond = clientApi.subscribe(brokerEPR, consumerEPR, topic);
+
+            assertEquals(subscriptionIDFirst, subscriptionIDSecond);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    // check for Xpath subscription
+    @Test
+    public final void testSubscribeXpath() {
+
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = null;
+            String xpathExpression = "/wsnt/test";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testSubscribeTopicAndXpath() {
+
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "testTopicAndXpathWSNT";
+            String xpathExpression = "/c/b";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeSimpleTopic() {
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "testUnsubscribeTopicWSNT";
+            String xpathExpression = null;
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeXpathTopic() {
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = null;
+            String xpathExpression = "/a/wsnt/c";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+
+    @Test
+    public final void testUnsubscribeSimpleAndXpathTopic() {
+        try {
+            WsntClientAPI clientApi = new WsntClientAPI();
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_NOTIFICATIONS_SERVICE_EPR);
+            String consumerEPR = configs.getProperty(ConfigKeys.CONSUMER_EPR);
+            String topicExpression = "unsubscribeSimpleAndTopicTest";
+            String xpathExpression = "/a/ws/nt";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPR, topicExpression, xpathExpression);
+
+            assertNotNull(subscriptionID);
+            try {
+                clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            } catch (AxisFault e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unable to subscribe: " + e.toString());
+        }
+
+    }
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/commons/TestCommonRoutines.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/commons/TestCommonRoutines.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/commons/TestCommonRoutines.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/commons/TestCommonRoutines.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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 wsmg.commons;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.commons.CommonRoutines;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestCommonRoutines extends TestCase {
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.commons.CommonRoutines#getXsdDateTime(java.util.Date)}.
+     */
+    @Test
+    public void testGetXsdDateTime() {
+        assertNotNull(CommonRoutines.getXsdDateTime(new Date()));
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/gui/GUITest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/gui/GUITest.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/gui/GUITest.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/gui/GUITest.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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 wsmg.gui;
+
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.gui.NotificationViewer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class GUITest {
+
+    static Properties configs = new Properties();
+
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testGUI() {
+        String[] args = new String[] { configs.getProperty(ConfigKeys.AXIS2_REPO) };
+
+        NotificationViewer.main(args);
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,154 @@
+/*
+ *
+ * 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 wsmg.matching.XPath;
+
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class TestAddtionalWseXpathAndTopicScenarios extends TestCase {
+
+    static Properties configs = new Properties();
+
+    class NotificationReciever implements ConsumerNotificationHandler {
+
+        private BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+        private String id;
+
+        public NotificationReciever(String id) {
+            this.id = id;
+        }
+
+        public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+            queue.add(msgEnvelope);
+            System.out.println(String.format("[reciever id: %s] %s", id, msgEnvelope));
+        }
+
+        public BlockingQueue<SOAPEnvelope> getMsgQueue() {
+            return queue;
+        }
+
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testXpathAndTopicOnlyRoundTrip() {
+
+        try {
+
+            String topic = "RoundTripTestXpathAndTopicWse";
+
+            String xpathExpression = "/c/b/a[text()=1]";
+
+            String msgFormat = "<c><b><a>%d</a></b></c>";
+
+            long value = 1;
+            String matchingMsg = String.format(msgFormat, value);
+            String unmatchingMsg = String.format(msgFormat, value + 1);
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            EndpointReference brokerEpr = new EndpointReference(
+                    configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR));
+
+            WseClientAPI topicOnlyReceiverApi = new WseClientAPI(brokerEpr);
+            NotificationReciever topicOnlyMsgReceiver = new NotificationReciever("Topic Only");
+
+            String[] topicConsumerEPRs = topicOnlyReceiverApi.startConsumerService(consumerPort, topicOnlyMsgReceiver);
+
+            assertTrue("invalid consumer eprs returned", topicConsumerEPRs.length > 0);
+
+            String topicOnlySubId = topicOnlyReceiverApi.subscribe(brokerEpr.getAddress(), topicConsumerEPRs[0], topic);
+
+            WseClientAPI xpathAndTopicReceiverApi = new WseClientAPI(brokerEpr);
+            NotificationReciever topicAndXpathMsgReceiver = new NotificationReciever("Topic And Xpath");
+            String[] topicAndXpathConsumerEPRs = xpathAndTopicReceiverApi.startConsumerService(consumerPort + 1,
+                    topicAndXpathMsgReceiver);
+
+            assertTrue("invalid consumer eprs returned", topicAndXpathConsumerEPRs.length > 0);
+
+            String topicAndXpathSubId = xpathAndTopicReceiverApi.subscribe(brokerEpr.getAddress(),
+                    topicAndXpathConsumerEPRs[0], topic, xpathExpression);
+
+            WseClientAPI senderApi = new WseClientAPI(brokerEpr);
+            senderApi.publish(brokerEpr.getAddress(), topic, matchingMsg);
+            senderApi.publish(brokerEpr.getAddress(), topic, unmatchingMsg);
+
+            try {
+
+                Thread.sleep(5000);
+
+                assertTrue("topic only reciever should get all messages" + topicOnlyMsgReceiver.getMsgQueue().size(),
+                        topicOnlyMsgReceiver.getMsgQueue().size() == 2);
+
+                assertTrue("xpath and topic reciever should only get one message"
+                        + topicAndXpathMsgReceiver.getMsgQueue().size(),
+                        topicAndXpathMsgReceiver.getMsgQueue().size() == 1);
+
+            } catch (InterruptedException e) {
+                fail("interrupted while waiting for message");
+            }
+
+            topicOnlyReceiverApi.unSubscribe(brokerEpr.getAddress(), topicOnlySubId, null);
+            topicOnlyReceiverApi.shutdownConsumerService();
+
+            xpathAndTopicReceiverApi.unSubscribe(brokerEpr.getAddress(), topicAndXpathSubId, null);
+            xpathAndTopicReceiverApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,141 @@
+/*
+ *
+ * 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 wsmg.matching.XPath;
+
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class TestWseXpathAndTopicSubscription extends TestCase implements ConsumerNotificationHandler {
+
+    static Properties configs = new Properties();
+
+    BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+    public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+        queue.add(msgEnvelope);
+        System.out.println(msgEnvelope);
+    }
+
+    BlockingQueue<SOAPEnvelope> getMsgQueue() {
+        return queue;
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testXpathOnlyRoundTrip() {
+
+        try {
+
+            String validMsgFormat = "<c><b><a> %d </a></b></c>";
+            String invalidMsgFormat = "<a><b><c> %d </c></b></a>";
+
+            long value = System.currentTimeMillis();
+            String validMsg = String.format(validMsgFormat, value);
+            String invalidMsg = String.format(invalidMsgFormat, value);
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+
+            WseClientAPI clientApi = new WseClientAPI(new EndpointReference(brokerEPR));
+
+            String[] consumerEPRs = clientApi.startConsumerService(consumerPort, this);
+
+            assertTrue(consumerEPRs.length > 0);
+
+            String xpathExpression = "/c/b/a";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPRs[0], null, xpathExpression);
+
+            clientApi.publish(validMsg);
+            clientApi.publish(invalidMsg);
+
+            try {
+                SOAPEnvelope env = getMsgQueue().take();
+
+                assertNotNull(env.getBody());
+                assertNotNull(env.getBody().getChildrenWithLocalName("c"));
+
+                OMElement element = (OMElement) env.getBody().getChildrenWithLocalName("c").next();
+
+                String text = element.toStringWithConsume();
+
+                assertTrue("round trip of message failed" + " - due to invalid messege content",
+                        text.indexOf(new Long(value).toString()) > 0);
+
+                Thread.sleep(5000);
+
+                assertTrue("unexpected msg recieved", getMsgQueue().isEmpty());
+
+            } catch (InterruptedException e) {
+                fail("interrupted while waiting for message");
+            } catch (XMLStreamException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+                fail("invalid xml recieved: " + e.getMessage());
+            }
+
+            clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,205 @@
+/*
+ *
+ * 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 wsmg.matching.XPath;
+
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import wsmg.util.ConfigKeys;
+
+public class TestWseXpathSubscription extends TestCase implements ConsumerNotificationHandler {
+
+    static Properties configs = new Properties();
+
+    BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+    public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+        queue.add(msgEnvelope);
+        System.out.println(msgEnvelope);
+    }
+
+    BlockingQueue<SOAPEnvelope> getMsgQueue() {
+        return queue;
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+        configs.load(configURL.openStream());
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public final void testXpathOnlyRoundTrip() {
+
+        try {
+
+            String validMsgFormat = "<c><b><a> %d </a></b></c>";
+            String invalidMsgFormat = "<a><b><c> %d </c></b></a>";
+
+            long value = System.currentTimeMillis();
+            String validMsg = String.format(validMsgFormat, value);
+            String invalidMsg = String.format(invalidMsgFormat, value);
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+
+            WseClientAPI clientApi = new WseClientAPI(new EndpointReference(brokerEPR));
+
+            String[] consumerEPRs = clientApi.startConsumerService(consumerPort, this);
+
+            assertTrue(consumerEPRs.length > 0);
+
+            String xpathExpression = "/c/b/a";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPRs[0], null, xpathExpression);
+
+            clientApi.publish(validMsg);
+            clientApi.publish(invalidMsg);
+
+            try {
+                SOAPEnvelope env = getMsgQueue().take();
+
+                assertNotNull(env.getBody());
+                assertNotNull(env.getBody().getChildrenWithLocalName("c"));
+
+                OMElement element = (OMElement) env.getBody().getChildrenWithLocalName("c").next();
+
+                String text = element.toStringWithConsume();
+
+                assertTrue("round trip of message failed" + " - due to invalid messege content",
+                        text.indexOf(new Long(value).toString()) > 0);
+
+                Thread.sleep(5000);
+
+                assertTrue("unexpected msg recieved", getMsgQueue().isEmpty());
+
+            } catch (InterruptedException e) {
+                fail("interrupted while waiting for message");
+            } catch (XMLStreamException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+                fail("invalid xml recieved: " + e.getMessage());
+            }
+
+            clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+
+    @Test
+    public final void testSimpleXpathTopicRoundTrip() {
+
+        try {
+
+            String validMsgFormat = "<c><b><a> %d </a></b></c>";
+            String invalidMsgFormat = "<a><b><c> %d </c></b></a>";
+
+            long value = System.currentTimeMillis();
+            String validMsg = String.format(validMsgFormat, value);
+            String invalidMsg = String.format(invalidMsgFormat, value);
+
+            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+
+            String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+
+            WseClientAPI clientApi = new WseClientAPI(new EndpointReference(brokerEPR));
+
+            String[] consumerEPRs = clientApi.startConsumerService(consumerPort, this);
+
+            assertTrue(consumerEPRs.length > 0);
+
+            String xpathExpression = "/c/b/a";
+            String topicExpression = "XpathAndTopicTestWse";
+
+            String subscriptionID = clientApi.subscribe(brokerEPR, consumerEPRs[0], topicExpression, xpathExpression);
+
+            clientApi.publish(brokerEPR, topicExpression, validMsg);
+            clientApi.publish(brokerEPR, topicExpression, invalidMsg);
+
+            try {
+                SOAPEnvelope env = getMsgQueue().take();
+
+                assertNotNull(env.getBody());
+                assertNotNull(env.getBody().getChildrenWithLocalName("c"));
+
+                OMElement element = (OMElement) env.getBody().getChildrenWithLocalName("c").next();
+
+                String text = element.toStringWithConsume();
+
+                assertTrue("round trip of message failed" + " - due to invalid messege content",
+                        text.indexOf(new Long(value).toString()) > 0);
+
+                Thread.sleep(5000);
+
+                assertTrue("unexpected msg recieved", getMsgQueue().isEmpty());
+
+            } catch (InterruptedException e) {
+                fail("interrupted while waiting for message");
+            } catch (XMLStreamException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+                fail("invalid xml recieved: " + e.getMessage());
+            }
+
+            clientApi.unSubscribe(brokerEPR, subscriptionID, null);
+            clientApi.shutdownConsumerService();
+
+        } catch (AxisFault e) {
+            e.printStackTrace();
+            fail("unexpected exception occured");
+        }
+
+    }
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,267 @@
+/*
+ *
+ * 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 wsmg.matching.XPath.performance;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public class XppXPath {
+
+    private Vector xPathExpressions = new Vector();
+    protected BufferedReader m_in = null;
+    private static final boolean DEBUG = false;
+    long total = 0;
+
+    public int[] getMatchedLinks(String message) {
+
+        return null;
+    }
+
+    public Vector checkQueries(String query) {
+        Vector result = new Vector();
+        Set xPathExpressionsSet = new HashSet(xPathExpressions);
+
+        int size = xPathExpressions.size();
+
+        for (int i = 0; i < size; i++) {
+
+            boolean match = query.equals(xPathExpressions.get(i));
+
+            // long start=System.nanoTime();
+            if (match) {
+
+                result.add(new Integer(i));
+
+            }
+            // long end=System.nanoTime();
+            // total+=(end-start);
+        }
+
+        // System.out.println("Total="+total);
+        return result;
+    }
+
+    public boolean checkQueriesVectorToSet(Set queries) {
+        // Vector result=new Vector();
+        Set xPathExpressionsSet = new HashSet(xPathExpressions);
+
+        int size = xPathExpressions.size();
+        Iterator iter = queries.iterator();
+        int counter = 0;
+        while (iter.hasNext()) {
+            Object query = iter.next();
+            for (int i = 0; i < size; i++) {
+
+                boolean match = query.equals(xPathExpressions.get(i));
+
+                // long start=System.nanoTime();
+                if (match) {
+
+                    return true;
+
+                }
+                // long end=System.nanoTime();
+                // total+=(end-start);
+            }
+            counter++;
+            // System.out.println("counter="+counter);
+        }
+        // System.out.println("Total="+total);
+        return false;
+    }
+
+    public boolean checkQueriesBySet(Set queries) {
+        Set xPathExpressionsSet = new HashSet(xPathExpressions);
+        Iterator iter = queries.iterator();
+        int counter = 0;
+        while (iter.hasNext()) {
+            if (xPathExpressionsSet.contains(iter.next())) {
+                // System.out.println("counter="+counter);
+                return true;
+            }
+            counter++;
+        }
+        return false;
+    }
+
+    public void addXPathExpressions(String xPathExpression) {
+        xPathExpressions.add(xPathExpression);
+    }
+
+    public void readQueriesFromFile(String queryFile) {
+        int noQueries = Integer.MAX_VALUE;
+        int qNum = 0;
+        // QueryParser qp = new XFQueryParser(queryFile);
+        QueryParser qp = new XPQueryParser(queryFile);
+        // Query query;
+        String queryString;
+        while (qNum < noQueries && ((queryString = qp.readNextQueryString()) != null)) {
+            if (DEBUG)
+                System.out.println(queryString);
+            addXPathExpressions(queryString);
+            qNum++;
+        }
+    }
+
+    public String getARandomQuery() {
+        int index = (int) (xPathExpressions.size() * (Math.random()));
+        return (String) xPathExpressions.get(index);
+    }
+
+    // From http://www.rgagnon.com/javadetails/java-0052.html
+    public static String readFile(String filename) throws IOException {
+        String lineSep = System.getProperty("line.separator");
+        BufferedReader br = new BufferedReader(new FileReader(filename));
+        String nextLine = "";
+        StringBuffer sb = new StringBuffer();
+        while ((nextLine = br.readLine()) != null) {
+            sb.append(nextLine);
+            //
+            // note:
+            // BufferedReader strips the EOL character.
+            //
+            sb.append(lineSep);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * @param args
+     * @throws IOException
+     * @throws FactoryConfigurationError
+     * @throws XMLStreamException
+     */
+    public static void main(String[] args) throws IOException, XMLStreamException, FactoryConfigurationError {
+        String queryFile = "C:\\YiFile\\yfilter-1.0\\yfilter-1.0\\queries2.txt";
+        XppXPath xppXPath = new XppXPath();
+        xppXPath.readQueriesFromFile(queryFile);
+        long total = 0;
+        final int round = 100;
+        String message = readFile("c:\\YiFile\\testdata\\soap2.txt");
+
+        int messageStartPoint = message.indexOf('<');
+        String xpathList = message.substring(0, messageStartPoint);
+        System.out.println("XpathList=" + xpathList);
+        System.out.println("*****************************************");
+        long start0 = System.nanoTime();
+        StringTokenizer parser0 = new StringTokenizer(xpathList, ";");
+        Set xpathTokens = new HashSet();
+        while (parser0.hasMoreTokens()) {
+            xpathTokens.add(parser0.nextToken());
+        }
+        long end0 = System.nanoTime();
+        long total0 = (end0 - start0);
+        // for(int i=0;i<xpathTokens.size();i++){
+        // System.out.println((String)xpathTokens.get(i));
+        // }
+        System.out.println("Avg Time to token=" + (total0));
+        System.out.println("Total token=" + xpathTokens.size());
+        boolean result = false;
+        for (int i = 0; i < round; i++) {
+            String randomQuery = xppXPath.getARandomQuery();
+            // xpathTokens.add(randomQuery);
+            // Vector result=null;
+
+            long start = System.nanoTime();
+            // result=xppXPath.checkQueries(randomQuery);
+            result = xppXPath.checkQueriesBySet(xpathTokens);
+            // result=xppXPath.checkQueriesVectorToSet(xpathTokens);
+            long end = System.nanoTime();
+            total += (end - start);
+        }
+        System.out.println("Match result=" + result);
+        System.out.println("Avg Time for Checking=" + (total / round));
+
+        // XSUL
+        // long start=System.nanoTime();
+        // XmlElement messageEl = builder.parseFragmentFromReader(new
+        // StringReader(
+        // message));
+        // XmlElement messageIdEl= messageEl.element(null,
+        // "Header").element(null,"MessageID");
+        // String messageId=messageIdEl.requiredTextContent();
+        // System.out.println("MessageId="+messageId);
+        // long end=System.nanoTime();
+        // total=(end-start);
+        // System.out.println("Avg Time="+(total));
+
+        // AXIOM
+        // long start=System.nanoTime();
+        // create the parser
+        // XMLStreamReader parser =
+        // XMLInputFactory.newInstance().createXMLStreamReader(new
+        // FileReader("c:\\YiFile\\testdata\\soap_only.txt"));
+        // create the builder
+        String message1 = readFile("c:\\YiFile\\testdata\\soap_only.txt");
+        long start = System.nanoTime();
+        XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(
+                new ByteArrayInputStream(message1.getBytes()));
+
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(), parser);
+        // get the root element (in this case the envelope)
+
+        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+
+        // // create the parser
+        // XMLStreamReader parser =
+        // XMLInputFactory.newInstance().createXMLStreamReader(new
+        // FileReader("c:\\YiFile\\testdata\\soap.txt"));
+        // // create the builder
+        // OMXMLParserWrapper builder =
+        // OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getOMFactory(),parser);
+        // // get the root element (in this case the envelope)
+        // SOAPEnvelope envelope = (SOAPEnvelope)builder.getDocumentElement();
+        //
+        //
+        String messageIDString = envelope.getHeader().getFirstChildWithName(new QName(null, "MessageID")).getText();
+        long end = System.nanoTime();
+        total = (end - start);
+        System.out.println("Avg Time for Axiom=" + (total));
+        // OMElement headerEl=envelope.getHeader().getFirstChildWithName(new
+        // QName("http://schemas.xmlsoap.org/soap/envelope/", "Header"));
+        envelope.getHeader().getFirstChildWithName(new QName(null, "MessageID")).serialize(System.out);
+        System.out.println();
+        //
+        // headerEl.getFirstChildWithName(new QName(null, "MessageID"));
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/ConfigKeys.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/ConfigKeys.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/ConfigKeys.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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 wsmg.util;
+
+public interface ConfigKeys {
+
+    String CONFIG_FILE_NAME = "unit_tests.properties";
+
+    String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
+    String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
+
+    String CONSUMER_EPR = "consumer.location";
+    String CONSUMER_PORT = "consumer.port";
+    String TOPIC_SIMPLE = "topic.simple";
+    String TOPIC_XPATH = "topic.xpath";
+    String AXIS2_REPO = "axis2.repo";
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestDcDate.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestDcDate.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestDcDate.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestDcDate.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,107 @@
+/*
+ *
+ * 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 wsmg.util;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.util.DcDate;
+import org.junit.Test;
+
+public class TestDcDate extends TestCase {
+
+    @Test
+    public void testDcDate() {
+        DcDate d;
+
+        // d = new DcDate("1997-07-16T19:20:30.45+01:00");
+
+        d = new DcDate(TimeZone.getDefault());
+
+        String dc = d.getDcDate();
+
+        // System.out.println(getClass()+" dc="+dc);
+
+        new DcDate(dc);
+        Calendar loc = new GregorianCalendar();
+        assertEquals(d.getYear(), loc.get(Calendar.YEAR));
+        assertEquals(d.getMonth(), loc.get(Calendar.MONTH) + 1);
+        assertEquals(d.getDay(), loc.get(Calendar.DAY_OF_MONTH));
+        assertEquals(d.getHour(), loc.get(Calendar.HOUR_OF_DAY));
+        assertEquals(d.getMinute(), loc.get(Calendar.MINUTE));
+
+        int tzOffset = TimeZone.getDefault().getRawOffset() / (60 * 1000);
+        int tzOffsetHours = tzOffset / 60;
+        assertEquals(tzOffset, d.getTimeZoneOffset());
+
+        DcDate dZ = new DcDate(TimeZone.getTimeZone("GMT"));
+
+        // System.out.println(getClass()+" dZ="+dZ);
+
+        assertEquals(0, dZ.getTimeZoneOffset());
+        // assertEquals(d.getDay() + tzOffset, dZ.getDay()); //may fail!
+        int localHour = dZ.getHour() + tzOffsetHours;
+        if (localHour > 24) {
+            localHour -= 24;
+        }
+        if (localHour < 0) {
+            localHour += 24;
+        }
+        // assertEquals(d.getHour(), localHour);
+
+        //
+        d = new DcDate("1997");
+        assertEquals(1997, d.getYear());
+        //
+        d = new DcDate("1997-07");
+        assertEquals(1997, d.getYear());
+        assertEquals(7, d.getMonth());
+        //
+        d = new DcDate("1997-07-16");
+        assertEquals(1997, d.getYear());
+        assertEquals(7, d.getMonth());
+        assertEquals(16, d.getDay());
+
+        // 1997-07-16T19:20+01:00
+        d = new DcDate("1997-07-16T19:20+01:00");
+        assertEquals(1997, d.getYear());
+        assertEquals(7, d.getMonth());
+        assertEquals(16, d.getDay());
+        assertEquals(19, d.getHour());
+        assertEquals(20, d.getMinute());
+        assertEquals(1 * 60, d.getTimeZoneOffset());
+        // 1997-07-16T19:20:30+01:00
+        d = new DcDate("1997-07-16T19:20:30+01:00");
+        // 1997-07-16T19:20:30.45+01:00
+        d = new DcDate("1997-07-16T19:20:30.45+01:00");
+        assertEquals("45", d.getDecimalFraction());
+        // Ex: 2004-04-13T11:53:15.4362784-04:00
+        d = new DcDate("2004-04-13T11:53:15.4362784-04:00");
+        assertEquals(13, d.getDay());
+        assertEquals("4362784", d.getDecimalFraction());
+
+    }
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestWsmgUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestWsmgUtil.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestWsmgUtil.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/java/wsmg/util/TestWsmgUtil.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,197 @@
+/*
+ *
+ * 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 wsmg.util;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
+import org.apache.airavata.wsmg.commons.WsmgNameSpaceConstants;
+import org.apache.airavata.wsmg.util.WsmgUtil;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestWsmgUtil extends TestCase {
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#formatURLString(java.lang.String)}.
+     */
+    @Test
+    public void testFormatURLString() {
+
+        String url = "http://www.test.com/unit_test";
+
+        assertSame(url, WsmgUtil.formatURLString(url));
+
+        url = "scp://test/test";
+
+        assertSame(url, WsmgUtil.formatURLString(url));
+
+        url = "test/test";
+
+        assertTrue(WsmgUtil.formatURLString(url).startsWith("http://"));
+
+    }
+
+    /**
+     * Test method for
+     * {@link org.apache.airavata.wsmg.util.WsmgUtil#sameStringValue(java.lang.String, java.lang.String)} .
+     */
+    @Test
+    public void testSameStringValue() {
+
+        assertTrue(WsmgUtil.sameStringValue(null, null));
+        assertTrue(WsmgUtil.sameStringValue("test", "test"));
+
+        assertFalse(WsmgUtil.sameStringValue("one", "two"));
+        assertFalse(WsmgUtil.sameStringValue(null, "test"));
+        assertFalse(WsmgUtil.sameStringValue("test", null));
+
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#getHostIP()}.
+     */
+    @Test
+    public void testGetHostIP() {
+        assertNotNull(WsmgUtil.getHostIP());
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#getTopicLocalString(java.lang.String)}.
+     */
+    @Test
+    public void testGetTopicLocalString() {
+
+        assertEquals("localstring", (WsmgUtil.getTopicLocalString("prefix:localstring")));
+
+        assertEquals("localstring", WsmgUtil.getTopicLocalString("localstring"));
+
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#getXPathString(org.apache.axiom.om.OMElement)}.
+     */
+    @Test
+    public void testGetXPathString() {
+
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+
+        try {
+
+            WsmgUtil.getXPathString(null);
+            fail("method should validate invalid arguments");
+        } catch (IllegalArgumentException e) {
+
+        } catch (AxisFault e) {
+            fail("invalid exception thrown");
+        }
+
+        try {
+
+            QName invalidQName = new QName("invalidURI", "invalidLocalName");
+
+            OMElement xpathEl = factory.createOMElement(invalidQName);
+
+            WsmgUtil.getXPathString(xpathEl);
+
+            fail("method should validate arguments");
+
+        } catch (AxisFault fault) {
+
+        }
+
+        try {
+
+            String xpathExpression = "testXpathExpression";
+            String dialect = "unknownXpathDialect";
+
+            OMNamespace ns = factory.createOMNamespace("unit_test", "jnt");
+
+            OMElement xpathEl = factory.createOMElement("TestXpath", ns);
+            xpathEl.addAttribute("Dialect", dialect, WsmgNameSpaceConstants.WSE_NS);
+
+            xpathEl.setText(xpathExpression);
+
+            WsmgUtil.getXPathString(xpathEl);
+
+            fail("method should reject unknown dialect");
+        } catch (AxisFault e) {
+
+        }
+
+        try {
+
+            String xpathExpression = "textXpathExpression";
+            String dialect = WsmgCommonConstants.XPATH_DIALECT;
+
+            OMNamespace ns = factory.createOMNamespace("unit_test", "jnt");
+
+            OMElement xpathEl = factory.createOMElement("TestXpath", ns);
+            xpathEl.addAttribute("Dialect", dialect, WsmgNameSpaceConstants.WSE_NS);
+
+            xpathEl.setText(xpathExpression);
+            assertEquals(xpathExpression, WsmgUtil.getXPathString(xpathEl));
+
+        } catch (AxisFault e) {
+            fail("unable to extract xpath query: " + e.toString());
+        }
+
+    }
+
+    /**
+     * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#getTopicFromRequestPath(java.lang.String)}.
+     */
+    @Test
+    public void testGetTopicFromRequestPath() {
+
+        assertNull(WsmgUtil.getTopicFromRequestPath(null));
+        assertNull(WsmgUtil.getTopicFromRequestPath(""));
+        assertNull(WsmgUtil.getTopicFromRequestPath("/"));
+        assertNull(WsmgUtil.getTopicFromRequestPath("/subscribe/url/"));
+        assertNull(WsmgUtil.getTopicFromRequestPath("/subscribe/url/topic/"));
+
+        assertEquals(WsmgUtil.getTopicFromRequestPath("/requestpath/topic/xyz"), "xyz");
+
+    }
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/unit_tests.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/unit_tests.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/unit_tests.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/unit_tests.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,28 @@
+#
+#
+# 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.
+#
+#
+
+
+broker.eventing.service.epr=http://localhost:8080/axis2/services/EventingService
+broker.notification.service.epr=http://localhost:8080/axis2/services/NotificationService
+consumer.port=2222
+consumer.location=http://localhost:2222
+topic.simple=MySimpleTestTopic
+topic.xpath=MyXpathTextTopic

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/wsmg.broker.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/wsmg.broker.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/wsmg.broker.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/test/resources/wsmg.broker.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,61 @@
+#
+#
+# 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.
+#
+#
+
+#Sample configuration file for broker
+
+
+#database realted settings (only applicable if 'broker.storage.type=persistent')
+broker.jdbc.driver=com.mysql.jdbc.Driver
+broker.jdbc.url=jdbc:mysql://localhost:3306/org.apache.airavata.wsmg?user=org.apache.airavata.wsmg&password=org.apache.airavata.wsmg
+
+#socket time out in milliseconds for sending messages. (defaults is 20000)
+broker.socket.timeout=60000
+
+
+#broker.storage.type=persistent
+broker.storage.type=memory
+
+#specifies wether delivery component should be started or not.
+broker.start.delivery.thread=true
+
+
+#fixed thread pool based delivery
+#broker.delivery.method=pcrew
+
+#dynamic thread pool based delivery
+#broker.delivery.method=parallel
+
+#single thread delivery
+broker.delivery.method=serial
+
+#number of message delivery failures before a url become black listed (default is 2)
+#broker.msg.delivery.retries=2
+
+#time period (in seconds) a url will be kept blacklisted (default is 5 seconds) 
+#consumer.expiration.time.gap=5 
+
+#maximum number of messages to be send to a one consumer/url at time. 
+#applicable if 'broker.delivery.method' is 'pcrew' . (default is 10)
+
+#sending.batch.size=10
+
+#size of the thread pool. only applicable if 'broker.delivery.method' is 'pcrew'. (default is 4)
+#sending.thread.pool.size=4