You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/12/08 16:38:27 UTC
svn commit: r1418689 - in /axis/axis1/java/trunk:
axis-testutils/src/main/java/org/ axis-testutils/src/main/java/org/apache/
axis-testutils/src/main/java/org/apache/axis/
axis-testutils/src/main/java/org/apache/axis/testutils/
axis-testutils/src/main/j...
Author: veithen
Date: Sat Dec 8 15:38:24 2012
New Revision: 1418689
URL: http://svn.apache.org/viewvc?rev=1418689&view=rev
Log:
Mavenized the JMS sample and added the necessary stuff to perform an integration test with ActiveMQ.
Added:
axis/axis1/java/trunk/axis-testutils/src/main/java/org/
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java (with props)
axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java (with props)
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java (with props)
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java (with props)
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java (with props)
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java (with props)
axis/axis1/java/trunk/samples/jms-sample/ (with props)
axis/axis1/java/trunk/samples/jms-sample/pom.xml (with props)
axis/axis1/java/trunk/samples/jms-sample/src/
axis/axis1/java/trunk/samples/jms-sample/src/main/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/JMSTest.java
- copied, changed from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/JMSTest.java
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/JMSURLTest.java
- copied, changed from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/dii/JMSURLTest.java
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/
axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/JMSURLStubTest.java
- copied, changed from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/JMSURLStubTest.java
axis/axis1/java/trunk/samples/jms-sample/src/main/wsdd/
axis/axis1/java/trunk/samples/jms-sample/src/main/wsdd/client-config.wsdd
- copied unchanged from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/client-config.wsdd
axis/axis1/java/trunk/samples/jms-sample/src/main/wsdd/server-config.wsdd
- copied unchanged from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/server-config.wsdd
axis/axis1/java/trunk/samples/jms-sample/src/main/wsdl/
axis/axis1/java/trunk/samples/jms-sample/src/main/wsdl/GetQuote.wsdl
- copied unchanged from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/GetQuote.wsdl
axis/axis1/java/trunk/samples/jms-sample/src/test/
axis/axis1/java/trunk/samples/jms-sample/src/test/conf/
axis/axis1/java/trunk/samples/jms-sample/src/test/conf/activemq-connection-factory.properties
axis/axis1/java/trunk/samples/jms-sample/src/test/java/
axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/
axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/
axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java (with props)
Removed:
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/JMSTest.java
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/client-config.wsdd
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/dii/JMSURLTest.java
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/server-config.wsdd
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/GetQuote.wsdl
axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/JMSURLStubTest.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerStartAction.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerStopAction.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessStartAction.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessStopAction.java
Modified:
axis/axis1/java/trunk/distribution/src/main/assembly/bin.xml
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartProcessMojo.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultProcessManager.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ManagedProcess.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessManager.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartProcessMojo.java
axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
axis/axis1/java/trunk/samples/pom.xml
Added: axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java (added)
+++ axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.axis.testutils.daemon;
+
+public interface Daemon {
+ void start(String[] args) throws Exception;
+ void stop() throws Exception;
+}
Propchange: axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Daemon.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java (added)
+++ axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.testutils.daemon;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class Launcher {
+ public static void main(String[] args) throws Exception {
+ String daemonClass = args[0];
+ int controlPort = Integer.parseInt(args[1]);
+ String[] daemonArgs = new String[args.length-2];
+ System.arraycopy(args, 2, daemonArgs, 0, args.length-2);
+ ServerSocket controlServerSocket = new ServerSocket();
+ controlServerSocket.bind(new InetSocketAddress(InetAddress.getByName("localhost"), controlPort));
+ Socket controlSocket = controlServerSocket.accept();
+ BufferedReader controlIn = new BufferedReader(new InputStreamReader(controlSocket.getInputStream(), "ASCII"));
+ Writer controlOut = new OutputStreamWriter(controlSocket.getOutputStream(), "ASCII");
+ Daemon daemon = (Daemon)Class.forName(daemonClass).newInstance();
+ daemon.start(daemonArgs);
+ controlOut.write("READY\r\n");
+ controlOut.flush();
+ String request = controlIn.readLine();
+ if (request == null) {
+ System.err.println("Control connection unexpectedly closed");
+ } else if (request.equals("STOP")) {
+ daemon.stop();
+ controlOut.write("STOPPED\r\n");
+ controlOut.flush();
+ } else {
+ System.err.println("Unexpected request: " + request);
+ }
+ }
+}
Propchange: axis/axis1/java/trunk/axis-testutils/src/main/java/org/apache/axis/testutils/daemon/Launcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/distribution/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/distribution/src/main/assembly/bin.xml?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/distribution/src/main/assembly/bin.xml (original)
+++ axis/axis1/java/trunk/distribution/src/main/assembly/bin.xml Sat Dec 8 15:38:24 2012
@@ -113,6 +113,18 @@
<outputDirectory>samples/jaxrpc</outputDirectory>
</fileSet>
<fileSet>
+ <directory>../samples/jms-sample/src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/jms-sample/src/main/wsdl</directory>
+ <outputDirectory>samples/jms/stub</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/jms-sample/src/main/wsdd</directory>
+ <outputDirectory>samples/jms</outputDirectory>
+ </fileSet>
+ <fileSet>
<directory>../samples/message-sample/src/main/java</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartProcessMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartProcessMojo.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartProcessMojo.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartProcessMojo.java Sat Dec 8 15:38:24 2012
@@ -102,7 +102,7 @@ public abstract class AbstractStartProce
return debug;
}
- protected void startJavaProcess(String description, String mainClass, String[] args, File workDir, ProcessStartAction startAction, ProcessStopAction stopAction) throws MojoExecutionException, MojoFailureException {
+ protected void startJavaProcess(String description, String mainClass, String[] args, File workDir, ProcessControl processControl) throws MojoExecutionException, MojoFailureException {
Log log = getLog();
// Locate java executable to use
@@ -155,8 +155,7 @@ public abstract class AbstractStartProce
description,
(String[])cmdline.toArray(new String[cmdline.size()]),
workDir,
- startAction,
- stopAction);
+ processControl);
} catch (Exception ex) {
throw new MojoFailureException("Failed to start server", ex);
}
Added: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java (added)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,81 @@
+/*
+ * 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 org.apache.axis.tools.maven.server;
+
+import java.io.File;
+import java.net.URL;
+import java.rmi.RemoteException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.client.AdminClient;
+import org.apache.axis.client.Call;
+import org.codehaus.plexus.logging.Logger;
+
+public class AxisServerProcessControl implements ProcessControl {
+ private final int port;
+ private final AdminClient adminClient;
+ private final File[] deployments;
+ private final File[] undeployments;
+ private final int timeout;
+
+ public AxisServerProcessControl(int port, AdminClient adminClient, File[] deployments, File[] undeployments, int timeout) {
+ this.port = port;
+ this.adminClient = adminClient;
+ this.deployments = deployments;
+ this.undeployments = undeployments;
+ this.timeout = timeout;
+ }
+
+ public void initializeProcess(Logger logger, Process process) throws Exception {
+ // Wait for server to become ready
+ String versionUrl = "http://localhost:" + port + "/axis/services/Version";
+ Call call = new Call(new URL(versionUrl));
+ call.setOperationName(new QName(versionUrl, "getVersion"));
+ long start = System.currentTimeMillis();
+ while (true) {
+ try {
+ String result = (String)call.invoke(new Object[0]);
+ logger.info("Server ready on port " + port + ": " + result.replace('\n', ' '));
+ break;
+ } catch (RemoteException ex) {
+ if (System.currentTimeMillis() > start + timeout) {
+ throw ex;
+ }
+ }
+ try {
+ int exitValue = process.exitValue();
+ // TODO: choose a better exception here
+ throw new RemoteException("The server process unexpectedly died with exit status " + exitValue);
+ } catch (IllegalThreadStateException ex) {
+ // This means that the process is still running; continue
+ }
+ Thread.sleep(200);
+ }
+
+ // Deploy services
+ AdminClientUtils.process(logger, adminClient, deployments);
+ }
+
+ public int shutdownProcess(Logger logger) throws Exception {
+ AdminClientUtils.process(logger, adminClient, undeployments);
+ adminClient.quit();
+ return STOPPING;
+ }
+}
Propchange: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/AxisServerProcessControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java (added)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,74 @@
+/*
+ * 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 org.apache.axis.tools.maven.server;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.InetAddress;
+import java.net.Socket;
+
+import org.codehaus.plexus.logging.Logger;
+
+public class DaemonProcessControl implements ProcessControl {
+ private final int controlPort;
+ private BufferedReader controlIn;
+ private Writer controlOut;
+
+ public DaemonProcessControl(int controlPort) {
+ this.controlPort = controlPort;
+ }
+
+ public void initializeProcess(Logger logger, Process process) throws Exception {
+ logger.debug("Attempting to establish control connection on port " + controlPort);
+ Socket controlSocket;
+ while (true) {
+ try {
+ controlSocket = new Socket(InetAddress.getByName("localhost"), controlPort);
+ break;
+ } catch (IOException ex) {
+ Thread.sleep(100);
+ }
+ }
+ logger.debug("Control connection established");
+ controlIn = new BufferedReader(new InputStreamReader(controlSocket.getInputStream(), "ASCII"));
+ controlOut = new OutputStreamWriter(controlSocket.getOutputStream(), "ASCII");
+ logger.debug("Waiting for daemon to become ready");
+ expectStatus("READY");
+ logger.debug("Daemon is ready");
+ }
+
+ public int shutdownProcess(Logger logger) throws Exception {
+ controlOut.write("STOP\r\n");
+ controlOut.flush();
+ expectStatus("STOPPED");
+ return STOPPING;
+ }
+
+ private void expectStatus(String expectedStatus) throws IOException {
+ String status = controlIn.readLine();
+ if (status == null) {
+ throw new IllegalStateException("Control connection unexpectedly closed");
+ } else if (!status.equals(expectedStatus)) {
+ throw new IllegalStateException("Unexpected status: " + status);
+ }
+ }
+}
Propchange: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonProcessControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultProcessManager.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultProcessManager.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultProcessManager.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultProcessManager.java Sat Dec 8 15:38:24 2012
@@ -36,15 +36,15 @@ public class DefaultProcessManager imple
this.logger = logger;
}
- public void startProcess(String description, String[] cmdline, File workDir, ProcessStartAction startAction, ProcessStopAction stopAction) throws Exception {
+ public void startProcess(String description, String[] cmdline, File workDir, ProcessControl processControl) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("Starting process with command line: " + Arrays.asList(cmdline));
}
Process process = Runtime.getRuntime().exec(cmdline, null, workDir);
- managedProcesses.add(new ManagedProcess(process, description, stopAction));
+ managedProcesses.add(new ManagedProcess(process, description, processControl));
new Thread(new StreamPump(process.getInputStream(), System.out)).start();
new Thread(new StreamPump(process.getErrorStream(), System.err)).start();
- startAction.execute(logger, process);
+ processControl.initializeProcess(logger, process);
}
public void stopAll() throws Exception {
@@ -54,7 +54,7 @@ public class DefaultProcessManager imple
int result;
logger.debug("Executing stop action");
try {
- result = managedProcess.getStopAction().execute(logger);
+ result = managedProcess.getProcessControl().shutdownProcess(logger);
} catch (Exception ex) {
if (savedException == null) {
savedException = ex;
@@ -64,7 +64,7 @@ public class DefaultProcessManager imple
if (logger.isDebugEnabled()) {
logger.debug("result = " + result);
}
- if (result == ProcessStopAction.STOPPING) {
+ if (result == ProcessControl.STOPPING) {
managedProcess.getProcess().waitFor();
} else {
managedProcess.getProcess().destroy();
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ManagedProcess.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ManagedProcess.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ManagedProcess.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ManagedProcess.java Sat Dec 8 15:38:24 2012
@@ -21,12 +21,12 @@ package org.apache.axis.tools.maven.serv
public class ManagedProcess {
private final Process process;
private final String description;
- private final ProcessStopAction stopAction;
+ private final ProcessControl processControl;
- public ManagedProcess(Process process, String description, ProcessStopAction stopAction) {
+ public ManagedProcess(Process process, String description, ProcessControl processControl) {
this.process = process;
this.description = description;
- this.stopAction = stopAction;
+ this.processControl = processControl;
}
public Process getProcess() {
@@ -37,7 +37,7 @@ public class ManagedProcess {
return description;
}
- public ProcessStopAction getStopAction() {
- return stopAction;
+ public ProcessControl getProcessControl() {
+ return processControl;
}
}
Added: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java (added)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,60 @@
+/*
+ * 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 org.apache.axis.tools.maven.server;
+
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Defines the actions to be executed after a given process has been started and when a process is
+ * stopped.
+ *
+ * @author Andreas Veithen
+ */
+public interface ProcessControl {
+ /**
+ * Indicates that the process is expected to be still running after the action is completed.
+ */
+ int RUNNING = 1;
+
+ /**
+ * Indicates that the action has sent a request to the process to initiate a clean shutdown,
+ * i.e. that the process is expected to be stopping (but not necessarily to be stopped yet).
+ */
+ int STOPPING = 2;
+
+ /**
+ * Initialize the process. This typically involves waiting for the process to be completely
+ * started and to configure the server process, e.g. to deploy services.
+ *
+ * @param logger
+ * @param process
+ * @throws Exception
+ */
+ void initializeProcess(Logger logger, Process process) throws Exception;
+
+ /**
+ * Prepare the process for shutdown. Typically (but not necessarily) this involves sending a
+ * request to initiate a clean shutdown of the process.
+ *
+ * @param logger
+ * @return
+ * @throws Exception
+ */
+ int shutdownProcess(Logger logger) throws Exception;
+}
Propchange: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessManager.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessManager.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessManager.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/ProcessManager.java Sat Dec 8 15:38:24 2012
@@ -21,6 +21,6 @@ package org.apache.axis.tools.maven.serv
import java.io.File;
public interface ProcessManager {
- void startProcess(String description, String[] cmdline, File workDir, ProcessStartAction startAction, ProcessStopAction stopAction) throws Exception;
+ void startProcess(String description, String[] cmdline, File workDir, ProcessControl processControl) throws Exception;
void stopAll() throws Exception;
}
Added: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java (added)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,77 @@
+/*
+ * 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 org.apache.axis.tools.maven.server;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Start a daemon.
+ *
+ * @goal start-daemon
+ * @phase pre-integration-test
+ * @requiresDependencyResolution test
+ */
+public class StartDaemonMojo extends AbstractStartProcessMojo {
+ /**
+ * The daemon class.
+ *
+ * @parameter
+ * @required
+ */
+ private String daemonClass;
+
+ /**
+ * The arguments to be passed to the main class.
+ *
+ * @parameter
+ */
+ private String[] args;
+
+ /**
+ * The working directory for the process.
+ *
+ * @parameter default-value="${project.build.directory}/work"
+ * @required
+ */
+ private File workDir;
+
+ protected void doExecute() throws MojoExecutionException, MojoFailureException {
+ int controlPort;
+ try {
+ ServerSocket ss = new ServerSocket(0);
+ controlPort = ss.getLocalPort();
+ ss.close();
+ } catch (IOException ex) {
+ throw new MojoFailureException("Failed to allocate port number", ex);
+ }
+ workDir.mkdirs();
+ String[] vmArgs = new String[args != null ? args.length + 2 : 2];
+ vmArgs[0] = daemonClass;
+ vmArgs[1] = String.valueOf(controlPort);
+ if (args != null) {
+ System.arraycopy(args, 0, vmArgs, 2, args.length);
+ }
+ startJavaProcess(daemonClass, "org.apache.axis.testutils.daemon.Launcher", vmArgs, workDir, new DaemonProcessControl(controlPort));
+ }
+}
Propchange: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartProcessMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartProcessMojo.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartProcessMojo.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartProcessMojo.java Sat Dec 8 15:38:24 2012
@@ -22,6 +22,7 @@ import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.logging.Logger;
/**
* Start an arbitrary Java process.
@@ -56,6 +57,13 @@ public class StartProcessMojo extends Ab
protected void doExecute() throws MojoExecutionException, MojoFailureException {
workDir.mkdirs();
- startJavaProcess(mainClass, mainClass, args != null ? args : new String[0], workDir, ProcessStartAction.NOP, ProcessStopAction.NOP);
+ startJavaProcess(mainClass, mainClass, args != null ? args : new String[0], workDir, new ProcessControl() {
+ public void initializeProcess(Logger logger, Process process) throws Exception {
+ }
+
+ public int shutdownProcess(Logger logger) throws Exception {
+ return RUNNING;
+ }
+ });
}
}
Modified: axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java (original)
+++ axis/axis1/java/trunk/maven/maven-axis-server-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java Sat Dec 8 15:38:24 2012
@@ -219,11 +219,10 @@ public class StartServerMojo extends Abs
"org.apache.axis.server.standalone.StandaloneAxisServer",
(String[])args.toArray(new String[args.size()]),
workDir,
- new AxisServerStartAction(actualPort, adminClient,
+ new AxisServerProcessControl(actualPort, adminClient,
(File[])deployments.toArray(new File[deployments.size()]),
- isDebug() || foreground ? Integer.MAX_VALUE : 20000),
- new AxisServerStopAction(adminClient,
- (File[])undeployments.toArray(new File[undeployments.size()])));
+ (File[])undeployments.toArray(new File[undeployments.size()]),
+ isDebug() || foreground ? Integer.MAX_VALUE : 20000));
} catch (Exception ex) {
throw new MojoFailureException("Failed to start server", ex);
}
Modified: axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java (original)
+++ axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java Sat Dec 8 15:38:24 2012
@@ -180,6 +180,13 @@ public abstract class AbstractWsdl2JavaM
private boolean helperGen;
/**
+ *
+ *
+ * @parameter default-value="false"
+ */
+ private boolean allowInvalidURL;
+
+ /**
* The location of the deployment WSDD file to be generated. This parameter is ignored if
* {@link #generate} is set to <code>client</code>. If this parameter is not specified, then no
* deployment WSDD will be generated.
@@ -269,7 +276,7 @@ public abstract class AbstractWsdl2JavaM
// emitter.setQuiet(quiet);
emitter.setTypeMappingVersion(typeMappingVersion);
emitter.setNowrap(noWrapped);
-// emitter.setAllowInvalidURL(allowInvalidURL);
+ emitter.setAllowInvalidURL(allowInvalidURL);
emitter.setWrapArrays(wrapArrays);
// if (namespaceMappingFile != null) {
// emitter.setNStoPkg(namespaceMappingFile.toString());
Propchange: axis/axis1/java/trunk/samples/jms-sample/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec 8 15:38:24 2012
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings
Added: axis/axis1/java/trunk/samples/jms-sample/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/pom.xml?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/samples/jms-sample/pom.xml (added)
+++ axis/axis1/java/trunk/samples/jms-sample/pom.xml Sat Dec 8 15:38:24 2012
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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>
+ <parent>
+ <groupId>org.apache.axis</groupId>
+ <artifactId>samples</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>jms-sample</artifactId>
+ <name>JMS Sample</name>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis-rt-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis-rt-transport-jms</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>stock-sample</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.6.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.6.4</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis-testutils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>maven-wsdl2java-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <file>src/main/wsdl/GetQuote.wsdl</file>
+ <generate>client</generate>
+ <typeMappingVersion>1.1</typeMappingVersion>
+ <deployScope>session</deployScope>
+ <allowInvalidURL>true</allowInvalidURL>
+ <mappings>
+ <mapping>
+ <namespace>urn:xmltoday-delayed-quotes</namespace>
+ <package>samples.jms.stub.xmltoday_delayed_quotes</package>
+ </mapping>
+ <mapping>
+ <namespace>urn:xmltoday-delayed-quotes</namespace>
+ <package>samples.jms.stub.xmltoday_delayed_quotes</package>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ <configuration>
+ <portNames>
+ <portName>test.brokerPort</portName>
+ </portNames>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <resources>
+ <resource>
+ <directory>src/test/conf</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <outputDirectory>${project.build.directory}/conf</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>maven-axis-server-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>start-broker</id>
+ <goals>
+ <goal>start-daemon</goal>
+ </goals>
+ <configuration>
+ <daemonClass>samples.jms.ActiveMQDaemon</daemonClass>
+ <args>
+ <arg>${test.brokerPort}</arg>
+ </args>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-broker</id>
+ <goals>
+ <goal>stop-all</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <echo message="Executing samples.jms.JMSTest ..."/>
+ <java classname="samples.jms.JMSTest" fork="true" failonerror="true">
+ <classpath refid="maven.test.classpath"/>
+ <sysproperty key="axis.ServerConfigFile" file="src/main/wsdd/server-config.wsdd"/>
+ <arg value="-c"/>
+ <arg value="${project.build.directory}/conf/activemq-connection-factory.properties"/>
+ <arg value="-d"/>
+ <arg value="dynamicQueues/testQ"/>
+ <arg value="XXX"/>
+ </java>
+ <echo message="Executing samples.jms.dii.JMSURLTest ..."/>
+ <java classname="samples.jms.dii.JMSURLTest" fork="true" failonerror="true">
+ <classpath refid="maven.test.classpath"/>
+ <sysproperty key="axis.ServerConfigFile" file="src/main/wsdd/server-config.wsdd"/>
+ <arg value="-c"/>
+ <arg value="${project.build.directory}/conf/activemq-connection-factory.properties"/>
+ <arg value="-d"/>
+ <arg value="dynamicQueues/testQ"/>
+ <arg value="-e"/>
+ <arg value="jms:/dynamicQueues/testQ?java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:${test.brokerPort}&ConnectionFactoryJNDIName=ConnectionFactory"/>
+ <arg value="XXX"/>
+ </java>
+ <echo message="Executing samples.jms.stub.JMSURLStubTest ..."/>
+ <java classname="samples.jms.stub.JMSURLStubTest" fork="true" failonerror="true">
+ <classpath refid="maven.test.classpath"/>
+ <sysproperty key="axis.ServerConfigFile" file="src/main/wsdd/server-config.wsdd"/>
+ <sysproperty key="axis.ClientConfigFile" file="src/main/wsdd/client-config.wsdd"/>
+ <arg value="-c"/>
+ <arg value="${project.build.directory}/conf/activemq-connection-factory.properties"/>
+ <arg value="-d"/>
+ <arg value="dynamicQueues/testQ"/>
+ <arg value="-e"/>
+ <arg value="jms:/dynamicQueues/testQ?java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:${test.brokerPort}&ConnectionFactoryJNDIName=ConnectionFactory"/>
+ <arg value="XXX"/>
+ </java>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: axis/axis1/java/trunk/samples/jms-sample/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Copied: axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/JMSTest.java (from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/JMSTest.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/JMSTest.java?p2=axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/JMSTest.java&p1=axis/axis1/java/trunk/distribution/src/main/files/samples/jms/JMSTest.java&r1=1418621&r2=1418689&rev=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/distribution/src/main/files/samples/jms/JMSTest.java (original)
+++ axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/JMSTest.java Sat Dec 8 15:38:24 2012
@@ -120,6 +120,7 @@ public class JMSTest {
catch(AxisFault af)
{
System.out.println(af.dumpToString());
+ System.exit(1);
}
}
Copied: axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/JMSURLTest.java (from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/dii/JMSURLTest.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/JMSURLTest.java?p2=axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/JMSURLTest.java&p1=axis/axis1/java/trunk/distribution/src/main/files/samples/jms/dii/JMSURLTest.java&r1=1418621&r2=1418689&rev=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/distribution/src/main/files/samples/jms/dii/JMSURLTest.java (original)
+++ axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/dii/JMSURLTest.java Sat Dec 8 15:38:24 2012
@@ -6,7 +6,6 @@ import org.apache.axis.client.Service;
import org.apache.axis.configuration.XMLStringProvider;
import org.apache.axis.deployment.wsdd.WSDDConstants;
import org.apache.axis.encoding.XMLType;
-import org.apache.axis.transport.jms.JMSConstants;
import org.apache.axis.transport.jms.JMSTransport;
import org.apache.axis.transport.jms.SimpleJMSListener;
import org.apache.axis.utils.Options;
@@ -36,24 +35,7 @@ public class JMSURLTest {
"</deployment>";
// the JMS URL target endpoint address
- static String sampleJmsUrl = "jms:/MyQ?" +
- "vendor=JNDI" +
- "&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory" +
- "&java.naming.provider.url=file:///c:/JNDIStore" +
- "&ConnectionFactoryJNDIName=MyCF" +
- "&deliveryMode=persistent" +
- "&priority=5" +
- "&ttl=10000" +
- "&debug=true";
- /*
- // example using Sonic
- static String sampleJmsUrl = "jms:/SampleQ1?" +
- "vendor=SonicMQ" +
- "&brokerURL=localhost:2506" +
- "&deliveryMode=persistent" +
- "&priority=5" +
- "&ttl=10000";
- */
+ static String sampleJmsUrl;
public static void main(String args[]) throws Exception {
Options opts = new Options( args );
@@ -69,6 +51,11 @@ public class JMSURLTest {
HashMap cfMap = SimpleJMSListener.createCFMap(opts);
String destination = opts.isValueSet('d');
+ sampleJmsUrl = opts.isValueSet('e');
+ if (sampleJmsUrl == null) {
+ printUsage();
+ }
+
// create the jms listener
SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
cfMap,
@@ -92,6 +79,7 @@ public class JMSURLTest {
catch(AxisFault af)
{
System.out.println(af.dumpToString());
+ System.exit(1);
}
}
@@ -102,7 +90,7 @@ public class JMSURLTest {
// note: this is optional, as all connectors will be closed upon exit
JMSTransport.closeMatchingJMSConnectors(sampleJmsUrl, username, password);
- System.exit(1);
+ System.exit(0);
}
public static Float getQuote(String ticker, String username, String password)
@@ -151,6 +139,7 @@ public class JMSURLTest {
System.out.println(" -c connection factory properties filename");
System.out.println(" -d destination");
System.out.println(" -t topic [absence of -t indicates queue]");
+ System.out.println(" -e the JMS endpoint URL to use for the client");
System.out.println();
System.out.println(" -u username");
System.out.println(" -w password");
Copied: axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/JMSURLStubTest.java (from r1418621, axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/JMSURLStubTest.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/JMSURLStubTest.java?p2=axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/JMSURLStubTest.java&p1=axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/JMSURLStubTest.java&r1=1418621&r2=1418689&rev=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/distribution/src/main/files/samples/jms/stub/JMSURLStubTest.java (original)
+++ axis/axis1/java/trunk/samples/jms-sample/src/main/java/samples/jms/stub/JMSURLStubTest.java Sat Dec 8 15:38:24 2012
@@ -25,6 +25,8 @@ import java.util.HashMap;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
@@ -44,17 +46,23 @@ public class JMSURLStubTest extends Test
super(name);
}
- public static Float getQuote(String ticker) throws AxisFault {
+ public static Float getQuote(String endptAddr, String ticker) throws AxisFault {
float quote = -1.0F;
GetQuoteServiceLocator locator = new GetQuoteServiceLocator();
GetQuote getQuote;
+ if (endptAddr == null) {
+ endptAddr = locator.getGetQuoteAddress();
+ }
+
try {
- getQuote = locator.getGetQuote();
+ getQuote = locator.getGetQuote(new URL(endptAddr));
}
catch (ServiceException e) {
throw new AxisFault("JAX-RPC ServiceException caught: ", e);
+ } catch (MalformedURLException e) {
+ throw new AxisFault("MalformedURLException caught: ", e);
}
assertTrue("getQuote is null", getQuote != null);
@@ -64,7 +72,6 @@ public class JMSURLStubTest extends Test
// close matching connectors
// note: this is optional, as all connectors will be closed upon exit
- String endptAddr = locator.getGetQuoteAddress();
JMSTransport.closeMatchingJMSConnectors(endptAddr, null, null);
}
catch (RemoteException e) {
@@ -82,6 +89,7 @@ public class JMSURLStubTest extends Test
System.out.println(" -c connection factory properties filename");
System.out.println(" -d destination");
System.out.println(" -t topic [absence of -t indicates queue]");
+ System.out.println(" -e the JMS endpoint URL to use for the client");
System.out.println();
System.out.println(" -u username");
System.out.println(" -w password");
@@ -110,6 +118,8 @@ public class JMSURLStubTest extends Test
HashMap cfMap = SimpleJMSListener.createCFMap(opts);
String destination = opts.isValueSet('d');
+ String endptAddr = opts.isValueSet('e');
+
args = opts.getRemainingArgs();
if ( args == null || args.length == 0)
printUsage();
@@ -129,17 +139,18 @@ public class JMSURLStubTest extends Test
{
try
{
- Float quote = stubTest.getQuote(args[i]);
+ Float quote = stubTest.getQuote(endptAddr, args[i]);
System.out.println(args[i] + ": " + quote);
}
catch(AxisFault af)
{
System.out.println(af.dumpToString());
+ System.exit(1);
}
}
listener.shutdown();
- System.exit(1);
+ System.exit(0);
}
}
Added: axis/axis1/java/trunk/samples/jms-sample/src/test/conf/activemq-connection-factory.properties
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/src/test/conf/activemq-connection-factory.properties?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/samples/jms-sample/src/test/conf/activemq-connection-factory.properties (added)
+++ axis/axis1/java/trunk/samples/jms-sample/src/test/conf/activemq-connection-factory.properties Sat Dec 8 15:38:24 2012
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:${test.brokerPort}
+transport.jms.ConnectionFactoryJNDIName=ConnectionFactory
Added: axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java?rev=1418689&view=auto
==============================================================================
--- axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java (added)
+++ axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java Sat Dec 8 15:38:24 2012
@@ -0,0 +1,36 @@
+/*
+ * 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 samples.jms;
+
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.axis.testutils.daemon.Daemon;
+
+public class ActiveMQDaemon implements Daemon {
+ private BrokerService broker;
+
+ public void start(String[] args) throws Exception {
+ broker = BrokerFactory.createBroker("broker:(tcp://localhost:" + args[0] + ")?useJmx=false&persistent=false");
+ broker.start();
+ }
+
+ public void stop() throws Exception {
+ broker.stop();
+ }
+}
Propchange: axis/axis1/java/trunk/samples/jms-sample/src/test/java/samples/jms/ActiveMQDaemon.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/samples/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/pom.xml?rev=1418689&r1=1418688&r2=1418689&view=diff
==============================================================================
--- axis/axis1/java/trunk/samples/pom.xml (original)
+++ axis/axis1/java/trunk/samples/pom.xml Sat Dec 8 15:38:24 2012
@@ -42,6 +42,7 @@
<module>integrationguide-sample</module>
<module>jaxm-sample</module>
<module>jaxrpc-sample</module>
+ <module>jms-sample</module>
<module>message-sample</module>
<module>mtomstub-sample</module>
<module>misc-sample</module>