beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From js...@apache.org
Subject svn commit: rev 46192 - in incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls: basic beaninfo checker composition properties
Date Thu, 16 Sep 2004 17:10:42 GMT
Author: jsong
Date: Thu Sep 16 10:10:41 2004
New Revision: 46192

Added:
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperExtend.jcx
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperationImpl.jcs
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/Outer.java
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecked.java
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.jcx
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.jcs
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecker.java
  (contents, props changed)
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedAssembler.java
  (contents, props changed)
Removed:
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/properties/
Modified:
   incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedImpl.jcs
Log:
Migrating existing controls drt tests into controls/test.


Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperExtend.jcx
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperExtend.jcx
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,20 @@
+package org.apache.beehive.controls.test.controls.basic;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+
+/**
+ * This tests extension of an inner control interface
+ * <p>
+ */
+@ControlExtension
+public interface InnerOperExtend extends Outer.InnerOperation
+{
+    public void voidExtOperation();
+    public int  intExtOperation(int intArg);
+    public int [] intArrayExtOperation(int [] intArrayArg);
+    public int [][] intMultiArrayExtOperation(int [][] intMultiArrayArg);
+    public Integer integerExtOperation(Integer integerArg);
+    public Integer [] integerArrayExtOperation(Integer [] integerArrayArg);
+    public Integer [][] integerMultiArrayExtOperation(Integer [][] integerMultiArrayArg);
+    public Object [] multiArgsExtOperation(int intArg, Integer integerArg, String stringArg);
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperationImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/InnerOperationImpl.jcs
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,35 @@
+package org.apache.beehive.controls.test.controls.basic;
+
+import java.lang.reflect.Method;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+import org.apache.beehive.controls.api.events.Client;
+
+@ControlImplementation
+public class InnerOperationImpl implements Outer.InnerOperation, Extensible
+{
+    public void voidOperation() {};
+    public int  intOperation(int intArg) { return intArg; }
+    public LocalArg localArgOperation(LocalArg localArg) { return localArg; }
+
+    /**
+     * Implements the Extensible.invoke interface when a JCX-declared method is called
+     */
+    public Object invoke(Method method, Object [] args) throws Throwable
+    {
+        // If the argument is an exception, throw it
+        if (args[0] instanceof Throwable)
+            throw (Throwable)args[0];
+
+        // otherwise, just echo it back, following the pattern above.
+        if (args.length == 1)
+        {
+            return args[0];
+        } 
+        else
+        {
+            return args;
+        }
+    }
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/Outer.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/basic/Outer.java
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,24 @@
+package org.apache.beehive.controls.test.controls.basic;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * This tests usage of nested/inner interfaces as control interfaces
+ * <p>
+ */
+public class Outer
+{
+    @ControlInterface
+    public interface InnerOperation
+    {
+        public class LocalArg
+        {
+            int intArg;
+            String stringArg;
+        }
+
+        public void voidOperation();
+        public int  intOperation(int intArg);
+        public LocalArg localArgOperation(LocalArg localArg);
+    }
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTest.java
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,53 @@
+package org.apache.beehive.controls.test.controls.beaninfo;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.packaging.FeatureAttribute;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.packaging.PropertyInfo;
+import org.apache.beehive.controls.api.packaging.ManifestAttribute;
+import org.apache.beehive.controls.api.packaging.ManifestAttributes;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/**
+ * A simple test class that tests using JSR-175 annotations to inject BeanInfo attributes
+ * for a Control type.
+ */
+@ControlInterface
+/* THE B51 VANILLA APT PROCESSOR BARFS ON THIS RIGHT NOW
+@ManifestAttributes (value={
+    @ManifestAttribute(name="Attribute1", value="Value1"),
+    @ManifestAttribute(name="Attribute2", value="Value2"),
+    @ManifestAttribute(name="Attribute3", value="Value3")
+}) */
+@ManifestAttribute(name="Attribute1", value="Value1")
+@FeatureInfo(
+    name="InfoTest name",
+    displayName="InfoTest display name"
+    /*
+    attributes=
+    {
+        @FeatureAttribute(name="fa1", value="fv1"),
+        @FeatureAttribute(name="fa2", value="fv2")
+    }
+    */
+)
+public interface InfoTest
+{
+    @PropertySet
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target( {ElementType.TYPE, ElementType.FIELD} )
+    public @interface TestProps
+    {
+        @PropertyInfo(bound=true, constrained=false)
+        @FeatureInfo(name="InfoTest prop1", displayName="InfoTest prop1")
+        public int prop1();
+
+        public boolean prop2();
+    }
+
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/beaninfo/InfoTestImpl.jcs
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,13 @@
+package org.apache.beehive.controls.test.controls.beaninfo;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+/**
+ * A simple test impl that tests using JSR-175 annotations to inject BeanInfo attributes
+ * for a Control type.
+ */
+@ControlImplementation
+public class InfoTestImpl implements InfoTest
+{
+
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecked.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecked.java
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,45 @@
+package org.apache.beehive.controls.test.controls.checker;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+@ControlInterface( checkerClass=HelloChecker.class )
+public interface HelloChecked
+{
+    //
+    // 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);
+    }
+
+    java.lang.String hello(java.lang.String name);
+
+    java.lang.String lastVisitor();
+
+    int visitorCount();
+}

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.jcx
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedExtend.jcx
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,14 @@
+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();
+}
+

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.jcs
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloCheckedImpl.jcs
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,41 @@
+package org.apache.beehive.controls.test.controls.checker;
+
+import java.lang.reflect.Method;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+
+@ControlImplementation
+public class HelloCheckedImpl implements HelloChecked, Extensible
+{ 
+    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; 
+    }
+} 

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecker.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/checker/HelloChecker.java
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,35 @@
+package org.apache.beehive.controls.test.controls.checker;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+
+import org.apache.beehive.controls.api.bean.ControlChecker;
+
+public class HelloChecker implements ControlChecker
+{
+    public void check(Declaration decl, AnnotationProcessorEnvironment env)
+    {
+        // Just refer to the public interface in some way to test
+        // this kind of dep.
+        HelloChecked.GenderType gt = HelloChecked.GenderType.NEUTRAL;
+
+        if ( decl instanceof TypeDeclaration )
+        {
+            env.getMessager().printNotice(decl.getPosition(),
+                    "HelloChecker: found type decl=" + decl);
+        }
+        else if ( decl instanceof FieldDeclaration )
+        {
+            env.getMessager().printNotice(decl.getPosition(),
+                    "HelloChecker: found field decl=" + decl);
+        }
+        else
+        {
+            env.getMessager().printNotice(decl.getPosition(),
+                    "HelloChecker: found decl=" + decl);
+        }
+    }
+}
+

Added: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedAssembler.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedAssembler.java
Thu Sep 16 10:10:41 2004
@@ -0,0 +1,17 @@
+package org.apache.beehive.controls.test.controls.composition;
+
+import org.apache.beehive.controls.api.assembly.ControlAssembler;
+import org.apache.beehive.controls.api.assembly.ControlAssemblyContext;
+
+public class NestedAssembler implements ControlAssembler
+{
+    public void assemble( ControlAssemblyContext cac )
+    {
+        System.out.println( "NestedAssembler:" );
+        System.out.println( "    context type=" + cac.getClass().getName() );
+        System.out.println( "    module=" + cac.getModuleDir() );
+        System.out.println( "    control type=" + cac.getControlType() );
+        System.out.println( "    control default impl=" + cac.getDefaultImplClassName() );
+    }
+}
+

Modified: incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedImpl.jcs
==============================================================================
--- incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedImpl.jcs
(original)
+++ incubator/beehive/trunk/controls/test/src/controls/org/apache/beehive/controls/test/controls/composition/NestedImpl.jcs
Thu Sep 16 10:10:41 2004
@@ -5,7 +5,7 @@
 import org.apache.beehive.controls.api.bean.ControlImplementation;
 import org.apache.beehive.controls.api.events.Client;
 
-@ControlImplementation
+@ControlImplementation( assembler=NestedAssembler.class )
 public class NestedImpl implements Nested
 { 
     @Client Return  returnClient;

Mime
View raw message