tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r652983 [2/5] - in /incubator/tuscany/java/sca/modules: assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/ assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/META-INF/services/ ...
Date Sat, 03 May 2008 02:52:41 GMT
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java Fri May  2 19:52:39 2008
@@ -35,21 +35,21 @@
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
-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.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+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.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
 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.xml.WSPolicyProcessor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test writing SCA XML assemblies.
@@ -57,32 +57,31 @@
  * @version $Rev$ $Date$
  */
 public class WriteAllTestCase extends TestCase {
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
     private ExtensibleStAXArtifactProcessor staxProcessor;
-    private TestModelResolver resolver; 
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
-    private CompositeBuilderImpl compositeUtil;
-    private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
-
+    private ModelResolver resolver; 
+    private CompositeBuilder compositeBuilder;
+    private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
 
     @Override
     public void setUp() throws Exception {
-        assemblyFactory = new DefaultAssemblyFactory();
-        scaBindingFactory = new TestSCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        mapper = new InterfaceContractMapperImpl();
-        compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
-        resolver = new TestModelResolver();
-        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, XMLInputFactory.newInstance(), policyFactory);
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+        resolver = new DefaultModelResolver();
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+        policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
     }
 
     @Override
@@ -112,12 +111,12 @@
         
         URL url = getClass().getResource("test_definitions.xml");
         URI uri = URI.create("test_definitions.xml");
-        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+        SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
         assertNotNull(scaDefns);
-        scaDefnDocProcessor.resolve(scaDefns, resolver);
+        policyDefinitionsProcessor.resolve(scaDefns, resolver);
         
         staxProcessor.resolve(composite, resolver);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         staxProcessor.write(composite, bos);
     }

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java Fri May  2 19:52:39 2008
@@ -26,6 +26,7 @@
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.definitions.SCADefinitions;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.monitor.Monitor;
@@ -47,7 +48,7 @@
     private CompositeBuilder compositeCloneBuilder;
     private CompositeBuilder componentConfigurationBuilder;
     private CompositeBuilder compositeServiceConfigurationBuilder;
-
+    
     /**
      * Constructs a new composite builder.
      * 

Modified: incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java Fri May  2 19:52:39 2008
@@ -30,16 +30,11 @@
  */
 public class AssemblyFactoryTestCase extends TestCase {
 
-    private AssemblyFactory factory;
+    private AssemblyFactory assemblyFactory;
 
     @Override
     public void setUp() throws Exception {
-        factory = new DefaultAssemblyFactory();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        factory = null;
+        assemblyFactory = new DefaultAssemblyFactory();
     }
 
     public void testCreateComponent() {
@@ -62,31 +57,31 @@
      * Create a composite
      */
     Composite createComposite() {
-        Composite c = factory.createComposite();
+        Composite c = assemblyFactory.createComposite();
 
         Component c1 = createComponent("AccountServiceComponent1");
         c.getComponents().add(c1);
         Component c2 = createComponent("AccountServiceComponent2");
         c.getComponents().add(c2);
 
-        Wire w = factory.createWire();
+        Wire w = assemblyFactory.createWire();
         w.setSource(c1.getReferences().get(0));
         w.setTarget(c2.getServices().get(0));
         c.getWires().add(w);
 
-        CompositeService cs = factory.createCompositeService();
+        CompositeService cs = assemblyFactory.createCompositeService();
         cs.setName("AccountService");
         cs.setPromotedService(c1.getServices().get(0));
-        cs.setInterfaceContract(new TestInterfaceContract(factory));
+        cs.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         c.getServices().add(cs);
-        cs.getBindings().add(new TestBinding(factory));
+        cs.getBindings().add(new TestBinding(assemblyFactory));
 
-        CompositeReference cr = factory.createCompositeReference();
+        CompositeReference cr = assemblyFactory.createCompositeReference();
         cr.setName("StockQuoteService");
         cr.getPromotedReferences().add(c2.getReferences().get(1));
-        cr.setInterfaceContract(new TestInterfaceContract(factory));
+        cr.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         c.getReferences().add(cr);
-        cr.getBindings().add(new TestBinding(factory));
+        cr.getBindings().add(new TestBinding(assemblyFactory));
 
         return c;
     }
@@ -95,16 +90,16 @@
      * Create a new component
      */
     Component createComponent(String name) {
-        Component c = factory.createComponent();
+        Component c = assemblyFactory.createComponent();
         c.setName(name);
 
         ConstrainingType constraint = createConstrainingType();
         c.setConstrainingType(constraint);
 
-        Implementation i = new TestImplementation(factory);
+        Implementation i = new TestImplementation(assemblyFactory);
         c.setImplementation(i);
 
-        ComponentProperty p = factory.createComponentProperty();
+        ComponentProperty p = assemblyFactory.createComponentProperty();
         p.setName("currency");
         p.setValue("USD");
         p.setMustSupply(true);
@@ -112,28 +107,28 @@
         p.setProperty(i.getProperties().get(0));
         c.getProperties().add(p);
 
-        ComponentReference ref1 = factory.createComponentReference();
+        ComponentReference ref1 = assemblyFactory.createComponentReference();
         ref1.setName("accountDataService");
         ref1.setMultiplicity(Multiplicity.ONE_ONE);
-        ref1.setInterfaceContract(new TestInterfaceContract(factory));
+        ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref1.setReference(i.getReferences().get(0));
         c.getReferences().add(ref1);
-        ref1.getBindings().add(new TestBinding(factory));
+        ref1.getBindings().add(new TestBinding(assemblyFactory));
 
-        ComponentReference ref2 = factory.createComponentReference();
+        ComponentReference ref2 = assemblyFactory.createComponentReference();
         ref2.setName("stockQuoteService");
         ref2.setMultiplicity(Multiplicity.ONE_ONE);
-        ref2.setInterfaceContract(new TestInterfaceContract(factory));
+        ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref2.setReference(i.getReferences().get(1));
         c.getReferences().add(ref2);
-        ref2.getBindings().add(new TestBinding(factory));
+        ref2.getBindings().add(new TestBinding(assemblyFactory));
 
-        ComponentService s = factory.createComponentService();
+        ComponentService s = assemblyFactory.createComponentService();
         s.setName("AccountService");
-        s.setInterfaceContract(new TestInterfaceContract(factory));
+        s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         s.setService(i.getServices().get(0));
         c.getServices().add(s);
-        s.getBindings().add(new TestBinding(factory));
+        s.getBindings().add(new TestBinding(assemblyFactory));
 
         return c;
     }
@@ -144,34 +139,34 @@
      * @return
      */
     ComponentType createComponentType() {
-        ComponentType ctype = factory.createComponentType();
+        ComponentType ctype = assemblyFactory.createComponentType();
 
-        Property p = factory.createProperty();
+        Property p = assemblyFactory.createProperty();
         p.setName("currency");
         p.setValue("USD");
         p.setMustSupply(true);
         p.setXSDType(new QName("", ""));
         ctype.getProperties().add(p);
 
-        Reference ref1 = factory.createReference();
+        Reference ref1 = assemblyFactory.createReference();
         ref1.setName("accountDataService");
-        ref1.setInterfaceContract(new TestInterfaceContract(factory));
+        ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref1.setMultiplicity(Multiplicity.ONE_ONE);
         ctype.getReferences().add(ref1);
-        ref1.getBindings().add(new TestBinding(factory));
+        ref1.getBindings().add(new TestBinding(assemblyFactory));
 
-        Reference ref2 = factory.createReference();
+        Reference ref2 = assemblyFactory.createReference();
         ref2.setName("stockQuoteService");
-        ref2.setInterfaceContract(new TestInterfaceContract(factory));
+        ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref2.setMultiplicity(Multiplicity.ONE_ONE);
         ctype.getReferences().add(ref2);
-        ref2.getBindings().add(new TestBinding(factory));
+        ref2.getBindings().add(new TestBinding(assemblyFactory));
 
-        Service s = factory.createService();
+        Service s = assemblyFactory.createService();
         s.setName("AccountService");
-        s.setInterfaceContract(new TestInterfaceContract(factory));
+        s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ctype.getServices().add(s);
-        s.getBindings().add(new TestBinding(factory));
+        s.getBindings().add(new TestBinding(assemblyFactory));
 
         return ctype;
     }
@@ -182,30 +177,30 @@
      * @return
      */
     ConstrainingType createConstrainingType() {
-        ConstrainingType ctype = factory.createConstrainingType();
+        ConstrainingType ctype = assemblyFactory.createConstrainingType();
 
-        AbstractProperty p = factory.createAbstractProperty();
+        AbstractProperty p = assemblyFactory.createAbstractProperty();
         p.setName("currency");
         p.setValue("USD");
         p.setMustSupply(true);
         p.setXSDType(new QName("", ""));
         ctype.getProperties().add(p);
 
-        AbstractReference ref1 = factory.createAbstractReference();
+        AbstractReference ref1 = assemblyFactory.createAbstractReference();
         ref1.setName("accountDataService");
-        ref1.setInterfaceContract(new TestInterfaceContract(factory));
+        ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref1.setMultiplicity(Multiplicity.ONE_ONE);
         ctype.getReferences().add(ref1);
 
-        AbstractReference ref2 = factory.createAbstractReference();
+        AbstractReference ref2 = assemblyFactory.createAbstractReference();
         ref2.setName("stockQuoteService");
-        ref2.setInterfaceContract(new TestInterfaceContract(factory));
+        ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ref2.setMultiplicity(Multiplicity.ONE_ONE);
         ctype.getReferences().add(ref2);
 
-        AbstractService s = factory.createAbstractService();
+        AbstractService s = assemblyFactory.createAbstractService();
         s.setName("AccountService");
-        s.setInterfaceContract(new TestInterfaceContract(factory));
+        s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
         ctype.getServices().add(s);
 
         return ctype;

Modified: incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java Fri May  2 19:52:39 2008
@@ -39,11 +39,6 @@
         assemblyFactory = new DefaultAssemblyFactory();
     }
     
-    @Override
-    protected void tearDown() throws Exception {
-        assemblyFactory = null;
-    }
-    
     public void testFuseIncludes() throws Exception {
         Composite c1 = assemblyFactory.createComposite();
         c1.setName(new QName("http://foo", "C1"));

Modified: incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java Fri May  2 19:52:39 2008
@@ -55,7 +55,7 @@
 public class PrintUtilTestCase {
 
     private AssemblyFactory factory = new DefaultAssemblyFactory();
-
+    
     /**
      * Create a composite
      */

Modified: incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java Fri May  2 19:52:39 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.Assert;
@@ -31,24 +30,19 @@
 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.SCABinding;
 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.sca.xml.SCABindingProcessor;
-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.core.ExtensionPointRegistry;
 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 WSDL interfaces.
@@ -57,44 +51,31 @@
  */
 public class ReadTestCase extends TestCase {
 
-    XMLInputFactory inputFactory;
-    DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
-        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();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(factories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        SCABindingFactory scaFactory = new SCABindingFactoryImpl();
-        factories.addFactory(scaFactory);
-        
-        SCABindingProcessor wsdlProcessor = new SCABindingProcessor(factories);
-        staxProcessors.addArtifactProcessor(wsdlProcessor);
-    }
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
 
-    @Override
-    public void tearDown() throws Exception {
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); 
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+        
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ComponentType componentType = componentTypeProcessor.read(reader);
+        ComponentType componentType = (ComponentType)staxProcessor.read(reader);
         assertNotNull(componentType);
         
         SCABinding referenceSCABinding = (SCABinding) componentType.getReferences().get(0).getBindings().get(0);
@@ -107,22 +88,18 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         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);
+        compositeBuilder.build(composite);
         
         SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
         SCABinding serviceSCABinding   = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
         
         Assert.assertNotNull(referenceSCABinding);
         Assert.assertNotNull(serviceSCABinding);        
-
-        //new PrintUtil(System.out).print(composite);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java Fri May  2 19:52:39 2008
@@ -27,22 +27,12 @@
 
 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.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;
-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.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 
 /**
  * Test reading/write WSDL interfaces.
@@ -51,57 +41,37 @@
  */
 public class WriteTestCase extends TestCase {
 
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
 
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        factories.addFactory(factory);
-        policyFactory = new DefaultPolicyFactory();
-        factories.addFactory(policyFactory);
-        
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(factories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        SCABindingFactoryImpl scaFactory = new SCABindingFactoryImpl();
-        factories.addFactory(scaFactory);
-
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
-        SCABindingProcessor scaProcessor = new SCABindingProcessor(factories);
-        staxProcessors.addArtifactProcessor(scaProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComponentType() throws Exception {
         InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.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));
         assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca /></service><reference name=\"addService\"><binding.sca /></reference></componentType>",
                      bos.toString());
-        //System.err.println(bos.toString());
     }
 
     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));
         assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca /></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component name=\"AddServiceComponent\"><service><binding.sca /></service></component><component name=\"SubtractServiceComponent\" /><component name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /></composite>",
             bos.toString() );
-        //System.err.println(bos.toString());
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java Fri May  2 19:52:39 2008
@@ -21,64 +21,58 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.Assert;
 
 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.SCABinding;
 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.CompositeModelResolver;
-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.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 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.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.junit.After;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.junit.Before;
 import org.junit.Test;
 
+/**
+ * SCABindingTestCase
+ *
+ * @version $Rev$ $Date$
+ */
 public class SCABindingTestCase {
 	
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor; 
+    private StAXArtifactProcessor<Object> staxProcessor; 
     private CompositeModelResolver resolver; 
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private CompositeBuilder compositeBuilder;
 
     @Before
     public void init() throws Exception { 
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        
         resolver = new CompositeModelResolver(null, null);
-        assemblyFactory = new DefaultAssemblyFactory();
-        scaBindingFactory = new SCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        mapper = new InterfaceContractMapperImpl();    	
-    }
-    
-    @After
-    public void destroy() throws Exception {
-        inputFactory = null;
-        staxProcessors = null;
-        resolver = null;
-        policyFactory = null;
-        assemblyFactory = null;
-        mapper = null;    	
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+        
     }
     
     @Test
@@ -91,18 +85,16 @@
     public void testBuildModel() {
     	try{
 	        InputStream is = getClass().getResourceAsStream("/Calculator.composite");      
-	        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
 	        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-	        Composite composite = compositeReader.read(reader);
+	        Composite composite = (Composite)staxProcessor.read(reader);
 	        
 	        is.close();
 	        Assert.assertNotNull(composite);
 	        
 	        resolver.addModel(composite);
 	       
-	        compositeReader.resolve(composite, resolver);
+	        staxProcessor.resolve(composite, resolver);
 	        
-	        CompositeBuilderImpl compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
 	        compositeBuilder.build(composite);
 	        
 	        SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);

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=652983&r1=652982&r2=652983&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 19:52:39 2008
@@ -44,7 +44,9 @@
 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.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;
@@ -70,6 +72,7 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         assemblyFactory = new DefaultAssemblyFactory();
         factories.addFactory(assemblyFactory);
@@ -79,7 +82,7 @@
         factories.addFactory(policyFactory);
         mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
@@ -96,7 +99,7 @@
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<ComponentType> componentTypeProcessor = staxProcessors.getProcessor(ComponentType.class);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         ComponentType componentType = componentTypeProcessor.read(reader);
@@ -106,7 +109,7 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
@@ -119,7 +122,7 @@
     }
     
     public void testReadPolicies() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("PoliciedCalculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
@@ -141,7 +144,7 @@
      * be of the 'Binding' form.
      */
     public void testReadBadWsdlElement() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("Calculator-bad-wsdlElement.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         try {

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=652983&r1=652982&r2=652983&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 19:52:39 2008
@@ -41,6 +41,7 @@
 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.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;
@@ -61,6 +62,7 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         factory = new DefaultAssemblyFactory();
         factories.addFactory(factory);
@@ -68,7 +70,7 @@
         factories.addFactory(policyFactory);
         
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
@@ -76,10 +78,6 @@
         WSDLFactory wsdlFactory = new DefaultWSDLFactory();
         factories.addFactory(wsdlFactory);
 
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
         WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(factories);
         staxProcessors.addArtifactProcessor(wsdlProcessor);
     }

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java Fri May  2 19:52:39 2008
@@ -53,6 +53,10 @@
 import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
 import org.apache.tuscany.sca.contribution.service.util.IOHelper;
 import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
 
 /**
  * Service interface that manages artifacts contributed to a Tuscany runtime.
@@ -119,10 +123,9 @@
     private ContributionFactory contributionFactory;
     
     
-    private ModelResolver domainResolver;
+    private ModelResolver policyDefinitionsResolver;
 
-
-    private List scaDefinitionsSink = null; 
+    private List policyDefinitions; 
     
     private String COMPOSITE_FILE_EXTN = ".composite";    
 
@@ -131,13 +134,13 @@
                                    URLArtifactProcessor documentProcessor,
                                    StAXArtifactProcessor staxProcessor,
                                    ExtensibleContributionListener contributionListener,
-                                   ModelResolver domainResolver,
+                                   ModelResolver policyDefinitionsResolver,
                                    ModelResolverExtensionPoint modelResolvers,
                                    ModelFactoryExtensionPoint modelFactories,
                                    AssemblyFactory assemblyFactory,
                                    ContributionFactory contributionFactory,
                                    XMLInputFactory xmlFactory,
-                                   List scaDefnSink) {
+                                   List<SCADefinitions> policyDefinitions) {
         super();
         this.contributionRepository = repository;
         this.packageProcessor = packageProcessor;
@@ -149,8 +152,8 @@
         this.xmlFactory = xmlFactory;
         this.assemblyFactory = assemblyFactory;
         this.contributionFactory = contributionFactory;
-        this.domainResolver = domainResolver;
-        this.scaDefinitionsSink = scaDefnSink;
+        this.policyDefinitionsResolver = policyDefinitionsResolver;
+        this.policyDefinitions = policyDefinitions;
     }
 
     public Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository)
@@ -232,7 +235,7 @@
         Contribution contributionMetadata = contributionFactory.createContribution();
 
         ContributionMetadataDocumentProcessor metadataDocumentProcessor =
-            new ContributionMetadataDocumentProcessor(staxProcessor, xmlFactory);
+            new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor);
         
         final URL[] urls = {sourceURL};
         // Allow access to create classloader. Requires RuntimePermission in security policy.
@@ -313,7 +316,7 @@
         if (modelResolver == null) {
             //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
             // the contribution import/export mechanism instead of this domainResolver hack.
-            modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, domainResolver);
+            modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, policyDefinitionsResolver);
         }
 
         //set contribution initial information
@@ -426,8 +429,26 @@
                     // Add the loaded model to the model resolver
                     modelResolver.addModel(model);
                     
-                    if ( isSCADefnsFile(anArtifactUri) ) {
-                        scaDefinitionsSink.add(model);
+                    // Add policy definitions to the list of policy definitions
+                    if (model instanceof SCADefinitions) { 
+                        policyDefinitions.add(model);
+                        
+                        SCADefinitions definitions = (SCADefinitions)model;
+                        for (Intent intent : definitions.getPolicyIntents() ) {
+                            policyDefinitionsResolver.addModel(intent);
+                        }
+                        
+                        for (PolicySet policySet : definitions.getPolicySets() ) {
+                            policyDefinitionsResolver.addModel(policySet);
+                        }
+                        
+                        for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
+                            policyDefinitionsResolver.addModel(attachPointType);
+                        }
+                        
+                        for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
+                            policyDefinitionsResolver.addModel(attachPointType);
+                        }
                     }
                 }
             }
@@ -496,12 +517,4 @@
         contribution.getDeployables().clear();
         contribution.getDeployables().addAll(resolvedDeployables);
     }
-
-    private boolean isSCADefnsFile(URI uri) {
-        int index = uri.toString().lastIndexOf("/");
-
-        index = (index != -1) ? index + 1 : 0;
-
-        return uri.toString().substring(index).equals("definitions.xml");
-    }
 }

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java Fri May  2 19:52:39 2008
@@ -24,10 +24,11 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 
 /**
@@ -42,7 +43,8 @@
     
     @Override
     protected void setUp() throws Exception {
-        artifactProcessors = new DefaultURLArtifactProcessorExtensionPoint((ModelFactoryExtensionPoint)null);
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        artifactProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
         artifactProcessors.addArtifactProcessor(new FileTypeArtifactProcessor());
         artifactProcessors.addArtifactProcessor(new FileNameArtifactProcessor());
     }

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java Fri May  2 19:52:39 2008
@@ -21,12 +21,12 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * Test ClassReferenceArtifactResolver.
@@ -38,17 +38,12 @@
     
     @Override
     protected void setUp() throws Exception {
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         
-        ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
+        ModelResolverExtensionPoint resolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
         resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
-        
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        
-        resolver = new ExtensibleModelResolver(null, resolvers, factories, null);
-    }
-    
-    @Override
-    protected void tearDown() throws Exception {
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        resolver = new ExtensibleModelResolver(null, resolvers, modelFactories);
     }
     
     /**

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java Fri May  2 19:52:39 2008
@@ -28,12 +28,12 @@
 
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.java.JavaExport;
 import org.apache.tuscany.sca.contribution.java.JavaImport;
 import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
-import org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl;
-import org.junit.After;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -50,12 +50,10 @@
     
     @Before
     public void setUp() throws Exception {
-        contributionFactory = new DefaultContributionFactory();
-        javaImportExportFactory = new JavaImportExportFactoryImpl();
-    }
-    
-    @After
-    public void tearDown() throws Exception {
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+        javaImportExportFactory = modelFactories.getFactory(JavaImportExportFactory.class);
     }
     
     private Contribution createContribution(String fileName) throws MalformedURLException {

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -26,10 +26,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.java.JavaExport;
+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.core.ExtensionPointRegistry;
 
 /**
  * Test JavaExportProcessorTestCase
@@ -40,21 +43,21 @@
 
     private static final String VALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export.java package=\"org.apache.tuscany.sca.contribution.java\"/>"
-            + "</contribution>";
+            + "<export.java  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\"/>";
 
     private static final String INVALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export.java/>"
-            + "</contribution>";
+            + "<export.java  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -62,13 +65,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new JavaImportExportFactoryImpl());
-        JavaExportProcessor exportProcessor = new JavaExportProcessor(factories);
-        JavaExport javaExport = exportProcessor.read(reader);
-        
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        JavaExport javaExport = (JavaExport)staxProcessor.read(reader);
         assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
     }
 
@@ -77,13 +75,9 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new JavaImportExportFactoryImpl());
-        JavaExportProcessor exportProcessor = new JavaExportProcessor(factories);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            exportProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -26,10 +26,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.java.JavaImport;
+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.core.ExtensionPointRegistry;
 
 /**
  * Test JavaImportProcessorTestCase
@@ -40,21 +43,21 @@
 
     private static final String VALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<import.java package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import.java  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>";
 
     private static final String INVALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<import.java location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import.java  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -62,12 +65,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new JavaImportExportFactoryImpl());
-        JavaImportProcessor importProcessor = new JavaImportProcessor(factories);
-        JavaImport javaImport = importProcessor.read(reader);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        JavaImport javaImport = (JavaImport)staxProcessor.read(reader);
         
         assertEquals("org.apache.tuscany.sca.contribution.java", javaImport.getPackage());
         assertEquals("sca://contributions/001", javaImport.getLocation());
@@ -78,13 +77,10 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
 
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new JavaImportExportFactoryImpl());
-        JavaImportProcessor importProcessor = new JavaImportProcessor(factories);
         try {
-            importProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);

Modified: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -28,10 +28,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+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.core.ExtensionPointRegistry;
 
 /**
  * Test NamespaceExportProcessorTestCase
@@ -42,21 +45,21 @@
 
     private static final String VALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export namespace=\"http://foo\"/>"
-            + "</contribution>";
+            + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" namespace=\"http://foo\"/>";
 
     private static final String INVALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export/>"
-            + "</contribution>";
+            + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -64,13 +67,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new NamespaceImportExportFactoryImpl());
-        NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(factories);
-        NamespaceExport namespaceExport = exportProcessor.read(reader);
-        
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader);
         assertEquals("http://foo", namespaceExport.getNamespace());
     }
 
@@ -79,13 +77,9 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new NamespaceImportExportFactoryImpl());
-        NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(factories);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            exportProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);

Modified: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -28,10 +28,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+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.core.ExtensionPointRegistry;
 
 /**
  * Test NamespaceImportProcessorTestCase
@@ -42,21 +45,21 @@
 
     private static final String VALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<import namespace=\"http://foo\" location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" namespace=\"http://foo\" location=\"sca://contributions/001\"/>";
 
     private static final String INVALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<import location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import  xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -64,12 +67,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new NamespaceImportExportFactoryImpl());
-        NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(factories);
-        NamespaceImport namespaceImport = importProcessor.read(reader);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        NamespaceImport namespaceImport = (NamespaceImport)staxProcessor.read(reader);
         
         assertEquals("http://foo", namespaceImport.getNamespace());
         assertEquals("sca://contributions/001", namespaceImport.getLocation());
@@ -80,13 +79,9 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new NamespaceImportExportFactoryImpl());
-        NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(factories);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            importProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);

Modified: incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -20,7 +20,6 @@
 package org.apache.tuscany.sca.contribution.resource.impl;
 
 
-
 import java.io.StringReader;
 
 import javax.xml.stream.XMLInputFactory;
@@ -28,10 +27,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.resource.ResourceExport;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * Test NamespaceExportProcessorTestCase
@@ -42,21 +44,21 @@
 
     private static final String VALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export.resource uri=\"helloworld/HelloWorldService.componentType\"/>"
-            + "</contribution>";
+            + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\"/>";
 
     private static final String INVALID_XML =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
-            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
-            + "<export.resource/>"
-            + "</contribution>";
+            + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -64,13 +66,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new ResourceImportExportFactoryImpl());
-        ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
-        ResourceExport resourceExport = exportProcessor.read(reader);
-        
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        ResourceExport resourceExport = (ResourceExport)staxProcessor.read(reader);
         assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
     }
 
@@ -79,13 +76,9 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new ResourceImportExportFactoryImpl());
-        ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            exportProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);



Mime
View raw message