View Javadoc

    1   package org.codehaus.xfire.spring;
    2
    3   import org.codehaus.xfire.XFire;
    4   import org.codehaus.xfire.aegis.AbstractXFireAegisTest;
    5   import org.codehaus.xfire.service.ServiceFactory;
    6   import org.springframework.context.ApplicationContext;
    7
    8   /***
    9    * Provides test support for XFire spring web services. Simply supply your ApplicationContext by
    10   * implementing the <code>createContext</code> method.
    11   *
    12   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    13   */
    14  public abstract class AbstractXFireSpringTest
    15      extends AbstractXFireAegisTest
    16  {
    17      ApplicationContext context;
    18
    19      public void setUp()
    20          throws Exception
    21      {
    22          context = createContext();
    23
    24          super.setUp();
    25      }
    26
    27      protected abstract ApplicationContext createContext();
    28
    29      protected ApplicationContext getContext()
    30      {
    31          return context;
    32      }
    33
    34      public ServiceFactory getServiceFactory()
    35      {
    36          return (ServiceFactory) context.getBean("xfire.serviceFactory");
    37      }
    38
    39      protected XFire getXFire()
    40      {
    41          return (XFire) context.getBean("xfire");
    42      }
    43
    44      protected Object getBean(String id)
    45      {
    46          return context.getBean(id);
    47      }
    48  }