You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/08/05 05:50:42 UTC
svn commit: r682576 - in /geronimo/server/branches/2.1:
plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/
testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/
testsuite/we...
Author: gawor
Date: Mon Aug 4 20:50:42 2008
New Revision: 682576
URL: http://svn.apache.org/viewvc?rev=682576&view=rev
Log:
add classes generated by wsgen to module classpath (GERONIMO-3793)
Added:
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java (with props)
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java (with props)
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml (with props)
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml (with props)
Modified:
geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java
geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java
Modified: geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java?rev=682576&r1=682575&r2=682576&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java (original)
+++ geronimo/server/branches/2.1/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java Mon Aug 4 20:50:42 2008
@@ -50,6 +50,9 @@
private static final Log LOG = LogFactory.getLog(WsdlGenerator.class);
+ private final static String ADD_TO_CLASSPATH_WSGEN_PROPERTY =
+ "org.apache.geronimo.jaxws.wsgen.addToClassPath";
+
private final static String FORK_WSGEN_PROPERTY =
"org.apache.geronimo.jaxws.wsgen.fork";
@@ -62,6 +65,7 @@
private QName wsdlPort;
private boolean forkWsgen = getForkWsgen();
private long forkTimeout = getForTimeout();
+ private boolean addToClassPath = getDefaultAddToClassPath();
private JAXWSTools jaxwsTools;
private static boolean getForkWsgen() {
@@ -88,6 +92,15 @@
}
}
+ private static boolean getDefaultAddToClassPath() {
+ String value = System.getProperty(ADD_TO_CLASSPATH_WSGEN_PROPERTY);
+ if (value == null) {
+ return true;
+ } else {
+ return Boolean.parseBoolean(value);
+ }
+ }
+
public WsdlGenerator() {
this.jaxwsTools = new JAXWSTools();
}
@@ -116,6 +129,14 @@
return this.wsdlPort;
}
+ public void setAddToClassPath(boolean addToClassPath) {
+ this.addToClassPath = addToClassPath;
+ }
+
+ public boolean getAddToClassPath() {
+ return this.addToClassPath;
+ }
+
private URL[] getWsgenClasspath(DeploymentContext context) throws Exception {
DeploymentConfigurationManager cm = (DeploymentConfigurationManager)context.getConfigurationManager();
Collection<? extends Repository> repositories = cm.getRepositories();
@@ -316,6 +337,9 @@
if (wsdlFile == null) {
throw new DeploymentException("Unable to find the service wsdl file");
}
+ if (this.addToClassPath) {
+ context.getConfiguration().addToClassPath(baseDir.getName());
+ }
return getRelativeNameOrURL(moduleBase, wsdlFile);
} else {
throw new DeploymentException("WSDL generation failed");
Added: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java?rev=682576&view=auto
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java (added)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java Mon Aug 4 20:50:42 2008
@@ -0,0 +1,45 @@
+/**
+ * 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.geronimo.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.WebService;
+
+@WebService(name = "Person",
+ targetNamespace = "http://org.apache.geronimo.test.person")
+public class JAXWSBean3 {
+
+ private static List<Person> PERSONS = new ArrayList<Person>();
+
+ static {
+ PERSONS.add(new Person("eric", "cartman"));
+ PERSONS.add(new Person("homer", "simpson"));
+ }
+
+ public Person[] getPersons1() {
+ return PERSONS.toArray(new Person [] {});
+ }
+
+ public List<Person> getPersons2() {
+ return PERSONS;
+ }
+
+}
Propchange: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/JAXWSBean3.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java?rev=682576&view=auto
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java (added)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java Mon Aug 4 20:50:42 2008
@@ -0,0 +1,50 @@
+/**
+ * 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.geronimo.test;
+
+public class Person {
+
+ private String firstName;
+ private String lastName;
+
+ public Person() {
+ }
+
+ public Person(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+}
Propchange: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/main/java/org/apache/geronimo/test/Person.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java?rev=682576&r1=682575&r2=682576&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java (original)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java Mon Aug 4 20:50:42 2008
@@ -51,15 +51,37 @@
@Test
public void testInvocation1() throws Exception {
- testInvocation("/JAXWSBean1Service", "/request1.xml", "JAXWSBean1");
+ Document doc = getResponse("/JAXWSBean1Service", "/request1.xml");
+
+ Text replyMsg = findText(doc.getDocumentElement(), "JAXWSBean1 foo bar");
+ assertTrue("reply message", replyMsg != null);
}
@Test
public void testInvocation2() throws Exception {
- testInvocation("/bean2", "/request1.xml", "JAXWSBean2");
+ Document doc = getResponse("/bean2", "/request1.xml");
+
+ Text replyMsg = findText(doc.getDocumentElement(), "JAXWSBean2 foo bar");
+ assertTrue("reply message", replyMsg != null);
}
- private void testInvocation(String servlet, String requestFile, String name) throws Exception {
+ @Test
+ public void testInvocation3() throws Exception {
+ Document doc = getResponse("/JAXWSBean3Service", "/request2a.xml");
+
+ assertTrue(findText(doc.getDocumentElement(), "simpson") != null);
+ assertTrue(findText(doc.getDocumentElement(), "cartman") != null);
+ }
+
+ @Test
+ public void testInvocation4() throws Exception {
+ Document doc = getResponse("/JAXWSBean3Service", "/request2b.xml");
+
+ assertTrue(findText(doc.getDocumentElement(), "simpson") != null);
+ assertTrue(findText(doc.getDocumentElement(), "cartman") != null);
+ }
+
+ private Document getResponse(String servlet, String requestFile) throws Exception {
String warName = System.getProperty("webAppName");
assertNotNull("Web application name not specified", warName);
@@ -78,14 +100,13 @@
InputSource is = new InputSource(new StringReader(reply));
Document doc = parseMessage(is);
- Text replyMsg = findText(doc.getDocumentElement(), name + " foo bar");
- assertTrue("reploy message", replyMsg != null);
+ return doc;
} finally {
conn.disconnect();
}
}
-
+
private Document parseMessage(InputSource is) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
@@ -153,6 +174,7 @@
buf.append(inputLine);
}
in.close();
+ System.out.println("--");
return buf.toString();
}
Added: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml?rev=682576&view=auto
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml (added)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml Mon Aug 4 20:50:42 2008
@@ -0,0 +1,25 @@
+<?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.
+-->
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <x:getPersons1 xmlns:x="http://org.apache.geronimo.test.person">
+ </x:getPersons1>
+ </soap:Body>
+</soap:Envelope>
Propchange: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2a.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml?rev=682576&view=auto
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml (added)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml Mon Aug 4 20:50:42 2008
@@ -0,0 +1,25 @@
+<?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.
+-->
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <x:getPersons2 xmlns:x="http://org.apache.geronimo.test.person">
+ </x:getPersons2>
+ </soap:Body>
+</soap:Envelope>
Propchange: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-partial/src/test/resources/request2b.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java?rev=682576&r1=682575&r2=682576&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java (original)
+++ geronimo/server/branches/2.1/testsuite/webservices-testsuite/jaxws-tests/jaxws-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java Mon Aug 4 20:50:42 2008
@@ -52,20 +52,31 @@
@Test
public void testInvocation1() throws Exception {
- testInvocation("/servlet1", "/request1.xml");
+ // service without WSDL
+ Document doc = getResponse("/servlet1", "/request3.xml");
+ Text replyMsg = findText(doc.getDocumentElement(), "Hello foo bar");
+ if (replyMsg == null) {
+ // XXX: work-around for CXF, wants <requestType> to be unqualified
+ doc = getResponse("/servlet1", "/request1.xml");
+ replyMsg = findText(doc.getDocumentElement(), "Hello foo bar");
+ }
+ assertTrue("reply message", replyMsg != null);
}
@Test
- public void testInvocation2() throws Exception {
- testInvocation("/servlet2", "/request3.xml");
+ public void testInvocation2() throws Exception {
+ // service with WSDL
+ Document doc = getResponse("/servlet2", "/request3.xml");
+ Text replyMsg = findText(doc.getDocumentElement(), "Hello foo bar");
+ assertTrue("reply message", replyMsg != null);
}
- private void testInvocation(String servlet, String requestFile) throws Exception {
+ private Document getResponse(String servlet, String requestFile) throws Exception {
String warName = System.getProperty("webAppName");
assertNotNull("Web application name not specified", warName);
InputStream requestInput = JaxWSTest.class.getResourceAsStream(requestFile);
- assertNotNull("SOAP request not specified", requestInput);
+ assertNotNull("SOAP request not found: " + requestFile, requestInput);
URL url = new URL(baseURL + warName + servlet);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
@@ -79,8 +90,7 @@
InputSource is = new InputSource(new StringReader(reply));
Document doc = parseMessage(is);
- Text replyMsg = findText(doc.getDocumentElement(), "Hello foo bar");
- assertTrue("reploy message", replyMsg != null);
+ return doc;
} finally {
conn.disconnect();