You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/04/26 18:20:11 UTC
svn commit: r397228 [2/2] - in /beehive/trunk/controls/test: infra/milton/
src/controls/org/apache/beehive/controls/test/controls/composition/
src/drivers/org/apache/beehive/controls/test/driver/composition/
src/junit-controls/org/apache/beehive/contro...
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/generic/GenericTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/generic/GenericTest.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/generic/GenericTest.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/generic/GenericTest.java Wed Apr 26 09:19:58 2006
@@ -21,8 +21,6 @@
import java.util.ArrayList;
import java.util.LinkedList;
-import junit.framework.Assert;
-
import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.events.EventHandler;
@@ -32,7 +30,6 @@
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
import org.apache.beehive.test.tools.milton.junit.ReportTestCase;
-import org.apache.beehive.test.tools.milton.common.Report;
/**
* A TestCase that tests control composition.
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/java/instantiate/TestInstantiate.java Wed Apr 26 09:19:58 2006
@@ -45,8 +45,7 @@
public class TestInstantiate extends MiltonTestCase
{
- public TestInstantiate(String s)throws Exception {
-
+ public TestInstantiate(String s) {
super(s);
}
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/binding/TestControlBinding.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/binding/TestControlBinding.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/binding/TestControlBinding.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/binding/TestControlBinding.java Wed Apr 26 09:19:58 2006
@@ -15,40 +15,35 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.binding;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
-
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
-import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
import org.apache.beehive.test.tools.mantis.annotations.tch.Desc;
-public class TestControlBinding extends HtmlReportTestCase
-{
- public TestControlBinding(String s){super(s);}
+public class TestControlBinding extends HtmlReportTestCase {
+ public TestControlBinding(String s) {
+ super(s);
+ }
@Freq("checkin")
@Desc("Test that a control implementation can be overridden with binding: " +
- "http://issues.apache.org/jira/browse/BEEHIVE-20")
- public void testBindingOverride() throws Exception
- {
- assertReport("/controlsWeb/binding/index.jsp", "testBindingOverride");
+ "http://issues.apache.org/jira/browse/BEEHIVE-20")
+ public void testBindingOverride() throws Exception {
+ assertReport("/controlsWeb/binding/index.jsp", "testBindingOverride");
}
@Freq("checkin")
@Desc("Test that a @ControlImplementation can set a defaultBinding " +
- "to an impl that is not the default naming scheme (ie ControlNameImpl)")
- public void testDefaultBinding() throws Exception
- {
- assertReport("/controlsWeb/binding/index.jsp", "testDefaultBinding");
+ "to an impl that is not the default naming scheme (ie ControlNameImpl)")
+ public void testDefaultBinding() throws Exception {
+ assertReport("/controlsWeb/binding/index.jsp", "testDefaultBinding");
}
@Freq("checkin")
@Desc("Test that a control implementation can be overridden with external binding " +
- "to an impl that is specified in controlbindings.properties")
- public void testExternalBinding() throws Exception
- {
- assertReport("/controlsWeb/binding/index.jsp", "testExternalBinding");
+ "to an impl that is specified in controlbindings.properties")
+ public void testExternalBinding() throws Exception {
+ assertReport("/controlsWeb/binding/index.jsp", "testExternalBinding");
}
}
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/composition/TestOuterControl.java Wed Apr 26 09:19:58 2006
@@ -15,13 +15,10 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.composition;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
-import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
/**
* Tests controls composition by invoking a control on a pageflow.
@@ -29,26 +26,26 @@
*/
public class TestOuterControl extends HtmlReportTestCase
{
- public TestOuterControl(String s){super(s);}
+ public TestOuterControl(String s){super(s);}
/**
* Tests instantiation of nested control.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInstantiation() throws Exception
{
- assertReport("/controlsWeb/composition/testInstantiation.do");
+ assertReport("/controlsWeb/composition/testInstantiation.do");
}
/**
* Tests instantiation of nested control.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInstantiationP() throws Exception
{
- assertReport("/controlsWeb/composition/testInstantiationP.do");
+ assertReport("/controlsWeb/composition/testInstantiationP.do");
}
/**
@@ -56,10 +53,10 @@
* nested control is reconfigured at instantiation.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInstantiationWithProperty() throws Exception
{
- assertReport("/controlsWeb/composition/testInstantiationWithProperty.do");
+ assertReport("/controlsWeb/composition/testInstantiationWithProperty.do");
}
/**
@@ -67,149 +64,149 @@
* nested control is reconfigured at instantiation.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInstantiationWithPropertyP() throws Exception
{
- assertReport("/controlsWeb/composition/testInstantiationWithPropertyP.do");
+ assertReport("/controlsWeb/composition/testInstantiationWithPropertyP.do");
}
/**
* Tests getting nested control property from context of nested control.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetPropertyByContext() throws Exception
{
- assertReport("/controlsWeb/composition/testGetPropertyByContext.do");
+ assertReport("/controlsWeb/composition/testGetPropertyByContext.do");
}
/**
* Tests getting nested control property from context of nested control.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetPropertyByContextP() throws Exception
{
- assertReport("/controlsWeb/composition/testGetPropertyByContextP.do");
+ assertReport("/controlsWeb/composition/testGetPropertyByContextP.do");
}
/**
* Tests getting nested control property using getter method on nested control bean class.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetPropertyByGetter() throws Exception
{
- assertReport("/controlsWeb/composition/testGetPropertyByGetter.do");
+ assertReport("/controlsWeb/composition/testGetPropertyByGetter.do");
}
/**
* Tests getting nested control property using getter method on nested control bean class.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetPropertyByGetterP() throws Exception
{
- assertReport("/controlsWeb/composition/testGetPropertyByGetterP.do");
+ assertReport("/controlsWeb/composition/testGetPropertyByGetterP.do");
}
/**
* Tests setting nested control property using setter method on nested control bean class.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testSetPropertyBySetter() throws Exception
{
- assertReport("/controlsWeb/composition/testSetPropertyBySetter.do");
+ assertReport("/controlsWeb/composition/testSetPropertyBySetter.do");
}
/**
* Tests setting nested control property using setter method on nested control bean class.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testSetPropertyBySetterP() throws Exception
{
- assertReport("/controlsWeb/composition/testSetPropertyBySetterP.do");
+ assertReport("/controlsWeb/composition/testSetPropertyBySetterP.do");
}
/**
* Tests getting a reconfigured property from context of the nested control.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetReconfiguredPropertyByContext() throws Exception
{
- assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContext.do");
+ assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContext.do");
}
/**
* Tests getting a reconfigured property from context of nested control.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testGetReconfiguredPropertyByContextP() throws Exception
{
- assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContextP.do");
+ assertReport("/controlsWeb/composition/testGetReconfiguredPropertyByContextP.do");
}
/**
* Tests outer control receiving events raised by nested control using EventHandler.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testEventHandler() throws Exception
{
- assertReport("/controlsWeb/composition/testEventHandler.do");
+ assertReport("/controlsWeb/composition/testEventHandler.do");
}
/**
* Tests outer control receiving events raised by nested control using EventHandler.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testEventHandlerP() throws Exception
{
- assertReport("/controlsWeb/composition/testEventHandlerP.do");
+ assertReport("/controlsWeb/composition/testEventHandlerP.do");
}
/**
* Tests outer control receiving events raised by nested control using EventListener.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testEventListener() throws Exception
{
- assertReport("/controlsWeb/composition/testEventListener.do");
+ assertReport("/controlsWeb/composition/testEventListener.do");
}
/**
* Tests outer control receiving events raised by nested control using EventListener.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testEventListenerP() throws Exception
{
- assertReport("/controlsWeb/composition/testEventListenerP.do");
+ assertReport("/controlsWeb/composition/testEventListenerP.do");
}
/**
* Tests outer control receiving events raised by nested control using inner classes.
* The outer control is instantiated declaratively
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInnnerClassListener() throws Exception
{
- assertReport("/controlsWeb/composition/testInnerClassListener.do");
+ assertReport("/controlsWeb/composition/testInnerClassListener.do");
}
/**
* Tests outer control receiving events raised by nested control using inner classes.
* The outer control is instantiated programmatically
*/
- @Freq("checkin")
+ @Freq("checkin")
public void testInnerClassListenerP() throws Exception
{
- assertReport("/controlsWeb/composition/testInnerClassListenerP.do");
+ assertReport("/controlsWeb/composition/testInnerClassListenerP.do");
}
}
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/context/TestContext.java Wed Apr 26 09:19:58 2006
@@ -15,14 +15,10 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.context;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
-import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
-
/**
* Tests controls context when instantiated by a pageflow running on a Tomcat server
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/contextevent/TestLifecycleEvent.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/contextevent/TestLifecycleEvent.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/contextevent/TestLifecycleEvent.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/contextevent/TestLifecycleEvent.java Wed Apr 26 09:19:58 2006
@@ -15,14 +15,11 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.contextevent;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
-
/**
* Tests control context events
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/event/TestEvent.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/event/TestEvent.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/event/TestEvent.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/event/TestEvent.java Wed Apr 26 09:19:58 2006
@@ -15,21 +15,20 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.event;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
-import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
-
/**
* Tests pageflow receiving events raised by a control
*/
public class TestEvent extends HtmlReportTestCase
{
- public TestEvent(String s){super(s);}
+ public TestEvent(String s){
+ super(s);
+ }
+
/**
* Tests receiving control's events by EventHandler annotation
*/
@@ -37,8 +36,6 @@
public void testByEventHandler() throws Exception
{
assertReport("/controlsWeb/event/eventhandler/begin.do");
- //assertReport("/controlsWeb/event/eventhandler/verifyResult.do");
-
}
/**
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/extension/TestSubControl.java Wed Apr 26 09:19:58 2006
@@ -15,20 +15,21 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.extension;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
/**
* Tests controls inheritance by invoking a sub control on a pageflow.
*/
public class TestSubControl extends HtmlReportTestCase
{
- public TestSubControl(String s){super(s);}
+ public TestSubControl(String s){
+ super(s);
+ }
+
/**
* Tests invoking a method inherited from the super control
* The sub control is instantiated declaratively
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/instantiate/TestInstantiate.java Wed Apr 26 09:19:58 2006
@@ -15,21 +15,20 @@
*
* $Header:$
*/
-
package org.apache.beehive.controls.test.jpf.instantiate;
import org.apache.beehive.test.tools.milton.junit.HtmlReportTestCase;
import org.apache.beehive.test.tools.mantis.annotations.tch.Freq;
import org.apache.beehive.test.tools.mantis.annotations.tch.Status;
-
-
/**
* Tests controls instantiation on a web app deployed on a Tomcat server
*/
public class TestInstantiate extends HtmlReportTestCase
{
- public TestInstantiate(String s){super(s);}
+ public TestInstantiate(String s){
+ super(s);
+ }
@Freq("checkin")
public void testDeclareWithProperty() throws Exception
Modified: beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/property/TestProperty.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/property/TestProperty.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/property/TestProperty.java (original)
+++ beehive/trunk/controls/test/src/units/org/apache/beehive/controls/test/jpf/property/TestProperty.java Wed Apr 26 09:19:58 2006
@@ -26,7 +26,10 @@
*/
public class TestProperty extends HtmlReportTestCase
{
- public TestProperty(String s){super(s);}
+ public TestProperty(String s){
+ super(s);
+ }
+
/**
* Tests pageflow getting control property via control context.
* The control is instantiated declaratively on the pageflow
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonControlContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonControlContext.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonControlContext.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonControlContext.java Wed Apr 26 09:19:58 2006
@@ -20,9 +20,9 @@
import java.beans.beancontext.BeanContextServiceProvider;
import java.beans.beancontext.BeanContextServices;
import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.Vector;
-import java.lang.reflect.InvocationTargetException;
import org.apache.beehive.controls.api.events.EventRef;
import org.apache.beehive.controls.api.context.ControlHandle;
@@ -36,45 +36,8 @@
* a standalone VM, and to give the client control of ControlContainerContext behavior, such
* as resource scoping.
*/
-public class MiltonControlContext extends ControlContainerContext
-{
- /**
- * The ControlBeanContextProvider inner class acts as a single BeanContext service
- * provider for the ControlBeanContext service class. The implementation is simple,
- * because the runtime ControlBeanContext implementation class directly implements
- * this interface.
- */
- private static class MiltonContextProvider implements BeanContextServiceProvider
- {
- //
- // BeanContextServiceProvider.getService()
- //
- public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass,
- Object serviceSelector)
- {
- //
- // Contextual services for a ControlBean is provided by the peer context
- // instance.
- //
- return bcs;
- }
-
- //
- // BeanContextServiceProvider.releaseService()
- //
- public void releaseService(BeanContextServices bcs, Object requestor, Object service)
- {
- // noop, because context exists whether referenced or not
- }
-
- //
- // BeanContextServiceProvider.getContextServiceSelectors()
- //
- public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass)
- {
- return null; // no selectors
- }
- }
+public class MiltonControlContext
+ extends ControlContainerContext {
/**
* A singleton instance of the ControlBeanContextProvider class is that will be registered
@@ -83,12 +46,13 @@
*/
static private MiltonContextProvider theProvider = new MiltonContextProvider();
+ Vector<String> _events = new Vector<String>();
+
/**
* Called by BeanContextSupport superclass during construction and deserialization to
* initialize subclass transient state
*/
- public void initialize()
- {
+ public void initialize() {
super.initialize();
//
@@ -101,15 +65,58 @@
org.apache.beehive.test.tools.milton.junit.MiltonInterceptorContextImpl.getProvider() );
}
+ public ControlHandle getControlHandle(org.apache.beehive.controls.api.bean.ControlBean bean) {
+ return new MiltonControlHandle(this, bean);
+ }
+
+ public void addEvent(String event) {
+ _events.add(event);
+ }
+
+ public void resetEvents() {
+ _events.clear();
+ }
+
+ public String [] getEvents() {
+ String [] retval = new String [_events.size()];
+ _events.toArray(retval);
+ return retval;
+ }
+
/**
* Override default getBeanAnnotationMap to not depend on ControlBean
* @param bean
* @param annotElem
- * @return
+ * @return the property map
+ */
+ /*
+ protected PropertyMap getBeanAnnotationMap( ControlBean bean, AnnotatedElement annotElem ) {
+ return super.getBeanAnnotationMap( bean, annotElem );
+ }
+ */
+
+ /**
+ * The ControlBeanContextProvider inner class acts as a single BeanContext service
+ * provider for the ControlBeanContext service class. The implementation is simple,
+ * because the runtime ControlBeanContext implementation class directly implements
+ * this interface.
*/
- protected PropertyMap getBeanAnnotationMap( ControlBean bean, AnnotatedElement annotElem )
- {
- return super.getBeanAnnotationMap( bean, annotElem ); //To change body of overridden methods use File | Settings | File Templates.
+ private static class MiltonContextProvider
+ implements BeanContextServiceProvider {
+
+ public Object getService(BeanContextServices bcs,
+ Object requestor,
+ Class serviceClass,
+ Object serviceSelector) {
+ return bcs;
+ }
+
+ public void releaseService(BeanContextServices bcs, Object requestor, Object service) {
+ }
+
+ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) {
+ return null; // no selectors
+ }
}
/**
@@ -119,22 +126,21 @@
*
* TODO: Provide a Serializable implementation of MiltonControlHandle.
*/
- private static class MiltonControlHandle implements ControlHandle
- {
+ private static class MiltonControlHandle
+ implements ControlHandle {
MiltonControlHandle(MiltonControlContext context,
- org.apache.beehive.controls.api.bean.ControlBean bean)
- {
+ org.apache.beehive.controls.api.bean.ControlBean bean) {
_testContext = context;
_bean = bean;
}
- public String getControlID() { return _bean.getControlID(); }
+ public String getControlID() {
+ return _bean.getControlID();
+ }
public Object sendEvent(EventRef event, Object [] args)
- throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
- {
- try
- {
+ throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ try {
//
// Push the test context, to simulate re-entering the container
//
@@ -151,28 +157,4 @@
MiltonControlContext _testContext;
org.apache.beehive.controls.api.bean.ControlBean _bean;
}
-
- public ControlHandle getControlHandle(org.apache.beehive.controls.api.bean.ControlBean bean)
- {
- return new MiltonControlHandle(this, bean);
- }
-
- public void addEvent(String event)
- {
- _events.add(event);
- }
-
- public void resetEvents()
- {
- _events.clear();
- }
-
- public String [] getEvents()
- {
- String [] retval = new String [_events.size()];
- _events.toArray(retval);
- return retval;
- }
-
- Vector<String> _events = new Vector<String>();
}
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonTestCase.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonTestCase.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonTestCase.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/MiltonTestCase.java Wed Apr 26 09:19:58 2006
@@ -2,66 +2,62 @@
import java.lang.reflect.Field;
-import java.beans.beancontext.BeanContextChild;
-import java.beans.beancontext.BeanContextServiceProvider;
-import java.beans.beancontext.BeanContextServices;
-
import junit.framework.TestCase;
-import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.bean.Controls;
/*
* A JUnit TestCase class which serves as a Control Container
* and supports Declarative instantiation.
*/
-public abstract class MiltonTestCase extends TestCase implements java.io.Serializable
-{
+public abstract class MiltonTestCase
+ extends TestCase implements java.io.Serializable {
+
+ protected static final long serialVersionUID = 16L;
+
protected MiltonControlContext mcc = null;
protected boolean controlClient = false;
- protected static final long serialVersionUID = 16L;
+ public MiltonTestCase() {
+ }
- public MiltonTestCase() {}
+ public MiltonTestCase(String name) {
+ super(name);
- public MiltonTestCase(String name)
- {
- super(name);
-
- if (isControlClient(this)) {
- this.controlClient = true;
- this.mcc = new MiltonControlContext();
- }
+ if (isControlClient(this)) {
+ this.controlClient = true;
+ this.mcc = new MiltonControlContext();
+ }
}
- public void setUp() throws Exception
- {
- if (this.controlClient) {
- mcc.beginContext();
- Controls.initializeClient(null, this, mcc);
- }
+ public void setUp()
+ throws Exception {
+
+ if (this.controlClient) {
+ mcc.beginContext();
+ Controls.initializeClient(null, this, mcc);
+ }
}
public void tearDown() {
- if (null != this.mcc)
- mcc.endContext();
+ if (null != this.mcc)
+ mcc.endContext();
}
/*
* helper method to determine if this is a client contains controls
*/
- private boolean isControlClient(Object controlContainer)
- {
- Class controlContainerClass = controlContainer.getClass();
-
- Field[] fields = controlContainerClass.getDeclaredFields();
-
- for (int i = 0; i < fields.length; i++) {
- Field f = fields[i];
- if (null != f.getAnnotation(org.apache.beehive.controls.api.bean.Control.class))
- return true;
- }
+ private boolean isControlClient(Object controlContainer) {
+ Class controlContainerClass = controlContainer.getClass();
+
+ Field[] fields = controlContainerClass.getDeclaredFields();
+
+ for (int i = 0; i < fields.length; i++) {
+ Field f = fields[i];
+ if (null != f.getAnnotation(org.apache.beehive.controls.api.bean.Control.class))
+ return true;
+ }
- return false;
+ return false;
}
}
Modified: beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/ReportTestCase.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/ReportTestCase.java?rev=397228&r1=397227&r2=397228&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/ReportTestCase.java (original)
+++ beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/ReportTestCase.java Wed Apr 26 09:19:58 2006
@@ -1,58 +1,48 @@
package org.apache.beehive.test.tools.milton.junit;
-import org.apache.beehive.test.tools.milton.junit.MiltonTestCase;
import org.apache.beehive.test.tools.milton.common.Report;
/*
- * A JUnit TestCase class which serves as a Control Container
- * and supports Declarative instantiation.
+ * A JUnit TestCase class which serves as a Control Container and supports Declarative instantiation.
*/
-public abstract class ReportTestCase extends MiltonTestCase
-{
- public ReportTestCase(String name)
- {
- super(name);
+public abstract class ReportTestCase
+ extends MiltonTestCase {
+
+ public ReportTestCase(String name) {
+ super(name);
}
- protected void assertReport(Report p_report) throws Exception
- {
- if (null == p_report)
- throw new IllegalArgumentException("Report parameter cannot be Null");
+ protected void assertReport(Report p_report) {
+ if (null == p_report)
+ throw new IllegalArgumentException("Report parameter cannot be Null");
if (Report.ABORT.equals(p_report.getStatus()))
- throw new AbortTestException("Abort Status Dectected: \n" +
- p_report.toString());
+ throw new AbortTestException("Abort Status Dectected: \n" + p_report.toString());
else if (Report.FAIL.equals(p_report.getStatus()))
- throw new junit.framework.AssertionFailedError("FAILURE: \n" +
- p_report.toString());
+ throw new junit.framework.AssertionFailedError("FAILURE: \n" + p_report.toString());
else if (!Report.PASS.equals(p_report.getStatus()))
- throw new AbortTestException("Unknown Status Detected: \n" +
- p_report.toString());
+ throw new AbortTestException("Unknown Status Detected: \n" + p_report.toString());
- printMessages(p_report);
- printExceptionStack(p_report);
+ printMessages(p_report);
+ printExceptionStack(p_report);
}
- protected void printMessages(Report p_report)
- {
- if (null == p_report) {
- return;
- }
-
- String l_messages = p_report.getMessage();
+ protected void printMessages(Report p_report) {
+ if (null == p_report)
+ return;
+
+ String l_messages = p_report.getMessage();
if (null != l_messages && !"".equals(l_messages))
System.out.println("\n[MESSAGES]\n\t" + l_messages);
}
- protected void printExceptionStack(Report p_report)
- {
- if (null == p_report) {
- return;
- }
+ protected void printExceptionStack(Report p_report) {
+ if (null == p_report)
+ return;
- String l_exceptionStack = p_report.getExceptionStack();
+ String l_exceptionStack = p_report.getExceptionStack();
if (null != l_exceptionStack && !"".equals(l_exceptionStack))
System.out.println("\n[EXCEPTION]\n\t" + l_exceptionStack);