You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/10/14 22:09:35 UTC

svn commit: r704656 - /tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java

Author: rfeng
Date: Tue Oct 14 13:09:34 2008
New Revision: 704656

URL: http://svn.apache.org/viewvc?rev=704656&view=rev
Log:
Update test case to JUNIT 4

Modified:
    tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java

Modified: tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java?rev=704656&r1=704655&r2=704656&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java (original)
+++ tuscany/branches/sca-equinox/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java Tue Oct 14 13:09:34 2008
@@ -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 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.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<SCADefinitions> policyDefinitionsProcessor = null;
-    private SCADefinitions definitions;
-    Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
-    Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
-    Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
-    Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
+    private static URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor = null;
+    private static SCADefinitions definitions;
+    private static Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
+    private static Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+    private static Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
+    private static Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
     public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
     public static final String namespace = "http://test";
     
@@ -70,8 +76,8 @@
     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 @@
         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 @@
         }
     }
 
+    @Test
     public void testReadSCADefinitions() throws Exception {
         assertNotNull(definitions);
         
@@ -124,6 +131,7 @@
         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"));