diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-24 00:14:41 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-24 00:14:41 +0000 |
commit | 341c40b73fb2ff82c89e1afefe7348467b168a18 (patch) | |
tree | 08f01d1d414cc2cdc3b787f896a6ed9da57b2293 /sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb | |
parent | 0ee5516f07f4efafb221f1c909a9cd4122f22c0e (diff) |
Port to tuscany 2.x
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@937561 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 27 insertions, 20 deletions
diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java b/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java index ffbdf1d54c..bc72dd1459 100644 --- a/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java +++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java @@ -27,13 +27,15 @@ import javax.xml.stream.XMLStreamReader; import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.builder.BuilderContext; +import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; -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.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; /** @@ -43,27 +45,30 @@ import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; */ public class ReadTestCase extends TestCase { + private ExtensionPointRegistry registry; private XMLInputFactory inputFactory; private StAXArtifactProcessor<Object> staxProcessor; private CompositeBuilder compositeBuilder; @Override public void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); + registry = new DefaultExtensionPointRegistry(); + inputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLInputFactory.class); + // StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); + staxProcessor = new ExtensibleStAXArtifactProcessor(registry); - compositeBuilder = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class).getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); + compositeBuilder = registry.getExtensionPoint(BuilderExtensionPoint.class).getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); } public void testReadComposite() throws Exception { + ProcessorContext context = new ProcessorContext(registry); InputStream is = getClass().getResourceAsStream("TestEJB.composite"); XMLStreamReader reader = inputFactory.createXMLStreamReader(is); - Composite composite = (Composite) staxProcessor.read(reader); + Composite composite = (Composite) staxProcessor.read(reader, context); assertNotNull(composite); - compositeBuilder.build(composite, null, null); + BuilderContext builderContext = new BuilderContext(registry); + compositeBuilder.build(composite, builderContext); assertTrue(((EJBImplementation) composite.getComponents().get(0).getImplementation()).getEJBLink().equals("module.jar#TestEJB")); } diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java b/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java index 8ba43dd635..d3b7300e4c 100644 --- a/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java +++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java @@ -28,11 +28,12 @@ import javax.xml.stream.XMLOutputFactory; 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.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; /** * Test reading/write WSDL interfaces. @@ -40,26 +41,27 @@ import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; * @version $Rev$ $Date$ */ public class WriteTestCase extends TestCase { - + private ExtensionPointRegistry registry; private XMLInputFactory inputFactory; private XMLOutputFactory outputFactory; private StAXArtifactProcessor<Object> staxProcessor; @Override public void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - outputFactory = XMLOutputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null); + registry = new DefaultExtensionPointRegistry(); + FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); + inputFactory = factories.getFactory(XMLInputFactory.class); + outputFactory = factories.getFactory(XMLOutputFactory.class); + staxProcessor = new ExtensibleStAXArtifactProcessor(registry); } public void testReadWriteComposite() throws Exception { + ProcessorContext context = new ProcessorContext(registry); InputStream is = getClass().getResourceAsStream("TestEJB.composite"); - Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is)); + Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is), context); assertNotNull(composite); ByteArrayOutputStream bos = new ByteArrayOutputStream(); - staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); + staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), context); assertTrue(bos.toString().contains("module.jar#TestEJB")); |