tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r711727 - in /tuscany/branches/sca-java-1.3.3/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/resources/org/apache/tuscany/sca/as...
Date Wed, 05 Nov 2008 22:38:32 GMT
Author: rfeng
Date: Wed Nov  5 14:38:31 2008
New Revision: 711727

URL: http://svn.apache.org/viewvc?rev=711727&view=rev
Log:
Merge fix for TUSCANY-2662 from trunk

Modified:
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java
  (contents, props changed)
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
    tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
    tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
    tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/Calculator.composite
    tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Wed Nov  5 14:38:31 2008
@@ -249,8 +249,29 @@
             reference.setMultiplicity(Multiplicity.ONE_N);
         } else if (ZERO_N.equals(value)) {
             reference.setMultiplicity(Multiplicity.ZERO_N);
+        } else if (ONE_ONE.equals(value)) {
+            reference.setMultiplicity(Multiplicity.ONE_ONE);
         }
     }
+    
+    protected XAttr writeMultiplicity(AbstractReference reference) {
+        Multiplicity multiplicity = reference.getMultiplicity();
+        if (multiplicity != null) {
+            String value = null;
+            if (Multiplicity.ZERO_ONE.equals(multiplicity)) {
+                value = ZERO_ONE;
+            } else if (Multiplicity.ONE_N.equals(multiplicity)) {
+                value = ONE_N;
+            } else if (Multiplicity.ZERO_N.equals(multiplicity)) {
+                value = ZERO_N;
+            } else if (Multiplicity.ONE_ONE.equals(multiplicity)) {
+                value = ONE_ONE;
+                return null;
+            }
+            return new XAttr(MULTIPLICITY, value);
+        }
+        return null;
+    }
 
     /**
      * Returns the value of a constrainingType attribute.

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
Wed Nov  5 14:38:31 2008
@@ -278,6 +278,7 @@
             
             writeStart(writer, REFERENCE,
                   new XAttr(NAME, reference.getName()),
+                  writeMultiplicity(reference),
                   writeTargets(reference),
                   policyProcessor.writePolicies(reference));
 

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Wed Nov  5 14:38:31 2008
@@ -743,6 +743,7 @@
             for (ComponentReference reference : component.getReferences()) {
                 writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
                            new XAttr(AUTOWIRE, reference.getAutowire()),
+                           writeMultiplicity(reference),
                            writeTargets(reference),
                            policyProcessor.writePolicies(reference));
 
@@ -829,6 +830,7 @@
             // Write <reference> element
             writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
                        new XAttr(PROMOTE, promote),
+                       writeMultiplicity(reference),
                        policyProcessor.writePolicies(reference));
 
             //write extended attributes

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
Wed Nov  5 14:38:31 2008
@@ -42,8 +42,8 @@
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.w3c.dom.Document;
 
 /**
@@ -214,6 +214,7 @@
         // Write <reference> elements
         for (AbstractReference reference : constrainingType.getReferences()) {
             writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+                       writeMultiplicity(reference),
                        policyProcessor.writePolicies(reference));
             
             extensionProcessor.write(reference.getInterfaceContract(), writer);

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java
Wed Nov  5 14:38:31 2008
@@ -34,13 +34,12 @@
 import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class AnyElementReadWriteTestCase extends TestCase {
 
 	private XMLInputFactory inputFactory;
-	String XML = "<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service
name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><interface.java interface=\"calculator.CalculatorService\"
/></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\"
target=\"AddServiceComponent\" /><reference name=\"subtractService\" target=\"SubtractServiceComponent\"
/><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference
name=\"divideService\" target=\"DivideServiceComponent\" /></component><component
name=\"AddServiceComponent\" /><component name=\"SubtractServiceComponent\" /><component
name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /><x:unknownElement
xmlns:x=\"http://x\" uknAttr=\"attribute1\"><y:subUnknownElement1 xmlns:y=\"http://y\"
uknAttr1
 =\"attribute2\" /><x:subUnknownElement2 /></x:unknownElement></composite>";
+	String XML = "<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service
name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><interface.java interface=\"calculator.CalculatorService\"
/></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\"
multiplicity=\"0..1\" target=\"AddServiceComponent\" /><reference name=\"subtractService\"
target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\"
/><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component
name=\"AddServiceComponent\" /><component name=\"SubtractServiceComponent\" /><component
name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /><x:unknownElement
xmlns:x=\"http://x\" uknAttr=\"attribute1\"><y:subUnknownElement1 xmlns:y
 =\"http://y\" uknAttr1=\"attribute2\" /><x:subUnknownElement2 /></x:unknownElement></composite>";
 	private ExtensibleStAXArtifactProcessor staxProcessor;
 
 	@Override

Propchange: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov  5 14:38:31 2008
@@ -1 +1,2 @@
 /tuscany/branches/sca-java-1.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestReadWriteUnkonwnElement.java:671193
+/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java:711710

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
Wed Nov  5 14:38:31 2008
@@ -29,7 +29,7 @@
     
     <component name="CalculatorServiceComponent">
 		<implementation.java class="calculator.CalculatorServiceImpl"/>
-        <reference name="addService" target="AddServiceComponent"/>
+        <reference name="addService"  multiplicity="0..1" target="AddServiceComponent"/>
         <reference name="subtractService" target="SubtractServiceComponent"/>
         <reference name="multiplyService" target="MultiplyServiceComponent"/>
         <reference name="divideService" target="DivideServiceComponent"/>

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
Wed Nov  5 14:38:31 2008
@@ -26,9 +26,9 @@
         <interface.java class="calculator.CalculatorService" />
   </service>
 
-  <reference name="divideService">
+  <reference name="divideService" multiplicity="1..1">
         <interface.java class="calculator.DivideService" />
   </reference>  
 
 </constrainingType>              
-       
\ No newline at end of file
+       

Modified: tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
Wed Nov  5 14:38:31 2008
@@ -20,12 +20,12 @@
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
 
   <service name="CalculatorService">
-        <interface.java class="calculator.CalculatorService" />
+        <interface.java interface="calculator.CalculatorService" />
   </service>
 
   <reference name="divideService">
-        <interface.java class="calculator.DivideService" />
+        <interface.java interface="calculator.DivideService" />
   </reference>  
 
 </componentType>              
-       
\ No newline at end of file
+       

Modified: tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
Wed Nov  5 14:38:31 2008
@@ -60,7 +60,7 @@
         assertNotNull(componentType);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
-        assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca
/><interface.java class=\"calculator.CalculatorService\" /></service><reference
name=\"addService\"><binding.sca /><interface.java class=\"calculator.AddService\"
/></reference></componentType>",
+        assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca
/><interface.java interface=\"calculator.CalculatorService\" /></service><reference
name=\"addService\"><binding.sca /><interface.java interface=\"calculator.AddService\"
/></reference></componentType>",
         		     bos.toString());
         }
 
@@ -70,8 +70,8 @@
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-        assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service
name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /><interface.java
interface=\"calculator.CalculatorService\" /></service><component name=\"CalculatorServiceComponent\"><implementation.java
class=\"calculator.CalculatorServiceImpl\" /><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca
/></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\"
/><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference
name=\"divideService\" target=\"DivideServiceComponent\" /></component><component
name=\"AddServiceComponent\"><implementation.java class=\"calculator.AddServiceImpl\"
/><service><binding.sca /><interface.java interface=\"calculator.AddService\"
/></se
 rvice></component><component name=\"SubtractServiceComponent\"><implementation.java
class=\"calculator.SubtractServiceImpl\" /></component><component name=\"MultiplyServiceComponent\"><implementation.java
class=\"calculator.MultiplyServiceImpl\" /></component><component name=\"DivideServiceComponent\"><implementation.java
class=\"calculator.DivideServiceImpl\" /></component></composite>",
-                 	 bos.toString() );
+        assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service
name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /><interface.java
interface=\"calculator.CalculatorService\" /></service><component name=\"CalculatorServiceComponent\"><implementation.java
class=\"calculator.CalculatorServiceImpl\" /><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca
/></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\"
/><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference
name=\"divideService\" target=\"DivideServiceComponent\" /></component><component
name=\"AddServiceComponent\"><implementation.java class=\"calculator.AddServiceImpl\"
/><service name=\"AddService\"><binding.sca /><interface.java interface=\"calculator
 .AddService\" /></service></component><component name=\"SubtractServiceComponent\"><implementation.java
class=\"calculator.SubtractServiceImpl\" /></component><component name=\"MultiplyServiceComponent\"><implementation.java
class=\"calculator.MultiplyServiceImpl\" /></component><component name=\"DivideServiceComponent\"><implementation.java
class=\"calculator.DivideServiceImpl\" /></component></composite>",
+                     bos.toString());
     }
 
 }

Modified: tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/Calculator.composite?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/Calculator.composite
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/Calculator.composite
Wed Nov  5 14:38:31 2008
@@ -38,7 +38,7 @@
 
     <component name="AddServiceComponent">
     <implementation.java class="calculator.AddServiceImpl"/>
-    <service>
+    <service name="AddService">
         <interface.java interface="calculator.AddService"/>
             <binding.sca/>
     </service>        

Modified: tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType?rev=711727&r1=711726&r2=711727&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
(original)
+++ tuscany/branches/sca-java-1.3.3/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
Wed Nov  5 14:38:31 2008
@@ -20,12 +20,12 @@
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
 
   <service name="CalculatorService">
-        <interface.java class="calculator.CalculatorService" />
+        <interface.java interface="calculator.CalculatorService" />
         <binding.sca/>
   </service>
 
   <reference name="addService">
-        <interface.java class="calculator.AddService" />
+        <interface.java interface="calculator.AddService" />
         <binding.sca/>
   </reference>  
 



Mime
View raw message