You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/07/10 18:21:56 UTC

svn commit: r420580 - in /beehive/trunk/controls/test: ./ src/controls/org/apache/beehive/controls/test/controls/checker/ src/controls/org/apache/beehive/controls/test/controls/interceptor/ src/junit-controls/org/apache/beehive/controls/test/controls/c...

Author: cschoett
Date: Mon Jul 10 09:21:55 2006
New Revision: 420580

URL: http://svn.apache.org/viewvc?rev=420580&view=rev
Log:
Ported serveral additional controls from the tch framework to junit.  The HelloCheckedExtend control uses a control checker and the HelloIntercepted control uses an interceptor annotation. Both the checker and interceptor annotation need to be built before the respective controls so I have decidied to utilize the auxillaries src location used by tch for these classes.

DRTs: controls core passed.

Added:
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java   (with props)
Removed:
    beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/
    beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/interceptor/
Modified:
    beehive/trunk/controls/test/build.xml

Modified: beehive/trunk/controls/test/build.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/test/build.xml?rev=420580&r1=420579&r2=420580&view=diff
==============================================================================
--- beehive/trunk/controls/test/build.xml (original)
+++ beehive/trunk/controls/test/build.xml Mon Jul 10 09:21:55 2006
@@ -154,7 +154,7 @@
 
         <property name="test.freq" value="detailed"/>
         <antcall target="test.server"/>
-        
+
         <delete dir="webapps/src/milton"/>
     </target>
 
@@ -515,6 +515,9 @@
         <delete dir="${build.dir}/junit-controls-classes"/>
         <delete dir="${build.dir}/junit-controls-beansrc"/>
         <delete dir="${build.dir}/junit-tests-classes"/>
+        <delete dir="${build.dir}/junit-aux-beansrc"/>
+        <delete dir="${build.dir}/junit-aux-classes"/>
+        <delete dir="${build.dir}/junit-assembly-beansrc"/>
         <delete file="${build.dir}/beehive-controls-junit-tests.jar"/>
     </target>
 
@@ -522,12 +525,24 @@
         <mkdir dir="${build.dir}/junit-controls-classes"/>
         <mkdir dir="${build.dir}/junit-controls-beansrc"/>
         <mkdir dir="${build.dir}/junit-tests-classes"/>
+        <mkdir dir="${build.dir}/junit-aux-classes"/>
+        <mkdir dir="${build.dir}/junit-aux-beansrc"/>
         <mkdir dir="${build.dir}/junit-assembly-beansrc"/>
 
+        <build-controls srcdir="src/auxilaries"
+                        destdir="${build.dir}/junit-aux-classes"
+                        tempdir="${build.dir}/junit-aux-beansrc"
+                        classpathref="test-junit.dependency.path"/>
+
+        <path id="_aux.classpath">
+            <path refid="test-junit.dependency.path"/>
+            <pathelement location="${build.dir}/junit-aux-classes"/>
+        </path>
+
         <build-controls srcdir="src/junit-controls"
                         destdir="${build.dir}/junit-controls-classes"
                         tempdir="${build.dir}/junit-controls-beansrc"
-                        classpathref="test-junit.dependency.path"/>
+                        classpathref="_aux.classpath"/>
 
         <copy todir="${build.dir}/junit-controls-classes">
             <fileset dir="src/junit-controls">
@@ -547,11 +562,13 @@
             </fileset>
         </assemble>
 
-        <control-jar destfile="${build.dir}/beehive-controls-junit-tests.jar"  basedir="${build.dir}/junit-controls-classes"/>
+        <control-jar destfile="${build.dir}/beehive-controls-junit-tests.jar">
+            <fileset dir="${build.dir}/junit-controls-classes"/>
+            <fileset dir="${build.dir}/junit-aux-classes"/>
+        </control-jar>
 
         <path id="_test.classpath">
             <path refid="test-junit.dependency.path"/>
-            <path refid="junit.dependency.path"/>
             <pathelement location="${build.dir}/beehive-controls-junit-tests.jar"/>
         </path>
 

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java?rev=420580&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java Mon Jul 10 09:21:55 2006
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.checker;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+
+/**
+ * This is a test extension that declares operations of various types
+ * <p>
+ */
+@ControlExtension
+public interface HelloCheckedExtend extends HelloChecked
+{
+    public void voidExtOperation();
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java?rev=420580&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java Mon Jul 10 09:21:55 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.checker;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+
+import java.lang.reflect.Method;
+
+@ControlImplementation
+public class HelloCheckedImpl implements HelloChecked, Extensible, java.io.Serializable
+{
+    public String _lastVisitor = "<none>";
+    int _visitorCount = 0;
+
+    public String hello(String name)
+    {
+        _lastVisitor = name;
+        _visitorCount++;
+        return "Hello, " + name;
+    }
+
+    public String lastVisitor()
+    {
+        return _lastVisitor;
+    }
+
+    public int visitorCount()
+    {
+        return _visitorCount;
+    }
+
+    /**
+     * Implements the Extensible.invoke interface when a JCX-declared method is called
+     */
+    public Object invoke(Method method, Object [] args)
+    {
+        //
+        // To Be Implemented
+        //
+        return null;
+    }
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java?rev=420580&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java Mon Jul 10 09:21:55 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.interceptor;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Code-gen test for interceptors.  Note that there is currently no
+ * runtime test for interceptors; this just tests that the code-gen
+ * path for interceptors results in compilable code.
+ */
+@ControlInterface
+public interface HelloIntercepted {
+    @EventSet
+    public interface multicastEvents {
+        @SampleInterceptorAnnotation
+        public void multicastNotify(int a);
+    }
+
+    @EventSet(unicast = true)
+    public interface unicastEvents {
+        @SampleInterceptorAnnotation
+        public int unicastNotify(Object b);
+    }
+
+    //
+    // A simple enumerated type used to customize the greeting by gender
+    //
+    public enum GenderType {
+        NEUTRAL, MALE, FEMALE
+    }
+
+    public @interface Gender {
+        GenderType value();
+    }
+
+    /**
+     * Declare a simple PropertySet, that allows the salutation used by the custom
+     * control to be customized.
+     */
+    @PropertySet
+    @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Greeting {
+        String salutation() default "Hello";
+
+        Gender gender() default @Gender(GenderType.NEUTRAL);
+    }
+
+    String hello(String name);
+
+    @SampleInterceptorAnnotation
+    String lastVisitor();
+
+    @SampleInterceptorAnnotation
+    int visitorCount();
+
+    /**
+     * Test intereptor annotations on overloaded methods
+     */
+    @SampleInterceptorAnnotation
+    int visitorCount(String name);
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloIntercepted.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java?rev=420580&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java Mon Jul 10 09:21:55 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.interceptor;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+
+import java.lang.reflect.Method;
+
+@ControlImplementation
+public class HelloInterceptedImpl implements HelloIntercepted, Extensible, java.io.Serializable {
+    public String _lastVisitor = "<none>";
+    int _visitorCount = 0;
+
+    public String hello(String name) {
+        _lastVisitor = name;
+        _visitorCount++;
+        return "Hello, " + name;
+    }
+
+    public String lastVisitor() {
+        return _lastVisitor;
+    }
+
+    public int visitorCount() {
+        return _visitorCount;
+    }
+
+    public int visitorCount(String name) {
+        return _visitorCount;
+    }
+
+    /**
+     * Implements the Extensible.invoke interface when a JCX-declared method is called
+     */
+    public Object invoke(Method method, Object [] args) {
+        //
+        // To Be Implemented
+        //
+        return null;
+    }
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interceptor/HelloInterceptedImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native