diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 20:47:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 20:47:37 +0000 |
commit | 95e143e04805c648c60a9be19f002fdaaf6f9bd0 (patch) | |
tree | 49015be1b7d115c7ec14cfc7548a21c854809a25 /branches | |
parent | ab4a622e8e37b055e3a877e1d783f96c0ed11aff (diff) |
Merge the fix for TUSCANY-2513 from trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695617 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
7 files changed, 58 insertions, 3 deletions
diff --git a/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar b/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar Binary files differindex 09085705e0..38c17ecebb 100644 --- a/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar +++ b/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar diff --git a/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar b/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar Binary files differindex 192924ed0e..c7d6833471 100644 --- a/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar +++ b/branches/sca-java-1.3.2/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar diff --git a/branches/sca-java-1.3.2/modules/implementation-java/pom.xml b/branches/sca-java-1.3.2/modules/implementation-java/pom.xml index a4b413d605..f3b942fef4 100644 --- a/branches/sca-java-1.3.2/modules/implementation-java/pom.xml +++ b/branches/sca-java-1.3.2/modules/implementation-java/pom.xml @@ -46,6 +46,12 @@ <artifactId>tuscany-sca-api</artifactId> <version>1.3.2-SNAPSHOT</version> </dependency> + + <dependency> + <groupId>javax.jws</groupId> + <artifactId>jsr181-api</artifactId> + <version>1.0-MR1</version> + </dependency> </dependencies> <build> diff --git a/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java index fc4d27e752..58c72e9ea5 100644 --- a/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java +++ b/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java @@ -37,6 +37,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import javax.jws.WebService; + import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.Multiplicity; @@ -96,7 +98,7 @@ public class HeuristicPojoProcessor extends BaseJavaClassVisitor { */ Set<Class> interfaces = getAllInterfaces(clazz); for (Class<?> i : interfaces) { - if (i.isAnnotationPresent(Remotable.class)) { + if (i.isAnnotationPresent(Remotable.class) || i.isAnnotationPresent(WebService.class)) { addService(type, i); } } diff --git a/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java index 78963f5b03..6854acdc2a 100644 --- a/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java +++ b/branches/sca-java-1.3.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java @@ -28,6 +28,8 @@ import java.util.ArrayList; import java.util.Set; import java.util.logging.Logger; +import javax.jws.WebService; + import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.implementation.java.IntrospectionException; @@ -64,7 +66,10 @@ public class ServiceProcessor extends BaseJavaClassVisitor { // scan interfaces for remotable Set<Class> interfaces = getAllInterfaces(clazz); for (Class<?> interfaze : interfaces) { - if (interfaze.isAnnotationPresent(Remotable.class) || interfaze.isAnnotationPresent(Callback.class)) { + if (interfaze.isAnnotationPresent(Remotable.class) + || interfaze.isAnnotationPresent(WebService.class) + || interfaze.isAnnotationPresent(Callback.class) + ) { Service service; try { service = createService(interfaze); diff --git a/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java index 50a221722f..ff267cd938 100644 --- a/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java +++ b/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java @@ -22,6 +22,7 @@ import java.lang.reflect.Constructor; import java.util.Collection; import java.util.List; +import javax.jws.WebService; import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; @@ -268,6 +269,17 @@ public class HeuristicPojoProcessorTestCase extends AbstractProcessorTest { assertTrue(type.getPropertyMembers().containsKey("gen4")); } + /** + * Interfaces with "@WebService" annotation implemented by the class should result + * in a Service in the same manner as an "@Remotable" annotation would. + */ + public void testInterfaceWithWebServiceAnnotation() throws Exception{ + JavaImplementation type = javaImplementationFactory.createJavaImplementation(); + visitEnd(SomeWebServiceImpl.class, type); + assertEquals(1, type.getServices().size()); + assertEquals("SomeWebService", type.getServices().get(0).getName()); + } + @Remotable private interface ReferenceRemotableInterface { void operation1(String param1); @@ -532,4 +544,19 @@ public class HeuristicPojoProcessorTestCase extends AbstractProcessorTest { } + @WebService + private interface SomeWebService { + void serviceOperation1(); + } + + @Service + private static class SomeWebServiceImpl implements SomeWebService { + public SomeWebServiceImpl() { + + } + + public void serviceOperation1() { + } + } + } diff --git a/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java b/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java index ef4747f43a..aea90aa6eb 100644 --- a/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java +++ b/branches/sca-java-1.3.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java @@ -18,6 +18,8 @@ */ package org.apache.tuscany.sca.implementation.java.introspect.impl; +import javax.jws.WebService; + import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; @@ -65,6 +67,12 @@ public class ServiceProcessorTestCase extends TestCase { assertEquals(1, type.getServices().size()); } + + public void testMultipleWithWebServiceAnnotation() throws Exception { + processor.visitClass(FooMultipleWithWebService.class, type); + assertEquals(2, type.getServices().size()); + } + public void testRemotableNoService() throws Exception { processor.visitClass(FooRemotableNoService.class, type); assertEquals(1, type.getServices().size()); @@ -102,6 +110,10 @@ public class ServiceProcessorTestCase extends TestCase { private interface Bar2 { } + + @WebService + private interface Bar3 { + } @Remotable private interface BazRemotable { @@ -124,7 +136,10 @@ public class ServiceProcessorTestCase extends TestCase { private class FooMultipleWithCalback implements Baz, Bar { } - + + private class FooMultipleWithWebService implements BazRemotable, Bar3 { + } + private class FooRemotableNoService implements BazRemotable, Bar { } |