diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-16 05:42:26 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-16 05:42:26 +0000 |
commit | 4ae4002366ded3f4b19cd96f403d8b418fcf00a1 (patch) | |
tree | 9179891f11c9add734a777713cabf7e39a980908 /java/sca/modules/binding-atom/src | |
parent | d4cc9a0bdd43477858b8ac67b69a4cdd615ec741 (diff) |
This is to change the Monitor to be request scoped for most of the cases:
Refactor the ArtifactProcessor/ModelResolver to take a ProcessorContext that holds context such as Monitor, Contribution for the contribution/artifact processing methods
Refactor the Builder to take a BuilderContext that holds context such as Monitor, Definitions, Base binding mapping for the building methods
Change the processor/resolver/builder implementation classes to not cache the Monitor
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-atom/src')
-rw-r--r-- | java/sca/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/java/sca/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java b/java/sca/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java index d9fb0264ad..6b8ff10d1a 100644 --- a/java/sca/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java +++ b/java/sca/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java @@ -29,13 +29,10 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; 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.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; /** * @version $Rev$ $Date$ @@ -55,23 +52,16 @@ public class AtomBindingProcessorTestCase extends TestCase { private XMLInputFactory inputFactory; private StAXArtifactProcessor<Object> staxProcessor; - private Monitor monitor; + private ProcessorContext context; @Override protected void setUp() throws Exception { DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + context = new ProcessorContext(extensionPoints); inputFactory = XMLInputFactory.newInstance(); - // Create a monitor - FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = factories.getFactory(MonitorFactory.class); - if (monitorFactory != null) { - monitor = monitorFactory.createMonitor(); - utilities.addUtility(monitorFactory); - } StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); + staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null); } /** @@ -81,7 +71,7 @@ public class AtomBindingProcessorTestCase extends TestCase { public void testLoadValidComposite() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE)); - Composite composite = (Composite)staxProcessor.read(reader); + Composite composite = (Composite)staxProcessor.read(reader, context); AtomBinding binding = (AtomBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); assertNotNull(binding); |