tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r653010 [1/2] - in /incubator/tuscany/java/sca: itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ modules/contribution/src/main/java/org/apache/tuscan...
Date Sat, 03 May 2008 06:47:55 GMT
Author: jsdelfino
Date: Fri May  2 23:47:54 2008
New Revision: 653010

URL: http://svn.apache.org/viewvc?rev=653010&view=rev
Log:
More simplifications and cleanup of artifact processor test cases and the setup/init of domain management itest and samples.

Added:
    incubator/tuscany/java/sca/modules/workspace-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
    incubator/tuscany/java/sca/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/
    incubator/tuscany/java/sca/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/
      - copied from r652985, incubator/tuscany/java/sca/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/
Removed:
    incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/
    incubator/tuscany/java/sca/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/
Modified:
    incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
    incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
    incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
    incubator/tuscany/java/sca/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java
    incubator/tuscany/java/sca/modules/policy-security-ws/src/test/java/org/apache/tuscany/sca/policy/security/ws/PolicyReadTestCase.java
    incubator/tuscany/java/sca/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java
    incubator/tuscany/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
    incubator/tuscany/java/sca/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
    incubator/tuscany/java/sca/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/DistributeComponents.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/ListComponents.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/ListDependencies.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/ListDeployables.java
    incubator/tuscany/java/sca/samples/domain-management/src/main/java/manager/WireComponents.java

Modified: incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java Fri May  2 23:47:54 2008
@@ -21,8 +21,6 @@
 
 
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -31,55 +29,33 @@
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
 import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionListener;
-import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
 import org.apache.tuscany.sca.node.SCAClient;
 import org.apache.tuscany.sca.node.SCANode2;
 import org.apache.tuscany.sca.node.SCANode2Factory;
 import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.workspace.Workspace;
 import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
 import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
-import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;
-import org.apache.tuscany.sca.workspace.processor.impl.ContributionInfoProcessor;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -93,32 +69,20 @@
     
      final static Logger logger = Logger.getLogger(ContributionSPIsTestCase.class.getName());
     
-    static ModelFactoryExtensionPoint modelFactories;
-    static ContributionFactory contributionFactory;
-    static AssemblyFactory assemblyFactory;
-    static WorkspaceFactory workspaceFactory;  
-    static PolicyFactory policyFactory;
-    static XMLInputFactory inputFactory;
-    static XMLOutputFactory outputFactory;    
-    
-    static ModelResolverExtensionPoint modelResolvers;
-    
-    static StAXArtifactProcessorExtensionPoint staxProcessors;
-    static StAXArtifactProcessor<Object> staxProcessor;
-    static URLArtifactProcessorExtensionPoint urlProcessors;
-    static URLArtifactProcessor<Object> urlProcessor;
-    static URLArtifactProcessor<Contribution> contributionInfoProcessor;
-    static URLArtifactProcessor<Contribution> contributionContentProcessor;
-    static StAXArtifactProcessor<Composite> compositeProcessor;
-    
-    static Workspace workspace;
-    
-    static List<String> problems = new ArrayList<String>();
-    static Monitor dependencyBuilderMonitor;
-    static ContributionDependencyBuilderImpl analyzer;
-    static List<ContributionListener> contributionListeners;
+    private static ModelFactoryExtensionPoint modelFactories;
+    private static WorkspaceFactory workspaceFactory;  
+    private static XMLOutputFactory outputFactory;    
     
-    static CompositeBuilder compositeBuilder;
+    private static ModelResolverExtensionPoint modelResolvers;
+    
+    private static URLArtifactProcessorExtensionPoint urlProcessors;
+    private static URLArtifactProcessor<Contribution> contributionInfoProcessor;
+    private static URLArtifactProcessor<Contribution> contributionContentProcessor;
+    
+    private static Workspace workspace;
+    
+    private static List<String> problems = new ArrayList<String>();
+    private static ContributionDependencyBuilder dependencyBuilder;
     
     @BeforeClass
     public static void init() throws Exception {
@@ -133,55 +97,26 @@
             
             // Create model factories
             modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-            contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-            assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
-            inputFactory = modelFactories.getFactory(XMLInputFactory.class);
             outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-            contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-            policyFactory = modelFactories.getFactory(PolicyFactory.class); 
             workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
             
             // Create model resolvers
             modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
 
             // Create artifact processors
-            staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-            staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
-            compositeProcessor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(Composite.class);
-           
             urlProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-            urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
                  
             // Create contribution processor
-            contributionInfoProcessor = new ContributionInfoProcessor(modelFactories, modelResolvers, urlProcessor);
-            contributionContentProcessor = new ContributionContentProcessor(modelFactories, modelResolvers, urlProcessor);
-            contributionListeners = registry.getExtensionPoint(ContributionListenerExtensionPoint.class).getContributionListeners();            
+            contributionInfoProcessor = urlProcessors.getProcessor("contribution/info");
+            contributionContentProcessor = urlProcessors.getProcessor("contribution/content");
             
             // Create workspace model to hold contribution information
             workspace = workspaceFactory.createWorkspace();
             
-            // create a dependency builder 
-            dependencyBuilderMonitor = new Monitor() {
-                    public void problem(Problem problem) {
-                        problems.add(problem.getMessageId() + " " + problem.getProblemObject().toString());
-                    }
-                };
-                
             MonitorFactory monitorFactory = registry.getExtensionPoint(MonitorFactory.class);
             Monitor monitor = monitorFactory.createMonitor();
-            analyzer = new ContributionDependencyBuilderImpl(monitor);  
-            
-            // Create composite builder
-            SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
-            IntentAttachPointTypeFactory intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-            InterfaceContractMapper contractMapper = new InterfaceContractMapperImpl();
-                       
-            compositeBuilder = new CompositeBuilderImpl(assemblyFactory, 
-                                                        scaBindingFactory, 
-                                                        intentAttachPointTypeFactory,
-                                                        contractMapper, 
-                                                        monitor);
+            dependencyBuilder = new ContributionDependencyBuilderImpl(monitor);  
             
         } catch(Exception ex){
             ex.printStackTrace();
@@ -189,11 +124,6 @@
         
    }
 
-    @AfterClass
-    public static void destroy() throws Exception {
-       
-    }
-    
     @Test
     public void testReadDependentContributions() throws Exception { 
         try {            
@@ -241,7 +171,7 @@
             for (Contribution tmpContribution : workspace.getContributions()){
                 for (Composite deployable : tmpContribution.getDeployables()){
                     if (deployable.getName().equals(chosenDeployableName)){
-                        contributionsToDeploy = analyzer.buildContributionDependencies(tmpContribution, workspace);
+                        contributionsToDeploy = dependencyBuilder.buildContributionDependencies(tmpContribution, workspace);
                     }
                 }
             }
@@ -249,7 +179,6 @@
             // load all the contributions in the dependency chain to find the chosen 
             // composite
             List<Contribution> loadedContributions = new ArrayList<Contribution>();
-            Composite deployable = null;
             for (Contribution tmpContribution : contributionsToDeploy){
                 Contribution loadedContribution = contribution(loadedContributions, tmpContribution.getURI(), tmpContribution.getLocation());
                 loadedContributions.add(loadedContribution);
@@ -305,11 +234,9 @@
 
 /*
             AssemblyInspector assemblyInspector = new AssemblyInspector();
-            
             System.out.println(assemblyInspector.assemblyAsString(node));
 */
             
-            
         } catch (Exception ex) {
             ex.printStackTrace();
             Assert.fail();
@@ -317,24 +244,12 @@
     }
     
     
-    /**
-     * FIXME Remove this later
-     * Waiting for more tidying of contribution processing. At the moment we have to 
-     * set up a dummy contribution repository to make it work
-     */    
     private Contribution contribution(List<Contribution> contributions, String contributionURI, String contributionLocation) throws ContributionReadException {
         try {
             URI uri = URI.create(contributionURI);
             URL location = locationURL(contributionLocation);
             Contribution contribution = (Contribution)contributionContentProcessor.read(null, uri, location);
             
-            // FIXME simplify this later
-            // Fix up contribution imports
-            ContributionRepository dummyRepository = new DummyContributionRepository(contributions);
-            for (ContributionListener listener: contributionListeners) {
-                listener.contributionAdded(dummyRepository, contribution);
-            }
-            
             ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
             contributionContentProcessor.resolve(contribution, modelResolver);
             
@@ -349,7 +264,7 @@
         }
     }
     
-    static URL locationURL(String location) throws MalformedURLException {
+    private static URL locationURL(String location) throws MalformedURLException {
         URI uri = URI.create(location);
         String scheme = uri.getScheme();
         if (scheme == null) {
@@ -363,27 +278,4 @@
         }
     }
     
-    /**
-     * FIXME Remove this later
-     */
-    private class DummyContributionRepository implements ContributionRepository {
-        
-        private List<Contribution> contributions;
-
-        public DummyContributionRepository(List<Contribution> contributions) {
-            this.contributions = contributions;
-        }
-        
-        public void addContribution(Contribution contribution) {}
-        public URL find(String contribution) { return null; }
-        public Contribution getContribution(String uri) { return null; }
-        public List<Contribution> getContributions() { return contributions; }
-        public URI getDomain() { return null; }
-        public List<String> list() { return null; }
-        public void remove(String contribution) {}
-        public void removeContribution(Contribution contribution) {}
-        public URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException { return null; }
-        public URL store(String contribution, URL sourceURL) throws IOException { return null;}
-        public void updateContribution(Contribution contribution) {}
-    }    
 }

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/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/sca/binding/ws/xml/ReadTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java Fri May  2 23:47:54 2008
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
@@ -30,30 +29,20 @@
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.OperationsConfigurator;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading WSDL interfaces.
@@ -63,35 +52,22 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        factories.addFactory(assemblyFactory);
-        scaBindingFactory = new SCABindingFactoryImpl();
-        factories.addFactory(scaBindingFactory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
         
-        WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
-        factories.addFactory(wsFactory);
-        WSDLFactory wsdlFactory = new DefaultWSDLFactory();
-        factories.addFactory(wsdlFactory);
-        
-        WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(factories);
-        staxProcessors.addArtifactProcessor(wsdlProcessor);
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     @Override
@@ -99,41 +75,31 @@
     }
 
     public void testReadComponentType() throws Exception {
-        StAXArtifactProcessor<ComponentType> componentTypeProcessor = staxProcessors.getProcessor(ComponentType.class);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ComponentType componentType = componentTypeProcessor.read(reader);
+        ComponentType componentType = (ComponentType)staxProcessor.read(reader);
         assertNotNull(componentType);
-
-        //new PrintUtil(System.out).print(componentType);
     }
 
     public void testReadComposite() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
-
-        //new PrintUtil(System.out).print(composite);
+        compositeBuilder.build(composite);
     }
     
     public void testReadPolicies() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("PoliciedCalculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
 
         assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0))
             .getConfiguredOperations().get(0).getRequiredIntents().size(), 2);
-        //new PrintUtil(System.out).print(composite);
     }
 
     /**
@@ -144,11 +110,10 @@
      * be of the 'Binding' form.
      */
     public void testReadBadWsdlElement() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("Calculator-bad-wsdlElement.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         try {
-            Composite composite = compositeProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("ContributionReadException expected.");
         } catch(ContributionReadException e) {
             // Expected

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/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/sca/binding/ws/xml/WriteTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java Fri May  2 23:47:54 2008
@@ -27,25 +27,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 
 /**
  * Test reading/write WSDL interfaces.
@@ -54,52 +42,33 @@
  */
 public class WriteTestCase extends TestCase {
 
-    XMLInputFactory inputFactory;
-    DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        factories.addFactory(factory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
-        factories.addFactory(wsFactory);
-        WSDLFactory wsdlFactory = new DefaultWSDLFactory();
-        factories.addFactory(wsdlFactory);
-
-        WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(factories);
-        staxProcessors.addArtifactProcessor(wsdlProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComponentType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
-        ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+        ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(componentType);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(componentType, bos);
+        staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
     }
 
     public void testReadWriteComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        Composite composite = staxProcessor.read(is, Composite.class);
+        Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(composite, bos);
+        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java Fri May  2 23:47:54 2008
@@ -172,7 +172,7 @@
         }
         
         public Class<?> getModelType() {
-            if (modelType == null) {
+            if (modelTypeName != null && modelType == null) {
                 try {
                     modelType = processorDeclaration.loadClass(modelTypeName);
                 } catch (Exception e) {

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java Fri May  2 23:47:54 2008
@@ -60,6 +60,7 @@
     private ValidationSchemaExtensionPoint schemas;
     private Monitor monitor;
     private boolean initialized;
+    private boolean hasSchemas;
     private Schema aggregatedSchema;
 
     /**
@@ -88,6 +89,11 @@
         try {
             List<String> uris = schemas.getSchemas();
             int n = uris.size();
+            if (n ==0) {
+                return;
+            } else {
+                hasSchemas = true;
+            }
             final Source[] sources = new Source[n];
             for (int i =0; i < n; i++) {
                 final String uri = uris.get(i);
@@ -171,32 +177,56 @@
 
     public XMLStreamReader createXMLStreamReader(InputStream arg0, String arg1) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        }else {
+            return inputFactory.createXMLStreamReader(arg0, arg1);
+        }
     }
 
     public XMLStreamReader createXMLStreamReader(InputStream arg0) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        } else {
+            return inputFactory.createXMLStreamReader(arg0);
+        }
     }
 
     public XMLStreamReader createXMLStreamReader(Reader arg0) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        } else {
+            return inputFactory.createXMLStreamReader(arg0);
+        }
     }
 
     public XMLStreamReader createXMLStreamReader(Source arg0) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+        } else {
+            return inputFactory.createXMLStreamReader(arg0);
+        }
     }
 
     public XMLStreamReader createXMLStreamReader(String arg0, InputStream arg1) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        } else {
+            return inputFactory.createXMLStreamReader(arg0, arg1);
+        }
     }
 
     public XMLStreamReader createXMLStreamReader(String arg0, Reader arg1) throws XMLStreamException {
         initializeSchemas();
-        return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        if (hasSchemas) {
+            return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+        } else {
+            return inputFactory.createXMLStreamReader(arg0, arg1);
+        }
     }
 
     public XMLEventAllocator getEventAllocator() {

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java Fri May  2 23:47:54 2008
@@ -52,7 +52,6 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
@@ -79,7 +78,6 @@
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
 import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.workspace.Workspace;
 import org.apache.tuscany.sca.workspace.WorkspaceFactory;
 import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
@@ -115,7 +113,6 @@
     private ExtensionPointRegistry extensionPoints;
     private Monitor monitor;
     private ContributionFactory contributionFactory;
-    private AssemblyFactory assemblyFactory;
     private WorkspaceFactory workspaceFactory;
     private StAXArtifactProcessor<Object> staxProcessor;
     private URLArtifactProcessor<Object> urlProcessor;
@@ -143,9 +140,7 @@
         outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
         outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
         contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-        assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
-        PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
         
         // Create model resolvers
         ModelResolverExtensionPoint modelResolvers = new DefaultModelResolverExtensionPoint();

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java Fri May  2 23:47:54 2008
@@ -26,11 +26,10 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 
 /**
  * @version $Rev$ $Date$
@@ -39,26 +38,19 @@
 
     protected static final String BPEL_PROCESS_FILE = "helloworld/helloworld.bpel";
 
-    private ModelFactoryExtensionPoint modelFactories;
+    private URLArtifactProcessor<Object> documentProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
-
-        modelFactories = new DefaultModelFactoryExtensionPoint();
-        modelFactories.addFactory(new DefaultAssemblyFactory());
-        modelFactories.addFactory(new DefaultWSDLFactory());
-
-        BPELFactory bpelFactory = new DefaultBPELFactory(modelFactories);
-        modelFactories.addFactory(bpelFactory);
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+        documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
     }
 
     public void testLoadBPELProcessDefinition() throws Exception {
-        BPELDocumentProcessor bpelDocumentProcessor = new BPELDocumentProcessor(modelFactories);
-
         URI processURI = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE).toURI();
         URL processLocation = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE);
-        BPELProcessDefinition bpelProcessDefinition = bpelDocumentProcessor.read(null, processURI, processLocation);
+        BPELProcessDefinition bpelProcessDefinition = (BPELProcessDefinition)documentProcessor.read(null, processURI, processLocation);
 
         assertNotNull(bpelProcessDefinition);
         assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName());

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java Fri May  2 23:47:54 2008
@@ -23,16 +23,17 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * @version $Rev$ $Date$
@@ -46,23 +47,26 @@
         + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
             + " <component name=\"BPELHelloWorldComponent\">"
             + "   <implementation.bpel process=\"hns:HelloWorld\" />"
-            + "</component>";
+            + " </component>"
+            + "</composite>";
 
     private static final String COMPOSITE_INVALID =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
             + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
             + " <component name=\"BPELHelloWorldComponent\">"
             + "   <implementation.bpel/>"
-            + "</component>";
+            + " </component>"
+            + "</composite>";
 
-    private StAXArtifactProcessorExtensionPoint staxProcessors;
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        xmlFactory = XMLInputFactory.newInstance();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -70,18 +74,10 @@
      * @throws Exception
      */
     public void testLoadValidComposite() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE));
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
         
-        StAXArtifactProcessor<BPELImplementation> bpelProcessor = staxProcessors.getProcessor(BPELImplementation.class);
-        
-        while(true) {
-            int event = reader.next();
-            if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
-                break;
-            }
-        }
-
-        BPELImplementation implementation = bpelProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
+        BPELImplementation implementation = (BPELImplementation)composite.getComponents().get(0).getImplementation();
         
         assertNotNull(implementation);
         assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), implementation.getProcess());
@@ -92,19 +88,10 @@
      * @throws Exception
      */
     public void testLoadInvalidComposite() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
-
-        StAXArtifactProcessor<BPELImplementation> bpelProcessor = staxProcessors.getProcessor(BPELImplementation.class);
-        
-        while(true) {
-            int event = reader.next();
-            if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
-                break;
-            }
-        }
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
 
         try {
-            bpelProcessor.read(reader);
+            staxProcessor.read(reader);
             
             fail("InvalidException should have been thrown");
         } catch(Exception e) {

Modified: incubator/tuscany/java/sca/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java Fri May  2 23:47:54 2008
@@ -23,20 +23,27 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
 import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.data.engine.config.ConnectionInfo;
 import org.apache.tuscany.sca.data.engine.config.ConnectionProperties;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * @version $Rev: 538445 $ $Date: 2007-05-15 23:20:37 -0700 (Tue, 15 May 2007) $
@@ -70,35 +77,30 @@
             + " </component>"
             + "</composite>";
 
-    private XMLInputFactory xmlFactory;
-    private ModelFactoryExtensionPoint modelFactories;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
-        xmlFactory = XMLInputFactory.newInstance();
-        
-        modelFactories = new DefaultModelFactoryExtensionPoint();
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(assemblyFactory);
-        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
-        modelFactories.addFactory(javaFactory);
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     public void testLoadCompositeUsingDatasource() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE));
-        
-        DATAImplementationProcessor dataProcessor = new DATAImplementationProcessor(modelFactories);
-        
-        while(true) {
-            int event = reader.next();
-            if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DATA.equals(reader.getName())) {
-                break;
-            }
-        }
-
-        DATAImplementation implementation = dataProcessor.read(reader);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE));
         
+        Composite composite = (Composite)staxProcessor.read(reader);
+        DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation();
         assertNotNull(implementation);
 
         ConnectionInfo connInfo = implementation.getConnectionInfo();
@@ -110,19 +112,10 @@
     }
 
     public void testLoadCompositeUsingConnectionProperties() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES));
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES));
 
-        DATAImplementationProcessor dataProcessor = new DATAImplementationProcessor(modelFactories);
-        
-        while(true) {
-            int event = reader.next();
-            if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DATA.equals(reader.getName())) {
-                break;
-            }
-        }
-
-        DATAImplementation implementation = dataProcessor.read(reader);
-        
+        Composite composite = (Composite)staxProcessor.read(reader);
+        DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation();
         assertNotNull(implementation);
 
         ConnectionInfo connInfo = implementation.getConnectionInfo();

Modified: incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java Fri May  2 23:47:54 2008
@@ -22,33 +22,25 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
-import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading Node implementations.
@@ -58,48 +50,31 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        factories.addFactory(assemblyFactory);
-        scaBindingFactory = new SCABindingFactoryImpl();
-        factories.addFactory(scaBindingFactory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
         
-        EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
-        factories.addFactory(nodeFactory);
-        
-        EJBImplementationProcessor ejbProcessor = new EJBImplementationProcessor(factories);
-        staxProcessors.addArtifactProcessor(ejbProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     public void testReadComposite() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("TestEJB.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
         
         assertTrue(((EJBImplementation)composite.getComponents().get(0).getImplementation()).getEJBLink().equals("module.jar#TestEJB"));
     }

Modified: incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java Fri May  2 23:47:54 2008
@@ -27,22 +27,12 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
-import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 
 /**
  * Test reading/write WSDL interfaces.
@@ -51,41 +41,25 @@
  */
 public class WriteTestCase extends TestCase {
 
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        factories.addFactory(factory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
-        factories.addFactory(nodeFactory);
-        
-        EJBImplementationProcessor ejbProcessor = new EJBImplementationProcessor(factories);
-        staxProcessors.addArtifactProcessor(ejbProcessor);
-
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("TestEJB.composite");
-        Composite composite = staxProcessor.read(is, Composite.class);
+        Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(composite, bos);
+        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
         
         assertTrue(bos.toString().contains("module.jar#TestEJB"));
 

Modified: incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java Fri May  2 23:47:54 2008
@@ -22,33 +22,24 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading Node implementations.
@@ -58,52 +49,31 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        ContributionFactory contributionFactory = new DefaultContributionFactory();
-        factories.addFactory(contributionFactory);
-        assemblyFactory = new DefaultAssemblyFactory();
-        factories.addFactory(assemblyFactory);
-        scaBindingFactory = new SCABindingFactoryImpl();
-        factories.addFactory(scaBindingFactory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
         
-        NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
-        factories.addFactory(nodeFactory);
-        
-        NodeImplementationProcessor nodeProcessor = new NodeImplementationProcessor(factories);
-        staxProcessors.addArtifactProcessor(nodeProcessor);
-        ConfiguredNodeImplementationProcessor configuredNodeProcessor = new ConfiguredNodeImplementationProcessor(factories);
-        staxProcessors.addArtifactProcessor(configuredNodeProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     public void testReadComposite() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("TestNode.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java Fri May  2 23:47:54 2008
@@ -27,65 +27,39 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 
 /**
- * Test reading/write WSDL interfaces.
+ * Test reading/writing Node implementations.
  * 
  * @version $Rev$ $Date$
  */
 public class WriteTestCase extends TestCase {
 
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        factories.addFactory(factory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
-        factories.addFactory(nodeFactory);
-        
-        NodeImplementationProcessor nodeProcessor = new NodeImplementationProcessor(factories);
-        staxProcessors.addArtifactProcessor(nodeProcessor);
-
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("TestNode.composite");
-        Composite composite = staxProcessor.read(is, Composite.class);
+        Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(composite, bos);
+        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java Fri May  2 23:47:54 2008
@@ -23,7 +23,6 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
@@ -31,18 +30,14 @@
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
@@ -50,11 +45,7 @@
 import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading OSGi implementations.
@@ -63,77 +54,53 @@
 public class OSGiReadImplTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
-    private OSGiImplementationProcessor osgiProcessor;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(assemblyFactory);
-        scaBindingFactory = new SCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        JavaInterfaceFactory javaInterfaceFactory = new DefaultJavaInterfaceFactory();
-        modelFactories.addFactory(javaInterfaceFactory);
-
-        osgiProcessor = new OSGiImplementationProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(osgiProcessor);
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
 
         OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
 
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        inputFactory = null;
-        staxProcessors = null;
-        policyFactory = null;
-        assemblyFactory = null;
-        mapper = null;
-    }
-
     public void testReadComposite() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
-
+        compositeBuilder.build(composite);
     }
 
     public void testReadAndResolveComposite() throws Exception {
-        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
         
-        StAXArtifactProcessor<ComponentType> componentTypeProcessor = staxProcessors.getProcessor(ComponentType.class);
         is = getClass().getClassLoader().getResourceAsStream("OSGiTestService.componentType");
         reader = inputFactory.createXMLStreamReader(is);
-        ComponentType componentType = componentTypeProcessor.read(reader);
+        ComponentType componentType = (ComponentType)staxProcessor.read(reader);
 
         ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
-        componentTypeProcessor.resolve(componentType, resolver);
+        staxProcessor.resolve(componentType, resolver);
         resolver.addModel(componentType);
         
-        compositeProcessor.resolve(composite, resolver);
+        staxProcessor.resolve(composite, resolver);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
     }
 
     public void testReadOSGiImplementation() throws Exception {
@@ -149,8 +116,7 @@
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         reader.next();
 
-
-        OSGiImplementation osgiImpl = osgiProcessor.read(reader);
+        OSGiImplementation osgiImpl = (OSGiImplementation)staxProcessor.read(reader);
 
         assertEquals(osgiImpl.getBundleSymbolicName(), "OSGiTestService");
         assertEquals(osgiImpl.getBundleVersion(), "2.0.0");

Modified: incubator/tuscany/java/sca/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java?rev=653010&r1=653009&r2=653010&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java Fri May  2 23:47:54 2008
@@ -43,7 +43,6 @@
     
     public void testPing() throws Exception {
         new Socket("127.0.0.1", 8085);
-        //System.in.read();
     }
 
 }



Mime
View raw message