diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules')
5 files changed, 44 insertions, 39 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java index 1b64c9aa33..641e523d2c 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java @@ -84,9 +84,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicyFactory; -import org.apache.tuscany.sca.policy.PolicySet; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -493,7 +491,8 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor { if (VALUE_QNAME.equals(name)) { if (gotOneValue && !isMany) { // TODO: TUSCANY-3231 this should be error not warning but that breaks OASIS tests - warning(context.getMonitor(), "ASM50032: multiple value elements for single-valued property", name, name); + // [rfeng] We should not issue warning here as the component property many inherit @many from the componentType property + // warning(context.getMonitor(), "ASM50032: multiple value elements for single-valued property", name, name); } loadElement(reader, root); gotOneValue = true; 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 9b2b1cca6c..d128897df0 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 @@ -100,17 +100,23 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_QNAME); composite.setLocal(false); - Component component = (Component)endpoint.getComponent().clone(); - component.setImplementation(null); - composite.getComponents().add(component); - component.getReferences().clear(); - component.getServices().clear(); - ComponentService service = (ComponentService)endpoint.getService().clone(); - component.getServices().add(service); - service.getBindings().clear(); - service.setInterfaceContract(endpoint.getComponentServiceInterfaceContract()); - Binding binding = (Binding)endpoint.getBinding().clone(); - service.getBindings().add(binding); + if (endpoint.getComponent() != null) { + Component component = (Component)endpoint.getComponent().clone(); + component.setImplementation(null); + composite.getComponents().add(component); + component.getReferences().clear(); + component.getServices().clear(); + if (endpoint.getService() != null) { + ComponentService service = (ComponentService)endpoint.getService().clone(); + component.getServices().add(service); + service.getBindings().clear(); + service.setInterfaceContract(endpoint.getComponentServiceInterfaceContract()); + if (endpoint.getBinding() != null) { + Binding binding = (Binding)endpoint.getBinding().clone(); + service.getBindings().add(binding); + } + } + } return composite; } catch (CloneNotSupportedException e) { return null; diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java index 7c3d7925d3..880addb292 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java @@ -250,21 +250,18 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA return policySet; } - private String getSCAPrefix(NamespaceContext nsContext) { - - Iterator iter = nsContext.getPrefixes(SCA11_NS); - while ( iter.hasNext()) { - String prefix = (String)iter.next(); - if ( !prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) - return prefix; - } - - // We have to have some prefix here to use before the function name. Otherwise the - // XPathFunctionResolver will never be called. - xpathHelper.registerPrefix("sca_internal", SCA11_NS, nsContext); - - return "sca_internal"; - } + private String getSCAPrefix(NamespaceContext nsContext) { + + Iterator<String> iter = nsContext.getPrefixes(SCA11_NS); + while (iter.hasNext()) { + String prefix = iter.next(); + if (!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { + return prefix; + } + } + + return "_sca"; + } public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent, ProcessorContext context) throws ContributionReadException { diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java index aa445f3ce7..9c9b041aa2 100644 --- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java +++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.endpoint.tribes; -import java.net.InetAddress; import java.util.HashMap; import java.util.Map; @@ -55,8 +54,8 @@ public class MultiRegTestCase implements EndpointListener { public void testReplication() throws Exception { RuntimeEndpoint ep1 = createEndpoint("ep1uri"); - String host = InetAddress.getLocalHost().getHostAddress(); - String bind = null; // "9.65.158.31"; + // String host = InetAddress.getLocalHost().getHostAddress(); + String bind = "127.0.0.1"; // "9.65.158.31"; String port1 = "8085"; String port2 = "8086"; String port3 = "8087"; @@ -74,7 +73,7 @@ public class MultiRegTestCase implements EndpointListener { Map<String, String> attrs2 = new HashMap<String, String>(); // attrs2.put("nomcast", "true"); - attrs1.put("bind", bind); + attrs2.put("bind", bind); attrs2.put("receiverPort", port2); attrs2.put("receiverAutoBind", range); // attrs2.put("routes", host + ":"+port1); @@ -84,7 +83,7 @@ public class MultiRegTestCase implements EndpointListener { Map<String, String> attrs3 = new HashMap<String, String>(); // attrs3.put("nomcast", "true"); - attrs1.put("bind", bind); + attrs3.put("bind", bind); attrs3.put("receiverPort", port3); attrs3.put("receiverAutoBind", range); // attrs3.put("routes", host + ":"+port1); diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java index 35d00fbba8..173d2126ff 100644 --- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java +++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java @@ -19,25 +19,29 @@ package org.apache.tuscany.sca.endpoint.tribes; +import java.util.HashMap; +import java.util.Map; + import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; public class ReplicatedEndpointRegistryTestCase { @Test - @Ignore("Ignore this test case for now as it might be sensitive to the multicast settings for a multi-homed machine") + // @Ignore("Ignore this test case for now as it might be sensitive to the multicast settings for a multi-homed machine") public void testReplicate() throws InterruptedException { DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class); - ReplicatedEndpointRegistry ep1 = new ReplicatedEndpointRegistry(extensionPoints, null, "foo", "bar"); + Map<String, String> attrs = new HashMap<String, String>(); + attrs.put("bind", "127.0.0.1"); + ReplicatedEndpointRegistry ep1 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar"); System.out.println("ep1 is: " + ep1); ep1.start(); @@ -50,7 +54,7 @@ public class ReplicatedEndpointRegistryTestCase { System.out.println("EP1 in Registry 1: " + e1p); Assert.assertNotNull(e1p); - ReplicatedEndpointRegistry ep2 = new ReplicatedEndpointRegistry(extensionPoints, null, "foo", "bar"); + ReplicatedEndpointRegistry ep2 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar"); System.out.println("ep2 is: " + ep2); ep2.start(); Thread.sleep(5000); @@ -59,7 +63,7 @@ public class ReplicatedEndpointRegistryTestCase { System.out.println("EP1 in Registry 2: " + e1p2); Assert.assertNotNull(e1p2); - ReplicatedEndpointRegistry ep3 = new ReplicatedEndpointRegistry(extensionPoints, null, "foo", "bar"); + ReplicatedEndpointRegistry ep3 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar"); System.out.println("ep3 is: " + ep3); ep3.start(); Thread.sleep(5000); |