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/05/14 20:35:02 UTC
svn commit: r1103180 [23/23] - in
/incubator/airavata/donations/ogce-donation: ./ modules/ modules/utils/
modules/utils/schemas/ modules/utils/schemas/gfac-schema-utils/
modules/utils/schemas/gfac-schema-utils/generated/
modules/utils/schemas/gfac-sche...
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxNameSpConsts.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxNameSpConsts.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxNameSpConsts.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxNameSpConsts.java Sat May 14 18:34:50 2011
@@ -0,0 +1,33 @@
+/*
+ * 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 edu.indiana.extreme.www.xgws.msgbox.util;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+
+public class MsgBoxNameSpConsts {
+
+
+ private final static OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ public final static OMNamespace MSG_BOX = factory.createOMNamespace(
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004", "msg");
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxOperations.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxOperations.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxOperations.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxOperations.java Sat May 14 18:34:50 2011
@@ -0,0 +1,51 @@
+/*
+ * 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 edu.indiana.extreme.www.xgws.msgbox.util;
+
+public enum MsgBoxOperations {
+ STORE_MSGS("storeMessages"), DESTROY_MSGBOX("destroyMsgBox"), TAKE_MSGS("takeMessages"), CREATE_MSGBOX(
+ "createMsgBox");
+
+private final String name;
+
+private MsgBoxOperations(String n) {
+name = n;
+}
+
+public String toString() {
+return name;
+}
+
+public boolean equals(String s) {
+return name.equals(s);
+}
+
+public static MsgBoxOperations valueFrom(String s) {
+for (MsgBoxOperations status : MsgBoxOperations.values()) {
+ if (status.toString().equalsIgnoreCase(s)) {
+ return status;
+ }
+
+}
+
+throw new RuntimeException("invalid WsEventingOperation:- " + s);
+
+}
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxUtils.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxUtils.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/main/java/edu/indiana/extreme/www/xgws/msgbox/util/MsgBoxUtils.java Sat May 14 18:34:50 2011
@@ -0,0 +1,72 @@
+/*
+ * 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 edu.indiana.extreme.www.xgws.msgbox.util;
+
+import java.io.Reader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+
+public class MsgBoxUtils {
+
+ public static SOAPEnvelope reader2SOAPEnvilope(Reader reader)
+ throws XMLStreamException {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
+
+ StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow);
+ SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
+ return omEnvelope;
+ }
+
+ public static OMElement reader2OMElement(Reader reader)
+ throws XMLStreamException {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
+
+ StAXOMBuilder builder = new StAXOMBuilder(inflow);
+ OMElement omElement = builder.getDocumentElement();
+ return omElement;
+ }
+
+ public static String formatMessageBoxUrl(String msgBoxServiceUrl,
+ String msgboxId) {
+ return msgBoxServiceUrl.endsWith("/") ? msgBoxServiceUrl + "clientid/"
+ + msgboxId : msgBoxServiceUrl + "/clientid/" + msgboxId;
+ }
+
+ public static String formatURLString(String url) {
+
+ if (url == null) {
+ throw new IllegalArgumentException("url can't be null");
+ }
+
+ if (url.indexOf("//") < 0) {
+ url = "http://" + url; // use default http
+ }
+ return url;
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/README.txt?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/README.txt (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/README.txt Sat May 14 18:34:50 2011
@@ -0,0 +1,28 @@
+wsmg-msgbox Quick Start Guide- Sample 1
+=================================
+
+This sample demonstrate how create a message box, how to store a message and retrieve that message and ultimately how to destroy the created
+message box.
+
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+
+1) configure and run wsmg-msgbox. please refer wsmg-msgbox user guide to know how to run the wsmg-msgbox.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) set configurations in './conf/configuration.properties' file.
+
+4) run following command:
+ ant run
+
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/msgBox/SimpleMsgBoxExec.class
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/msgBox/SimpleMsgBoxExec.class?rev=1103180&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/msgBox/SimpleMsgBoxExec.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/util/ConfigKeys.class
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/util/ConfigKeys.class?rev=1103180&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/bin/wsmg/samples/util/ConfigKeys.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.properties?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.properties (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.properties Sat May 14 18:34:50 2011
@@ -0,0 +1,3 @@
+
+
+axis2.home=/Apps/axis2-1.5.1
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.xml?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/build.xml Sat May 14 18:34:50 2011
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+
+<project name="msgboxsamples" default="run" basedir=".">
+
+ <property file="build.properties" />
+ <property name="lib.path" value="../../" />
+ <property name="dest.dir" value="bin" />
+ <property name="src.dir" value="src" />
+ <property name="conf.dir" location="conf" />
+
+
+
+ <path id="msgbox.class.path">
+ <fileset dir="${lib.path}">
+ <include name="*.jar" />
+ </fileset>
+
+ <fileset dir="${axis2.home}/lib">
+ <include name="*.jar" />
+ </fileset>
+
+ <path location="${conf.dir}" />
+
+ <pathelement location="${dest.dir}" />
+
+ </path>
+
+
+ <target name="clean">
+ <delete dir="${dest.dir}" />
+ </target>
+
+ <target name="build" depends="makeDest">
+ <antcall target="compile" />
+ </target>
+
+ <target name="makeDest">
+ <mkdir dir="${dest.dir}" />
+ </target>
+
+
+ <target name="compile" depends="makeDest">
+ <javac debug="true" srcdir="${src.dir}" destdir="${dest.dir}">
+ <classpath refid="msgbox.class.path" />
+ </javac>
+ </target>
+
+
+ <target name="run" depends="build">
+
+ <java classname="wsmg.samples.msgBox.SimpleMsgBoxExec" fork="true">
+ <classpath refid="msgbox.class.path" />
+ </java>
+
+ </target>
+
+
+</project>
\ No newline at end of file
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/conf/configuration.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/conf/configuration.properties?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/conf/configuration.properties (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/conf/configuration.properties Sat May 14 18:34:50 2011
@@ -0,0 +1,3 @@
+axis2.repository=/Apps/axis2-1.5/lib
+msgbox.service.url=http://localhost:8080/axis2/services/MsgBoxService
+msgbox.id=67889-28837892-33457700-33-4889uu9688--4770333068
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/msgBox/SimpleMsgBoxExec.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/msgBox/SimpleMsgBoxExec.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/msgBox/SimpleMsgBoxExec.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/msgBox/SimpleMsgBoxExec.java Sat May 14 18:34:50 2011
@@ -0,0 +1,74 @@
+package wsmg.samples.msgBox;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+
+import wsmg.samples.util.ConfigKeys;
+import edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient;
+import edu.indiana.extreme.www.xgws.msgbox.util.MsgBoxUtils;
+
+public class SimpleMsgBoxExec {
+
+ private static Properties getDefaults() {
+ Properties defaults = new Properties();
+ defaults.setProperty(ConfigKeys.MSGBOX_SERVICE_URL,
+ "http://localhost:8080/axis2/services/MsgBoxService");
+ return defaults;
+ }
+
+ public static void main(String[] args) throws IOException {
+
+ Properties configurations = new Properties(getDefaults());
+ URL configURL = ClassLoader
+ .getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+
+ if (configURL != null) {
+ configurations.load(configURL.openStream());
+
+ } else {
+ System.out
+ .println("unable to load configurations defaults will be used");
+ }
+
+ String msgBoxId = UUID.randomUUID().toString();
+ MsgBoxClient client = new MsgBoxClient();
+
+ EndpointReference msgBoxEpr = client.createMessageBox(configurations
+ .getProperty(ConfigKeys.MSGBOX_SERVICE_URL), 500L);
+
+ try {
+ client.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
+ .reader2OMElement(new StringReader(
+ "<test>A simple test message</test>")));
+ } catch (XMLStreamException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Iterator<OMElement> iterator = client.takeMessagesFromMsgBox(msgBoxEpr,
+ 500L);
+ int i = 0;
+ if (iterator != null)
+ while (iterator.hasNext()) {
+ i++;
+ System.out.println("Retrieved message :" + i);
+ try {
+ System.out.println(iterator.next().toStringWithConsume());
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Delete message box response : "
+ + client.deleteMsgBox(msgBoxEpr, 500L));
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/util/ConfigKeys.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/util/ConfigKeys.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/samples/msgBoxSample/src/wsmg/samples/util/ConfigKeys.java Sat May 14 18:34:50 2011
@@ -0,0 +1,10 @@
+package wsmg.samples.util;
+
+public class ConfigKeys {
+
+ public static final String AXIS2_REPO = "axis2.repository";
+ public static final String CONFIG_FILE_NAME = "configuration.properties";
+ public static final String MSGBOX_SERVICE_URL = "msgbox.service.url";
+ public static final String MSGBOX_ID = "msgbox.id";
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/InMemoryMessageBoxServer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/InMemoryMessageBoxServer.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/InMemoryMessageBoxServer.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/InMemoryMessageBoxServer.java Sat May 14 18:34:50 2011
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.www.xgws.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;
+
+public class InMemoryMessageBoxServer {
+ private static int count = 0;
+
+ private static SimpleHTTPServer receiver;
+
+ public static final int TESTING_PORT = 5555;
+
+ public static final String FAILURE_MESSAGE = "Intentional Failure";
+
+
+ public static synchronized void deployService(AxisService service)
+ throws AxisFault {
+ receiver.getConfigurationContext().getAxisConfiguration().addService(
+ service);
+ }
+
+ 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) {
+ ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
+
+ receiver = new SimpleHTTPServer(er, TESTING_PORT);
+
+ try {
+ receiver.start();
+ System.out.print("Server started on port "
+ + TESTING_PORT + ".....");
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e1) {
+ throw new AxisFault("Thread interuptted", e1);
+ }
+ startMessageBox();
+ }
+ count++;
+ }
+
+ public static void startMessageBox() throws Exception {
+
+ AxisService axisService = new AxisService("MsgBoxService");
+ axisService.addParameter("configuration.file.name" , "wsmg.broker.properties");
+ axisService.setServiceLifeCycle(new edu.indiana.extreme.www.xgws.msgbox.MsgBoxServiceLifeCycle());
+
+
+ createOperation(axisService, "storeMessages", new MsgBoxServiceMessageReceiverInOut(),
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/storeMessages",
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/MsgBoxPT/storeMessagesResponse");
+ createOperation(axisService, "destroyMsgBox", new MsgBoxServiceMessageReceiverInOut(),
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/destroyMsgBox",
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/MsgBoxPT/destroyMsgBoxResponse");
+ createOperation(axisService, "takeMessages", new MsgBoxServiceMessageReceiverInOut(),
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/takeMessages",
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/MsgBoxPT/takeMessagesResponse");
+ createOperation(axisService, "createMsgBox", new MsgBoxServiceMessageReceiverInOut(),
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/createMsgBox",
+ "http://www.extreme.indiana.edu/xgws/msgbox/2004/MsgBoxPT/createMsgBoxResponse");
+ axisService.addParameter("configuration.file.name", "msgBox.properties");
+ axisService.addParameter("ServiceClass", "edu.indiana.extreme.www.xgws.msgbox.MsgBoxServiceSkeleton");
+
+
+ InMemoryMessageBoxServer.deployService(axisService);
+
+ new MsgBoxServiceLifeCycle().startUp(InMemoryMessageBoxServer.getConfigurationContext(), axisService);
+
+ }
+
+
+ public static void createOperation(AxisService axisService, String name, MessageReceiver messageReceiver,
+ String inputAction, String outputAction){
+ InOutAxisOperation operation1 = new InOutAxisOperation(new QName(name));
+ operation1.setMessageReceiver(messageReceiver);
+ operation1.setOutputAction(outputAction);
+ axisService.addOperation(operation1);
+ if(inputAction != null){
+ axisService.mapActionToOperation(inputAction, operation1);
+ }
+ }
+
+
+ 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 {
+ //File file = new File(prefixBaseDirectory(repository));
+// if (!file.exists()) {
+// throw new Exception("repository directory "
+// + file.getAbsolutePath() + " does not exists");
+// }
+ return ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(repository,
+ axis2xml);
+ }
+
+ public static synchronized void stop() throws AxisFault {
+ if (count == 1) {
+ receiver.stop();
+ while (receiver.isRunning()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ //nothing to do here
+ }
+ }
+ count = 0;
+// tp.doStop();
+ System.out.print("Server stopped .....");
+ } else {
+ count--;
+ }
+ receiver.getConfigurationContext().terminate();
+ }
+
+ 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) {
+// String baseDir;
+// try {
+// baseDir = new File(System.getProperty("basedir", ".")).getCanonicalPath();
+// } catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+// return baseDir + "/" + path;
+ return path;
+ }
+
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MessageBoxStressTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MessageBoxStressTest.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MessageBoxStressTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MessageBoxStressTest.java Sat May 14 18:34:50 2011
@@ -0,0 +1,118 @@
+/*
+ * 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 edu.indiana.extreme.www.xgws.msgbox;
+
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.ServiceClient;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient;
+import edu.indiana.extreme.www.xgws.msgbox.util.MsgBoxUtils;
+
+public class MessageBoxStressTest extends TestCase {
+ private int port = 5555;
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ //System.setProperty("axis2.repository", "/home/hemapani/playground/E-Science/axis2-1.5/repository");
+ InMemoryMessageBoxServer.start(null,null);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testMessageBox() throws Exception {
+
+ String msgBoxId = UUID.randomUUID().toString();
+ MsgBoxClient user = new MsgBoxClient();
+
+ //test publish with Epr
+ EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
+
+ System.out.println(msgBoxEpr.toString());
+ user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
+ .reader2OMElement(new StringReader(
+ "<test>A simple test message</test>")));
+
+
+
+ Iterator<OMElement> iterator = user.takeMessagesFromMsgBox(msgBoxEpr,
+ 500L);
+ int i = 0;
+ if (iterator != null)
+ while (iterator.hasNext()) {
+ i++;
+ System.out.println("Retrieved message :" + i);
+ System.out.println(iterator.next().toStringWithConsume());
+ }
+
+ System.out.println("Delete message box response : "
+ + user.deleteMsgBox(msgBoxEpr, 500L));
+
+ //test invocations with id encoded in the Url
+ msgBoxId = UUID.randomUUID().toString();
+ user = new MsgBoxClient();
+
+ //test publish with Epr
+ msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
+
+ String mesgboxUrl = "http://localhost:"+port+"/axis2/services/MsgBoxService/clientid/"+msgBoxId;
+
+ ServiceClient client = new ServiceClient();
+ client.getOptions().setTo(new EndpointReference(mesgboxUrl));
+
+ OMElement request = OMAbstractFactory.getOMFactory().createOMElement(new QName("foo"));
+ request.setText("bar");
+ client.sendReceive(request);
+
+ iterator = user.takeMessagesFromMsgBox(new EndpointReference(mesgboxUrl),500L);
+ assertTrue(iterator.hasNext());
+ iterator.next();
+ assertFalse(iterator.hasNext());
+
+ System.out.println("All tests Done");
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MsgBoxTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MsgBoxTest.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MsgBoxTest.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/msgbox/src/test/java/edu/indiana/extreme/www/xgws/msgbox/MsgBoxTest.java Sat May 14 18:34:50 2011
@@ -0,0 +1,114 @@
+/*
+ * 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 edu.indiana.extreme.www.xgws.msgbox;
+
+import java.io.StringReader;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient;
+import edu.indiana.extreme.www.xgws.msgbox.util.MsgBoxUtils;
+
+public class MsgBoxTest extends TestCase {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testMessageBox() throws Exception {
+
+ String fill = "aaaaaaaaaaa";
+
+ for (int i = 0; i < 5; i++) {
+ fill = fill + fill;
+ }
+
+ System.out.println("fill size : " + fill.length());
+
+ MsgBoxClient user = new MsgBoxClient();
+
+ EndpointReference msgBoxEpr = user.createMessageBox(
+ "http://localhost:8080/axis2/services/MsgBoxService", 5000L);
+ /*
+ * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
+ * StringReader( "<test>simple test message 1</test>")));
+ * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
+ * StringReader( "<test>simple test message 2</test>")));
+ * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
+ * StringReader( "<test>simple test message 3</test>")));
+ * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
+ * StringReader( "<test>simple test message 4</test>")));
+ */
+
+ EndpointReference msgBoxEprTcpMon = new EndpointReference(msgBoxEpr
+ .getAddress().replace("8080", "5050"));
+
+ for (int i = 0; i < 10; i++) {
+ String msg = String.format(
+ "<msg><seq>%d</seq><fill>%s</fill></msg>", i, fill);
+
+ user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
+ .reader2OMElement(new StringReader(msg)));
+
+ Thread.sleep(200L);
+ }
+
+ Iterator<OMElement> iterator = null;
+
+ try {
+ iterator = user.takeMessagesFromMsgBox(msgBoxEprTcpMon, 5000L);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if (iterator != null)
+ while (iterator.hasNext()) {
+
+ System.out.println(iterator.next().toStringWithConsume());
+ }
+
+ System.out.println("Delete message box response : "
+ + user.deleteMsgBox(msgBoxEpr, 5000L));
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/pom.xml?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/pom.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/pom.xml Sat May 14 18:34:50 2011
@@ -0,0 +1,120 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.ogce.ws-messenger</groupId>
+ <artifactId>ws-messenger</artifactId>
+ <packaging>pom</packaging>
+ <name>OGCE-WS-Messenger</name>
+ <version>1.1.1</version>
+ <url>http://maven.apache.org</url>
+ <repositories>
+ <repository>
+ <id>ogce.m2.all</id>
+ <name>ogce.m2.all</name>
+ <url>http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <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>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <type>jar</type>
+ <version>1.2.8</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2</artifactId>
+ <version>1.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.15</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- disabling unit tests for now -->
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ </plugins>
+ </build>
+
+ <modules>
+ <module>wsmg-commons</module>
+ <module>msgbox</module>
+ <module>broker</module>
+ <module>messenger</module>
+ <module>workflow-tracking</module>
+ <module>distribution</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+
+ <release.version>1.1.1</release.version>
+
+ </properties>
+
+</project>
\ No newline at end of file
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/wsmg-commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/wsmg-commons/pom.xml?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/wsmg-commons/pom.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/wsmg-commons/pom.xml Sat May 14 18:34:50 2011
@@ -0,0 +1,26 @@
+<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.commons</groupId>
+ <artifactId>broker_commons</artifactId>
+ <packaging>jar</packaging>
+ <name>wsmg-commons</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8
+ </project.reporting.outputEncoding>
+ </properties>
+</project>