diff options
Diffstat (limited to 'branches/sca-equinox/modules')
3 files changed, 43 insertions, 38 deletions
diff --git a/branches/sca-equinox/modules/contribution-resource/pom.xml b/branches/sca-equinox/modules/contribution-resource/pom.xml index 5a2422ed4c..8456435e31 100644 --- a/branches/sca-equinox/modules/contribution-resource/pom.xml +++ b/branches/sca-equinox/modules/contribution-resource/pom.xml @@ -66,7 +66,7 @@ <Bundle-Version>${tuscany.version}</Bundle-Version> <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.resource</Bundle-SymbolicName> <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.contribution.resource*</Export-Package> + <Export-Package>org.apache.tuscany.sca.contribution.resource</Export-Package> </instructions> </configuration> </plugin> diff --git a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java index e43d705ec3..52ec0b4cfc 100644 --- a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java @@ -19,14 +19,14 @@ package org.apache.tuscany.sca.contribution.resource.impl; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.io.StringReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; -import junit.framework.TestCase; - import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -38,38 +38,39 @@ import org.apache.tuscany.sca.monitor.DefaultMonitorFactory; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; +import org.junit.BeforeClass; +import org.junit.Test; /** * Test NamespaceExportProcessorTestCase * * @version $Rev$ $Date$ */ -public class ResourceExportProcessorTestCase extends TestCase { +public class ResourceExportProcessorTestCase { private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<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\"?>" - + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>"; - private XMLInputFactory inputFactory; - private StAXArtifactProcessor<Object> staxProcessor; - private Monitor monitor; + private static XMLInputFactory inputFactory; + private static StAXArtifactProcessor<Object> staxProcessor; + private static Monitor monitor; - @Override - protected void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); inputFactory = XMLInputFactory.newInstance(); // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = new DefaultMonitorFactory(); + MonitorFactory monitorFactory = new DefaultMonitorFactory(); if (monitorFactory != null) { - monitor = monitorFactory.createMonitor(); - utilities.addUtility(monitorFactory); + monitor = monitorFactory.createMonitor(); + utilities.addUtility(monitorFactory); } - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + StAXArtifactProcessorExtensionPoint staxProcessors = + extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); } @@ -77,6 +78,7 @@ public class ResourceExportProcessorTestCase extends TestCase { * Test loading a valid export element from a contribution metadata stream * @throws Exception */ + @Test public void testLoad() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML)); ResourceExport resourceExport = (ResourceExport)staxProcessor.read(reader); @@ -87,6 +89,7 @@ public class ResourceExportProcessorTestCase extends TestCase { * Test loading an INVALID export element from a contribution metadata stream * @throws Exception */ + @Test public void testLoadInvalid() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML)); /*try { @@ -96,8 +99,8 @@ public class ResourceExportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeURIMissing", problem.getMessageId()); - } + } } diff --git a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java index 1e99b0b01b..1fc439f073 100644 --- a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java @@ -19,15 +19,14 @@ package org.apache.tuscany.sca.contribution.resource.impl; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.io.StringReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; -import junit.framework.TestCase; - import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -39,38 +38,39 @@ import org.apache.tuscany.sca.monitor.DefaultMonitorFactory; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; +import org.junit.BeforeClass; +import org.junit.Test; /** * Test NamespaceImportProcessorTestCase * * @version $Rev$ $Date$ */ -public class ResourceImportProcessorTestCase extends TestCase { +public class ResourceImportProcessorTestCase { private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>"; private static final String INVALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>"; - private XMLInputFactory inputFactory; - private StAXArtifactProcessor<Object> staxProcessor; - private Monitor monitor; + private static XMLInputFactory inputFactory; + private static StAXArtifactProcessor<Object> staxProcessor; + private static Monitor monitor; - @Override - protected void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); inputFactory = XMLInputFactory.newInstance(); // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = new DefaultMonitorFactory(); + MonitorFactory monitorFactory = new DefaultMonitorFactory(); if (monitorFactory != null) { - monitor = monitorFactory.createMonitor(); - utilities.addUtility(monitorFactory); + monitor = monitorFactory.createMonitor(); + utilities.addUtility(monitorFactory); } - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + StAXArtifactProcessorExtensionPoint staxProcessors = + extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); } @@ -78,6 +78,7 @@ public class ResourceImportProcessorTestCase extends TestCase { * Test loading a valid import element from a contribution metadata stream * @throws Exception */ + @Test public void testLoad() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML)); ResourceImport namespaceImport = (ResourceImport)staxProcessor.read(reader); @@ -89,6 +90,7 @@ public class ResourceImportProcessorTestCase extends TestCase { * Test loading a INVALID import element from a contribution metadata stream * @throws Exception */ + @Test public void testLoadInvalid() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML)); /*try { @@ -98,8 +100,8 @@ public class ResourceImportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeURIMissing", problem.getMessageId()); - } + } } |