You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/04/09 13:39:40 UTC
svn commit: r526718 -
/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Author: mmao
Date: Mon Apr 9 04:39:39 2007
New Revision: 526718
URL: http://svn.apache.org/viewvc?view=rev&rev=526718
Log:
Add unit test in tools/javato which fail the jaxwsservicefactorybean
Modified:
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?view=diff&rev=526718&r1=526717&r2=526718
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java Mon Apr 9 04:39:39 2007
@@ -20,14 +20,27 @@
package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
import java.io.File;
-import junit.framework.TestCase;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ProcessorTestBase;
import org.apache.cxf.tools.fortest.classnoanno.docbare.Stock;
import org.apache.cxf.tools.fortest.withannotation.doc.Hello;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator;
-public class JaxwsServiceBuilderTest extends TestCase {
+public class JaxwsServiceBuilderTest extends ProcessorTestBase {
+ JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
+ WSDL11Generator generator = new WSDL11Generator();
+
+ public void setUp() throws Exception {
+ super.setUp();
+ builder.setBus(BusFactory.getDefaultBus());
+ }
+ public void tearDown() {
+ }
+
public void testGetOutputFile() {
- JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
builder.setServiceClass(Stock.class);
assertNull(builder.getOutputFile());
@@ -36,5 +49,42 @@
File expected = new File("file:///c:/tmp.wsdl");
assertTrue(expected.equals(builder.getOutputFile()));
}
-
+
+ public void testBare() {
+ // REVISIT: Wrong part name
+ // <wsdl:message name="getPrice">
+ // <wsdl:part name="arg00" type="xsd:string">
+ // </wsdl:part>
+
+ builder.setServiceClass(Stock.class);
+ ServiceInfo service = builder.build();
+ generator.setServiceModel(service);
+ File output = getOutputFile("stock_bare.wsdl");
+ assertNotNull(output);
+ generator.generate(output);
+ assertTrue(output.exists());
+ }
+
+ public void testWrapped() {
+ // REVIST: If there is wsdlLocation annotation, but the serviceBuilder can not load the wsdl,
+ // we should print WARNs not throw exceptions and fail the build.
+ // builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.doc.Hello.class);
+
+ // REVISIT: Wrong part name
+ // <wsdl:message name="getPrice">
+ // <wsdl:part name="arg00" type="xsd:string">
+ // </wsdl:part>
+
+ builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.doc.HelloWrapped.class);
+ ServiceInfo service = builder.build();
+ generator.setServiceModel(service);
+ File output = getOutputFile("hello_wrapped.wsdl");
+ assertNotNull(output);
+ generator.generate(output);
+ assertTrue(output.exists());
+ }
+
+ private File getOutputFile(String fileName) {
+ return new File(output, fileName);
+ }
}