You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2013/09/10 14:52:10 UTC

svn commit: r1521467 - in /cxf/trunk/rt/transports/http-netty/netty-server/src/test: java/org/apache/cxf/transport/http/netty/server/integration/ resources/org/apache/cxf/transport/http/netty/server/integration/

Author: ningjiang
Date: Tue Sep 10 12:52:09 2013
New Revision: 1521467

URL: http://svn.apache.org/r1521467
Log:
Added an unit test in netty-server transport

Added:
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/SSLNettySpringServerTest.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/resources/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/SSLNettySpringServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/SSLNettySpringServerTest.java?rev=1521467&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/SSLNettySpringServerTest.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/SSLNettySpringServerTest.java Tue Sep 10 12:52:09 2013
@@ -0,0 +1,70 @@
+/**
+ * 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.transport.http.netty.server.integration;
+
+import java.net.URL;
+import javax.xml.ws.Endpoint;
+import org.apache.hello_world_soap_http.SOAPService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * publish the service with SSL configuraiton with Spring
+ */
+public class SSLNettySpringServerTest extends SSLNettyServerTest {
+    public static final String PORT = allocatePort(SSLNettySpringServerTest.class);
+
+    static {
+        System.setProperty("SSLNettySpringServerTest.port", PORT);
+    }
+    static ConfigurableApplicationContext context;
+
+    @BeforeClass
+    public static void start() throws Exception {
+        context = new ClassPathXmlApplicationContext(
+                "/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml");
+
+        address = "https://localhost:" + PORT + "/SoapContext/SoapPort";
+        ep = context.getBean("myEndpoint", Endpoint.class);
+
+        URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+
+        SOAPService service = new SOAPService(wsdl);
+        assertNotNull("Service is null", service);
+
+        g = service.getSoapPort();
+        assertNotNull("Port is null", g);
+    }
+
+    @AfterClass
+    public static void stop() throws Exception {
+        if (g != null) {
+            ((java.io.Closeable)g).close();
+        }
+        if (ep != null) {
+            ep.stop();
+        }
+        ep = null;
+        context.close();
+    }
+
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/resources/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/resources/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml?rev=1521467&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/resources/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/resources/org/apache/cxf/transport/http/netty/server/integration/ApplicationContext.xml Tue Sep 10 12:52:09 2013
@@ -0,0 +1,83 @@
+<?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.
+-->
+
+<!-- 
+  ** This file configures the Server which runs the web service.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xmlns:httpn="http://cxf.apache.org/transports/http-netty-server/configuration"
+  xmlns:jaxws="http://cxf.apache.org/jaxws"
+  xmlns:cxf="http://cxf.apache.org/core"
+  xsi:schemaLocation="
+            http://cxf.apache.org/configuration/security  		      
+            http://cxf.apache.org/schemas/configuration/security.xsd
+            http://cxf.apache.org/transports/http/configuration
+            http://cxf.apache.org/schemas/configuration/http-conf.xsd
+            http://cxf.apache.org/transports/http-netty-server/configuration 
+		    http://cxf.apache.org/schemas/configuration/http-netty-server.xsd
+		    http://cxf.apache.org/jaxws
+            http://cxf.apache.org/schemas/jaxws.xsd
+            http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+            http://www.springframework.org/schema/beans
+            http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <cxf:bus/>
+
+    <jaxws:endpoint
+            id="myEndpoint"
+            bus="cxf"
+            implementor="org.apache.hello_world_soap_http.GreeterImpl"
+            address="https://localhost:${SSLNettySpringServerTest.port}/SoapContext/SoapPort"/>
+
+    <http:destination name="{http://apache.org/hello_world_soap_http}GreeterPort.http-destination">
+    </http:destination>
+  
+  <httpn:engine-factory>
+   <httpn:engine port="${SSLNettySpringServerTest.port}">
+    <httpn:tlsServerParameters>
+      <sec:keyManagers keyPassword="skpass">
+           <sec:keyStore file="src/test/resources/org/apache/cxf/transport/http/netty/server/integration/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:keyManagers>
+      <sec:trustManagers>
+           <sec:keyStore file="src/test/resources/org/apache/cxf/transport/http/netty/server/integration/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:trustManagers>
+      <sec:cipherSuitesFilter>
+        <!-- these filters ensure that a ciphersuite with
+          export-suitable or null encryption is used,
+          but exclude anonymous Diffie-Hellman key change as
+          this is vulnerable to man-in-the-middle attacks -->
+        <sec:include>.*_EXPORT_.*</sec:include>
+        <sec:include>.*_EXPORT1024_.*</sec:include>
+        <sec:include>.*_WITH_DES_.*</sec:include>
+        <sec:include>.*_WITH_AES_.*</sec:include>
+        <sec:include>.*_WITH_NULL_.*</sec:include>
+        <sec:exclude>.*_DH_anon_.*</sec:exclude>
+      </sec:cipherSuitesFilter>
+      <sec:clientAuthentication want="true" required="true"/>
+    </httpn:tlsServerParameters>
+   </httpn:engine>
+  </httpn:engine-factory>
+</beans>