package org.codehaus.xfire.transport.http;

import org.codehaus.xfire.addressing.AddressingInHandler;
import org.codehaus.xfire.addressing.AddressingOutHandler;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.ServiceRegistry;
import org.codehaus.xfire.test.AbstractServletTest;

import com.meterware.httpunit.HttpNotFoundException;

public class XFireConfigurableServletNewTest
    extends AbstractServletTest
{
    public void testServlet()
        throws Exception
    {
        try
        {
            newClient().getResponse("http://localhost/services/");
        }
        catch(HttpNotFoundException e) {}
        
        ServiceRegistry reg = getXFire().getServiceRegistry();

        assertTrue(reg.hasService("Echo"));
        Service echo = reg.getService("Echo");
        assertNotNull(echo.getName());
        assertNotSame("", echo.getName().getNamespaceURI());
        
        assertTrue(reg.hasService("Echo1"));
        Service echo1 = reg.getService("Echo1");
        assertNotNull(echo1.getBinding(SoapHttpTransport.SOAP12_HTTP_BINDING));

        assertEquals(2, echo1.getInHandlers().size());

        assertTrue(echo1.getInHandlers().get(1) instanceof AddressingInHandler);
        assertEquals(2, echo1.getOutHandlers().size());
        assertTrue(echo1.getOutHandlers().get(1) instanceof AddressingOutHandler);  
        
        assertEquals(2, getXFire().getInHandlers().size());
    }

    protected String getConfiguration()
    {
        return "/org/codehaus/xfire/transport/http/configurable-web.xml";
    }

}
package org.codehaus.xfire.transport.http;

import org.codehaus.xfire.addressing.AddressingInHandler;
import org.codehaus.xfire.addressing.AddressingOutHandler;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.ServiceRegistry;
import org.codehaus.xfire.test.AbstractServletTest;

import com.meterware.httpunit.HttpNotFoundException;

public class XFireConfigurableServletNewTest
    extends AbstractServletTest
{
    public void testServlet()
        throws Exception
    {
        try
        {
            newClient().getResponse("http://localhost/services/");
        }
        catch(HttpNotFoundException e) {}
        
        ServiceRegistry reg = getXFire().getServiceRegistry();

        assertTrue(reg.hasService("Echo"));
        Service echo = reg.getService("Echo");
        assertNotNull(echo.getName());
        assertNotSame("", echo.getName().getNamespaceURI());
        
        assertTrue(reg.hasService("Echo1"));
        Service echo1 = reg.getService("Echo1");
        assertNotNull(echo1.getBinding(SoapHttpTransport.SOAP12_HTTP_BINDING));

        assertEquals(3, echo1.getInHandlers().size());
        assertTrue(echo1.getInHandlers().get(2) instanceof AddressingInHandler);
        assertEquals(2, echo1.getOutHandlers().size());
        assertTrue(echo1.getOutHandlers().get(1) instanceof AddressingOutHandler);   
        
        assertEquals(2, getXFire().getInHandlers().size());
    }

    protected String getConfiguration()
    {
        return "/org/codehaus/xfire/transport/http/configurable-web.xml";
    }

}
Fix test.We have new default handler, so handlers list size must updated.
Fix test.We have new default handler, so handlers list size must updated.

git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@1808 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba
