You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by mc...@apache.org on 2008/12/03 16:07:31 UTC

svn commit: r722922 - in /tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java: impl/ introspection/impl/

Author: mcombellack
Date: Wed Dec  3 07:07:30 2008
New Revision: 722922

URL: http://svn.apache.org/viewvc?rev=722922&view=rev
Log:
Converted unit tests from JUnit 3 to JUnit 4

Modified:
    tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
    tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
    tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
    tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java

Modified: tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java?rev=722922&r1=722921&r2=722922&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java (original)
+++ tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java Wed Dec  3 07:07:30 2008
@@ -18,12 +18,13 @@
  */
 package org.apache.tuscany.sca.interfacedef.java.impl;
 
+import static org.junit.Assert.assertEquals;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
@@ -35,6 +36,7 @@
 import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
 import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.junit.Test;
 import org.osoa.sca.annotations.Remotable;
 
 /**
@@ -43,13 +45,14 @@
  * 
  * @version $Rev$ $Date$
  */
-public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase {
+public class JavaInterfaceUtilDuplicateRemotableTestCase {
 
     /**
      * Test to get the getTime() method from the LocalTimeService
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testLocalTimeServiceGetTime() throws Exception {
         doTestLocalTimeServiceGetTime(LocalTimeService.class);
     }
@@ -75,6 +78,7 @@
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testWorldTimeServiceGetTime() throws Exception {
         doTestWorldTimeServiceGetTime(WorldTimeService.class);
     }
@@ -101,6 +105,7 @@
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testGMTTimeServiceGetTime() throws Exception {
         doTestGMTTimeServiceGetTime(GMTTimeService.class);
     }
@@ -129,6 +134,7 @@
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testLocalTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
         doTestLocalTimeServiceGetTime(TimeServiceImpl.class);
     }
@@ -139,6 +145,7 @@
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testWorldTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
         doTestWorldTimeServiceGetTime(TimeServiceImpl.class);
     }
@@ -148,6 +155,7 @@
      *
      * @throws Exception Test failed
      */
+    @Test
     public void testGMTTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
         doTestGMTTimeServiceGetTime(TimeServiceImpl.class);
     }
@@ -189,6 +197,7 @@
      * 
      * This test case is for TUSCANY-2194
      */
+    @Test
     public void testDuplicateOpeartionOnRemotableInterface()
     {
         JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();

Modified: tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java?rev=722922&r1=722921&r2=722922&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java (original)
+++ tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java Wed Dec  3 07:07:30 2008
@@ -19,24 +19,26 @@
 package org.apache.tuscany.sca.interfacedef.java.impl;
 
 import static org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil.findOperation;
+import static org.junit.Assert.assertEquals;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * @version $Rev$ $Date$
  */
-public class JavaInterfaceUtilTestCase extends TestCase {
+public class JavaInterfaceUtilTestCase {
     private List<Operation> operations;
 
+    @Test
     public void testNoParamsFindOperation() throws Exception {
         Method method = Foo.class.getMethod("foo");
         Operation ret = findOperation(method, operations);
@@ -44,6 +46,7 @@
         assertEquals(0, method.getParameterTypes().length);
     }
 
+    @Test
     public void testParamsFindOperation() throws Exception {
         Method method = Foo.class.getMethod("foo", String.class);
         Operation ret = findOperation(method, operations);
@@ -51,16 +54,15 @@
         assertEquals(String.class, method.getParameterTypes()[0]);
     }
 
+    @Test
     public void testPrimitiveParamFindOperation() throws NoSuchMethodException {
         Method method = Foo.class.getMethod("foo", Integer.TYPE);
         Operation operation = findOperation(method, operations);
         assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical());
     }
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
+    @Before
+    public void setUp() throws Exception {
         Operation operation = newOperation("foo");
         List<DataType> types = new ArrayList<DataType>();
         DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);

Modified: tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java?rev=722922&r1=722921&r2=722922&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java (original)
+++ tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java Wed Dec  3 07:07:30 2008
@@ -18,7 +18,11 @@
  */
 package org.apache.tuscany.sca.interfacedef.java.introspection.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.apache.tuscany.sca.interfacedef.ConversationSequence;
 import org.apache.tuscany.sca.interfacedef.Interface;
@@ -26,17 +30,19 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.junit.Before;
+import org.junit.Test;
 import org.osoa.sca.annotations.Conversational;
 import org.osoa.sca.annotations.EndsConversation;
 
 /**
  * @version $Rev$ $Date$
  */
-public class ConversationalIntrospectionTestCase extends TestCase {
+public class ConversationalIntrospectionTestCase {
     private JavaInterfaceFactory javaFactory;
     
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         javaFactory = new DefaultJavaInterfaceFactory();
     }
 
@@ -49,6 +55,7 @@
         return null;
     }
 
+    @Test
     public void testServiceContractConversationalInformationIntrospection() throws Exception {
         Interface i = javaFactory.createJavaInterface(Foo.class);
         assertNotNull(i);
@@ -59,6 +66,7 @@
         assertEquals(ConversationSequence.CONVERSATION_END, seq);
     }
 
+    @Test
     public void testBadServiceContract() throws Exception {
         try {
             javaFactory.createJavaInterface(BadFoo.class);
@@ -68,6 +76,7 @@
         }
     }
 
+    @Test
     public void testNonConversationalInformationIntrospection() throws Exception {
         Interface i = javaFactory.createJavaInterface(NonConversationalFoo.class);
         assertFalse(i.isConversational());

Modified: tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java?rev=722922&r1=722921&r2=722922&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java (original)
+++ tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java Wed Dec  3 07:07:30 2008
@@ -18,23 +18,26 @@
  */
 package org.apache.tuscany.sca.interfacedef.java.introspection.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
 import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.junit.Before;
+import org.junit.Test;
 import org.osoa.sca.annotations.PolicySets;
 import org.osoa.sca.annotations.Requires;
 
 /**
  * @version $Rev$ $Date$
  */
-public class PolicyProcessorTestCase extends TestCase {
+public class PolicyProcessorTestCase {
     private JavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
     private PolicyJavaInterfaceVisitor policyProcessor;
 
+    @Test
     public void testInterfaceLevel() throws Exception {
         JavaInterface type = factory.createJavaInterface(Interface1.class);
         policyProcessor.visitInterface(type);
@@ -42,6 +45,7 @@
         assertEquals(1, type.getPolicySets().size());
     }
 
+    @Test
     public void testMethodLevel() throws Exception {
         JavaInterface type = factory.createJavaInterface(Interface2.class);
         policyProcessor.visitInterface(type);
@@ -53,6 +57,7 @@
         assertEquals(1, type.getOperations().get(1).getPolicySets().size());
     }
 
+    @Test
     public void testInterfaceAndMethodLevel() throws Exception {
         JavaInterface type = factory.createJavaInterface(Interface3.class);
         policyProcessor.visitInterface(type);
@@ -64,9 +69,8 @@
         assertEquals(1, type.getOperations().get(1).getPolicySets().size());
     }
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         policyProcessor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory());
     }