From c60a17f13d2b111c0f22b58bba20c92d9c3d50d9 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 14 Oct 2008 20:09:34 +0000 Subject: Update test case to JUNIT 4 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@704656 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/definitions/ReadDocumentTestCase.java | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'branches') diff --git a/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java b/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java index ec4ead8b87..6a654a7c9b 100644 --- a/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java +++ b/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java @@ -19,6 +19,12 @@ package org.apache.tuscany.sca.definitions; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.net.URI; import java.net.URL; import java.util.Hashtable; @@ -26,8 +32,6 @@ import java.util.Map; import javax.xml.namespace.QName; -import junit.framework.TestCase; - import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; @@ -39,20 +43,22 @@ import org.apache.tuscany.sca.policy.IntentAttachPointType; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.ProfileIntent; import org.apache.tuscany.sca.policy.QualifiedIntent; +import org.junit.BeforeClass; +import org.junit.Test; /** * Test reading SCA XML assembly documents. * * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $ */ -public class ReadDocumentTestCase extends TestCase { +public class ReadDocumentTestCase { - private URLArtifactProcessor policyDefinitionsProcessor = null; - private SCADefinitions definitions; - Map intentTable = new Hashtable(); - Map policySetTable = new Hashtable(); - Map bindingTypesTable = new Hashtable(); - Map implTypesTable = new Hashtable(); + private static URLArtifactProcessor policyDefinitionsProcessor = null; + private static SCADefinitions definitions; + private static Map intentTable = new Hashtable(); + private static Map policySetTable = new Hashtable(); + private static Map bindingTypesTable = new Hashtable(); + private static Map implTypesTable = new Hashtable(); public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0"; public static final String namespace = "http://test"; @@ -70,8 +76,8 @@ public class ReadDocumentTestCase extends TestCase { private static final QName javaImpl = new QName(scaNamespace, "implementation.java"); - @Override - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); // Create StAX processors @@ -81,7 +87,7 @@ public class ReadDocumentTestCase extends TestCase { URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class); - URL url = getClass().getResource("test_definitions.xml"); + URL url = ReadDocumentTestCase.class.getResource("test_definitions.xml"); URI uri = URI.create("test_definitions.xml"); definitions = policyDefinitionsProcessor.read(null, uri, url); @@ -102,6 +108,7 @@ public class ReadDocumentTestCase extends TestCase { } } + @Test public void testReadSCADefinitions() throws Exception { assertNotNull(definitions); @@ -124,6 +131,7 @@ public class ReadDocumentTestCase extends TestCase { assertNotNull(implTypesTable.get(javaImpl)); } + @Test public void testResolveSCADefinitions() throws Exception { assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent); ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection")); -- cgit v1.2.3