summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java22
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java2
-rw-r--r--sca-java-2.x/trunk/modules/core/META-INF/MANIFEST.MF1
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java94
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java8
-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
13 files changed, 304 insertions, 18 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
index 9f323a5507..153734ddc5 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
@@ -19,6 +19,9 @@
package org.apache.tuscany.sca.assembly.xml;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -41,6 +44,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.policy.PolicySet;
/**
*
@@ -87,6 +91,10 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti
endpoint.setComponent(component);
endpoint.setService(service);
endpoint.setBinding(binding);
+
+ // retrieve the stash of intents and policy sets from the component
+ endpoint.getRequiredIntents().addAll(component.getRequiredIntents());
+ endpoint.getPolicySets().addAll(component.getPolicySets());
}
return endpoint;
}
@@ -108,6 +116,14 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti
composite.getComponents().add(component);
component.getReferences().clear();
component.getServices().clear();
+
+ // stash endpoint intents and policy sets on the component so that they are all
+ // in one place
+ component.getRequiredIntents().clear();
+ component.getRequiredIntents().addAll(endpoint.getRequiredIntents());
+ component.getPolicySets().clear();
+ component.getPolicySets().addAll(endpoint.getPolicySets());
+
if (endpoint.getService() != null) {
ComponentService service = (ComponentService)endpoint.getService().clone();
component.getServices().add(service);
@@ -143,5 +159,11 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti
}
public void resolve(Endpoint model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
+ // the only thing we'll resolve here is the policy model as the endpoint
+ // matching algorithm needs to look inside the policy model
+
+ for (PolicySet policySet : model.getPolicySets()){
+ extensionProcessor.resolve(policySet, resolver, context);
+ }
}
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java
index 981872fdfa..a69580f518 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java
@@ -33,4 +33,6 @@ public interface EndpointSerializer {
Endpoint readEndpoint(String xml);
String write(Endpoint endpoint);
+
+ void resolveEndpoint(Endpoint endpoint);
}
diff --git a/sca-java-2.x/trunk/modules/core/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/core/META-INF/MANIFEST.MF
index 964e629744..1a388f973d 100644
--- a/sca-java-2.x/trunk/modules/core/META-INF/MANIFEST.MF
+++ b/sca-java-2.x/trunk/modules/core/META-INF/MANIFEST.MF
@@ -68,6 +68,7 @@ Import-Package: javax.security.auth,
org.apache.tuscany.sca.monitor;version="2.0.0",
org.apache.tuscany.sca.node;version="2.0.0",
org.apache.tuscany.sca.policy;version="2.0.0",
+ org.apache.tuscany.sca.policy.util;version="2.0.0",
org.apache.tuscany.sca.provider;version="2.0.0",
org.apache.tuscany.sca.runtime;version="2.0.0",
org.apache.tuscany.sca.work;version="2.0.0",
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
index 4e5275058e..8cdb0363e9 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
@@ -21,6 +21,8 @@ package org.apache.tuscany.sca.core.assembly.impl;
import java.io.StringReader;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
@@ -29,12 +31,21 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.context.CompositeContext;
+import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.definitions.Definitions;
+import org.apache.tuscany.sca.policy.BindingType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHelper;
import org.apache.tuscany.sca.runtime.EndpointSerializer;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.oasisopen.sca.ServiceRuntimeException;
public class EndpointSerializerImpl implements EndpointSerializer {
@@ -57,6 +68,7 @@ public class EndpointSerializerImpl implements EndpointSerializer {
public Endpoint readEndpoint(String xml) {
try {
+ //System.out.println("Read Endpoint string >> " + xml);
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
Endpoint result = processor.read(reader, new ProcessorContext(registry));
result.setRemote(true);
@@ -66,6 +78,84 @@ public class EndpointSerializerImpl implements EndpointSerializer {
throw new ServiceRuntimeException(e);
}
}
+
+ public void resolveEndpoint(Endpoint endpoint) {
+ CompositeContext compositeContext = ((RuntimeEndpoint)endpoint).getCompositeContext();
+
+ if (compositeContext == null){
+ // will be null if this is the SCAClient
+ return;
+ }
+
+ Definitions systemDefinitions = compositeContext.getSystemDefinitions();
+ if (systemDefinitions != null){
+ // Find pre-resolved intents from the system definition
+ List<Intent> intents = new ArrayList<Intent>();
+
+ for (Intent intent : endpoint.getRequiredIntents()){
+ Intent resolvedIntent = PolicyHelper.getIntent(systemDefinitions, intent.getName());
+
+ if (resolvedIntent != null){
+ intents.add(resolvedIntent);
+ } else {
+ // look to see if this intent is provided by the binding
+ BindingType bindingType = systemDefinitions.getBindingType(endpoint.getBinding().getType());
+
+ if (bindingType != null){
+ for (Intent apIntent : bindingType.getAlwaysProvidedIntents()){
+ if (apIntent.getName().equals(intent.getName())){
+ resolvedIntent = apIntent;
+ break;
+ }
+ }
+
+ if (resolvedIntent == null){
+ for (Intent mpIntent : bindingType.getMayProvidedIntents()){
+ if (mpIntent.getName().equals(intent.getName())){
+ resolvedIntent = mpIntent;
+ break;
+ }
+ }
+ }
+ }
+
+ if (resolvedIntent != null){
+ intents.add(resolvedIntent);
+ } else {
+ throw new ServiceRuntimeException("Remote endpoint " +
+ endpoint +
+ " has intent " +
+ intent +
+ " that can't be found in the local system definitions in node " +
+ compositeContext.getNodeURI());
+ }
+ }
+ }
+
+ endpoint.getRequiredIntents().clear();
+ endpoint.getRequiredIntents().addAll(intents);
+
+ // Find pre-resolved policy sets from the system definition
+ List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ for (PolicySet policySet : endpoint.getPolicySets()){
+ PolicySet resolvedPolicySet = PolicyHelper.getPolicySet(systemDefinitions, policySet.getName());
+ if (resolvedPolicySet != null){
+ policySets.add(resolvedPolicySet);
+ } else {
+ throw new ServiceRuntimeException("Remote endpoint " +
+ endpoint +
+ " has policy set " +
+ policySet +
+ " that can't be found in the local system definitions in node " +
+ compositeContext.getNodeURI());
+ }
+ }
+
+ endpoint.getPolicySets().clear();
+ endpoint.getPolicySets().addAll(policySets);
+ }
+ }
public String write(Endpoint endpoint) {
StringWriter sw = new StringWriter();
@@ -74,7 +164,9 @@ public class EndpointSerializerImpl implements EndpointSerializer {
processor.write(endpoint, writer, new ProcessorContext(registry));
writer.flush();
writer.close();
- return sw.toString();
+ String endpointString = sw.toString();
+ //System.out.println("Write Endpoint string >> " + endpointString);
+ return endpointString;
} catch (Exception e) {
throw new ServiceRuntimeException(e);
}
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
index db8911d466..09cbab76d1 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
@@ -925,7 +925,12 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
@Override
protected synchronized void resolve() {
if (xml != null && component == null) {
- if (compositeContext == null) {
+ // TUSCANY-3958 - when an endpoint arrives at the remote side of the
+ // domain registry it's composite context is set, but to
+ // a default that's not that useful. We can tell because it
+ // doesn't set the system definitions
+ if (compositeContext == null ||
+ compositeContext.getSystemDefinitions() == null) {
compositeContext = CompositeContext.getCurrentCompositeContext();
if (compositeContext != null) {
bind(compositeContext);
@@ -934,6 +939,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
if (serializer != null) {
RuntimeEndpointImpl ep = (RuntimeEndpointImpl)serializer.readEndpoint(xml);
copyFrom(ep);
+ serializer.resolveEndpoint(this);
} else {
// In this case, we assume that we're running on a detached (non Tuscany) thread and
// as a result we need to connect back to the Tuscany environment...
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();
+ }
}