tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r957345 - in /tuscany/sca-java-2.x/trunk/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tr...
Date Wed, 23 Jun 2010 21:08:11 GMT
Author: rfeng
Date: Wed Jun 23 21:08:11 2010
New Revision: 957345

URL: http://svn.apache.org/viewvc?rev=957345&view=rev
Log:
Use loopback for multicast testing

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
    tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java
    tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=957345&r1=957344&r2=957345&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Wed Jun 23 21:08:11 2010
@@ -84,9 +84,7 @@ import org.apache.tuscany.sca.interfaced
 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 ext
                     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;

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java?rev=957345&r1=957344&r2=957345&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
Wed Jun 23 21:08:11 2010
@@ -100,17 +100,23 @@ public class EndpointProcessor extends B
             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;

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java?rev=957345&r1=957344&r2=957345&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
Wed Jun 23 21:08:11 2010
@@ -250,21 +250,18 @@ public class PolicySetProcessor extends 
         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 {

Modified: tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java?rev=957345&r1=957344&r2=957345&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/MultiRegTestCase.java
Wed Jun 23 21:08:11 2010
@@ -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
     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
 
         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
 
         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);

Modified: tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java?rev=957345&r1=957344&r2=957345&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/test/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistryTestCase.java
Wed Jun 23 21:08:11 2010
@@ -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 ReplicatedEndpointRegistryT
         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 ReplicatedEndpointRegistryT
         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);



Mime
View raw message