summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/testing')
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/pom.xml15
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java4
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions17
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml36
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite6
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite29
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite31
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java57
8 files changed, 179 insertions, 16 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/pom.xml b/sca-java-2.x/trunk/testing/itest/interface-matching/pom.xml
index 1146689446..f49d84a8f1 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/pom.xml
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/pom.xml
@@ -67,7 +67,20 @@
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-rmi</artifactId>
<version>2.0-SNAPSHOT</version>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.9</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
index 0538739b99..cfc53da0d4 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/java/org/apache/tuscany/sca/itest/interfaces/ServiceComponentImpl.java
@@ -28,10 +28,6 @@ public class ServiceComponentImpl implements ServiceComponent {
@Callback
protected CallbackInterface callback;
-/*
- @Reference
- protected ServiceComponent chainedCallbackReference;
-*/
private static ParameterObject po;
public String foo(String str) {
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
new file mode 100644
index 0000000000..39b298a665
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/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/itest/interfaces/definitions.xml \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml
new file mode 100644
index 0000000000..f462f81388
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/definitions.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://www.tuscany.apache.org/itests/interface/match"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" >
+
+
+ <sca:policySet name="BasicAuthenticationPolicySet"
+ attachTo="//sca:binding.ws"
+ provides="clientAuthentication.transport"
+ appliesTo="//sca:binding.ws">
+ <tuscany:basicAuthentication>
+ <tuscany:userName>myname</tuscany:userName>
+ <tuscany:password>mypassword</tuscany:password>
+ </tuscany:basicAuthentication>
+ </sca:policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite
index 8f71d058c6..f13cc8657b 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite
@@ -22,10 +22,6 @@
name="MatchDistributedService" >
<component name="DistributedServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ServiceComponentImpl" />
-<!--
- <reference name="chainedCallbackReference" target="DistributedServiceComponent">
- </reference>
--->
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ServiceComponentImpl" />
</component>
</composite> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite
new file mode 100644
index 0000000000..e5591f2e93
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite
@@ -0,0 +1,29 @@
+<?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
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:foo="http://foo" targetNamespace="http://foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ name="MatchPolicyDistributedClient" >
+
+ <component name="DistributedClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ClientComponentImpl" />
+ <reference name="aCallBackService" target="DistributedServiceComponent"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite
new file mode 100644
index 0000000000..7340a2d6e6
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite
@@ -0,0 +1,31 @@
+<?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
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:foo="http://foo" targetNamespace="http://foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ name="MatchPolicyDistributedService" >
+
+ <component name="DistributedServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ServiceComponentImpl" />
+ <service name="ServiceComponent" requires="authentication">
+ <binding.ws requires="sca:SOAP.v1_2"/>
+ </service>
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
index 4174a338c0..f4d5f009ed 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
@@ -35,7 +35,7 @@ import org.oasisopen.sca.ServiceRuntimeException;
public class InerfaceMatchTestCase {
/**
- * Non-remoteable client and service interfaces where the interfaces match.
+ * Non-remotable client and service interfaces where the interfaces match.
* Components running in the same composite/JVM, i.e. no remote registry
*
* @throws Exception
@@ -62,8 +62,8 @@ public class InerfaceMatchTestCase {
}
/**
- * Remoteable client and service interfaces where the interfaces match.
- * Components running in the seaprate composite/JVM, i.e. there is a remote registry
+ * Remotable client and service interfaces where the interfaces match.
+ * Components running in the separate composite/JVM, i.e. there is a remote registry
*
* @throws Exception
*/
@@ -84,7 +84,7 @@ public class InerfaceMatchTestCase {
"org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite",
contributions);
- // for default binding on node2 to use a different port from node 1(which will default to 8080
+ // force default binding on node2 to use a different port from node 1(which will default to 8080
((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/");
node2.start();
@@ -112,7 +112,7 @@ public class InerfaceMatchTestCase {
}
/**
- * Remoteable client and service interfaces where the interfaces match but
+ * Remotable client and service interfaces where the interfaces match but
* where there is a parameter that can't be converted to/from XML using JAXB
* Components running in the separate composite/JVM, i.e. there is a remote registry
*
@@ -137,7 +137,7 @@ public class InerfaceMatchTestCase {
"org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchNonJAXBDistributedService.composite",
contributions);
- // for default binding on node2 to use a different port from node 1(which will default to 8080
+ // force default binding on node2 to use a different port from node 1(which will default to 8080
// Don't need to do this as not testing callbacks here
//((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
//((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/");
@@ -164,4 +164,49 @@ public class InerfaceMatchTestCase {
node1.stop();
node2.stop();
}
+
+ /**
+ * Remotable client and service interfaces where the interfaces match and the service has policy.
+ * Components running in the separate composite/JVM, i.e. there is a remote registry
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testPolicyDistributedRemotable() throws Exception {
+
+
+ String [] contributions = {"./target/classes"};
+ Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
+ "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedClient.composite",
+ contributions);
+ node1.start();
+
+ Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
+ "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchPolicyDistributedService.composite",
+ contributions);
+ // force binding.ws on node2 to use a different port from node 1(which will default to 8080
+ ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
+ node2.start();
+
+ ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent");
+ ParameterObject po = new ParameterObject();
+
+ try {
+ String response = local.foo1(po);
+ Assert.assertEquals("AComponent", response);
+ } catch (ServiceRuntimeException ex){
+ Assert.fail("Unexpected exception with foo " + ex.toString());
+ }
+
+ try {
+ local.callback("Callback");
+ String response = local.getCallbackValue();
+ Assert.assertEquals("Callback", response);
+ } catch (ServiceRuntimeException ex){
+ Assert.fail("Unexpected exception with callback" + ex.toString());
+ }
+
+ node1.stop();
+ node2.stop();
+ }
}