summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-java/src/test
diff options
context:
space:
mode:
authorkelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68>2009-07-09 15:06:38 +0000
committerkelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68>2009-07-09 15:06:38 +0000
commit70d307d1d6dc72b81f83fcc5db746d8a55e17dec (patch)
treefec63451daf30a4083f5052d711ce4c20dc107d9 /java/sca/modules/implementation-java/src/test
parent3a6b8b52c846c239e5d99559fe889ddd4a8a2efa (diff)
TUSCANY-3136 trap use of @Property reference on methods
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@792573 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-java/src/test')
-rw-r--r--java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java b/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
index 3f531e48d6..be90ba297e 100644
--- a/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
+++ b/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
import java.util.List;
import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
@@ -119,6 +120,22 @@ public class ConstructorPropertyTestCase extends AbstractProcessorTest {
// TODO multiplicity
// }
+ @Test
+ public void testClassWithBadMethodArgProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method meth = BadFoo2.class.getMethod("BadFoo2Method", String.class);
+
+ try {
+ propertyProcessor.visitMethod(meth, type);
+
+ fail();
+ } catch (IllegalPropertyException e) {
+ e.printStackTrace();
+ System.out.println("Exception successfully received");
+ }
+
+ }
+
private static class Foo {
@org.oasisopen.sca.annotation.Constructor()
@@ -165,5 +182,19 @@ public class ConstructorPropertyTestCase extends AbstractProcessorTest {
}
}
+
+ private static class BadFoo2 {
+
+ @org.oasisopen.sca.annotation.Constructor()
+ public BadFoo2(@Property(name = "myProp", required = true)String prop) {
+
+ }
+
+ /** Java can't tell that the @reference argument is disallowed by SCA, but the run time must reject it*/
+ public void BadFoo2Method(@Property(name = "badMethodArgProp")String methArg)
+ {}
+
+
+ }
}