cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1102593 - in /cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws: ArrayService.java ArrayServiceImpl.java ArrayServiceServer.java JaxWsDynamicClientTest.java
Date Fri, 13 May 2011 07:51:13 GMT
Author: ffang
Date: Fri May 13 07:51:12 2011
New Revision: 1102593

URL: http://svn.apache.org/viewvc?rev=1102593&view=rev
Log:
[CXF-3501]testcase to demonstrate how to pass array by dynamic client

Added:
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayService.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceImpl.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceServer.java
Modified:
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java

Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayService.java?rev=1102593&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayService.java
(added)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayService.java
Fri May 13 07:51:12 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.jaxws;
+
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "org.apache.cxf.systest.jaxws")
+public interface ArrayService {
+    @WebMethod(operationName = "init")
+    void initValueNotNull(@WebParam(name = "values") String[] values);
+
+}
+

Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceImpl.java?rev=1102593&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceImpl.java
(added)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceImpl.java
Fri May 13 07:51:12 2011
@@ -0,0 +1,38 @@
+/**
+ * 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.jaxws;
+
+import java.util.Arrays;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "org.apache.cxf.systest.jaxws", 
+            endpointInterface = "org.apache.cxf.systest.jaxws.ArrayService")
+public class ArrayServiceImpl implements ArrayService {
+
+    @Override
+    public void initValueNotNull(String[] values) {
+        System.out.println("values length is " + values.length);
+        System.out.println("Got values: " + Arrays.asList(values));
+
+    }
+
+
+
+}

Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceServer.java?rev=1102593&view=auto
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceServer.java
(added)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ArrayServiceServer.java
Fri May 13 07:51:12 2011
@@ -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.cxf.systest.jaxws;
+
+import javax.xml.ws.Endpoint;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class ArrayServiceServer extends AbstractBusTestServerBase {
+    static final String PORT1 = allocatePort(ArrayServiceServer.class);
+
+    protected void run() {
+        Object implementor = new ArrayServiceImpl();
+        String address = "http://localhost:" + PORT1 + "/ArrayService";
+        Endpoint.publish(address, implementor);
+    }
+
+    public static void main(String[] args) {
+        try {
+            ArrayServiceServer s = new ArrayServiceServer();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+}

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java?rev=1102593&r1=1102592&r2=1102593&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java
Fri May 13 07:51:12 2011
@@ -22,11 +22,14 @@ package org.apache.cxf.systest.jaxws;
 import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientCallback;
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
 import org.apache.cxf.no_body_parts.types.Operation1;
 import org.apache.cxf.no_body_parts.types.Operation1Response;
@@ -38,6 +41,7 @@ import org.junit.Test;
 
 public class JaxWsDynamicClientTest extends AbstractBusClientServerTestBase {
     static final String PORT = TestUtil.getPortNumber(ServerNoBodyParts.class);
+    static final String PORT1 = TestUtil.getPortNumber(ArrayServiceServer.class);
 
     private String md5(byte[] bytes) {
         MessageDigest algorithm;
@@ -61,6 +65,8 @@ public class JaxWsDynamicClientTest exte
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
                    launchServer(ServerNoBodyParts.class, true));
+        assertTrue("server did not launch correctly",
+                   launchServer(ArrayServiceServer.class, true));
     }
     
     @Test
@@ -85,4 +91,18 @@ public class JaxWsDynamicClientTest exte
         assertEquals(md5(bucketOfBytes), r.getStatus());
     }
     
+    @Test
+    public void testArrayList() throws Exception {
+        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
+        Client client = dcf.createClient(new URL("http://localhost:"
+                                                 + PORT1 + "/ArrayService?wsdl"));
+
+        String[] values = new String[] {"foobar", "something" };
+        List<String> list = Arrays.asList(values);
+        
+        client.getOutInterceptors().add(new LoggingOutInterceptor());
+        client.getInInterceptors().add(new LoggingInInterceptor());
+        client.invoke("init", list);
+    }
+    
 }



Mime
View raw message