⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servicecomponenttest.java

📁 Xfire文件 用于开发web service 的一个开源工具 很好用的
💻 JAVA
字号:
package org.codehaus.xfire.spring;/** * @author Arjen Poutsma */import java.util.List;import org.codehaus.xfire.handler.AbstractHandler;import org.codehaus.xfire.handler.HandlerPipeline;import org.codehaus.xfire.handler.Phase;import org.codehaus.xfire.service.Service;import org.codehaus.xfire.service.ServiceRegistry;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class ServiceComponentTest        extends AbstractXFireSpringTest{    public void testSpringIntegration()            throws Exception    {        ApplicationContext appContext = getContext();                assertNotNull(appContext.getBean("xfire.serviceFactory"));        assertNotNull(appContext.getBean("echo"));                ServiceBean service = (ServiceBean) appContext.getBean("echoService");        assertNotNull(service);                assertNotNull(service.getXFireService());                ServiceRegistry reg = (ServiceRegistry) appContext.getBean("xfire.serviceRegistry");        assertTrue(reg.hasService(service.getXFireService().getSimpleName()));                assertNotNull(service.getInHandlers());    }        public void testPhasePropertyOfHandlers() throws Exception     {        AbstractHandler unchangedHandler = (AbstractHandler) getContext().getBean("addressingHandler");        assertEquals("pre-dispatch",unchangedHandler.getPhase());                AbstractHandler handler = (AbstractHandler) getContext().getBean("changedPhaseHandler");        assertEquals("pre-invoke",handler.getPhase());            }    public void testNoIntf()            throws Exception    {        ServiceBean service = (ServiceBean) getContext().getBean("echoService");        assertNotNull(service);        assertEquals("Echo", service.getXFireService().getSimpleName());    }        public void testHandlerOrderingBefore() throws Exception    {        ServiceBean service = (ServiceBean) getContext().getBean("firstBeforeSecond");        AbstractHandler testHandler = (AbstractHandler) getContext().getBean("firstHandler");        AbstractHandler testHandler2 = (AbstractHandler) getContext().getBean("secondHandler");        HandlerPipeline pipeline = new HandlerPipeline(getXFire().getInPhases());        pipeline.addHandlers(service.getInHandlers());        List inHandlers = pipeline.getPhaseHandlers(Phase.USER).getHandlers();        int firstPos = inHandlers.indexOf(testHandler);        int secondPos = inHandlers.indexOf(testHandler2);        assertTrue(firstPos != -1);        assertTrue(secondPos != -1);        assertTrue(firstPos < secondPos);    }    public void testHandlerOrderingAfter() throws Exception    {        ServiceBean service = (ServiceBean) getContext().getBean("firstAfterSecond");        AbstractHandler testHandler = (AbstractHandler) getContext().getBean("firstHandler2");        AbstractHandler testHandler2 = (AbstractHandler) getContext().getBean("secondHandler2");        HandlerPipeline pipeline = new HandlerPipeline(getXFire().getInPhases());        pipeline.addHandlers(service.getInHandlers());        List inHandlers = pipeline.getPhaseHandlers(Phase.USER).getHandlers();        int firstPos = inHandlers.indexOf(testHandler);        int secondPos = inHandlers.indexOf(testHandler2);        assertTrue(firstPos != -1);        assertTrue(secondPos != -1);        assertTrue(firstPos > secondPos);    }        public void testNondefaultBinding() throws Exception    {    		ServiceBean service = (ServiceBean) getContext().getBean("echoNondefaultBind");        assertNotNull(service);        Service endpoint = service.getXfire().getServiceRegistry().getService("EchoBind");         //There should be no bindings, none specified and no default created        assertEquals(0, endpoint.getBindings().size());    }        protected ApplicationContext createContext()    {        return new ClassPathXmlApplicationContext(new String[]{                "/org/codehaus/xfire/spring/xfire.xml",                "/org/codehaus/xfire/spring/serviceBean.xml"});    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -