Package com.alibaba.citrus.util.internal

Examples of com.alibaba.citrus.util.internal.InterfaceImplementorBuilder


    /**
     * httpunit未实现getResourcePaths方法。
     * 以下实现可在servlet 2.5/3.0上执行。
     */
    private static ServletContext createServletContextWrapper(final ServletContext servletContext) {
        return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() {
            public URL getResource(String path) throws MalformedURLException {
                URL presetResult = nextGetResourceURL.get();

                if (presetResult != null) {
                    return presetResult;
View Full Code Here


            this.itfs = itfs;
        }

        @Override
        public Object getObject() throws Exception {
            return new InterfaceImplementorBuilder().setSuperclass(object.getClass()).addInterface(itfs).toObject(object);
        }
View Full Code Here

    /**
     * httpunit未实现getResourcePaths方法。
     * 以下实现可在servlet 2.5/3.0上执行。
     */
    private static ServletContext createServletContextWrapper(final ServletContext servletContext) {
        return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() {
            public Set<String> getResourcePaths(String path) {
                try {
                    URL baseURL = servletContext.getResource(path);
                    File basedir = null;

View Full Code Here

        assertNotNull(engine);
    }

    protected ServletContext createServletContextWrapper(final boolean supportGetResourceOfRoot) {
        return (ServletContext) new InterfaceImplementorBuilder().addInterface(ServletContext.class).toObject(new Object() {
            /** 判断当resource不存在时,返回null。 */
            public URL getResource(String path) throws MalformedURLException {
                if (("/".equals(path) || isEmpty(path)) && !supportGetResourceOfRoot) {
                    return null;
                }
View Full Code Here

        HttpServletRequest mockRequest = createMock(HttpServletRequest.class);

        // request
        attrs = createHashMap();

        request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() {
            public Locale getLocale() {
                return Locale.CHINA;
            }

            public HttpSession getSession(boolean create) {
View Full Code Here

            requestContext.prepare();
            expectLastCall().once();
            replay(requestContext);

            if (overrider != null) {
                return (RequestContext) new InterfaceImplementorBuilder()
                        .addInterface(requestContext.getClass().getInterfaces())
                        .toObject(overrider, requestContext);
            } else {
                return requestContext;
            }
View Full Code Here

        HttpServletRequest mockRequest = createMock(HttpServletRequest.class);

        // request
        attrs = createHashMap();

        request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() {
            public Object getAttribute(String name) {
                return attrs.get(name);
            }

            public void setAttribute(String name, Object o) {
View Full Code Here

        expect(requestMock.getHeader("Referer")).andReturn("http://localhost:8080/").once();
        expect(requestMock.getCookies()).andReturn(new Cookie[0]).once();

        replay(requestMock, response, servletContext);

        request = (HttpServletRequest) new InterfaceImplementorBuilder().addInterface(HttpServletRequest.class).toObject(new Object() {
            public Object getAttribute(String name) {
                return requestAttrs.get(name);
            }

            public void setAttribute(String name, Object o) {
View Full Code Here

    private Map<String, Object> attrs = createHashMap();

    @Before
    public void init() {
        valve = new MyInputOutputValve();
        context = (PipelineContext) new InterfaceImplementorBuilder().addInterface(PipelineContext.class).toObject(new Object() {
            public Object getAttribute(String key) {
                return attrs.get(key);
            }

            public void setAttribute(String key, Object value) {
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.internal.InterfaceImplementorBuilder

Copyright © 2018 www.massapicom. 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.