Author: ffang
Date: Mon Sep 18 00:01:55 2006
New Revision: 447292
URL: http://svn.apache.org/viewvc?view=rev&rev=447292
Log:
[JIRA CXF-92] porting doc/lit/bare system test
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
(with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
(with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
(with props)
Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
incubator/cxf/trunk/testutils/src/main/resources/wsdl/doc_lit_bare.wsdl
Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=447292&r1=447291&r2=447292
==============================================================================
---
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Mon Sep 18 00:01:55 2006
@@ -112,7 +112,9 @@
// Operation wide style, what to do with the mixed style/use?
for (BindingOperationInfo boi : sbi.getOperations()) {
- bindingStyle = sbi.getStyle(boi.getOperationInfo());
+ if (sbi.getStyle(boi.getOperationInfo()) != null) {
+ bindingStyle = sbi.getStyle(boi.getOperationInfo());
+ }
if (boi.getUnwrappedOperation() == null) {
parameterStyle = SoapConstants.PARAMETER_STYLE_BARE;
}
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java?view=auto&rev=447292
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
Mon Sep 18 00:01:55 2006
@@ -0,0 +1,116 @@
+/**
+ * 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.cxf.systest.basicDOCBare;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.ClientServerTestBase;
+import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
+import org.apache.hello_world_doc_lit_bare.SOAPService;
+import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
+
+public class DOCBareClientServerTest extends ClientServerTestBase {
+
+ private final QName serviceName = new
QName("http://apache.org/hello_world_doc_lit_bare",
+ "SOAPService");
+ private final QName portName = new
QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort");
+
+ public static Test suite() throws Exception {
+ TestSuite suite = new TestSuite(DOCBareClientServerTest.class);
+ return new ClientServerSetupBase(suite) {
+ public void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
launchServer(Server.class));
+ }
+ };
+
+ }
+
+ public void testBasicConnection() throws Exception {
+ URL wsdl = getClass().getResource("/wsdl/doc_lit_bare.wsdl");
+ assertNotNull("WSDL is null", wsdl);
+
+ SOAPService service = new SOAPService(wsdl, serviceName);
+ assertNotNull("Service is ull ", service);
+
+ PutLastTradedPricePortType putLastTradedPrice =
service.getPort(portName,
+
PutLastTradedPricePortType.class);
+ TradePriceData priceData = new TradePriceData();
+ priceData.setTickerPrice(1.0f);
+ priceData.setTickerSymbol("CELTIX");
+
+ Holder<TradePriceData> holder = new Holder<TradePriceData>(priceData);
+
+ for (int i = 0; i < 5; i++) {
+ putLastTradedPrice.sayHi(holder);
+ assertEquals(4.5f, holder.value.getTickerPrice());
+ assertEquals("OBJECTWEB", holder.value.getTickerSymbol());
+ putLastTradedPrice.putLastTradedPrice(priceData);
+ }
+
+ }
+
+ public void testAnnotation() throws Exception {
+ Class claz = PutLastTradedPricePortType.class;
+ TradePriceData priceData = new TradePriceData();
+ Holder<TradePriceData> holder = new Holder<TradePriceData>(priceData);
+ Method method = claz.getMethod("sayHi", holder.getClass());
+ assertNotNull("Can not find SayHi method in generated class ", method);
+ Annotation ann = method.getAnnotation(WebMethod.class);
+ WebMethod webMethod = (WebMethod)ann;
+ assertEquals(webMethod.operationName(), "SayHi");
+ Annotation[][] paraAnns = method.getParameterAnnotations();
+ for (Annotation[] paraType : paraAnns) {
+ for (Annotation an : paraType) {
+ if (an.annotationType() == WebParam.class) {
+ WebParam webParam = (WebParam)an;
+ assertNotSame("", webParam.targetNamespace());
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(DOCBareClientServerTest.class);
+ }
+
+ /*
+ * public static void main(String[] args) { ClientServerTest cst = new
+ * ClientServerTest(); if ("client".equals(args[0])) { try {
+ * cst.testAsyncPollingCall(); } catch (Exception ex) {
+ * ex.printStackTrace(); } System.err.println("Exiting...........");
+ * System.exit(0); } else if ("server".equals(args[0])) { try { //
+ * cst.setUp(); cst.onetimeSetUp(); } catch (Exception ex) {
+ * ex.printStackTrace(); } } else { System.out.println("Invaid arg"); } }
+ */
+
+}
+
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/DOCBareClientServerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java?view=auto&rev=447292
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
Mon Sep 18 00:01:55 2006
@@ -0,0 +1,48 @@
+/**
+ * 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.cxf.systest.basicDOCBare;
+import javax.xml.ws.Holder;
+
+import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
+import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
+
+
[EMAIL PROTECTED](serviceName = "SOAPService",
+ portName = "SoapPort",
+ endpointInterface =
"org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType",
+ targetNamespace =
"http://apache.org/hello_world_doc_lit_bare")
+public class PutLastTradedPriceImpl implements PutLastTradedPricePortType {
+
+ public void sayHi(Holder<TradePriceData> inout) {
+ inout.value.setTickerPrice(4.5f);
+ inout.value.setTickerSymbol("OBJECTWEB");
+ }
+ public void putLastTradedPrice(TradePriceData body) {
+ System.out.println("-----TradePriceData TickerPrice : ----- " +
body.getTickerPrice());
+ System.out.println("-----TradePriceData TickerSymbol : ----- " +
body.getTickerSymbol());
+
+ }
+
+ public String bareNoParam() {
+ return "testResponse";
+ }
+
+
+}
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/PutLastTradedPriceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java?view=auto&rev=447292
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
Mon Sep 18 00:01:55 2006
@@ -0,0 +1,59 @@
+/**
+ * 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.cxf.systest.basicDOCBare;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.systest.common.TestServerBase;
+
+public class Server extends TestServerBase {
+
+
+ protected void run() {
+ Object implementor = new PutLastTradedPriceImpl();
+ String address =
"http://localhost:9107/SOAPDocLitBareService/SoapPort";
+ Endpoint ep = Endpoint.create(implementor);
+ Map<String, Object> props = new HashMap<String, Object>(2);
+ props.put(Endpoint.WSDL_SERVICE, new
QName("http://apache.org/hello_world_doc_lit_bare",
+ "SOAPService"));
+ props.put(Endpoint.WSDL_PORT, new
QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort"));
+ ep.setProperties(props);
+ ep.publish(address);
+ }
+
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
\ No newline at end of file
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/basicDOCBare/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/testutils/src/main/resources/wsdl/doc_lit_bare.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/doc_lit_bare.wsdl?view=diff&rev=447292&r1=447291&r2=447292
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/doc_lit_bare.wsdl
(original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/doc_lit_bare.wsdl Mon
Sep 18 00:01:55 2006
@@ -100,7 +100,7 @@
</binding>
<wsdl:service name="SOAPService">
<wsdl:port name="SoapPort" binding="tns:PutLastTradedPriceSoapBinding">
- <soap:address
location="http://localhost:9003/SOAPDocLitBareService/SoapPort"/>
+ <soap:address
location="http://localhost:9107/SOAPDocLitBareService/SoapPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>