Package org.mule.module.cxf.support

Source Code of org.mule.module.cxf.support.ProxyServiceConfigurationTestCase

/*
* $Id: ProxyServiceConfigurationTestCase.java 19383 2010-09-06 20:37:51Z epere4 $
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/

package org.mule.module.cxf.support;

import org.mule.MuleServer;
import org.mule.tck.AbstractMuleTestCase;
import org.mule.util.ExceptionUtils;

import java.net.URL;

import org.apache.cxf.service.factory.ServiceConstructionException;

public class ProxyServiceConfigurationTestCase extends AbstractMuleTestCase
{
    public void testGetEndpointName_CorrectNameSpace()
    {
        String configFilePath = "/org/mule/module/cxf/support/test-proxy-mule-config-correct-namespace.xml";
        startServer(configFilePath);
    }

    public void testGetEndpointName_NoNameSpace()
    {
        String configFilePath = "/org/mule/module/cxf/support/test-proxy-mule-config-no-namespace.xml";
        try
        {
            startServer(configFilePath);
            fail("It should have failed because no namespace was specified");
        }
        catch (RuntimeException e)
        {
            Throwable rootCause = ExceptionUtils.getRootCause(e);
            assertTrue("Exception must be of type " + ServiceConstructionException.class + ", instead of "
                       + rootCause, rootCause instanceof ServiceConstructionException);
        }
    }

    private void startServer(String configFilePath)
    {
        URL configURL = this.getClass().getResource(configFilePath);
        MuleServer muleServer = new MuleServer(configURL.toString())
        {
            @Override
            public void shutdown(Throwable e)
            {
                throw new RuntimeException(e);
            }
        };
        muleServer.start(false, false);
    }

}
TOP

Related Classes of org.mule.module.cxf.support.ProxyServiceConfigurationTestCase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.