From 26c7d87982e6eb53ff3f5b394b06af135395824b Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 6 Oct 2010 13:54:26 +0000 Subject: Copy itest and compliance test to be under testing folder git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1005039 13f79535-47bb-0310-9956-ffa450edef68 --- .../trunk/testing/itest/ws/http-ssl/README | 68 ++++++++++++++++ .../trunk/testing/itest/ws/http-ssl/pom.xml | 52 ++++++++++++ .../binding/ws/axis2/helloworld/HelloWorld.java | 29 +++++++ .../ws/axis2/helloworld/HelloWorldClient.java | 35 ++++++++ .../ws/axis2/helloworld/HelloWorldService.java | 30 +++++++ .../main/resources/META-INF/sca-contribution.xml | 23 ++++++ ....apache.tuscany.sca.definitions.xml.Definitions | 17 ++++ .../binding/ws/axis2/helloworld/definitions.xml | 35 ++++++++ .../ws/axis2/helloworld/helloworld.composite | 59 ++++++++++++++ .../binding/ws/axis2/helloworld/helloworld.wsdl | 90 +++++++++++++++++++++ .../sca/binding/ws/axis2/helloworld/tuscany.jks | Bin 0 -> 1378 bytes .../sca/binding/ws/axis2/HTTPSTestCase.java | 59 ++++++++++++++ 12 files changed, 497 insertions(+) create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/README create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/pom.xml create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/definitions.xml create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.composite create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.wsdl create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/tuscany.jks create mode 100644 sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HTTPSTestCase.java (limited to 'sca-java-2.x/trunk/testing/itest/ws/http-ssl') diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/README b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/README new file mode 100644 index 0000000000..41dcb8680b --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/README @@ -0,0 +1,68 @@ +The module tests web service communications running over HTTPS. HTTPS is configured +in this embedded test environment by adding the confidentiality intent to both +reference and service and by configuring reference and service side policy sets +to configure the web service binding appropriately to enable SSL. + +When running the web service binding in a container that itself is configured +to provide SSL support these policy sets are not required. TODO can they themselves +detect that they are not required. + +The SSL configuration depends on public/private key pairs and a keystore. This is how +they are organized and generated + + +Generate Private/Public keys into a keystore for use at the server +------------------------------------------------------------------ + +keytool -genkey -keyalg RSA -sigalg MD5withRSA -keysize 1024 -alias TuscanyUser -dname "CN=Tuscany Service, OU=Tuscany, O=Apache, L=Hursley, S=Hampshire, C=UK" -storetype JKS -keystore tuscany.jks -validity 9999 -keypass tuscany -storepass tuscany + +View the contents of the key store that result +---------------------------------------------- + +keytool -list -v -keystore tuscany.jks -storepass tuscany + +Keystore type: JKS +Keystore provider: SUN + +Your keystore contains 1 entry + +Alias name: tuscanyuser +Creation date: 26-Feb-2010 +Entry type: PrivateKeyEntry +Certificate chain length: 1 +Certificate[1]: +Owner: CN=Tuscany Service, OU=Tuscany, O=Apache, L=Hursley, ST=Hampshire, C=UK +Issuer: CN=Tuscany Service, OU=Tuscany, O=Apache, L=Hursley, ST=Hampshire, C=UK +Serial number: 4b87b4d7 +Valid from: Fri Feb 26 11:47:35 GMT 2010 until: Mon Jul 13 12:47:35 BST 2037 +Certificate fingerprints: + MD5: C3:0C:D6:DF:F6:27:26:47:AD:41:44:CA:D7:98:FA:41 + SHA1: 2E:82:AD:F6:54:E0:C6:A5:47:5C:8C:9F:3B:5A:65:8E:F9:5A:40:07 + Signature algorithm name: MD5withRSA + Version: 3 + + +IN THIS EMBEDDED TEST THE FOLLOWING ARE NOT REQUIRED AS BOTH REFERENCE AND SERVICES +ARE RUNNING IN THE SAME JVM AND HAVE ACCESS TO THE SERVICE SIDE KEY STORE + +Generate the client side certificate +------------------------------------ + +keytool -export -alias TuscanyUser -file tuscany.cer -keystore tuscany.jks -storepass tuscany + +Print the contents of the generated certificate file +---------------------------------------------------- + +keytool -printcert -v -file tuscany.cer + +Owner: CN=Tuscany Service, OU=Tuscany, O=Apache, L=Hursley, ST=Hampshire, C=UK +Issuer: CN=Tuscany Service, OU=Tuscany, O=Apache, L=Hursley, ST=Hampshire, C=UK +Serial number: 4b87b4d7 +Valid from: Fri Feb 26 11:47:35 GMT 2010 until: Mon Jul 13 12:47:35 BST 2037 +Certificate fingerprints: + MD5: C3:0C:D6:DF:F6:27:26:47:AD:41:44:CA:D7:98:FA:41 + SHA1: 2E:82:AD:F6:54:E0:C6:A5:47:5C:8C:9F:3B:5A:65:8E:F9:5A:40:07 + Signature algorithm name: MD5withRSA + Version: 3 + + \ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/pom.xml b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/pom.xml new file mode 100644 index 0000000000..05f96f4a25 --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-SNAPSHOT + ../pom.xml + + + itest-ws-http-ssl + Apache Tuscany SCA iTest WS HTTP SSL + + + + + org.apache.tuscany.sca + tuscany-feature-webservice + 2.0-SNAPSHOT + pom + + + + org.apache.tuscany.sca + tuscany-policy-security + 2.0-SNAPSHOT + + + + + + ${artifactId} + + diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java new file mode 100644 index 0000000000..98eb6e361b --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java @@ -0,0 +1,29 @@ +/* + * 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.tuscany.sca.binding.ws.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorld { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..2c6c4fc92c --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java @@ -0,0 +1,35 @@ +/* + * 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.tuscany.sca.binding.ws.axis2.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClient implements HelloWorld { + + @Reference + public HelloWorld helloWorldWS; + + public String getGreetings(String s) { + String response = helloWorldWS.getGreetings(s); + System.out.println("At client: " + response); + return response; + } + +} diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..3662007984 --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * 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.tuscany.sca.binding.ws.axis2.helloworld; + +public class HelloWorldService implements HelloWorld { + + public String getGreetings(String s) { + String response = "Hello " + s; + System.out.println("At service: " + response); + return response; + } + +} diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7e71dd465f --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions new file mode 100644 index 0000000000..04fe620be4 --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions @@ -0,0 +1,17 @@ +# 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. +org/apache/tuscany/sca/binding/ws/axis2/helloworld/definitions.xml \ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/definitions.xml b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/definitions.xml new file mode 100644 index 0000000000..d7251590ba --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/definitions.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.composite b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.composite new file mode 100644 index 0000000000..aa21221b30 --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.composite @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.wsdl b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..a352696b8e --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/helloworld.wsdl @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/tuscany.jks b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/tuscany.jks new file mode 100644 index 0000000000..d67bccdf8b Binary files /dev/null and b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/helloworld/tuscany.jks differ diff --git a/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HTTPSTestCase.java b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HTTPSTestCase.java new file mode 100644 index 0000000000..d58f761b79 --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/ws/http-ssl/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HTTPSTestCase.java @@ -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.tuscany.sca.binding.ws.axis2; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorld; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.Ignore; + +@Ignore("TUSCANY-3632") +public class HTTPSTestCase extends TestCase { + + private Node node; + private HelloWorld helloWorld; + private HelloWorld helloWorld2; + private HelloWorld helloWorld3; + + @Override + protected void setUp() throws Exception { + node = NodeFactory.newInstance().createNode(new Contribution("test", "target/classes")); + node.start(); + helloWorld = node.getService(HelloWorld.class, "HelloWorldClient"); + helloWorld2 = node.getService(HelloWorld.class, "HelloWorldClient2"); + helloWorld3 = node.getService(HelloWorld.class, "HelloWorldClient3"); + } + + public void testCalculator() throws Exception { + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + assertEquals("Hello petra", helloWorld2.getGreetings("petra")); + // TODO - check policy matching for unconfigure reference + //assertEquals("Hello petra", helloWorld3.getGreetings("petra")); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + +} -- cgit v1.2.3