diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-10 22:35:58 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-10 22:35:58 +0000 |
commit | b0110591babafacab5d77fbb97c51aa3cd7bd439 (patch) | |
tree | be89a3c808a5df2714d0b04375f455794d9b36d8 /branches | |
parent | 9134aecc4e049bfa5df2fc2f17c90f3088b1e2f1 (diff) |
Convert the test cases to JUNIT 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703592 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
3 files changed, 37 insertions, 28 deletions
diff --git a/branches/sca-equinox/modules/contribution-namespace/pom.xml b/branches/sca-equinox/modules/contribution-namespace/pom.xml index c2c4c51bfb..5e6d2d66a8 100644 --- a/branches/sca-equinox/modules/contribution-namespace/pom.xml +++ b/branches/sca-equinox/modules/contribution-namespace/pom.xml @@ -66,7 +66,7 @@ <Bundle-Version>${tuscany.version}</Bundle-Version> <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.namespace</Bundle-SymbolicName> <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.contribution.namespace*</Export-Package> + <Export-Package>org.apache.tuscany.sca.contribution.namespace</Export-Package> </instructions> </configuration> </plugin> diff --git a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java index 369460b280..f4f6ed7879 100644 --- a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java @@ -19,13 +19,14 @@ package org.apache.tuscany.sca.contribution.namespace.impl; +import static junit.framework.Assert.assertEquals; +import static junit.framework.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.namespace.NamespaceExport; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; @@ -37,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 NamespaceExportProcessorTestCase extends TestCase { +public class NamespaceExportProcessorTestCase { private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" namespace=\"http://foo\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<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\"?>" - + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>"; + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<export 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); - } - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + monitor = monitorFactory.createMonitor(); + utilities.addUtility(monitorFactory); + } + StAXArtifactProcessorExtensionPoint staxProcessors = + extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); } @@ -76,6 +78,7 @@ public class NamespaceExportProcessorTestCase 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)); NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader); @@ -86,6 +89,7 @@ public class NamespaceExportProcessorTestCase 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 { @@ -95,8 +99,8 @@ public class NamespaceExportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeNameSpaceMissing", problem.getMessageId()); - } + } } diff --git a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java index 7163876339..e3d96dc70f 100644 --- a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java @@ -21,13 +21,14 @@ package org.apache.tuscany.sca.contribution.namespace.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.namespace.NamespaceImport; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; @@ -39,13 +40,15 @@ 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 NamespaceImportProcessorTestCase extends TestCase { +public class NamespaceImportProcessorTestCase { private static final String VALID_XML = "<?xml version=\"1.0\" encoding=\"ASCII\"?>" @@ -55,12 +58,12 @@ public class NamespaceImportProcessorTestCase extends TestCase { "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<import 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 @@ -78,6 +81,7 @@ public class NamespaceImportProcessorTestCase 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)); NamespaceImport namespaceImport = (NamespaceImport)staxProcessor.read(reader); @@ -90,6 +94,7 @@ public class NamespaceImportProcessorTestCase 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 { |