Author: jsong
Date: Wed Apr 27 16:50:18 2005
New Revision: 165069
URL: http://svn.apache.org/viewcvs?rev=165069&view=rev
Log:
Fix for BEEHIVE-277. Users can now pass a Control interface to a test method
Modified:
incubator/beehive/trunk/controls/test/infra/milton/milton.jar
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
Modified: incubator/beehive/trunk/controls/test/infra/milton/milton.jar
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/milton/milton.jar?rev=165069&r1=165068&r2=165069&view=diff
==============================================================================
Binary files - no diff available.
Modified:
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java?rev=165069&r1=165068&r2=165069&view=diff
==============================================================================
---
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
(original)
+++
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/mantis/MiltonProcessor.java
Wed Apr 27 16:50:18 2005
@@ -24,6 +24,7 @@
import com.sun.mirror.declaration.ParameterDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.InterfaceType;
/*
* A Mantis processor for generating Control Test clients (jpf, jws, etc)
@@ -178,20 +179,37 @@
throw new IllegalStateException("All Milton
test methods must accept at least one ControlBean parameter");
Collection<MiltonTestControl> controls = new
ArrayList<MiltonTestControl>();
+
+ //Will store the name of the Control type
+ String controlType = null;
//all parameters to a milton test method must be
control beans
for (ParameterDeclaration p : pd) {
boolean isControlBean = false;
- ClassType sct =
((ClassType)p.getType()).getSuperclass();
+ try {
+ ClassType sct =
((ClassType)p.getType()).getSuperclass();
+
+ // Make sure that the parameter is a
ControlBean
+ while (!
sct.toString().equals("java.lang.Object")) {
- // Make sure that the parameter is a ControlBean
- while (!
sct.toString().equals("java.lang.Object")) {
- if
(sct.toString().equals("org.apache.beehive.controls.runtime.bean.ControlBean"))
{
- isControlBean = true;
- break;
+ if (sct.toString().equals(
+
"org.apache.beehive.controls.runtime.bean.ControlBean"
+ )
+ )
+ {
+ isControlBean = true;
+ controlType =
((ClassType)p.getType()).toString();
+ break;
}
-
sct = (ClassType)sct.getSuperclass();
+ }
+ }
+ catch (ClassCastException cce) {
+ InterfaceType sct =
(InterfaceType)p.getType();
+ //if we have an interface instead of a
ControlBean subclass
+ //we assume that its a control interface
+ isControlBean = true;
+ controlType =
((InterfaceType)p.getType()).toString();
}
if (! isControlBean)
@@ -200,7 +218,6 @@
//get @Milton.TestControl annotations off
parameters
Milton.TestControl a_mtc =
(Milton.TestControl)p.getAnnotation(Milton.TestControl.class);
- String controlType =
((ClassType)p.getType()).toString();
String controlName = md.getSimpleName() + "_" +
p.getSimpleName();
String[] controlAnnotations =
Milton.DEFAULT_CONTROL_ANNOTATIONS;
String controlModifier =
Milton.DEFAULT_CONTROL_MODIFIER;