Modified: tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java?rev=722852&r1=722851&r2=722852&view=diff ============================================================================== --- tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java (original) +++ tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java Wed Dec 3 04:09:11 2008 @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.implementation.java.introspect.impl; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; @@ -26,14 +26,17 @@ import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.JavaScopeImpl; +import org.junit.Before; +import org.junit.Test; /** * @version $Rev$ $Date$ */ -public class ScopeProcessorTestCase extends TestCase { +public class ScopeProcessorTestCase { private JavaImplementationFactory javaImplementationFactory; + @Test public void testCompositeScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -42,6 +45,7 @@ assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope()); } + @Test public void testSessionScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -49,6 +53,7 @@ assertEquals(JavaScopeImpl.SESSION, type.getJavaScope()); } + @Test public void testConversationalScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -56,6 +61,7 @@ assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope()); } + @Test public void testRequestScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -63,6 +69,7 @@ assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope()); } + @Test public void testStatelessScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -70,6 +77,7 @@ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope()); } + @Test public void testNoScope() throws IntrospectionException { ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory()); JavaImplementation type = javaImplementationFactory.createJavaImplementation(); @@ -77,9 +85,8 @@ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope()); } - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { javaImplementationFactory = new DefaultJavaImplementationFactory(); }
Modified: tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java?rev=722852&r1=722851&r2=722852&view=diff ============================================================================== --- tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java (original) +++ tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java Wed Dec 3 04:09:11 2008 @@ -19,12 +19,14 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl; import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getService; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.lang.reflect.Field; import java.lang.reflect.Method; -import junit.framework.TestCase; - import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; @@ -32,6 +34,8 @@ import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; import org.apache.tuscany.sca.interfacedef.InvalidCallbackException; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; +import org.junit.Before; +import org.junit.Test; import org.osoa.sca.CallableReference; import org.osoa.sca.annotations.Callback; import org.osoa.sca.annotations.Service; @@ -39,16 +43,17 @@ /** * @version $Rev$ $Date$ */ -public class ServiceCallbackTestCase extends TestCase { +public class ServiceCallbackTestCase { private ServiceProcessor processor; private JavaImplementationFactory javaImplementationFactory; - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory()); javaImplementationFactory = new DefaultJavaImplementationFactory(); } + @Test public void testMethodCallbackInterface() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(FooImpl.class, type); @@ -59,6 +64,7 @@ assertEquals(method, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().getAnchor()); } + @Test public void testFieldCallbackInterface() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(FooImpl.class, type); @@ -69,6 +75,7 @@ assertEquals(field, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().getAnchor()); } + @Test public void testFieldCallbackInterface1() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(FooImpl1.class, type); @@ -80,6 +87,7 @@ } + @Test public void testMethodDoesNotMatchCallback() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(BadBarImpl.class, type); @@ -92,6 +100,7 @@ } } + @Test public void testNoParamCallback() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(BadBarImpl.class, type); @@ -104,6 +113,7 @@ } } + @Test public void testFieldDoesNotMatchCallback() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(BadBarImpl.class, type); @@ -116,6 +126,7 @@ } } + @Test public void testBadCallbackInterfaceAnnotation() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); try { Modified: tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java?rev=722852&r1=722851&r2=722852&view=diff ============================================================================== --- tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java (original) +++ tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java Wed Dec 3 04:09:11 2008 @@ -28,17 +28,27 @@ import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.junit.Before; +import org.junit.Test; import org.osoa.sca.annotations.Callback; import org.osoa.sca.annotations.Remotable; import org.osoa.sca.annotations.Service; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; /** * @version $Rev$ $Date$ */ -public class ServiceProcessorTestCase extends TestCase { +public class ServiceProcessorTestCase { private ServiceProcessor processor; private JavaImplementation type; + @Test public void testMultipleInterfaces() throws Exception { processor.visitClass(FooMultiple.class, type); assertEquals(2, type.getServices().size()); @@ -48,12 +58,14 @@ assertNotNull(ModelHelper.getService(type, Bar.class.getSimpleName())); } + @Test public void testSingleInterfaces() throws Exception { processor.visitClass(FooSingle.class, type); assertEquals(1, type.getServices().size()); assertNotNull(ModelHelper.getService(type, Baz.class.getSimpleName())); } + @Test public void testMultipleNoService() throws Exception { processor.visitClass(FooMultipleNoService.class, type); assertEquals(0, type.getServices().size()); @@ -62,17 +74,20 @@ /** * Verifies a service with a callback annotation is recognized */ + @Test public void testMultipleWithCallbackAnnotation() throws Exception { processor.visitClass(FooMultipleWithCalback.class, type); assertEquals(1, type.getServices().size()); } + @Test public void testMultipleWithWebServiceAnnotation() throws Exception { processor.visitClass(FooMultipleWithWebService.class, type); assertEquals(2, type.getServices().size()); } + @Test public void testRemotableNoService() throws Exception { processor.visitClass(FooRemotableNoService.class, type); assertEquals(1, type.getServices().size()); @@ -80,10 +95,12 @@ assertEquals(BazRemotable.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass()); } + @Test public void testNonInterface() throws Exception { processor.visitClass(FooServiceUsingClassImpl.class, type); } + @Test public void testNoInterfaces() throws Exception { try { processor.visitClass(BadDefinition.class, type); @@ -93,9 +110,8 @@ } } - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory()); JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(); type = javaImplementationFactory.createJavaImplementation();
