You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by pa...@apache.org on 2011/09/23 07:27:53 UTC
svn commit: r1174523 [1/2] - in /incubator/airavata/trunk/modules:
commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/
ws-messenger/client/
ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ ...
Author: patanachai
Date: Fri Sep 23 05:27:52 2011
New Revision: 1174523
URL: http://svn.apache.org/viewvc?rev=1174523&view=rev
Log:
AIRAVATA-101 change messagebox namespace and fix test cases
Added:
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/resources/conf/
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/resources/conf/msgBroker.properties
Removed:
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/resources/conf/msgBroker.properties
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/samples/
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/client/
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/performance_evaluator/
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/wsmg/matching/
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/resources/wsmg.broker.properties
Modified:
incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
incubator/airavata/trunk/modules/ws-messenger/client/pom.xml
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java
incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java
incubator/airavata/trunk/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java
incubator/airavata/trunk/modules/ws-messenger/commons/pom.xml
incubator/airavata/trunk/modules/ws-messenger/messagebox/pom.xml
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/resources/services.xml
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java
incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
Modified: incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java (original)
+++ incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java Fri Sep 23 05:27:52 2011
@@ -23,8 +23,6 @@ package org.apache.airavata.workflow.tra
import java.rmi.RemoteException;
-import javax.xml.namespace.QName;
-
import org.apache.airavata.workflow.tracking.WorkflowTrackingException;
import org.apache.airavata.workflow.tracking.client.Callback;
import org.apache.airavata.workflow.tracking.client.NotificationType;
@@ -35,6 +33,7 @@ import org.apache.airavata.wsmg.client.N
import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
import org.apache.airavata.wsmg.client.msgbox.MsgboxHandler;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
@@ -173,7 +172,7 @@ public class MessageBoxNotificationHandl
if (msgBoxAddr.getAllReferenceParameters() == null)
throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
String msgBoxId = msgBoxAddr.getAllReferenceParameters()
- .get(new QName("http://org.apache.airavata/xgws/msgbox/2004/", "MsgBoxAddr")).getText();
+ .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText();
if (msgBoxId == null)
throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddr is missing");
String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
Modified: incubator/airavata/trunk/modules/ws-messenger/client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/pom.xml?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/pom.xml (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/pom.xml Fri Sep 23 05:27:52 2011
@@ -32,11 +32,6 @@
<!-- Axis2 -->
<dependency>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>${axis2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
</dependency>
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java Fri Sep 23 05:27:52 2011
@@ -20,10 +20,9 @@
*/
package org.apache.airavata.wsmg.client;
-import javax.xml.namespace.QName;
-
import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
import org.apache.airavata.wsmg.client.msgbox.MsgboxHandler;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.airavata.wsmg.commons.WsmgVersion;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMFactory;
@@ -99,7 +98,7 @@ abstract class CommonMsgBrokerClient imp
if (msgBoxEpr.getAllReferenceParameters() == null)
throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
String msgBoxId = msgBoxEpr.getAllReferenceParameters()
- .get(new QName("http://org.apache.airavata/xgws/msgbox/2004/", "MsgBoxAddr")).getText();
+ .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText();
if (msgBoxId == null)
throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddr is missing");
String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java Fri Sep 23 05:27:52 2011
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
import org.apache.airavata.wsmg.client.MsgBrokerClientException;
import org.apache.airavata.wsmg.client.NotificationHandler;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
import org.apache.axis2.addressing.EndpointReference;
@@ -70,7 +71,7 @@ public class MsgboxHandler {
String clientId = toAddress.substring(biginIndex + "clientid".length() + 1);
if ((msgBoxAddr.getAllReferenceParameters() == null || msgBoxAddr.getAllReferenceParameters()
- .get(new QName("http://org.apache.airavata/xgws/msgbox/2004/", "MsgBoxAddr")).getText() == null)
+ .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText() == null)
&& biginIndex == -1)
throw new MsgBrokerClientException("Invalid Message Box Address");
this.msgBoxUser = new MsgBoxClient();
@@ -91,9 +92,9 @@ public class MsgboxHandler {
if (msgBoxEpr.getAllReferenceParameters() == null)
throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
String msgBoxId = msgBoxEpr.getAllReferenceParameters()
- .get(new QName("http://org.apache.airavata/xgws/msgbox/2004/", "MsgBoxAddr")).getText();
+ .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText();
if (msgBoxId == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddr is missing");
+ throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddress is missing");
String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
formattedEventSink = String.format(format, msgBoxEventSink, msgBoxId);
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java Fri Sep 23 05:27:52 2011
@@ -31,66 +31,15 @@ public class NotificationViewer {
boolean packFrame = false;
- /*
- * private static String getAxis2Repository(String[] cmdArgs) {
- *
- * // if its in system properties get it.
- *
- * if (System.getProperty(WsmgCommonConstants.CONFIG_AXIS2_REPO) != null) { File repodir = new File(System
- * .getProperty(WsmgCommonConstants.CONFIG_AXIS2_REPO));
- *
- * if (repodir.isDirectory()) { return repodir.getAbsolutePath(); }
- *
- * throw new RuntimeException( "axis2 repository given in system parameter is invalid: " +
- * repodir.getAbsolutePath());
- *
- * }
- *
- * if (cmdArgs.length > 1) {
- *
- * if (cmdArgs[0].startsWith("-" + WsmgCommonConstants.CONFIG_AXIS2_REPO)) {
- *
- * File repoDir = new File(cmdArgs[1]);
- *
- * if (repoDir.isDirectory()) { return repoDir.getAbsolutePath(); }
- *
- * throw new RuntimeException( "axis2 repository given as a command line argument is invalid: " +
- * repoDir.getAbsolutePath()); }
- *
- * throw new RuntimeException("unknown commandline argument");
- *
- * }
- *
- * String axis2Home = System.getenv().get("AXIS2_HOME");
- *
- *
- * if (axis2Home != null) {
- *
- * String repo = axis2Home.endsWith(File.pathSeparator) ? axis2Home + "repository" : axis2Home + File.separator +
- * "repository";
- *
- * File repoDir = new File(repo);
- *
- * if (repoDir.isDirectory()) {
- *
- *
- * return repoDir.getAbsolutePath(); } }
- *
- * return null; }
- *
- * private static void printHelp() { System.out.println("unable to determine axis2 repository");
- * System.out.println("please provide the system property: " + WsmgCommonConstants.CONFIG_AXIS2_REPO);
- * System.out.println("or set AXIS2_HOME envirnment variable"); }
- */
-
/**
* Construct and show the application.
*/
public NotificationViewer() {
NotificationViewerFrame frame = new NotificationViewerFrame();
- // Validate frames that have preset sizes
- // Pack frames that have useful preferred size info, e.g. from their
- // layout
+ /*
+ * Validate frames that have preset sizes Pack frames that have useful
+ * preferred size info, e.g. from their layout
+ */
if (packFrame) {
frame.pack();
} else {
@@ -118,13 +67,6 @@ public class NotificationViewer {
* String[]
*/
public static void main(String[] args) {
-
- /*
- * final String axis2Repo = getAxis2Repository(args);
- *
- * if (axis2Repo == null) { printHelp(); System.exit(1); }
- */
-
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java Fri Sep 23 05:27:52 2011
@@ -24,6 +24,7 @@ package org.apache.airavata.wsmg.msgbox.
import javax.xml.namespace.QName;
import org.apache.airavata.wsmg.client.util.ClientUtil;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.airavata.wsmg.commons.NameSpaceConstants;
import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
import org.apache.axiom.om.OMAbstractFactory;
@@ -51,8 +52,7 @@ public class CreateMsgBox {
public CreateMsgBox(String msgBoxLocation, long timeout) {
this.msgBoxEndPointReference = msgBoxLocation;
- responseEl = OMAbstractFactory.getOMFactory().createOMElement(
- new QName("http://org.apache.airavata/xgws/msgbox/2004/", "MsgBoxId"));
+ responseEl = OMAbstractFactory.getOMFactory().createOMElement(MsgBoxQNameConstants.MSG_BOXID_QNAME);
timeoutInMilliSeconds = timeout;
}
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java Fri Sep 23 05:27:52 2011
@@ -23,9 +23,7 @@ package org.apache.airavata.wsmg.msgbox.
import org.apache.airavata.wsmg.commons.NameSpaceConstants;
import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
@@ -40,19 +38,19 @@ import org.slf4j.LoggerFactory;
public class StoreMessage {
private static final Logger logger = LoggerFactory.getLogger(StoreMessage.class);
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
protected EndpointReference msgBoxEndPointReference;
- protected long timeoutInMilliSeconds;
- private String msgBoxId;
+ protected long timeoutInMilliSeconds;
public StoreMessage(EndpointReference msgBoxEpr, long timeout) throws AxisFault {
this.msgBoxEndPointReference = msgBoxEpr;
this.timeoutInMilliSeconds = timeout;
String address = msgBoxEpr.getAddress();
+
+ /*
+ * Validate
+ */
int biginIndex = address.indexOf("clientid");
- if (biginIndex != -1) {
- msgBoxId = address.substring(biginIndex + "clientid".length() + 1);
- } else {
+ if (biginIndex == -1) {
throw new AxisFault("Invalid Message Box EPR cannot find message box ID");
}
}
@@ -66,7 +64,6 @@ public class StoreMessage {
}
public String execute(OMElement messageIn) throws AxisFault {
- // OMElement message = createMessageEl(this.msgBoxId, messageIn);
ServiceClient serviceClient = createServiceClient();
OMElement responseMessage = null;
@@ -81,19 +78,7 @@ public class StoreMessage {
throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
}
return responseMessage.getFirstElement().getText();
- }
-
- private OMElement createMessageEl(String msgboxid, OMElement messageIn) throws AxisFault {
- OMElement message = factory.createOMElement("storeMessages", NameSpaceConstants.MSG_BOX);
- OMElement messageElement = factory.createOMElement("message", NameSpaceConstants.MSG_BOX);
- OMElement msgBoxId = factory.createOMElement("MsgBoxId", NameSpaceConstants.MSG_BOX);
- msgBoxId.setText(msgboxid);
- message.addChild(msgBoxId);
- messageElement.addChild(messageIn);
- message.addChild(messageElement);
- message.declareNamespace(NameSpaceConstants.MSG_BOX);
- return message;
- }
+ }
private ServiceClient createServiceClient() throws AxisFault {
String uuid = UUIDGenerator.getUUID();
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java Fri Sep 23 05:27:52 2011
@@ -85,9 +85,8 @@ public class TakeMessages {
} finally {
serviceClient.cleanupTransport();
}
-
- Iterator<OMElement> children = responseMessage.getFirstElement().getChildren();
- return children;
+
+ return (Iterator<OMElement>)responseMessage.getFirstElement().getChildren();
}
private OMElement createMessageEl(String msgboxid) throws AxisFault {
Modified: incubator/airavata/trunk/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java Fri Sep 23 05:27:52 2011
@@ -21,22 +21,14 @@
package org.apache.airavata.wsmg.gui;
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.airavata.wsmg.client.util.ConfigKeys;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
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
@@ -45,10 +37,7 @@ public class GUITest {
@Test
public void testGUI() {
- String[] args = new String[] { configs.getProperty(ConfigKeys.AXIS2_REPO) };
-
- NotificationViewer.main(args);
-
+ NotificationViewer.main(null);
}
}
Modified: incubator/airavata/trunk/modules/ws-messenger/commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/commons/pom.xml?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/commons/pom.xml (original)
+++ incubator/airavata/trunk/modules/ws-messenger/commons/pom.xml Fri Sep 23 05:27:52 2011
@@ -21,39 +21,13 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
-
+
<!-- Axis2 -->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>${axis2.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- </dependency>
-
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
+
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <systemPropertyVariables>
- <propertyName>propertyValue</propertyName>
- <buildDirectory>${project.build.directory}</buildDirectory>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/pom.xml?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/pom.xml (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/pom.xml Fri Sep 23 05:27:52 2011
@@ -14,6 +14,7 @@
<url>http://incubator.apache.org/airavata/</url>
<dependencies>
+
<dependency>
<groupId>airavata</groupId>
<artifactId>airavata-messenger-commons</artifactId>
@@ -26,13 +27,6 @@
<artifactId>slf4j-api</artifactId>
</dependency>
- <!-- Axis2 -->
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>${axis2.version}</version>
- </dependency>
-
<!-- Test -->
<dependency>
<groupId>junit</groupId>
@@ -45,16 +39,17 @@
<version>${airavata.version}</version>
<scope>test</scope>
</dependency>
+ <!-- Axis2 for test only-->
<dependency>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-local</artifactId>
+ <artifactId>axis2-transport-http</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
+ <artifactId>axis2-transport-local</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java Fri Sep 23 05:27:52 2011
@@ -25,6 +25,7 @@ import java.io.StringReader;
import java.sql.SQLException;
import java.util.List;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.airavata.wsmg.commons.NameSpaceConstants;
import org.apache.airavata.wsmg.msgbox.Storage.MsgBoxStorage;
import org.apache.airavata.wsmg.msgbox.util.MsgBoxCommonConstants;
@@ -56,7 +57,7 @@ public class MsgBoxServiceSkeleton imple
public void init(ServiceContext context) throws AxisFault {
this.storage = (MsgBoxStorage) context.getConfigurationContext().getProperty(
MsgBoxCommonConstants.MSGBOX_STORAGE);
-
+
logger.info("Start clean up thread for messagebox");
deletingThread = new Thread(new DeleteOldMessageRunnable());
deletingThread.start();
@@ -64,14 +65,14 @@ public class MsgBoxServiceSkeleton imple
public void destroy(ServiceContext context) {
this.storage = null;
-
+
// stop Deleting thread
this.stop = true;
this.deletingThread.interrupt();
- try{
+ try {
deletingThread.join();
- }catch(Exception e){
+ } catch (Exception e) {
logger.error("Cannot shutdown cleanup thread", e);
}
}
@@ -79,14 +80,14 @@ public class MsgBoxServiceSkeleton imple
public OMElement createMsgBox() throws Exception {
try {
String createdMsgBoxId = storage.createMsgBox();
-
+
logger.debug("MsgBox created:" + createdMsgBoxId);
/*
* Output response
*/
- OMElement dd = factory.createOMElement(MsgBoxCommonConstants.CREATE_MSGBOX_RESP_QNAME);
- OMElement url = factory.createOMElement(MsgBoxCommonConstants.MSG_BOXID_QNAME);
+ OMElement dd = factory.createOMElement(MsgBoxQNameConstants.CREATE_MSGBOX_RESP_QNAME);
+ OMElement url = factory.createOMElement(MsgBoxQNameConstants.MSG_BOXID_QNAME);
url.setText(createdMsgBoxId);
dd.addChild(url);
return dd;
@@ -100,30 +101,31 @@ public class MsgBoxServiceSkeleton imple
public OMElement storeMessages(String msgBoxAddr, String messageID, String soapAction, OMElement message)
throws Exception {
- OMElement resp = factory.createOMElement(MsgBoxCommonConstants.STOREMSG_RESP_QNAME);
- OMElement status = factory.createOMElement(MsgBoxCommonConstants.MSGBOX_STATUS_QNAME);
+ OMElement resp = factory.createOMElement(MsgBoxQNameConstants.STOREMSG_RESP_QNAME);
+ OMElement status = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_STATUS_QNAME);
try {
storage.putMessageIntoMsgBox(msgBoxAddr, messageID, soapAction, message);
-
+
logger.debug("Put Message to MsgBox:" + msgBoxAddr + " with messageID:" + messageID);
-
+
status.setText(TRUE);
} catch (SQLException e) {
logger.error("Error while storing message: " + message + " in msgbx: " + msgBoxAddr, e);
status.setText(FALSE);
-
- //FIXME: Should we throw exception?? or client will read false status
+
+ // FIXME: Should we throw exception?? or client will read false
+ // status
}
resp.addChild(status);
resp.declareNamespace(NameSpaceConstants.MSG_BOX);
return resp;
}
- public OMElement takeMessages(String msgBoxAddr) throws Exception {
+ public OMElement takeMessages(String msgBoxAddr) throws Exception {
try {
- OMElement respEl = factory.createOMElement(MsgBoxCommonConstants.TAKE_MSGBOX_RESP_QNAME);
- OMElement messageSet = factory.createOMElement(MsgBoxCommonConstants.MSGBOX_MESSAGE_QNAME);
-
+ OMElement respEl = factory.createOMElement(MsgBoxQNameConstants.TAKE_MSGBOX_RESP_QNAME);
+ OMElement messageSet = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_MESSAGE_QNAME);
+
List<String> list = storage.takeMessagesFromMsgBox(msgBoxAddr);
if (list != null && list.size() != 0) {
for (String string : list) {
@@ -143,42 +145,43 @@ public class MsgBoxServiceSkeleton imple
}
public OMElement destroyMsgBox(String msgBoxAddr) throws Exception {
- OMElement respEl = factory.createOMElement(MsgBoxCommonConstants.DESTROY_MSGBOX_RESP_QNAME);
- OMElement statusEl = factory.createOMElement(MsgBoxCommonConstants.MSGBOX_STATUS_QNAME);
+ OMElement respEl = factory.createOMElement(MsgBoxQNameConstants.DESTROY_MSGBOX_RESP_QNAME);
+ OMElement statusEl = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_STATUS_QNAME);
String addr = msgBoxAddr;
- try{
+ try {
storage.destroyMsgBox(addr);
logger.debug("Destry MsgBox:" + msgBoxAddr);
statusEl.setText(TRUE);
- }catch(Exception e){
+ } catch (Exception e) {
logger.error("Error while delete msgbx: " + msgBoxAddr, e);
statusEl.setText(FALSE);
-
- //FIXME: Should we throw exception?? or client will read false status
+
+ // FIXME: Should we throw exception?? or client will read false
+ // status
}
respEl.addChild(statusEl);
return respEl;
}
-
- class DeleteOldMessageRunnable implements Runnable{
+
+ class DeleteOldMessageRunnable implements Runnable {
public void run() {
- while(!stop){
- try{
-
- //sleep
+ while (!stop) {
+ try {
+
+ // sleep
Thread.sleep(SLEEP_TIME);
-
- //try to remove old message
- if(storage != null){
+
+ // try to remove old message
+ if (storage != null) {
storage.removeAncientMessages();
}
- }catch(Exception e){
+ } catch (Exception e) {
logger.error(e.getMessage(), e);
}
- }
+ }
}
-
+
}
-
+
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java Fri Sep 23 05:27:52 2011
@@ -23,6 +23,7 @@ package org.apache.airavata.wsmg.msgbox;
import java.util.List;
+import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingFaultsHelper;
import org.apache.axis2.context.MessageContext;
@@ -35,13 +36,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * This Dispatcher is used to validate the incoming message, this is set to Handler list in MsgBoxServiceLifeCycle.
+ * This Dispatcher is used to validate the incoming message, this is set to
+ * Handler list in MsgBoxServiceLifeCycle.
*/
public class StoreMessageHandler extends AddressingBasedDispatcher {
private static final Logger logger = LoggerFactory.getLogger(StoreMessageHandler.class);
- private static final String WSMG_MSGSTORE_SOAP_ACTION = "http://org.apache.airavata/xgws/msgbox/2004/storeMessages";
+ private static final String WSMG_MSGSTORE_SOAP_ACTION = MsgBoxQNameConstants.STOREMSG_QNAME.getNamespaceURI()
+ + MsgBoxQNameConstants.STOREMSG_QNAME.getLocalPart();
private static final String ADDRESSING_VALIDATE_ACTION = "addressing.validateAction";
-
+
private Phase addressingPhase;
private AxisOperation messageBoxOperation;
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java Fri Sep 23 05:27:52 2011
@@ -26,7 +26,7 @@ public class ConfigKeys {
public static final String MSG_PRESV_DAYS = "messagePreservationDays";
public static final String MSG_PRESV_HRS = "messagePreservationHours";
public static final String MSG_PRESV_MINS = "messagePreservationMinutes";
- public static String MSG_BOX_JDBC_DRIVER = "msgBox.jdbc.driver";
- public static String MSG_BOX_JDBC_URL = "msgBox.jdbc.url";
- public static String USE_DATABASE_STORAGE = "msgBox.usedatabase";
+ public static final String MSG_BOX_JDBC_DRIVER = "msgBox.jdbc.driver";
+ public static final String MSG_BOX_JDBC_URL = "msgBox.jdbc.url";
+ public static final String USE_DATABASE_STORAGE = "msgBox.usedatabase";
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java Fri Sep 23 05:27:52 2011
@@ -21,34 +21,7 @@
package org.apache.airavata.wsmg.msgbox.util;
-import javax.xml.namespace.QName;
public class MsgBoxCommonConstants {
- public static final String MSGBOX_STORAGE = "msgbox.storage";
- public static final String AXIS_MODULE_NAME_ADDRESSING = "addressing";
- public static final QName MSG_BOXID_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/", "msgboxid",
- "msg");
-
- public static final QName STOREMSG_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "storeMessages", "msg");
- public static final QName DESTROYMSG_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "destroyMsgBox", "msg");
- public static final QName TAKEMSGS_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "takeMessages", "msg");
- public static final QName CREATEMSG_BOX = new QName("http://org.apache.airavata/xgws/msgbox/2004/", "createMsgBox",
- "msg");
-
- public static final QName STOREMSG_RESP_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "storeMessagesResponse", "msg");
- public static final QName DESTROY_MSGBOX_RESP_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "destroyMsgBoxResponse", "msg");
- public static final QName CREATE_MSGBOX_RESP_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "createMsgBoxResponse", "msg");
- public static final QName TAKE_MSGBOX_RESP_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/",
- "takeMessagesResponse", "msg");
-
-
- public static final QName MSGBOX_STATUS_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/", "status", "msg");
- public static final QName MSGBOX_MESSAGE_QNAME = new QName("http://org.apache.airavata/xgws/msgbox/2004/", "messages", "msg");
-
+ public static final String MSGBOX_STORAGE = "msgbox.storage";
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/resources/services.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/resources/services.xml?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/resources/services.xml (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/main/resources/services.xml Fri Sep 23 05:27:52 2011
@@ -28,31 +28,30 @@
</parameter>
<parameter name="useOriginalwsdl">false</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
- <operation name="storeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/xgws/msgbox/2004/">
- <actionMapping>http://org.apache.airavata/xgws/msgbox/2004/storeMessages
+ <operation name="storeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
+ <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/storeMessages
</actionMapping>
- <outputActionMapping>http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/storeMessagesResponse
+ <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/storeMessagesResponse
</outputActionMapping>
</operation>
- <operation name="destroyMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/xgws/msgbox/2004/">
- <actionMapping>http://org.apache.airavata/xgws/msgbox/2004/destroyMsgBox
+ <operation name="destroyMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
+ <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/destroyMsgBox
</actionMapping>
- <outputActionMapping>http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/destroyMsgBoxResponse
+ <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/destroyMsgBoxResponse
</outputActionMapping>
</operation>
- <operation name="takeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/xgws/msgbox/2004/">
- <actionMapping>http://org.apache.airavata/xgws/msgbox/2004/takeMessages
+ <operation name="takeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
+ <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/takeMessages
</actionMapping>
- <outputActionMapping>http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/takeMessagesResponse
+ <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/takeMessagesResponse
</outputActionMapping>
</operation>
- <operation name="createMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/xgws/msgbox/2004/">
- <actionMapping>http://org.apache.airavata/xgws/msgbox/2004/createMsgBox
+ <operation name="createMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
+ <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/createMsgBox
</actionMapping>
- <outputActionMapping>http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/createMsgBoxResponse
+ <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/createMsgBoxResponse
</outputActionMapping>
</operation>
- <parameter name="configuration.file.name" locked="false">msgBox.properties</parameter>
</service>
</serviceGroup>
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java Fri Sep 23 05:27:52 2011
@@ -21,25 +21,13 @@
package org.apache.airavata.wsmg.msgbox;
-import java.io.File;
-import java.io.FilenameFilter;
-
import javax.xml.namespace.QName;
-import junit.framework.TestCase;
-
import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.deployment.DeploymentEngine;
-import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.ListenerManager;
import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.transport.http.SimpleHTTPServer;
@@ -58,48 +46,7 @@ public class InMemoryMessageBoxServer {
public static synchronized void unDeployService(QName service) throws AxisFault {
receiver.getConfigurationContext().getAxisConfiguration().removeService(service.getLocalPart());
- }
-
- public static synchronized void unDeployClientService() throws AxisFault {
- if (receiver.getConfigurationContext().getAxisConfiguration() != null) {
- receiver.getConfigurationContext().getAxisConfiguration().removeService("AnonymousService");
- }
- }
-
- public static synchronized void start() throws Exception {
- start(prefixBaseDirectory(Constants.TESTING_REPOSITORY));
- }
-
- public static synchronized void start(String repository) throws Exception {
- if (count == 0) {
- ConfigurationContext er = getNewConfigurationContext(repository);
-
- receiver = new SimpleHTTPServer(er, TESTING_PORT);
-
- try {
- receiver.start();
- ListenerManager listenerManager = er.getListenerManager();
- TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_HTTP);
- trsIn.setReceiver(receiver);
- if (listenerManager == null) {
- listenerManager = new ListenerManager();
- listenerManager.init(er);
- }
- listenerManager.addListener(trsIn, true);
- System.out.print("Server started on port " + TESTING_PORT + ".....");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e1) {
- throw new AxisFault("Thread interuptted", e1);
- }
-
- count++;
- }
+ }
public static synchronized void start(String repository, String axis2xml) throws Exception {
if (count == 0) {
@@ -126,24 +73,24 @@ public class InMemoryMessageBoxServer {
public static void startMessageBox() throws Exception {
+ /*
+ * Imitate service.xml
+ */
AxisService axisService = new AxisService("MsgBoxService");
- axisService.addParameter("configuration.file.name", "msgBox.properties");
axisService.setServiceLifeCycle(new MsgBoxServiceLifeCycle());
-
+ axisService.addParameter("ServiceClass", "org.apache.airavata.wsmg.msgbox.MsgBoxServiceSkeleton");
createOperation(axisService, "storeMessages", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/xgws/msgbox/2004/storeMessages",
- "http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/storeMessagesResponse");
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/storeMessages",
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/storeMessagesResponse");
createOperation(axisService, "destroyMsgBox", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/xgws/msgbox/2004/destroyMsgBox",
- "http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/destroyMsgBoxResponse");
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/destroyMsgBox",
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/destroyMsgBoxResponse");
createOperation(axisService, "takeMessages", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/xgws/msgbox/2004/takeMessages",
- "http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/takeMessagesResponse");
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/takeMessages",
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/takeMessagesResponse");
createOperation(axisService, "createMsgBox", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/xgws/msgbox/2004/createMsgBox",
- "http://org.apache.airavata/xgws/msgbox/2004/MsgBoxPT/createMsgBoxResponse");
- axisService.addParameter("configuration.file.name", "msgBox.properties");
- axisService.addParameter("ServiceClass", "org.apache.airavata.wsmg.msgbox.MsgBoxServiceSkeleton");
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/createMsgBox",
+ "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/createMsgBoxResponse");
InMemoryMessageBoxServer.deployService(axisService);
@@ -162,15 +109,6 @@ public class InMemoryMessageBoxServer {
}
}
- public static ConfigurationContext getNewConfigurationContext(String repository) throws Exception {
- if (repository != null) {
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, repository
- + "/conf/axis2.xml");
- } else {
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
- }
- }
-
public static ConfigurationContext getNewConfigurationContext(String repository, String axis2xml) throws Exception {
return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, axis2xml);
}
@@ -196,71 +134,7 @@ public class InMemoryMessageBoxServer {
public static ConfigurationContext getConfigurationContext() {
return receiver.getConfigurationContext();
- }
-
- public static ServiceContext createAdressedEnabledClientSide(AxisService service) throws AxisFault {
- File file = getAddressingMARFile();
- TestCase.assertTrue(file.exists());
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
- prefixBaseDirectory("target/test-resources/integrationRepo"), null);
- AxisModule axisModule = DeploymentEngine.buildModule(file, configContext.getAxisConfiguration());
- configContext.getAxisConfiguration().addModule(axisModule);
-
- configContext.getAxisConfiguration().addService(service);
-
- ServiceGroupContext serviceGroupContext = configContext
- .createServiceGroupContext(service.getAxisServiceGroup());
- return serviceGroupContext.getServiceContext(service);
- }
-
- static class AddressingFilter implements FilenameFilter {
- public boolean accept(File dir, String name) {
- return name.startsWith("addressing") && name.endsWith(".mar");
- }
- }
-
- private static File getAddressingMARFile() {
- File dir = new File(prefixBaseDirectory(Constants.TESTING_REPOSITORY + "/modules"));
- File[] files = dir.listFiles(new AddressingFilter());
- TestCase.assertTrue(files.length == 1);
- File file = files[0];
- TestCase.assertTrue(file.exists());
- return file;
- }
-
- public static ConfigurationContext createClientConfigurationContext() throws AxisFault {
- File file = getAddressingMARFile();
- TestCase.assertTrue(file.exists());
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
- prefixBaseDirectory(Constants.TESTING_PATH + "/integrationRepo"),
- prefixBaseDirectory(Constants.TESTING_PATH + "/integrationRepo/conf/axis2.xml"));
- AxisModule axisModule = DeploymentEngine.buildModule(file, configContext.getAxisConfiguration());
- configContext.getAxisConfiguration().addModule(axisModule);
- return configContext;
- }
-
- public static ConfigurationContext createClientConfigurationContext(String repo) throws AxisFault {
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo, repo + "/conf/axis2.xml");
- }
-
- public static ServiceContext createAdressedEnabledClientSide(AxisService service, String clientHome)
- throws AxisFault {
- File file = getAddressingMARFile();
- TestCase.assertTrue(file.exists());
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
- clientHome, null);
- AxisModule axisModule = DeploymentEngine.buildModule(file, configContext.getAxisConfiguration());
-
- configContext.getAxisConfiguration().addModule(axisModule);
- // sysContext.getAxisConfiguration().engageModule(moduleDesc.getName());
-
- configContext.getAxisConfiguration().addService(service);
- ServiceGroupContext serviceGroupContext = configContext
- .createServiceGroupContext(service.getAxisServiceGroup());
- return serviceGroupContext.getServiceContext(service);
- }
+ }
public static String prefixBaseDirectory(String path) {
return path;
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java Fri Sep 23 05:27:52 2011
@@ -42,7 +42,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class MessageBoxStressTest extends TestCase {
- private int port = 5555;
+ private int port = InMemoryMessageBoxServer.TESTING_PORT;
private long timeout = 5000L;
@BeforeClass
@@ -106,6 +106,7 @@ public class MessageBoxStressTest extend
try {
client = new ServiceClient();
+ System.out.println(mesgboxUrl);
client.getOptions().setTo(new EndpointReference(mesgboxUrl));
OMElement response = client.sendReceive(request);
} finally {
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java Fri Sep 23 05:27:52 2011
@@ -39,7 +39,7 @@ import org.junit.Test;
public class MsgBoxTest extends TestCase {
- private int port = 5555;
+ private int port = InMemoryMessageBoxServer.TESTING_PORT;
private long timeout = 5000L;
@BeforeClass
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java Fri Sep 23 05:27:52 2011
@@ -23,44 +23,42 @@ package org.apache.airavata.wsmg.broker;
import java.io.IOException;
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.WseMsgBrokerClient;
import org.apache.airavata.wsmg.util.TestUtilServer;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.junit.Test;
public class BrokerWSETest extends TestCase implements ConsumerNotificationHandler {
+ private static int port = TestUtilServer.TESTING_PORT;
static Properties configs = new Properties();
- BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
-
public void handleNotification(SOAPEnvelope msgEnvelope) {
- queue.add(msgEnvelope);
System.out.println("Received " + msgEnvelope);
}
- BlockingQueue<SOAPEnvelope> getMsgQueue() {
- return queue;
- }
-
@Override
protected void setUp() throws Exception {
TestUtilServer.start(null, null);
}
+ @Override
+ protected void tearDown() throws Exception {
+ TestUtilServer.stop();
+ }
+
@Test
public void testRoundTrip() throws InterruptedException {
try {
- String brokerEPR = "http://127.0.0.1:8080/axis2/services/EventingService";
+ String brokerEPR = "http://localhost:" + port + "/axis2/services/EventingService";
long value = System.currentTimeMillis();
String msg = String.format("<msg> current time is : %d </msg>", value);
@@ -74,20 +72,23 @@ public class BrokerWSETest extends TestC
String topic = "WseRoundTripTestTopic";
- String subscriptionID = wseMsgBrokerClient.subscribe(brokerEPR, consumerEPRs[0], topic);
- wseMsgBrokerClient.subscribe(consumerEPRs[0], topic, "/foo/bar");
-
- wseMsgBrokerClient.publish(topic, msg);
-
- wseMsgBrokerClient.publish(topic, "<foo><bar>Test</bar></foo>");
+ String subscriptionID = wseMsgBrokerClient.subscribe(consumerEPRs[0], topic, null);
+ System.out.println("topic sub id = " + subscriptionID);
+
+ try {
+ wseMsgBrokerClient.publish(topic, msg);
+ wseMsgBrokerClient.publish(topic, AXIOMUtil.stringToOM("<foo><bar>Test</bar></foo>"));
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
Thread.sleep(2000);
try {
wseMsgBrokerClient.unSubscribe(subscriptionID);
} catch (AxisFault e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ fail(e.getMessage());
}
wseMsgBrokerClient.shutdownConsumerService();
@@ -96,19 +97,11 @@ public class BrokerWSETest extends TestC
try {
System.in.read();
} catch (IOException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
-
- // fail("unexpected exception occured");
+ fail("unexpected exception occured");
}
System.out.println("Broker roundtrip done");
}
-
- @Override
- protected void tearDown() throws Exception {
- // TestUtilServer.stop();
- }
-
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java Fri Sep 23 05:27:52 2011
@@ -23,37 +23,35 @@ package org.apache.airavata.wsmg.broker;
import java.io.IOException;
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.WsntMsgBrokerClient;
import org.apache.airavata.wsmg.util.TestUtilServer;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.junit.Test;
public class BrokerWSNTTest extends TestCase implements ConsumerNotificationHandler {
-
+
+ private static int port = TestUtilServer.TESTING_PORT;
static Properties configs = new Properties();
- BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
-
public void handleNotification(SOAPEnvelope msgEnvelope) {
- // queue.add(msgEnvelope);
System.out.println("Received " + msgEnvelope);
}
- BlockingQueue<SOAPEnvelope> getMsgQueue() {
- return queue;
- }
-
@Override
protected void setUp() throws Exception {
TestUtilServer.start(null, null);
}
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestUtilServer.stop();
+ }
@Test
public void testRoundTrip() throws InterruptedException {
@@ -66,35 +64,31 @@ public class BrokerWSNTTest extends Test
int consumerPort = 6767;
- String brokerEPR = "http://127.0.0.1:5555/axis2/services/NotificationService";
+ String brokerEPR = "http://localhost:" + port + "/axis2/services/NotificationService";
wsntMsgBrokerClient.init(brokerEPR);
String[] consumerEPRs = wsntMsgBrokerClient.startConsumerService(consumerPort, this);
assertTrue(consumerEPRs.length > 0);
- String topic = "WsntRoundTripTestTopic";
-
- String topicSubscriptionID = wsntMsgBrokerClient.subscribe(brokerEPR, consumerEPRs[0], topic);
+ String topic = "/WsntRoundTripTestTopic";
+ String topicSubscriptionID = wsntMsgBrokerClient.subscribe(consumerEPRs[0], topic, null);
System.out.println("topic subscription id: " + topicSubscriptionID);
- String xpathSubscriptionID = wsntMsgBrokerClient.subscribe(consumerEPRs[0], topic, "/foo/bar");
-
- System.out.println("xpath subscription id: " + xpathSubscriptionID);
-
-
- wsntMsgBrokerClient.publish(topic, msg);
-
- wsntMsgBrokerClient.publish(topic, "<foo><bar>eligible to</bar></foo>");
+ try {
+ wsntMsgBrokerClient.publish(topic, msg);
+ wsntMsgBrokerClient.publish(topic, AXIOMUtil.stringToOM("<foo><bar>Test</bar></foo>"));
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
Thread.sleep(2000);
try {
wsntMsgBrokerClient.unSubscribe(topicSubscriptionID);
- wsntMsgBrokerClient.unSubscribe(xpathSubscriptionID);
} catch (AxisFault e) {
- // TODO Auto-generated catch block
e.printStackTrace();
+ fail(e.getMessage());
}
wsntMsgBrokerClient.shutdownConsumerService();
@@ -104,19 +98,12 @@ public class BrokerWSNTTest extends Test
try {
System.in.read();
} catch (IOException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
- // fail("unexpected exception occured");
+ fail("unexpected exception occured");
}
System.out.println("Broker roundtrip done");
}
-
- @Override
- protected void tearDown() throws Exception {
- TestUtilServer.stop();
- }
-
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java Fri Sep 23 05:27:52 2011
@@ -26,19 +26,21 @@ 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.WseMsgBrokerClient;
import org.apache.airavata.wsmg.util.ConfigKeys;
+import org.apache.airavata.wsmg.util.TestUtilServer;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
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;
-
public class TestAddtionalWseXpathAndTopicScenarios extends TestCase {
static Properties configs = new Properties();
@@ -54,7 +56,6 @@ public class TestAddtionalWseXpathAndTop
}
public void handleNotification(SOAPEnvelope msgEnvelope) {
-
queue.add(msgEnvelope);
System.out.println(String.format("[reciever id: %s] %s", id, msgEnvelope));
}
@@ -62,21 +63,16 @@ public class TestAddtionalWseXpathAndTop
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());
+
+ TestUtilServer.start(null, null);
}
- /**
- * @throws java.lang.Exception
- */
@After
public void tearDown() throws Exception {
}
@@ -98,36 +94,31 @@ public class TestAddtionalWseXpathAndTop
int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
- EndpointReference brokerEpr = new EndpointReference(
- configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR));
+ String brokerEpr = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
- WseMsgBrokerClient topicOnlyReceiverApi = new WseMsgBrokerClient();
- topicOnlyReceiverApi.init(brokerEpr.getAddress());
+ WseMsgBrokerClient topicOnlyReceiverApi = new WseMsgBrokerClient();
+ topicOnlyReceiverApi.init(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);
+ String topicOnlySubId = topicOnlyReceiverApi.subscribe(topicConsumerEPRs[0], topic, null);
+ System.out.println("Topic only subscription ID: " + topicOnlySubId);
WseMsgBrokerClient xpathAndTopicReceiverApi = new WseMsgBrokerClient();
- xpathAndTopicReceiverApi.init(brokerEpr.getAddress());
+ xpathAndTopicReceiverApi.init(brokerEpr);
NotificationReciever topicAndXpathMsgReceiver = new NotificationReciever("Topic And Xpath");
- String[] topicAndXpathConsumerEPRs = xpathAndTopicReceiverApi.startConsumerService(consumerPort + 1,
- topicAndXpathMsgReceiver);
-
+ String[] topicAndXpathConsumerEPRs = xpathAndTopicReceiverApi.startConsumerService(consumerPort + 1, topicAndXpathMsgReceiver);
assertTrue("invalid consumer eprs returned", topicAndXpathConsumerEPRs.length > 0);
-
- String topicAndXpathSubId = xpathAndTopicReceiverApi.subscribe(
- topicAndXpathConsumerEPRs[0], topic, xpathExpression);
-
+ String topicAndXpathSubId = xpathAndTopicReceiverApi.subscribe(topicAndXpathConsumerEPRs[0], topic, xpathExpression);
+ System.out.println("Xpath and Topic subscription ID: " + topicAndXpathSubId);
+
WseMsgBrokerClient senderApi = new WseMsgBrokerClient();
- senderApi.init(brokerEpr.getAddress());
- senderApi.publish(topic, matchingMsg);
- senderApi.publish(topic, unmatchingMsg);
+ senderApi.init(brokerEpr);
try {
+
+ senderApi.publish(topic, AXIOMUtil.stringToOM(matchingMsg));
+ senderApi.publish(topic, AXIOMUtil.stringToOM(unmatchingMsg));
Thread.sleep(5000);
@@ -137,7 +128,8 @@ public class TestAddtionalWseXpathAndTop
assertTrue("xpath and topic reciever should only get one message"
+ topicAndXpathMsgReceiver.getMsgQueue().size(),
topicAndXpathMsgReceiver.getMsgQueue().size() == 1);
-
+ } catch (XMLStreamException x){
+ fail("Error while creating OMElement");
} catch (InterruptedException e) {
fail("interrupted while waiting for message");
}
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java Fri Sep 23 05:27:52 2011
@@ -33,15 +33,15 @@ import junit.framework.TestCase;
import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
import org.apache.airavata.wsmg.util.ConfigKeys;
+import org.apache.airavata.wsmg.util.TestUtilServer;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
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;
-
public class TestWseXpathAndTopicSubscription extends TestCase implements ConsumerNotificationHandler {
static Properties configs = new Properties();
@@ -58,18 +58,14 @@ public class TestWseXpathAndTopicSubscri
return queue;
}
- /**
- * @throws java.lang.Exception
- */
@Before
public void setUp() throws Exception {
URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
configs.load(configURL.openStream());
+
+ TestUtilServer.start(null, null);
}
- /**
- * @throws java.lang.Exception
- */
@After
public void tearDown() throws Exception {
}
@@ -88,8 +84,7 @@ public class TestWseXpathAndTopicSubscri
int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
- String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
-
+ String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
WseMsgBrokerClient msgBrokerClient = new WseMsgBrokerClient();
msgBrokerClient.init(brokerEPR);
@@ -101,10 +96,12 @@ public class TestWseXpathAndTopicSubscri
String subscriptionID = msgBrokerClient.subscribe(consumerEPRs[0], null, xpathExpression);
- msgBrokerClient.publish(null,validMsg);
- msgBrokerClient.publish(null,invalidMsg);
+
try {
+ msgBrokerClient.publish(null, AXIOMUtil.stringToOM(validMsg));
+ msgBrokerClient.publish(null, AXIOMUtil.stringToOM(invalidMsg));
+
SOAPEnvelope env = getMsgQueue().take();
assertNotNull(env.getBody());
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java Fri Sep 23 05:27:52 2011
@@ -30,12 +30,14 @@ import javax.xml.stream.XMLStreamExcepti
import junit.framework.TestCase;
-import org.apache.airavata.wsmg.client.*;
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
import org.apache.airavata.wsmg.util.ConfigKeys;
+import org.apache.airavata.wsmg.util.TestUtilServer;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
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;
@@ -57,88 +59,19 @@ public class TestWseXpathSubscription ex
return queue;
}
- /**
- * @throws java.lang.Exception
- */
@Before
public void setUp() throws Exception {
URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
configs.load(configURL.openStream());
+
+ TestUtilServer.start(null, null);
}
- /**
- * @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);
-
- WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
- wseMsgBrokerClient.init(brokerEPR);
-
- String[] consumerEPRs = wseMsgBrokerClient.startConsumerService(consumerPort, this);
-
- assertTrue(consumerEPRs.length > 0);
-
- String xpathExpression = "/c/b/a";
-
- String subscriptionID = wseMsgBrokerClient.subscribe(consumerEPRs[0], null, xpathExpression);
-
- wseMsgBrokerClient.publish(null,validMsg);
- wseMsgBrokerClient.publish(null,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());
- }
-
- wseMsgBrokerClient.unSubscribe(subscriptionID);
- wseMsgBrokerClient.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- fail("unexpected exception occured");
- }
-
- }
-
- @Test
public final void testSimpleXpathTopicRoundTrip() {
try {
@@ -152,7 +85,7 @@ public class TestWseXpathSubscription ex
int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
- String brokerEPR = configs.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+ String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
wseMsgBrokerClient.init(brokerEPR);
@@ -166,10 +99,11 @@ public class TestWseXpathSubscription ex
String subscriptionID = wseMsgBrokerClient.subscribe(consumerEPRs[0], topicExpression, xpathExpression);
- wseMsgBrokerClient.publish(topicExpression, validMsg);
- wseMsgBrokerClient.publish(topicExpression, invalidMsg);
-
try {
+
+ wseMsgBrokerClient.publish(topicExpression, AXIOMUtil.stringToOM(validMsg));
+ wseMsgBrokerClient.publish(topicExpression, AXIOMUtil.stringToOM(invalidMsg));
+
SOAPEnvelope env = getMsgQueue().take();
assertNotNull(env.getBody());
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java Fri Sep 23 05:27:52 2011
@@ -26,10 +26,7 @@ import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.util.BrokerUtil;
import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java?rev=1174523&r1=1174522&r2=1174523&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java (original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java Fri Sep 23 05:27:52 2011
@@ -25,9 +25,6 @@ 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";