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 02:29:37 UTC

svn commit: r1142350 [11/18] - in /incubator/airavata/donations/ogce-donation/modules/ws-messaging: broker/ broker/customLibs/ broker/customLibs/activeMQ/ broker/src/ broker/src/main/ broker/src/main/java/ broker/src/main/java/wsmg/ broker/src/main/jav...

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/client/WsntClientAPISubscriptionTests.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/commons/TestCommonRoutines.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/commons/TestCommonRoutines.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/commons/TestCommonRoutines.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/commons/TestCommonRoutines.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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 wsmg.commons.CommonRoutines#getXsdDateTime(java.util.Date)}.
+	 */
+	@Test
+	public void testGetXsdDateTime() {
+		assertNotNull(CommonRoutines.getXsdDateTime(new Date()));
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/gui/GUITest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/gui/GUITest.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/gui/GUITest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/gui/GUITest.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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.client.ConsumerNotificationHandler;
+import wsmg.client.WseClientAPI;
+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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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.client.ConsumerNotificationHandler;
+import wsmg.client.WseClientAPI;
+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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/TestWseXpathSubscription.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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.client.ConsumerNotificationHandler;
+import wsmg.client.WseClientAPI;
+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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/matching/XPath/performance/XppXPath.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,276 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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;
+
+import edu.berkeley.cs.db.yfilterplus.queryparser.QueryParser;
+import edu.berkeley.cs.db.yfilterplus.queryparser.XPQueryParser;
+
+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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/ConfigKeys.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/ConfigKeys.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/ConfigKeys.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestDcDate.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestDcDate.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestDcDate.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestDcDate.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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);
+
+		DcDate d2 = 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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestWsmgUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestWsmgUtil.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestWsmgUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/util/TestWsmgUtil.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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.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;
+
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.commons.WsmgNameSpaceConstants;
+
+/**
+ * @author ramith
+ * 
+ */
+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 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 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 wsmg.util.WsmgUtil#getHostIP()}.
+	 */
+	@Test
+	public void testGetHostIP() {
+		assertNotNull(WsmgUtil.getHostIP());
+	}
+
+	/**
+	 * Test method for
+	 * {@link 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 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 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/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/widgetTest/Client.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/widgetTest/Client.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/widgetTest/Client.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/java/wsmg/widgetTest/Client.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,658 @@
+///* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*-  //------100-columns-wide------>|*/
+///*
+// * Copyright (c) 2004 Extreme! Lab, Indiana University. All rights reserved.
+// *
+// * This software is open source. See the bottom of this file for the licence.
+// *
+// * $Id: Client.java,v 1.5 2006/05/01 14:52:54 yihuan Exp $
+// */
+//
+//package wsmg.widgetTest;
+//
+//
+//
+//import java.net.URI;
+//import java.util.Calendar;
+//import java.util.GregorianCalendar;
+//import java.util.List;
+//import java.util.TimeZone;
+//
+//import javax.xml.namespace.QName;
+//
+//import org.xmlpull.v1.builder.XmlElement;
+//import org.xmlpull.v1.builder.XmlInfosetBuilder;
+//
+//import wsmg.Server;
+//import wsmg.WsmgConstants;
+//import wsmg.XmlConsumer;
+//import wsmg.stub.BrokerStub;
+//import wsmg.stub.NotificationProducerStub;
+//import wsmg.stub.SubscriptionStub;
+//import wsmg.stub.WidgetStub;
+//import wsmg.stub.WsrfResourceStub;
+//import xsul.MLogger;
+//import xsul.XmlConstants;
+//import xsul.XsulException;
+//import xsul.util.XsulUtil;
+//import xsul.ws_addressing.WsAddressing;
+//import xsul.ws_addressing.WsaEndpointReference;
+//
+///**
+// * Implementaiton of Widget client for <a
+// * href="http://www-106.ibm.com/developerworks/offers/WS-Specworkshops/ws-rf200404.html">WSRF
+// * Interop</a>
+// * 
+// * @version $Revision: 1.5 $
+// * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
+// */
+//public class Client {
+//	private final static MLogger logger = MLogger.getLogger();
+//
+//	private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+//
+//	private static final int DEFAULT_SCENARIO = 0; // 10; //6; //-8;
+//
+//	public static final String WELL_KNOWN_QUERY = "boolean(/*/*[namespace-uri()='"
+//			+ WsmgConstants.WSRL_NS.getNamespaceName()
+//			+ "' "
+//			+ "and local-name()='" + WsmgConstants.TERMINATION_TIME + "'])";
+//
+//	// boolean(/*/*[namespace-uri()=&apos;http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceLifetime&apos;
+//	// and local-name()=&apos;TerminationTime&apos;])
+//
+//	private Client() {
+//	}
+//
+//	public static void main(String[] args) throws Exception {
+//		new Client().run(args);
+//	}
+//
+//	public static void verbose(String msg) {
+//		if (true) {
+//			System.err.println(msg);
+//		}
+//	}
+//
+//	private void run(String[] args) throws Exception {
+//
+//		int scenario = DEFAULT_SCENARIO;
+//		// setTo s12:mustUnderstand="1">
+//		if (args.length > 0) {
+//			scenario = Integer.parseInt(args[0]);
+//		}
+//
+//		String widgetServiceLocation = Server.getLocation();
+//
+//		int port = 11534;
+//		if (widgetServiceLocation == null) {
+//			if (args.length > 1) {
+//				String s = args[1];
+//				if (s.startsWith("http")) {
+//					widgetServiceLocation = s;
+//					// } else {
+//					// port = Integer.parseInt(s);
+//				}
+//			}
+//		}
+//		System.out.println("***WidgetServiceLocation:" + widgetServiceLocation);
+//		if (scenario != 0) {
+//			runScenario(scenario, widgetServiceLocation);
+//		} else {
+//			System.err.println("running all scenarios");
+//			for (int i = 1; i <= 8; i++) {
+//				runScenario(i, widgetServiceLocation);
+//			}
+//			runScenario(-8, widgetServiceLocation);
+//			runScenario(-9, widgetServiceLocation);
+//			for (int i = 8; i <= 10; i++) {
+//				runScenario(i, widgetServiceLocation);
+//			}
+//		}
+//		System.err.println("Client finished OK");
+//
+//	}
+//
+//	private void runScenario(int scenario, String widgetServiceLocation)
+//			throws Exception {
+//		// if(widgetServiceLocation == null) {
+//		// widgetServiceLocation = "http://localhost:"+port;
+//		// }
+//		System.err.println("scenario " + scenario
+//				+ " with widget service located at " + widgetServiceLocation);
+//
+//		WidgetStub ws = null;
+//		if (scenario < 8) {
+//			if (widgetServiceLocation != null) {
+//				System.err.println("scenario " + scenario + " connecting to "
+//						+ widgetServiceLocation);
+//				WidgetCreator widgetService = new WidgetCreator(new URI(
+//						widgetServiceLocation));
+//				ws = widgetService.createWidget();
+//			} else {
+//				if (scenario < 8) {
+//					throw new XsulException(
+//							"widget location is required for scenarios < 8");
+//				}
+//				System.err.println("no widget service location specified");
+//			}
+//		}
+//
+//		QName terminationTimeQ = new QName(WsmgConstants.WSRL_NS
+//				.getNamespaceName(), "TerminationTime", WsmgConstants.WSRL_NS
+//				.getPrefix());
+//		QName currentTimeQ = new QName(
+//				WsmgConstants.WSRL_NS.getNamespaceName(), "CurrentTime",
+//				WsmgConstants.WSRL_NS.getPrefix());
+//		QName widgetFooQ = new QName(
+//				WsmgConstants.WIDGET_NS.getNamespaceName(), "foo",
+//				WsmgConstants.WIDGET_NS.getPrefix());
+//		if (scenario != 6 && (scenario >= 3 && scenario < 8)) {
+//			Calendar cal = new GregorianCalendar();
+//			cal.setTimeInMillis(System.currentTimeMillis() + 6 * 60 * 1000);
+//			cal.setTimeZone(TimeZone.getDefault()); // TODO is it needed?
+//			ws.setTerminationTime(cal);
+//		}
+//
+//		if (scenario == -8) {
+//			// checkTTIsNull(ws, terminationTimeQ);
+//
+//			Calendar cal = new GregorianCalendar();
+//			cal.setTimeInMillis(System.currentTimeMillis() + 6 * 60 * 1000);
+//			cal.setTimeZone(TimeZone.getDefault()); // TODO is it needed?
+//			ws.setTerminationTime(cal);
+//
+//			ws.setTerminationTime(null);
+//			checkTTIsNull(ws, terminationTimeQ);
+//		}
+//
+//		if (scenario == 4 || scenario == 5) {
+//			List list = ws.getResourceProperty(terminationTimeQ);
+//			verbose("getResourceProperty = " + XsulUtil.safeXmlToString(list));
+//		}
+//
+//		if (scenario == 5) {
+//			List list = ws.getMultipleResourceProperties(new QName[] {
+//					terminationTimeQ, currentTimeQ });
+//			verbose("getMultipleResourceProperties = "
+//					+ XsulUtil.safeXmlToString(list));
+//
+//		}
+//
+//		if (scenario == 6) {
+//			List results = ws.queryResourcePropertiesByXpath(WELL_KNOWN_QUERY);
+//			verbose("queryResourcePropertiesByXpath = "
+//					+ XsulUtil.safeXmlToString(results));
+//			results = ws.queryResourcePropertiesByXpath("/*");
+//			verbose("queryResourcePropertiesByXpath = "
+//					+ XsulUtil.safeXmlToString(results));
+//		}
+//
+//		if (scenario == 7) {
+//			List list = ws.getResourceProperty(widgetFooQ);
+//			assert list.size() == 0;
+//
+//			XmlElement insertRequest = builder.newFragment(
+//					WsmgConstants.WSRP_NS, "Insert");
+//			XmlElement s1 = insertRequest.addElement(WsmgConstants.WIDGET_NS,
+//					"foo");
+//			s1.addChild("string1");
+//			ws.setResourceProperties(new XmlElement[] { insertRequest });
+//			// verbose("setResourceProperties = "+XsulUtil.safeXmlToString(e));
+//
+//			list = ws.getResourceProperty(widgetFooQ);
+//			assert list.size() == 1;
+//			checkFooEl((XmlElement) list.get(0), "string1");
+//
+//			XmlElement updateRequest = builder.newFragment(
+//					WsmgConstants.WSRP_NS, "Update");
+//			XmlElement s2 = updateRequest.addElement(WsmgConstants.WIDGET_NS,
+//					"foo");
+//			s2.addChild("string2");
+//			XmlElement s3 = updateRequest.addElement(WsmgConstants.WIDGET_NS,
+//					"foo");
+//			s3.addChild("string3");
+//			ws.setResourceProperties(new XmlElement[] { updateRequest });
+//
+//			list = ws.getResourceProperty(widgetFooQ);
+//			assert list.size() == 2;
+//			checkFooEl((XmlElement) list.get(0), "string2");
+//			checkFooEl((XmlElement) list.get(1), "string3");
+//
+//			// TODO refactor into WsrpDeleteRequest(WIDGET_NS, "foo");
+//			XmlElement deleteRequest = builder.newFragment(
+//					WsmgConstants.WSRP_NS, "Delete");
+//			deleteRequest.declareNamespace(WsmgConstants.WIDGET_NS);
+//			deleteRequest.addAttribute("resourceProperty",
+//					WsmgConstants.WIDGET_NS.getPrefix() + ":foo");
+//			ws.setResourceProperties(new XmlElement[] { deleteRequest });
+//
+//			list = ws.getResourceProperty(widgetFooQ);
+//			assert list.size() == 0;
+//		}
+//
+//		if (scenario == 8 || scenario == 9) {
+//			String consumerLoc = System.getProperty("wsrf.consumer");
+//			if (consumerLoc == null) {
+//				consumerLoc = XmlConsumer.getLocation();
+//			}
+//			if (consumerLoc == null) {
+//				throw new IllegalStateException(
+//						"consumer location required to run scenario >= 8");
+//			}
+//
+//			String producerLoc = System.getProperty("wsrf.producer");
+//			WsaEndpointReference producerReference = null;
+//			NotificationProducerStub np = null;
+//			if (producerLoc == null && ws != null) {
+//				producerReference = ws.getResourceEpr();
+//				producerLoc = producerReference.getAddress().toString();
+//				np = new NotificationProducerStub(producerReference);
+//				System.err.println("using WidgetService Instance as producer "
+//						+ producerReference);
+//			}
+//			if (producerReference == null && producerLoc == null) {
+//				producerLoc = widgetServiceLocation; // use widget service as
+//														// default producer
+//				System.err.println("using WidgetService Instance as producer "
+//						+ producerLoc);
+//			}
+//			if (producerLoc == null) {
+//				throw new IllegalStateException(
+//						"producer location required to run scenario >= 8");
+//			}
+//			if (producerReference == null) {
+//				producerReference = new WsaEndpointReference(new URI(
+//						producerLoc));
+//				np = new NotificationProducerStub(producerReference);
+//				System.err.println("using (Broker) producer " + producerLoc);
+//			}
+//
+//			// if(scenario == 10) {
+//			// BrokerStub br = new BrokerStub(producerReference);
+//			// WsrfResourceStub publisherRegistrationRes =
+//			// br.registerPublisher(new WsaEndpointReference(new
+//			// URI(widgetServiceLocation)));
+//			// }
+//
+//			WsaEndpointReference consumerReference = new WsaEndpointReference(
+//					new URI(consumerLoc));
+//			XmlElement topicExpEl = builder.newFragment(WsmgConstants.WSNT_NS,
+//					"TopicExpression");
+//			topicExpEl.addAttribute("dialect",
+//					WsmgConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT);
+//			topicExpEl.declareNamespace(WsmgConstants.WIDGET_NS);
+//			topicExpEl.addChild(WsmgConstants.WIDGET_NS.getPrefix()
+//					+ ":TestTopic");
+//			SubscriptionStub subscriptionRes = np.subscribe(consumerReference,
+//					topicExpEl, true); // boolean value is used to set
+//										// UseNotify
+//
+//			XmlElement topicEl = (XmlElement) topicExpEl.clone();
+//			topicEl.setName("Topic");
+//
+//			generateN(ws, np);
+//			XmlElement curMsg = np.getCurrentMessage(topicEl);
+//			verbose("getCurrentMessage=" + XsulUtil.safeXmlToString(curMsg)
+//					+ "\n\n\n");
+//
+//			if (scenario == 9) {
+//
+//				generateN(ws, np);
+//				curMsg = np.getCurrentMessage(topicEl);
+//				verbose("getCurrentMessage=" + XsulUtil.safeXmlToString(curMsg)
+//						+ "\n\n\n");
+//
+//				subscriptionRes.pauseSubscription();
+//				generateN(ws, np);
+//				curMsg = np.getCurrentMessage(topicEl);
+//				verbose("getCurrentMessage=" + XsulUtil.safeXmlToString(curMsg)
+//						+ "\n\n\n");
+//
+//				subscriptionRes.resumeSubscription();
+//				generateN(ws, np);
+//				curMsg = np.getCurrentMessage(topicEl);
+//				verbose("getCurrentMessage=" + XsulUtil.safeXmlToString(curMsg)
+//						+ "\n\n\n");
+//			}
+//
+//			subscriptionRes.destroy();
+//		}
+//
+//		if (scenario == 10) {
+//			String brokerLoc = System.getProperty("wsrf.broker");
+//			if (brokerLoc == null) {
+//				String producerLoc = System.getProperty("wsrf.producer");
+//				if (producerLoc != null) {
+//					brokerLoc = producerLoc;
+//					System.err.println("using WS-NT producer as broker "
+//							+ producerLoc);
+//				}
+//			}
+//			if (brokerLoc == null) {
+//				throw new RuntimeException(
+//						"WS-NT broker or producer location is required for scenario "
+//								+ scenario);
+//			}
+//			WsaEndpointReference brokerReference = new WsaEndpointReference(
+//					new URI(brokerLoc));
+//			BrokerStub br = new BrokerStub(brokerReference);
+//			WsrfResourceStub publisherRegistrationRes = br
+//					.registerPublisher(new WsaEndpointReference(new URI(
+//							widgetServiceLocation)));
+//		}
+//
+//		if (scenario == 2) {
+//			ws.destroy();
+//		}
+//		System.err.println("scenario " + scenario + " finished OK");
+//
+//	}
+//
+//	private void checkTTIsNull(WidgetStub ws, QName terminationTimeQ) {
+//		List list = ws.getResourceProperty(terminationTimeQ);
+//		if (list.size() == 0) {
+//			return; // ALEK: some impls will have no termination time intiailly
+//					// ...
+//		}
+//		verbose("getResourceProperty = " + XsulUtil.safeXmlToString(list));
+//		assert list.size() == 1;
+//		XmlElement ttEl = (XmlElement) list.get(0);
+//		assert terminationTimeQ.getLocalPart().equals(ttEl.getName());
+//		assert terminationTimeQ.getNamespaceURI().equals(
+//				ttEl.getNamespace().getNamespaceName());
+//		String xsiNil = ttEl.getAttributeValue(XmlConstants.XSI_NS
+//				.getNamespaceName(), "nil");
+//		assert xsiNil != null;
+//		assert xsiNil.equals("1") || xsiNil.equals("true");
+//	}
+//
+//	private void generateN(WidgetStub ws, NotificationProducerStub np) {
+//		if (ws == null) { // special case when broker is tested as notficaiton
+//							// producer
+//			System.out.println("Ws is null");
+//			np.generateNotification(); // "notification from IU XSUL");
+//		} else {
+//			System.out.println("Ws is NOT null");
+//			ws.generateNotification(); // "notification from IU XSUL");
+//		}
+//	}
+//
+//	private void checkFooEl(XmlElement e, String s) {
+//		assert "foo".equals(e.getName());
+//		assert WsmgConstants.WIDGET_NS.equals(e.getNamespace());
+//		assert e.hasChildren();
+//		assert s.equals(e.requiredTextContent());
+//	}
+//
+//	/*
+//	 * public static class SubscriptionStub extends WsrfResourceStub {
+//	 * 
+//	 * SubscriptionStub(WsaEndpointReference widgetEpr) { super(widgetEpr); }
+//	 * 
+//	 * public void pauseSubscription() { invoker.setMessageId(null); XmlElement
+//	 * message = builder.newFragment(WsmgConstants.WSNT_NS,
+//	 * "PauseSubscription"); //XmlElement message =
+//	 * builder.newFragment(WidgetService.WSNT_NS, "PauseSubcription"); //NOTE
+//	 * TYPO!!! invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage.getRoot()) + "\n\n\n"); }
+//	 * 
+//	 * public void resumeSubscription() { invoker.setMessageId(null); XmlElement
+//	 * message = builder.newFragment(WsmgConstants.WSNT_NS,
+//	 * "ResumeSubscription");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage.getRoot()) + "\n\n\n"); } }
+//	 * 
+//	 * public static class BrokerStub extends WidgetStub {
+//	 * 
+//	 * BrokerStub(WsaEndpointReference widgetEpr) { super(widgetEpr); }
+//	 * 
+//	 * public WsrfResourceStub registerPublisher(WsaEndpointReference
+//	 * wsaEndpointReference) { invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSBR_NS, "RegisterPublisher");
+//	 * 
+//	 * WsaEndpointReference publisherRef; try { publisherRef =
+//	 * (WsaEndpointReference) wsaEndpointReference.clone(); } catch
+//	 * (CloneNotSupportedException e) { throw new XsulException("internal error:
+//	 * could not clone EPR"); }
+//	 * publisherRef.setNamespace(WsmgConstants.WSBR_NS);
+//	 * publisherRef.setName("PublisherReference");
+//	 * message.addElement(publisherRef);
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage) + "\n\n\n"); XmlElement
+//	 * publisherRegistrationRef = responseMessage.requiredElement(
+//	 * WsmgConstants.WSBR_NS, "PublisherRegistrationReference"); return new
+//	 * WsrfResourceStub(new WsaEndpointReference( publisherRegistrationRef)); } }
+//	 */
+//
+//	/**
+//	 * This stub is NOT multi-thread safe!
+//	 */
+//	/*
+//	 * public static class NotificationProducerStub extends WidgetStub {
+//	 * 
+//	 * NotificationProducerStub(WsaEndpointReference widgetEpr) {
+//	 * super(widgetEpr); }
+//	 * 
+//	 * public XmlElement getCurrentMessage(XmlElement topicExp) {
+//	 * invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSNT_NS, "GetCurrentMessage");
+//	 * message.addChild(topicExp);
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage.getRoot()) + "\n\n\n"); if
+//	 * (responseMessage.hasChildren() == false) { //INTEROP can it be empoty?
+//	 * return null; } else { return (XmlElement)
+//	 * responseMessage.requiredElementContent().iterator(). next(); } }
+//	 * 
+//	 * public SubscriptionStub subscribe(WsaEndpointReference consumerReference,
+//	 * XmlElement topicExpression, boolean useNotfy) {
+//	 * invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSNT_NS, "Subscribe");
+//	 * 
+//	 * WsaEndpointReference cr; try { cr = (WsaEndpointReference)
+//	 * consumerReference.clone(); } catch (CloneNotSupportedException e) { throw
+//	 * new XsulException("internal error: could not clone EPR"); }
+//	 * cr.setNamespace(WsmgConstants.WSNT_NS); cr.setName("ConsumerReference");
+//	 * message.addElement(cr); // <wsnt:TopicExpression
+//	 * dialect="http://www.ibm.com/xmlns/stdwip/web-services/WS-Topics/TopicExpressiom/simple">widget:TestTopic</wsnt:TopicExpression>
+//	 * message.addElement(topicExpression);
+//	 * message.addElement(WsmgConstants.WSNT_NS, "UseNotify").addChild( useNotfy ?
+//	 * "true" : "false");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage) + "\n\n\n"); XmlElement sr =
+//	 * responseMessage.requiredElement(WsmgConstants.WSNT_NS,
+//	 * "SubscriptionReference"); return new SubscriptionStub(new
+//	 * WsaEndpointReference(sr)); } }
+//	 */
+//
+//	/**
+//	 * This stub is NOT multi-thread safe!
+//	 */
+//	/*
+//	 * public static class WidgetStub extends WsrfResourceStub {
+//	 * 
+//	 * protected WidgetStub(WsaEndpointReference widgetEpr) { super(widgetEpr); }
+//	 * 
+//	 * public void generateNotification() { invoker.setMessageId(null); //String
+//	 * msg = XmlElement message = builder.newFragment(WsmgConstants.WIDGET_NS,
+//	 * "generateNotification");
+//	 * //invoker.setDefaultAction(URI.create(message.getNamespace().getNamespaceName()+"/"+message.getName()));
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/generateEvent")); XmlElement responseMessage =
+//	 * invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage) + "\n\n\n"); }
+//	 *  }
+//	 */
+//
+//	private static class WidgetCreator extends WsrfResourceStub {
+//
+//		// private URI location;
+//
+//		WidgetCreator(URI location) {
+//			// this.location = location;
+//			super(new WsaEndpointReference(location));
+//		}
+//
+//		private WidgetStub createWidget() {
+//			// WsaInvoker invoker = new WsaInvoker();
+//			// invoker.setSoapFragrance(Soap12XsulUtil.getInstance());
+//			// invoker.setSoapFragrance(Soap11XsulUtil.getInstance());
+//			// invoker.setTargetEPR(epr);
+//			invoker.setMessageId(null);
+//			// invoker.setIndent(null);
+//			XmlElement message = builder.newFragment(WsmgConstants.WIDGET_NS,
+//					"createWidget");
+//			invoker.setDefaultAction(URI.create(message.getNamespace()
+//					.getNamespaceName()
+//					+ "/" + message.getName()));
+//
+//			XmlElement responseMessage = invoker.invokeMessage(message);
+//
+//			XmlElement e = responseMessage.requiredElement(
+//					WsAddressing.NS_2004_08, WsaEndpointReference.NAME);
+//			WsaEndpointReference widgetEpr = new WsaEndpointReference(e);
+//			verbose("\n\nWIDGET EPR=" + widgetEpr + "\n\n\n");
+//
+//			return new WidgetStub(widgetEpr);
+//		}
+//
+//	}
+//	/*
+//	 * public static class WsrfResourceStub { protected WsaInvoker invoker; // =
+//	 * new WsaInvoker(); private WsaEndpointReference resourceEpr;
+//	 * 
+//	 * WsrfResourceStub(WsaEndpointReference resourceEpr) { this.resourceEpr =
+//	 * resourceEpr; logger.finest("resourceEprInWsrfResourceStub
+//	 * Constructor"+builder.serializeToString(resourceEpr)); invoker = new
+//	 * WsaInvoker(); invoker.setTargetEPR(resourceEpr);
+//	 * invoker.setSoapFragrance(Soap11XsulUtil.getInstance()); invoker.setIndent("
+//	 * "); // to improve interop do not use KA
+//	 * invoker.setUseHttpKeepAlive(false);
+//	 *  }
+//	 * 
+//	 * public WsaEndpointReference getResourceEpr() { return resourceEpr; }
+//	 * 
+//	 * public void destroy() { invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSRL_NS, "Destroy");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); XmlElement
+//	 * responseMessage = invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage.getRoot()) + "\n\n\n"); }
+//	 * 
+//	 * public void setTerminationTime(Calendar cal) {
+//	 * invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSRL_NS, "SetTerminationTime");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName()));
+//	 * 
+//	 * XmlElement child = message.addElement(WsmgConstants.WSRL_NS,
+//	 * "RequestedTerminationTime"); if (cal == null) {
+//	 * child.addAttribute(XmlConstants.XSI_NS, "nil", "true"); } else {
+//	 * child.addChild(new DcDate(cal)); } XmlElement responseMessage =
+//	 * invoker.invokeMessage(message); verbose("\n\nRESPONSE=" +
+//	 * XsulUtil.safeXmlToString(responseMessage.getRoot()) + "\n\n\n"); }
+//	 * 
+//	 * public List getResourceProperty(QName qn) { //List<XmlElement>
+//	 * XmlNamespace ns = builder.newNamespace(qn.getPrefix(),
+//	 * qn.getNamespaceURI()); String name = qn.getLocalPart();
+//	 * invoker.setMessageId(null);
+//	 * 
+//	 * XmlElement message = builder.newFragment(WsmgConstants.WSRP_NS,
+//	 * "GetResourceProperty");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespaceName() + "/" +
+//	 * message.getName()));
+//	 * 
+//	 * //message.addChild(new QNameElText(message, WidgetService.WIDGET_NS,
+//	 * "TerminationTime")); //message.declareNamespace(WidgetService.WIDGET_NS);
+//	 * message.addChild(new QNameElText(message, ns, name));
+//	 * //message.declareNamespace(WidgetService.WSRL_NS); if (ns.getPrefix() !=
+//	 * null) { message.declareNamespace(ns); } //child.addChild(new
+//	 * DcDate(TimeZone.getDefault())); XmlElement responseMessage =
+//	 * invoker.invokeMessage(message);
+//	 * 
+//	 * verbose("\n\nRESPONSE=" + XsulUtil.safeXmlToString(responseMessage.getRoot()) +
+//	 * "\n\n\n"); List list = elementsAsList(responseMessage); return list; }
+//	 * 
+//	 * public List getMultipleResourceProperties(QName[] qnamez) { //TODO JDK15
+//	 * List<XmlElement> invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSRP_NS,
+//	 * "GetMultipleResourceProperties");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName()));
+//	 * 
+//	 * //message.addChild(new QNameElText(message, WidgetService.WIDGET_NS,
+//	 * "TerminationTime")); //message.declareNamespace(WidgetService.WIDGET_NS);
+//	 * //wsrp:ResourceProperty
+//	 * 
+//	 * for (int i = 0; i < qnamez.length; i++) { QName qn = qnamez[i];
+//	 * XmlNamespace ns = builder.newNamespace(qn.getPrefix(),
+//	 * qn.getNamespaceURI()); XmlElement child =
+//	 * message.addElement(WsmgConstants.WSRP_NS, "ResourceProperty");
+//	 * child.addChild(new QNameElText(message, ns, qn.getLocalPart())); if
+//	 * (qn.getPrefix() != null) { child.declareNamespace(ns); } }
+//	 * 
+//	 * XmlElement responseMessage = invoker.invokeMessage(message);
+//	 * 
+//	 * verbose("\n\nRESPONSE=" + XsulUtil.safeXmlToString(responseMessage.getRoot()) +
+//	 * "\n\n\n");
+//	 * 
+//	 * List list = elementsAsList(responseMessage); return list; }
+//	 * 
+//	 * public List queryResourcePropertiesByXpath(String query) { if (query ==
+//	 * null) { throw new IllegalArgumentException(); }
+//	 * invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSRP_NS, "QueryResourceProperties");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespaceName() + "/" +
+//	 * message.getName()));
+//	 * 
+//	 * XmlElement queryExpressionEl = message.addElement(WsmgConstants.WSRP_NS,
+//	 * "QueryExpression"); queryExpressionEl.addAttribute("dialect",
+//	 * WsmgConstants.XPATH1_DIALECT); queryExpressionEl.addChild(query);
+//	 * 
+//	 * XmlElement responseMessage = invoker.invokeMessage(message);
+//	 * 
+//	 * verbose("\n\nRESPONSE=" + XsulUtil.safeXmlToString(responseMessage.getRoot()) +
+//	 * "\n\n\n");
+//	 * 
+//	 * List list = childrenAsList(responseMessage); return list; }
+//	 * 
+//	 * public void setResourceProperties(XmlElement[] requests) { if
+//	 * (requests.length == 0) { throw new IllegalArgumentException("at least one
+//	 * request is required"); }
+//	 * 
+//	 * invoker.setMessageId(null); XmlElement message =
+//	 * builder.newFragment(WsmgConstants.WSRP_NS, "SetResourceProperties");
+//	 * invoker.setDefaultAction(URI.create(message.getNamespace().
+//	 * getNamespaceName() + "/" + message.getName())); for (int i = 0; i <
+//	 * requests.length; i++) { message.addElement(requests[i]); }
+//	 * //message.addChild(new QNameElText(message, WidgetService.WIDGET_NS,
+//	 * "TerminationTime")); //message.declareNamespace(WidgetService.WIDGET_NS);
+//	 * //wsrp:ResourceProperty
+//	 * //message.declareNamespace(WidgetService.WSRL_NS);
+//	 * 
+//	 * XmlElement responseMessage = invoker.invokeMessage(message);
+//	 * 
+//	 * verbose("\n\nRESPONSE=" + XsulUtil.safeXmlToString(responseMessage.getRoot()) +
+//	 * "\n\n\n"); }
+//	 * 
+//	 * private List elementsAsList(XmlElement responseMessage) { List list = new
+//	 * ArrayList(); for (Iterator it =
+//	 * responseMessage.requiredElementContent().iterator(); it.hasNext(); ) {
+//	 * XmlElement el = (XmlElement) it.next(); list.add(el); } return list; }
+//	 * 
+//	 * private List childrenAsList(XmlElement responseMessage) { List list = new
+//	 * ArrayList(); for (Iterator it = responseMessage.children(); it.hasNext(); ) {
+//	 * Object child = it.next(); list.add(child); } return list; }
+//	 *  }
+//	 */
+//
+//}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/unit_tests.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/unit_tests.properties?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/unit_tests.properties (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/unit_tests.properties Sun Jul  3 00:29:24 2011
@@ -0,0 +1,7 @@
+
+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/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/wsmg.broker.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/wsmg.broker.properties?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/wsmg.broker.properties (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/test/resources/wsmg.broker.properties Sun Jul  3 00:29:24 2011
@@ -0,0 +1,40 @@
+#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/wsmg?user=wsmg&password=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

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/pom.xml?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/pom.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/pom.xml Sun Jul  3 00:29:24 2011
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>ws-messenger</artifactId>
+		<groupId>org.ogce.ws-messenger</groupId>
+		<version>1.1.1</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.ogce.messenger</groupId>
+	<artifactId>messenger</artifactId>
+	<packaging>war</packaging>
+	<name>messenger</name>
+
+	<build>
+		<finalName>${artifactId}</finalName>
+		<plugins>
+			<plugin>
+
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-war-plugin</artifactId>
+
+				<configuration>
+					<webResources>
+						<resource>
+							<directory>${basedir}/axis2_dependencies/</directory>
+							<targetPath>WEB-INF/lib</targetPath>
+							<includes>
+								<include>*.jar</include>
+							</includes>
+							<excludes>
+								<exclude>axiom-api*</exclude>
+								<exclude>log4j*</exclude>
+							</excludes>
+						</resource>
+					</webResources>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<dependencies>
+
+		<dependency>
+			<groupId>org.ogce.broker</groupId>
+			<artifactId>broker</artifactId>
+			<version>1.1.1</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.7</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.ws.commons.axiom</groupId>
+			<artifactId>axiom-api</artifactId>
+			<version>1.2.8</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.ws.commons.axiom</groupId>
+			<artifactId>axiom-impl</artifactId>
+			<version>1.2.8</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+			<scope>provided</scope>
+
+		</dependency>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.6</version>
+			<type>jar</type>
+
+		</dependency>
+		<dependency>
+			<groupId>org.apache.axis2</groupId>
+			<artifactId>axis2</artifactId>
+			<version>1.5</version>
+			<scope>provided</scope>
+		</dependency>
+
+	</dependencies>
+</project>