From 05a983da945419d83d52b2870c43cdef5eb3b600 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 6 Dec 2011 11:06:07 +0000 Subject: TUSCANY-3965 - Generally stop detecting non-annotated properties/references if @Service/@Reference/@Property annotations are present git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1210860 13f79535-47bb-0310-9956-ffa450edef68 --- .../introspect/impl/HeuristicPojoProcessor.java | 26 ++++++++++------------ .../trunk/testing/compliance-tests/java-ci/pom.xml | 5 +++++ .../tuscany/sca/itest/ctcalc/CTCalcTestCase.java | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java index ac92d7b802..43cdeb319d 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java @@ -91,6 +91,7 @@ public class HeuristicPojoProcessor extends BaseJavaClassVisitor { @Override public void visitEnd(Class clazz, JavaImplementation type) throws IntrospectionException { List services = type.getServices(); + if (services.isEmpty()) { // heuristically determine the service /** @@ -116,20 +117,17 @@ public class HeuristicPojoProcessor extends BaseJavaClassVisitor { addService(type, clazz); } } - if (!(type.getReferenceMembers().isEmpty() && type.getPropertyMembers().isEmpty())) { - // references and properties have been explicitly defined - // if (type.getServices().isEmpty()) { - // calculateServiceInterface(clazz, type, methods); - // if (type.getServices().isEmpty()) { - // throw new ServiceTypeNotFoundException(clazz.getName()); - // } - // } - evaluateConstructor(type, clazz); - return; - } - Set methods = getAllUniquePublicProtectedMethods(clazz, false); - - calcPropRefs(methods, services, type, clazz); + + // TUSCANY-3965 - The OSASIS JCI spec (section 8) now provides an explicit algorithm + // for property and reference introspection. It's only performed if no @Service, @Reference + // or @Property annotation is present + if (clazz.getAnnotation(org.oasisopen.sca.annotation.Service.class) == null && + type.getReferenceMembers().isEmpty() && + type.getPropertyMembers().isEmpty()){ + Set methods = getAllUniquePublicProtectedMethods(clazz, false); + calcPropRefs(methods, services, type, clazz); + } + evaluateConstructor(type, clazz); } diff --git a/sca-java-2.x/trunk/testing/compliance-tests/java-ci/pom.xml b/sca-java-2.x/trunk/testing/compliance-tests/java-ci/pom.xml index 75d7bd1e48..9176953646 100644 --- a/sca-java-2.x/trunk/testing/compliance-tests/java-ci/pom.xml +++ b/sca-java-2.x/trunk/testing/compliance-tests/java-ci/pom.xml @@ -74,6 +74,11 @@ -Xms256m -Xmx1024m **/POJO_10004_TestCase.java + **/POJO_5004_TestCase.java + **/POJO_5005_TestCase.java + **/POJO_8003_TestCase.java + **/POJO_8010_TestCase.java + **/POJO_8024_TestCase.java diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/ctcalc/CTCalcTestCase.java b/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/ctcalc/CTCalcTestCase.java index c856f42c57..a13a6d1b3f 100644 --- a/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/ctcalc/CTCalcTestCase.java +++ b/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/ctcalc/CTCalcTestCase.java @@ -76,7 +76,7 @@ public class CTCalcTestCase { @Test public void testAnnotatedExtension() { assertEquals("Annotated", annotatedComponent.test()); - assertEquals(2, ((NodeImpl)node).getDomainComposite().getComponents().get(0).getProperties().size()); + assertEquals(0, ((NodeImpl)node).getDomainComposite().getComponents().get(0).getProperties().size()); System.out.println(((NodeImpl)node).getDomainComposite().getComponents().get(0).getProperties()); } -- cgit v1.2.3