You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ron Grimes <rg...@sinclairoil.com> on 2009/02/20 19:07:07 UTC

AbstractCXFSpring Test in Eclipse

Sorry if this has been asked/answered before, but I couldn't find it.
Does anyone have an example of how to run an AbstractCXFSpringTest in
Eclipse? I would like to see both the test class and
ApplicationContext.xml setup. 
 
Thanks,
 
Ron 

Re: AbstractCXFSpring Test in Eclipse

Posted by Daniel Kulp <dk...@apache.org>.
On Fri February 20 2009 1:07:07 pm Ron Grimes wrote:
> Sorry if this has been asked/answered before, but I couldn't find it.
> Does anyone have an example of how to run an AbstractCXFSpringTest in
> Eclipse? I would like to see both the test class and
> ApplicationContext.xml setup.

The CXF system tests use this in a  bunch of places.    For example, a simple 
one:
public class Cxf1332Test extends AbstractCXFSpringTest {

    /**
     * @throws Exception
     */
    public Cxf1332Test() throws Exception {
    }

    @Test
    public void tryToSendStringArray() throws Exception {
        Cxf1332 client = getBean(Cxf1332.class, "client");
        String[] a = new String[] {"a", "b", "c"};
        client.hostSendData(a);
        assertArrayEquals(a, Cxf1332Impl.getLastStrings());
    }
    
    /** {@inheritDoc}*/
    @Override
    protected String[] getConfigLocations() {
        return new String[] {"classpath:/org/apache/cxf/cxf1332/beans.xml" };
    }
}

and the beans.xml:
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:jaxws="http://cxf.apache.org/jaxws" 
xmlns:cxf="http://cxf.apache.org/core" 
xsi:schemaLocation=" 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 
<import resource="classpath:META-INF/cxf/cxf.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" /> 

    <bean id="logInbound" 
class="org.apache.cxf.interceptor.LoggingInInterceptor"/> 
    <bean id="logOutbound" 
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> 
    
    <cxf:bus> 
        <cxf:inInterceptors> <ref bean="logInbound"/> </cxf:inInterceptors> 
        <cxf:outInterceptors> <ref bean="logOutbound"/> </cxf:outInterceptors> 
        <cxf:inFaultInterceptors> <ref bean="logOutbound"/> 
</cxf:inFaultInterceptors> 
    </cxf:bus> 
    <jaxws:endpoint id="cxf1332" 
implementor="org.apache.cxf.cxf1332.Cxf1332Impl" 
                    address="http://localhost:8088/Cxf1332" /> 
    
    <bean id="proxyFactory" 
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
       <property name="serviceClass" value="org.apache.cxf.cxf1332.Cxf1332"/>
       <property name="address" value="http://localhost:8088/Cxf1332"/>
  </bean>

  <bean id="client" class="org.apache.cxf.cxf1332.Cxf1332"
    factory-bean="proxyFactory" factory-method="create"/>
    
    
</beans> 




-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog