tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r533382 [1/2] - in /incubator/tuscany/java/sca: itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ modules/assembly-xml/src/test/java/org/apache/tus...
Date Sat, 28 Apr 2007 16:18:46 GMT
Author: jsdelfino
Date: Sat Apr 28 09:18:40 2007
New Revision: 533382

URL: http://svn.apache.org/viewvc?view=rev&rev=533382
Log:
Added more logic to recurse into nested composites, expand them and wire up non-composite components. Changed ArtifactProcessors to not depend on the default factories but use factories passed to their constructors.

Added:
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/InnerCalculator.composite   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/InnerOperations.composite   (with props)
    incubator/tuscany/java/sca/modules/core-spring/src/test/resources/org/apache/tuscany/core/spring/OuterCalculator.composite   (with props)
Modified:
    incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeDocumentProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeDocumentProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeDocumentProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadAllTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadDocumentTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ResolveTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WireTestCase.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WriteAllTestCase.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/CompositeService.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
    incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/TestRuntimeContext.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/SimpleRuntimeImpl.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/interfacedef/java/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/interfacedef/wsdl/xml/WriteTestCase.java

Modified: incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java Sat Apr 28 09:18:40 2007
@@ -24,8 +24,12 @@
 import java.net.URI;
 import java.net.URL;
 
+import javax.xml.stream.XMLInputFactory;
+
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.assembly.xml.ComponentTypeDocumentProcessor;
 import org.apache.tuscany.assembly.xml.ComponentTypeProcessor;
 import org.apache.tuscany.assembly.xml.CompositeDocumentProcessor;
@@ -51,6 +55,10 @@
 import org.apache.tuscany.contribution.service.util.IOHelper;
 import org.apache.tuscany.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.core.ExtensionPointRegistry;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * This is more intended to be a integration test then a unit test. *
@@ -65,6 +73,11 @@
     
     protected void setUp() throws Exception {
         
+        // Create default factories
+        AssemblyFactory factory = new DefaultAssemblyFactory();
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper mapper = new DefaultInterfaceContractMapper();
+        
         // Create an extension point registry
         ExtensionPointRegistry extensionRegistry = new DefaultExtensionPointRegistry();
 
@@ -75,13 +88,14 @@
         extensionRegistry.addExtensionPoint(URLArtifactProcessorExtensionPoint.class, documentProcessors);
 
         // Register base artifact processors
-        staxProcessors.addExtension(new CompositeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
-
-        documentProcessors.addExtension(new CompositeDocumentProcessor(staxProcessors));
-        documentProcessors.addExtension(new ComponentTypeDocumentProcessor(staxProcessors));
-        documentProcessors.addExtension(new ConstrainingTypeDocumentProcessor(staxProcessors));
+        staxProcessors.addExtension(new CompositeProcessor(factory, policyFactory, mapper, staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
+
+        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+        documentProcessors.addExtension(new CompositeDocumentProcessor(staxProcessors, inputFactory));
+        documentProcessors.addExtension(new ComponentTypeDocumentProcessor(staxProcessors, inputFactory));
+        documentProcessors.addExtension(new ConstrainingTypeDocumentProcessor(staxProcessors, inputFactory));
 
         // Create package processor extension point
         PackageTypeDescriberImpl describer = new PackageTypeDescriberImpl();

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeDocumentProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeDocumentProcessor.java Sat Apr 28 09:18:40 2007
@@ -28,9 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.ComponentType;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.processor.URLArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
@@ -38,8 +36,6 @@
 import org.apache.tuscany.contribution.service.ContributionResolveException;
 import org.apache.tuscany.contribution.service.ContributionWireException;
 import org.apache.tuscany.contribution.service.ContributionWriteException;
-import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A componentType processor.
@@ -55,17 +51,9 @@
      * @param policyFactory
      * @param registry
      */
-    public ComponentTypeDocumentProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
-        super(factory, policyFactory, staxProcessor);
+    public ComponentTypeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
+        super(null, null, staxProcessor);
         this.inputFactory = inputFactory;
-    }
-    
-    /**
-     * Constructs a new componentType processor.
-     * @param registry
-     */
-    public ComponentTypeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), staxProcessor, XMLInputFactory.newInstance());
     }
     
     public ComponentType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ComponentTypeProcessor.java Sat Apr 28 09:18:40 2007
@@ -39,7 +39,6 @@
 import org.apache.tuscany.assembly.Property;
 import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.Service;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
 import org.apache.tuscany.contribution.service.ContributionReadException;
@@ -49,7 +48,6 @@
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A componentType processor.
@@ -66,14 +64,6 @@
      */
     public ComponentTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension extensionProcessor) {
         super(factory, policyFactory, extensionProcessor);
-    }
-    
-    /**
-     * Constructs a new componentType processor.
-     * @param extensionProcessor
-     */
-    public ComponentTypeProcessor(StAXArtifactProcessorExtension extensionProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), extensionProcessor);
     }
     
     public ComponentType read(XMLStreamReader reader) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeDocumentProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeDocumentProcessor.java Sat Apr 28 09:18:40 2007
@@ -28,9 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Composite;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.processor.URLArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
@@ -38,8 +36,6 @@
 import org.apache.tuscany.contribution.service.ContributionResolveException;
 import org.apache.tuscany.contribution.service.ContributionWireException;
 import org.apache.tuscany.contribution.service.ContributionWriteException;
-import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A composite processor.
@@ -55,17 +51,9 @@
      * @param policyFactory
      * @param staxProcessor
      */
-    public CompositeDocumentProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
-        super(factory, policyFactory, staxProcessor);
+    public CompositeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
+        super(null, null, staxProcessor);
         this.inputFactory = inputFactory;
-    }
-
-    /**
-     * Construct a new composite processor.
-     * @param staxProcessor
-     */
-    public CompositeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), staxProcessor, XMLInputFactory.newInstance());
     }
 
     public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java Sat Apr 28 09:18:40 2007
@@ -50,7 +50,6 @@
 import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.Service;
 import org.apache.tuscany.assembly.Wire;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.assembly.util.CompositeUtil;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
@@ -61,9 +60,7 @@
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.interfacedef.Operation;
-import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A composite processor.
@@ -87,15 +84,6 @@
         this.interfaceContractMapper = interfaceContractMapper;
     }
 
-    /**
-     * Construct a new composite processor.
-     * @param extensionProcessor
-     */
-    public CompositeProcessor(StAXArtifactProcessorExtension extensionProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(),
-             new DefaultInterfaceContractMapper(), extensionProcessor);
-    }
-
     public Composite read(XMLStreamReader reader) throws ContributionReadException {
         Composite composite = null;
         Composite include = null;
@@ -525,9 +513,13 @@
         // Configure all components
         compositeUtil.configureComponents(composite, problems);
         
-        //FIXME this should be done only on top level deployable composites
-        // Wire references
-        compositeUtil.wireReferences(composite, problems);
+        //FIXME this should only be done on top level deployable composites
+
+        // Expand nested composites
+        //compositeUtil.expandComposites(composite, problems);
+        
+        // Wire the composite
+        compositeUtil.wireComposite(composite, problems);
        
         // Uncommenting the following three lines can be useful to detect
         // and troubleshoot SCA assembly XML composite configuration

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeDocumentProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeDocumentProcessor.java Sat Apr 28 09:18:40 2007
@@ -28,9 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.ConstrainingType;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.processor.URLArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
@@ -38,8 +36,6 @@
 import org.apache.tuscany.contribution.service.ContributionResolveException;
 import org.apache.tuscany.contribution.service.ContributionWireException;
 import org.apache.tuscany.contribution.service.ContributionWriteException;
-import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A contrainingType content handler.
@@ -55,17 +51,9 @@
      * @param policyFactory
      * @param staxProcessor
      */
-    public ConstrainingTypeDocumentProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
-        super(factory, policyFactory, staxProcessor);
+    public ConstrainingTypeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor, XMLInputFactory inputFactory) {
+        super(null, null, staxProcessor);
         this.inputFactory = inputFactory;
-    }
-
-    /**
-     * Construct a new constrainingType processor.
-     * @param staxProcessor
-     */
-    public ConstrainingTypeDocumentProcessor(StAXArtifactProcessorExtension staxProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), staxProcessor, XMLInputFactory.newInstance());
     }
 
     public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeProcessor.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ConstrainingTypeProcessor.java Sat Apr 28 09:18:40 2007
@@ -33,7 +33,6 @@
 import org.apache.tuscany.assembly.AbstractService;
 import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.ConstrainingType;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
 import org.apache.tuscany.contribution.resolver.ArtifactResolver;
 import org.apache.tuscany.contribution.service.ContributionReadException;
@@ -43,7 +42,6 @@
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.policy.PolicyFactory;
-import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A contrainingType content handler.
@@ -60,14 +58,6 @@
      */
     public ConstrainingTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension extensionProcessor) {
         super(factory, policyFactory, extensionProcessor);
-    }
-
-    /**
-     * Construct a new constrainingType processor.
-     * @param extensionProcessor
-     */
-    public ConstrainingTypeProcessor(StAXArtifactProcessorExtension extensionProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), extensionProcessor);
     }
 
     public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadAllTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadAllTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadAllTestCase.java Sat Apr 28 09:18:40 2007
@@ -25,6 +25,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Callback;
 import org.apache.tuscany.assembly.Component;
 import org.apache.tuscany.assembly.ComponentReference;
@@ -34,8 +35,13 @@
 import org.apache.tuscany.assembly.CompositeService;
 import org.apache.tuscany.assembly.Multiplicity;
 import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -49,10 +55,14 @@
     private DefaultArtifactResolver resolver; 
 
     public void setUp() throws Exception {
+        AssemblyFactory factory = new DefaultAssemblyFactory();
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper mapper = new DefaultInterfaceContractMapper();
+        
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
-        staxProcessors.addExtension(new CompositeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new CompositeProcessor(factory, policyFactory, mapper, staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
 
         resolver = new DefaultArtifactResolver(getClass().getClassLoader());
     }

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadDocumentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadDocumentTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadDocumentTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadDocumentTestCase.java Sat Apr 28 09:18:40 2007
@@ -21,13 +21,21 @@
 
 import java.net.URL;
 
+import javax.xml.stream.XMLInputFactory;
+
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test reading SCA XML assembly documents.
@@ -40,18 +48,23 @@
     private DefaultArtifactResolver resolver; 
 
     public void setUp() throws Exception {
+        AssemblyFactory factory = new DefaultAssemblyFactory();
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper mapper = new DefaultInterfaceContractMapper();
+        
         documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
         
         // Create Stax processors
         DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
-        staxProcessors.addExtension(new CompositeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new CompositeProcessor(factory, policyFactory, mapper, staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
         
         // Create document processors
-        documentProcessors.addExtension(new CompositeDocumentProcessor(staxProcessors));
-        documentProcessors.addExtension(new ComponentTypeDocumentProcessor(staxProcessors));
-        documentProcessors.addExtension(new ConstrainingTypeDocumentProcessor(staxProcessors));
+        XMLInputFactory inputFactory = XMLInputFactory.newInstance(); 
+        documentProcessors.addExtension(new CompositeDocumentProcessor(staxProcessors, inputFactory));
+        documentProcessors.addExtension(new ComponentTypeDocumentProcessor(staxProcessors, inputFactory));
+        documentProcessors.addExtension(new ConstrainingTypeDocumentProcessor(staxProcessors, inputFactory));
 
         resolver = new DefaultArtifactResolver(getClass().getClassLoader());
     }

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ReadTestCase.java Sat Apr 28 09:18:40 2007
@@ -26,7 +26,13 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test reading SCA XML assemblies.
@@ -37,8 +43,14 @@
 
     private XMLInputFactory inputFactory;
     private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
         inputFactory = XMLInputFactory.newInstance();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
     }
@@ -46,10 +58,13 @@
     public void tearDown() throws Exception {
         inputFactory = null;
         staxProcessors = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(staxProcessors);
+        ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(factory, policyFactory, staxProcessors);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         assertNotNull(componentTypeReader.read(reader));
@@ -58,7 +73,7 @@
 
     public void testReadConstrainingType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
-        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(staxProcessors);
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         assertNotNull(constrainingTypeReader.read(reader));
         is.close();
@@ -67,7 +82,7 @@
 
     public void testReadComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         assertNotNull(compositeReader.read(reader));
         is.close();
@@ -76,7 +91,7 @@
 
     public void testReadCompositeAndWireIt() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         assertNotNull(compositeReader.read(reader));
         is.close();

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ResolveTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ResolveTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ResolveTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ResolveTestCase.java Sat Apr 28 09:18:40 2007
@@ -26,10 +26,16 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test resolving SCA XML assemblies.
@@ -41,8 +47,14 @@
     private XMLInputFactory inputFactory;
     private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
     private DefaultArtifactResolver resolver; 
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
         inputFactory = XMLInputFactory.newInstance();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
         resolver = new DefaultArtifactResolver(getClass().getClassLoader());
@@ -52,11 +64,14 @@
         inputFactory = null;
         staxProcessors = null;
         resolver = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testResolveConstrainingType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
-        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(staxProcessors);
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         ConstrainingType constrainingType = constrainingTypeReader.read(reader);
         is.close();
@@ -64,7 +79,7 @@
         resolver.add(constrainingType);
 
         is = getClass().getResourceAsStream("TestAllCalculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeReader.read(reader);
         is.close();
@@ -78,7 +93,7 @@
 
     public void testResolveComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite nestedComposite = compositeReader.read(reader);
         is.close();
@@ -86,7 +101,7 @@
         resolver.add(nestedComposite);
 
         is = getClass().getResourceAsStream("TestAllCalculator.composite");
-        compositeReader = new CompositeProcessor(staxProcessors);
+        compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeReader.read(reader);
         is.close();

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WireTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WireTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WireTestCase.java Sat Apr 28 09:18:40 2007
@@ -26,10 +26,16 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test the wiring of SCA XML assemblies.
@@ -41,22 +47,31 @@
     private XMLInputFactory inputFactory;
     private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
     private DefaultArtifactResolver resolver; 
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
         inputFactory = XMLInputFactory.newInstance();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
         resolver = new DefaultArtifactResolver(getClass().getClassLoader());
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
     }
 
     public void tearDown() throws Exception {
         inputFactory = null;
         staxProcessors = null;
         resolver = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testResolveConstrainingType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
-        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(staxProcessors);
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         ConstrainingType constrainingType = constrainingTypeReader.read(reader);
         is.close();
@@ -64,7 +79,7 @@
         resolver.add(constrainingType);
 
         is = getClass().getResourceAsStream("TestAllCalculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeReader.read(reader);
         is.close();
@@ -79,7 +94,7 @@
 
     public void testResolveComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        CompositeProcessor compositeReader = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite nestedComposite = compositeReader.read(reader);
         is.close();
@@ -87,7 +102,7 @@
         resolver.add(nestedComposite);
 
         is = getClass().getResourceAsStream("TestAllCalculator.composite");
-        compositeReader = new CompositeProcessor(staxProcessors);
+        compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeReader.read(reader);
         is.close();

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WriteAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WriteAllTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WriteAllTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/WriteAllTestCase.java Sat Apr 28 09:18:40 2007
@@ -24,11 +24,17 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.ComponentType;
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test writing SCA XML assemblies.
@@ -38,18 +44,27 @@
 public class WriteAllTestCase extends TestCase {
     private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
     private DefaultArtifactResolver resolver; 
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
-        staxProcessors.addExtension(new CompositeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new CompositeProcessor(factory, policyFactory, mapper, staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
         resolver = new DefaultArtifactResolver(getClass().getClassLoader());
     }
 
     public void tearDown() throws Exception {
         staxProcessors = null;
         resolver = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testReadWriteComposite() throws Exception {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Composite.java Sat Apr 28 09:18:40 2007
@@ -104,12 +104,4 @@
      */
     Composite copy();
     
-    /**
-     * Returns an instance of the composite. Components inside the
-     * composite are copied but the aspects of the componentType
-     * (services, references and properties) are not copied.
-     * @return
-     */
-    Composite instanciate();
-    
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/CompositeService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/CompositeService.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/CompositeService.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/CompositeService.java Sat Apr 28 09:18:40 2007
@@ -38,5 +38,5 @@
      * @param promotedService the promoted component service.
      */
     void setPromotedService(ComponentService promotedService);
-
+    
 }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/Wire.java Sat Apr 28 09:18:40 2007
@@ -18,7 +18,6 @@
  */
 package org.apache.tuscany.assembly;
 
-import org.apache.tuscany.assembly.util.Visitable;
 import org.apache.tuscany.policy.IntentAttachPoint;
 import org.apache.tuscany.policy.PolicySetAttachPoint;
 

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentImpl.java Sat Apr 28 09:18:40 2007
@@ -37,9 +37,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentImpl implements Component, Visitable {
-    private List<Object> extensions = new ArrayList<Object>();
-    private boolean unresolved;
+public class ComponentImpl extends BaseImpl implements Component {
     private ConstrainingType constrainingType;
     private Implementation implementation;
     private String name;
@@ -57,9 +55,9 @@
     }
     
     public ComponentImpl(Component other) {
-        unresolved = other.isUnresolved();
-        extensions.addAll(other.getExtensions());
-
+        super(other);
+        
+        // Copy ComponentImpl attributes
         constrainingType = other.getConstrainingType();
         implementation = other.getImplementation();
         name = other.getName();
@@ -77,40 +75,6 @@
         autowire = other.isAutowire();
     }
 
-    public Component instanciate() {
-        ComponentImpl instance = new ComponentImpl();
-        instance.instanciate(this);
-        return instance;
-    }
-    
-    private void instanciate(Component other) {
-        unresolved = other.isUnresolved();
-        extensions.addAll(other.getExtensions());
-
-        constrainingType = other.getConstrainingType();
-        implementation = other.getImplementation();
-        name = other.getName();
-        properties = other.getProperties();
-        for (ComponentReference reference: other.getReferences()) {
-            references.add(new ComponentReferenceImpl(reference));
-        }
-        requiredIntents = other.getRequiredIntents();
-        policySets = other.getPolicySets();;
-        autowire = other.isAutowire();
-    }
-    
-    public List<Object> getExtensions() {
-        return extensions;
-    }
-
-    public boolean isUnresolved() {
-        return unresolved;
-    }
-
-    public void setUnresolved(boolean undefined) {
-        this.unresolved = undefined;
-    }
-
     public ConstrainingType getConstrainingType() {
         return constrainingType;
     }
@@ -164,7 +128,7 @@
     }
 
     public boolean accept(Visitor visitor) {
-        if (!visitor.visit(this)) {
+        if (!super.accept(visitor)) {
             return false;
         }
         for (ComponentProperty property : properties) {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/ComponentTypeImpl.java Sat Apr 28 09:18:40 2007
@@ -21,13 +21,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.tuscany.assembly.Base;
 import org.apache.tuscany.assembly.ComponentType;
 import org.apache.tuscany.assembly.ConstrainingType;
 import org.apache.tuscany.assembly.Property;
 import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.Service;
-import org.apache.tuscany.assembly.util.Visitable;
 import org.apache.tuscany.assembly.util.Visitor;
 import org.apache.tuscany.policy.Intent;
 import org.apache.tuscany.policy.PolicySet;
@@ -37,9 +35,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public class ComponentTypeImpl implements ComponentType, Visitable {
-    private List<Object> extensions = new ArrayList<Object>();
-    private boolean unresolved;
+public class ComponentTypeImpl extends BaseImpl implements ComponentType {
     private String uri;
     private ConstrainingType constrainingType;
     private List<Property> properties = new ArrayList<Property>();
@@ -59,9 +55,7 @@
      * @param other
      */
     public ComponentTypeImpl(ComponentType other) {
-        unresolved = other.isUnresolved();
-        extensions.addAll(other.getExtensions());
-        
+        super(other);
         uri = other.getURI();
         constrainingType = other.getConstrainingType();
         for (Service service: other.getServices()) {
@@ -77,23 +71,6 @@
         policySets.addAll(other.getPolicySets());
     }
     
-    /**
-     * Instanciate...
-     * @param other
-     */
-    protected void instanciate(ComponentType other) {
-        unresolved = other.isUnresolved();
-        extensions = other.getExtensions();
-        
-        uri = other.getURI();
-        constrainingType = other.getConstrainingType();
-        services = other.getServices();
-        references = other.getReferences();
-        properties = other.getProperties();
-        requiredIntents = other.getRequiredIntents();
-        policySets = other.getPolicySets();
-    }
-    
     public String getURI() {
         return uri;
     }
@@ -130,20 +107,8 @@
         return policySets;
     }
 
-    public List<Object> getExtensions() {
-        return extensions;
-    }
-
-    public boolean isUnresolved() {
-        return unresolved;
-    }
-
-    public void setUnresolved(boolean undefined) {
-        this.unresolved = undefined;
-    }
-
     public boolean accept(Visitor visitor) {
-        if (!visitor.visit(this)) {
+        if (!super.accept(visitor)) {
             return false;
         }
         for (Property property : properties) {

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/impl/CompositeImpl.java Sat Apr 28 09:18:40 2007
@@ -28,6 +28,7 @@
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.CompositeReference;
 import org.apache.tuscany.assembly.CompositeService;
+import org.apache.tuscany.assembly.Property;
 import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.Service;
 import org.apache.tuscany.assembly.Wire;
@@ -52,18 +53,30 @@
      * @param other
      */
     public CompositeImpl(Composite other) {
-        super(other);
+        
+        // Copy BaseImpl attributes
+        setUnresolved(other.isUnresolved());
+        getExtensions().addAll(other.getExtensions());
+        
+        // Copy ComponentTypeImpl attributes
+        setURI(other.getURI());
+        setConstrainingType(other.getConstrainingType());
+        for (Property property: other.getProperties()) {
+            getProperties().add(new PropertyImpl(property));
+        }
+        getRequiredIntents().addAll(other.getRequiredIntents());
+        getPolicySets().addAll(other.getPolicySets());
+
+        // Copy CompositeImpl attributes
         name = other.getName();
         autowire = other.isAutowire();
         local = other.isLocal();
         for (Component component: other.getComponents()) {
             components.add(new ComponentImpl(component));
         }
-        getServices().clear();
         for (Service service: other.getServices()) {
             getServices().add(new CompositeServiceImpl((CompositeService)service));
         }
-        getReferences().clear();
         for (Reference reference: other.getReferences()) {
             getReferences().add(new CompositeReferenceImpl((CompositeReference)reference));
         }
@@ -133,26 +146,6 @@
         return copy;
     }
     
-    public Composite instanciate() {
-        CompositeImpl instance = new CompositeImpl();
-        instance.instanciate(this);
-        return instance;
-    }
-    
-    protected void instanciate(Composite other) {
-        super.instanciate(other);
-        
-        name = other.getName();
-        autowire = other.isAutowire();
-        local = other.isLocal();
-        for (Component component: other.getComponents()) {
-            components.add(new ComponentImpl(component));
-        }
-        for (Wire wire: other.getWires()) {
-            wires.add(new WireImpl(wire));
-        }
-    }
-
     @Override
     public int hashCode() {
         return String.valueOf(getName()).hashCode();

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java Sat Apr 28 09:18:40 2007
@@ -39,9 +39,7 @@
 import org.apache.tuscany.assembly.SCABinding;
 import org.apache.tuscany.assembly.Service;
 import org.apache.tuscany.assembly.Wire;
-import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 
 /**
  * A utility class that handles the configuration of the components inside a 
@@ -59,7 +57,6 @@
      * 
      * @param assemblyFactory
      * @param interfaceContractMapper
-     * @param composite
      */
     public CompositeUtil(AssemblyFactory assemblyFactory,
                          InterfaceContractMapper interfaceContractMapper) {
@@ -68,16 +65,6 @@
     }
 
     /**
-     * Constructs a new composite util.
-     *  
-     * @param composite
-     */
-    public CompositeUtil() {
-        this(new DefaultAssemblyFactory(),
-             new DefaultInterfaceContractMapper());
-    }
-
-    /**
      * Collect all includes in a graph of includes.
      * 
      * @param composite
@@ -492,13 +479,14 @@
     }
 
     /**
-     * Resolves promoted services
+     * Connect composite services to the component services that they
+     * promote. 
      * 
      * @param composite
      * @param componentServices
      * @param problems
      */
-    private void connectPromotedServices(Composite composite,
+    private void connectCompositeServices(Composite composite,
                                          Map<String, ComponentService> componentServices,
                                          List<Base> problems) {
 
@@ -534,7 +522,7 @@
      * @param componentReferences
      * @param problems
      */
-    private void connectPromotedReferences(Composite composite,
+    private void connectCompositeReferences(Composite composite,
                                            Map<String, ComponentReference> componentReferences,
                                            List<Base> problems) {
 
@@ -574,7 +562,7 @@
      * @param componentReferences
      * @param problems
      */
-    private void connectReferenceTargets(Composite composite,
+    private void connectComponentReferences(Composite composite,
                                       Map<String, ComponentService> componentServices,
                                       Map<String, ComponentReference> componentReferences,
                                       List<Base> problems) {
@@ -661,7 +649,7 @@
      * @param componentReferences
      * @param problems
      */
-    private void connectWiredReferences(Composite composite,
+    private void connectWires(Composite composite,
                                   Map<String, ComponentService> componentServices,
                                   Map<String, ComponentReference> componentReferences,
                                   List<Base> problems) {
@@ -713,11 +701,211 @@
     }
 
     /**
-     * Wire the references inside the composite.
+     * Follow a service promotion chain down to the inner most
+     * (non composite) component service.
+     * 
+     * @param topCompositeService
+     * @return
+     */
+    private ComponentService getPromotedComponentService(CompositeService compositeService) {
+        ComponentService componentService = compositeService.getPromotedService();
+        if (componentService != null) {
+            Service service = componentService.getService();
+            if (service instanceof CompositeService) {
+                
+                // Continue to follow the service promotion chain
+                return getPromotedComponentService((CompositeService)service);
+
+            } else {
+                
+                // Found a non-composite service
+                return componentService;
+            }
+        } else {
+            
+            // No promoted service
+            return null;
+        }
+    }
+    
+    /**
+     * Follow a reference promotion chain down to the inner most
+     * (non composite) component references.
+     * 
+     * @param compositeReference
+     * @return
+     */
+    private List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
+        List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
+        collectPromotedComponentReferences(compositeReference, componentReferences);
+        return componentReferences;
+    }
+    
+    /**
+     * Follow a reference promotion chain down to the inner most
+     * (non composite) component references.
+     * 
+     * @param compositeReference
+     * @param componentReferences
+     * @return
+     */
+    private void collectPromotedComponentReferences(CompositeReference compositeReference, List<ComponentReference> componentReferences) {
+        for (ComponentReference componentReference: compositeReference.getPromotedReferences()) {
+            Reference reference = componentReference.getReference();
+            if (reference instanceof CompositeReference) {
+                
+                // Continue to follow the reference promotion chain
+                collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
+
+            } else if (reference != null) {
+                
+                // Found a non-composite reference
+                componentReferences.add(componentReference);
+            }
+        }
+    }
+
+    /**
+     * Activate composite services in nested composites.
      * 
+     * @param composite
      * @param problems
      */
-    public void wireReferences(Composite composite, List<Base> problems) {
+    public void activateCompositeServices(Composite composite, List<Base> problems)  {
+        
+        // Process nested composites recursively
+        for (Component component: composite.getComponents()) {
+            Implementation implementation = component.getImplementation();
+            if (implementation instanceof Composite) {
+                
+                // First process nested composites
+                activateCompositeServices((Composite)implementation, problems);
+                
+                // Process the component services declared on components
+                // in this composite
+                for (ComponentService componentService: component.getServices()) {
+                    CompositeService compositeService = (CompositeService)componentService.getService();
+                    if (compositeService != null) {
+                        ComponentService promotedService = getPromotedComponentService(compositeService);
+                        if (promotedService != null) {
+                            
+                            // Add the component service to the innermost promoted component
+                            SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+                            Component promotedComponent = scaBinding.getComponent();
+                            promotedComponent.getServices().add(componentService);
+                        }
+                    }
+                }
+            }
+        }
+        
+        // Process composite services declared in this composite 
+        for (Service service: composite.getServices()) {
+            CompositeService compositeService = (CompositeService)service;
+            ComponentService promotedService = getPromotedComponentService(compositeService);
+            if (promotedService != null) {
+
+                // Create a new component service to represent this composite service
+                // on the promoted component
+                ComponentService newComponentService = assemblyFactory.createComponentService();
+                newComponentService.setName(compositeService.getName());
+                newComponentService.setService(compositeService);
+                SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+                Component component = scaBinding.getComponent();
+                component.getServices().add(newComponentService);
+                
+                // Change the composite service to now promote the newly created
+                // component service directly
+                compositeService.setPromotedService(newComponentService);
+            }
+        }
+    }
+
+    /**
+     * Wire composite references in nested composites.
+     * @param composite
+     * @param problems
+     */
+    public void wireCompositeReferences(Composite composite, List<Base> problems)  {
+        
+        // Process nested composites recursively
+        for (Component component: composite.getComponents()) {
+            Implementation implementation = component.getImplementation();
+            if (implementation instanceof Composite) {
+                wireCompositeReferences((Composite)implementation, problems);
+            }
+        }
+        
+        // Process composite references declared in this composite 
+        for (Reference reference: composite.getReferences()) {
+            CompositeReference compositeReference = (CompositeReference)reference;
+            List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
+            for (ComponentReference promotedReference: promotedReferences) {
+
+                // Override the configuration of the promoted reference
+                promotedReference.getBindings().clear();
+                promotedReference.getBindings().addAll(compositeReference.getBindings());
+            }
+        }
+
+        // Process the component references declared on components
+        // in this composite
+        for (Component component: composite.getComponents()) {
+            Implementation implementation = component.getImplementation();
+            if (implementation instanceof Composite) {
+                for (ComponentReference componentReference: component.getReferences()) {
+                    CompositeReference compositeReference = (CompositeReference)componentReference.getReference();
+                    if (compositeReference != null) {
+                        List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
+                        for (ComponentReference promotedReference: promotedReferences) {
+                            
+                            // Override the configuration of the promoted reference
+                            promotedReference.getBindings().clear();
+                            promotedReference.getBindings().addAll(componentReference.getBindings());
+                            
+                            // Wire the promoted reference to the actual non-composite
+                            // component services
+                            promotedReference.getTargets().clear();
+                            for (ComponentService target: componentReference.getTargets()) {
+                                if (target.getService() instanceof CompositeService) {
+                                    
+                                    // Wire to the actual component service promoted by a 
+                                    // composite service
+                                    CompositeService compositeService = (CompositeService)target.getService();
+                                    ComponentService componentService = compositeService.getPromotedService();
+                                    if (componentService != null) {
+                                        promotedReference.getTargets().add(componentService);
+                                    }
+                                } else {
+                                    
+                                    // Wire to a non-composite target service
+                                    promotedReference.getTargets().add(target);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Wire component references to component services and connect 
+     * promoted services/references to component services/references
+     * inside a composite.
+     * 
+     * @param composite
+     * @param problems
+     */
+    public void wireComposite(Composite composite, List<Base> problems) {
+        
+        // Wire nested composites recursively
+        for (Component component: composite.getComponents()) {
+            Implementation implementation = component.getImplementation();
+            if (implementation instanceof Composite) {
+                wireComposite((Composite)implementation, problems);
+            }
+        }
 
         // Index and bind all component services and references
         Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
@@ -726,15 +914,16 @@
         // Create SCA bindings on all component services and references
         createSCABindings(composite, componentServices, componentReferences, problems);
 
-        // Resolve promoted services and references
-        connectPromotedServices(composite, componentServices, problems);
-        connectPromotedReferences(composite, componentReferences, problems);
+        // Connect composite services and references to the component
+        // services and references that they promote
+        connectCompositeServices(composite, componentServices, problems);
+        connectCompositeReferences(composite, componentReferences, problems);
         
-        // Connect references to their targets
-        connectReferenceTargets(composite, componentServices, componentReferences, problems);
+        // Connect component references to their targets
+        connectComponentReferences(composite, componentServices, componentReferences, problems);
 
-        // Connect references as described in wires
-        connectWiredReferences(composite, componentServices, componentReferences, problems);
+        // Connect component references as described in wires
+        connectWires(composite, componentServices, componentReferences, problems);
 
         // Validate that references are wired or promoted, according
         // to their multiplicity
@@ -759,10 +948,11 @@
             if (implementation instanceof Composite) {
                 
                 Composite compositeImplementation = (Composite)implementation;
-                Composite instance = compositeImplementation.instanciate();
-                component.setImplementation(instance);
-                expandComposites(instance, problems);
+                Composite copy = compositeImplementation.copy();
+                component.setImplementation(copy);
+                expandComposites(copy, problems);
             }
         }
     }
+    
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/ReadTestCase.java Sat Apr 28 09:18:40 2007
@@ -27,13 +27,19 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Base;
 import org.apache.tuscany.assembly.ComponentType;
 import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.assembly.util.CompositeUtil;
 import org.apache.tuscany.assembly.xml.ComponentTypeProcessor;
 import org.apache.tuscany.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test reading WSDL interfaces.
@@ -44,8 +50,14 @@
 
     XMLInputFactory inputFactory;
     DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
         inputFactory = XMLInputFactory.newInstance();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
 
@@ -56,10 +68,13 @@
     public void tearDown() throws Exception {
         inputFactory = null;
         staxProcessors = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(staxProcessors);
+        ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(factory, policyFactory, staxProcessors);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         ComponentType componentType = componentTypeProcessor.read(reader);
@@ -69,16 +84,16 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeProcessor = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeUtil compositeUtil = new CompositeUtil();
+        CompositeUtil compositeUtil = new CompositeUtil(factory, mapper);
         compositeUtil.fuseIncludes(composite, new ArrayList<Base>());
         compositeUtil.configureComponents(composite, new ArrayList<Base>());
-        compositeUtil.wireReferences(composite, new ArrayList<Base>());
+        compositeUtil.wireComposite(composite, new ArrayList<Base>());
 
         //new PrintUtil(System.out).print(composite);
     }

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/WriteTestCase.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/binding/ws/xml/WriteTestCase.java Sat Apr 28 09:18:40 2007
@@ -26,12 +26,18 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.ComponentType;
 import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.assembly.xml.ComponentTypeProcessor;
 import org.apache.tuscany.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.assembly.xml.ConstrainingTypeProcessor;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * Test reading/write WSDL interfaces.
@@ -42,14 +48,20 @@
 
     XMLInputFactory inputFactory;
     DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
 
     public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
         inputFactory = XMLInputFactory.newInstance();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
 
-        staxProcessors.addExtension(new CompositeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new CompositeProcessor(factory, policyFactory, mapper, staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
 
         WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor();
         staxProcessors.addExtension(wsdlProcessor);
@@ -58,6 +70,9 @@
     public void tearDown() throws Exception {
         inputFactory = null;
         staxProcessors = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
     }
 
     public void testReadWriteComponentType() throws Exception {

Added: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java?view=auto&rev=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java (added)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java Sat Apr 28 09:18:40 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.    
+ */
+
+package org.apache.tuscany.core.spring;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.contribution.resolver.DefaultArtifactResolver;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
+
+/**
+ * Test the wiring of SCA XML assemblies.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class WireTestCaseFIXME extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private DefaultArtifactResolver resolver; 
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
+
+    public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new DefaultInterfaceContractMapper();
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+        resolver = new DefaultArtifactResolver(getClass().getClassLoader());
+    }
+
+    public void tearDown() throws Exception {
+        inputFactory = null;
+        staxProcessors = null;
+        resolver = null;
+        policyFactory = null;
+        factory = null;
+        mapper = null;
+    }
+
+    public void testWireComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("OuterCalculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        Composite nestedComposite = compositeReader.read(reader);
+        is.close();
+        assertNotNull(nestedComposite);
+        resolver.add(nestedComposite);
+
+        is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
+        reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeReader.read(reader);
+        is.close();
+        
+        compositeReader.resolve(composite, resolver);
+        compositeReader.wire(composite);
+        
+        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spring/src/test/java/org/apache/tuscany/core/spring/WireTestCaseFIXME.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/TestRuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/TestRuntimeContext.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/TestRuntimeContext.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/application/context/TestRuntimeContext.java Sat Apr 28 09:18:40 2007
@@ -20,7 +20,9 @@
 
 import java.io.InputStream;
 
+import org.apache.tuscany.assembly.AssemblyFactory;
 import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.assembly.xml.ComponentTypeProcessor;
 import org.apache.tuscany.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.assembly.xml.ConstrainingTypeProcessor;
@@ -29,7 +31,11 @@
 import org.apache.tuscany.contribution.service.ContributionException;
 import org.apache.tuscany.core.bean.context.CompositeApplicationContext;
 import org.apache.tuscany.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 import org.apache.tuscany.interfacedef.java.xml.JavaInterfaceProcessor;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
 /**
  * A mini test runtime that uses a custom Spring ApplicationContext to turn an
@@ -43,12 +49,16 @@
 
     public TestRuntimeContext(String compositeFile) {
         
+        AssemblyFactory factory = new DefaultAssemblyFactory();
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper mapper = new DefaultInterfaceContractMapper();
+        
         // Populate ArtifactProcessor registry
         DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
-        CompositeProcessor compositeProcessor = new CompositeProcessor(staxProcessors);
+        CompositeProcessor compositeProcessor = new CompositeProcessor(factory, policyFactory, mapper, staxProcessors);
         staxProcessors.addExtension(compositeProcessor);
-        staxProcessors.addExtension(new ComponentTypeProcessor(staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new ComponentTypeProcessor(factory, policyFactory, staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessors));
         staxProcessors.addExtension(new JavaInterfaceProcessor());
         staxProcessors.addExtension(new JavaImplementationProcessor());
         

Modified: incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java?view=diff&rev=533382&r1=533381&r2=533382
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java Sat Apr 28 09:18:40 2007
@@ -68,7 +68,7 @@
                                                                        interfaceContractMapper, staxProcessors);
         staxProcessors.addExtension(compositeProcessor);
         staxProcessors.addExtension(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessors));
-        staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));
+        staxProcessors.addExtension(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessors));
         staxProcessors.addExtension(new JavaInterfaceProcessor());
         staxProcessors.addExtension(new JavaImplementationProcessor(
             assemblyFactory, policyFactory, javaImplementationFactory, new DefaultJavaClassIntrospector()));



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message