    1   package org.controlhaus.amazon;
    2
    3   import java.lang.reflect.Method;
    4
    5   import junit.framework.TestCase;
    6
    7   import org.apache.beehive.controls.api.context.ControlBeanContext;
    8   import org.apache.beehive.controls.runtime.bean.ControlContainerContext;
    9
    10  /***
    11   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    12   * @since Nov 5, 2004
    13   */
    14  public class AbstractControlTest
    15      extends TestCase
    16  {
    17      private ControlContainerContext context;
    18
    19      public void setUp() throws Exception
    20      {
    21          context = new ControlContainerContext();
    22
    23          try
    24          {
    25              Class init = getClass().getClassLoader().loadClass(
    26                      getClass().getName() + "ClientInitializer" );
    27
    28              Method m = init.getMethod("initialize",
    29                                        new Class[]
    30                                        {
    31                                              ControlBeanContext.class,
    32                                              getClass()
    33                                        } );
    34
    35              m.invoke( null, new Object[] { context, this } );
    36          }
    37          catch ( ClassNotFoundException cnfe )
    38          {
    39              // do nothing.
    40          }
    41      }
    42
    43      public ControlContainerContext getContext()
    44      {
    45          return context;
    46      }
    47  }