You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Dan Diephouse <da...@envoisolutions.com> on 2004/10/29 17:55:59 UTC

Control Usage Questions

Hi again,
I'm starting to grasp beehive and have managed to write my first test now:

Hello hello = (Hello) Beans.instantiate( getClass().getClassLoader(),
                                                 "pkg.HelloBean" );
assertNotNull(hello);
       
ControlContainerContext context = new ControlContainerContext();
       
HelloControlTester user = new HelloControlTester();
HelloControlTesterClientInitializer.initialize(context, user);
       
assertNotNull(user);
assertEquals("hello!", user.hello());

Simple enough! What I didn't grasp before was that the class which 
contained @Control definitions needed to be run through the generator as 
well to generate the "XXXClientInitializer" class.  I had figured it was 
done through reflection on the fly magically :-)...

Anyway, this has given risen to a couple questions...
1. Why are Implementation classes "jcs" files instead of java files?
2. In the control tutorial there is just a bean which is instantiated 
(ie the first line of the test).  For classes which contain "@Control" 
definitions is the "XXXClientInitializer" pattern above the best way to 
initialize them?  Or is there some kind of container which does this 
automatically? 

Thanks,
- Dan




-- 
Dan Diephouse
Envoi Solutions LLC
http://envoisolutions.com/people/dan