tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r652543 - in /incubator/tuscany/java/sca/modules/implementation-java/src: main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/
Date Thu, 01 May 2008 14:53:27 GMT
Author: slaws
Date: Thu May  1 07:53:26 2008
New Revision: 652543

URL: http://svn.apache.org/viewvc?rev=652543&view=rev
Log:
TUSCANY-2273. Thanks for the patch Vamsi

Modified:
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java?rev=652543&r1=652542&r2=652543&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
Thu May  1 07:53:26 2008
@@ -47,6 +47,9 @@
         if (method.getParameterTypes().length != 0) {
             throw new IllegalDestructorException("Destructor must not have argments", method);
         }
+        if(!method.getReturnType().equals(void.class)) {
+            throw new IllegalDestructorException("Destructor must return void.", method);
+        }
         if (type.getDestroyMethod() != null) {
             throw new DuplicateDestructorException("More than one destructor found on implementation");
         }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java?rev=652543&r1=652542&r2=652543&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
Thu May  1 07:53:26 2008
@@ -47,6 +47,9 @@
         if (method.getParameterTypes().length != 0) {
             throw new IllegalInitException("Initializer must not have argments", method);
         }
+        if(!method.getReturnType().equals(void.class)) {
+            throw new IllegalInitException("Initializer must return void.", method);
+        }
         if (type.getInitMethod() != null) {
             throw new DuplicateInitException("More than one initializer found on implementaton");
         }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java?rev=652543&r1=652542&r2=652543&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
Thu May  1 07:53:26 2008
@@ -72,6 +72,18 @@
     }
 
 
+    public void testBadDestroy2() throws Exception {
+        DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        Method method = Bar.class.getDeclaredMethod("badDestroy2");
+        try {
+            processor.visitMethod(method, type);
+            fail();
+        } catch (IllegalDestructorException e) {
+            // expected
+        }
+    }
+
     private class Foo {
 
         @Destroy
@@ -95,5 +107,9 @@
         }
 
 
+        @Destroy
+        public String badDestroy2() {
+            return null;
+        }
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java?rev=652543&r1=652542&r2=652543&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
Thu May  1 07:53:26 2008
@@ -74,6 +74,18 @@
     }
 
 
+    public void testBadInit2() throws Exception {
+        InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("badInit2");
+        try {
+            processor.visitMethod(method, type);
+            fail();
+        } catch (IllegalInitException e) {
+            // expected
+        }
+    }
+
     private class Foo {
         @Init
         public void init() {
@@ -95,5 +107,9 @@
         }
 
 
+        @Init
+        public String badInit2() {
+            return null;
+        }
     }
 }



Mime
View raw message