Examples of EntryPointContext


Examples of org.apache.tuscany.core.context.EntryPointContext

        this.tomcatHost = tomcatHost;
        this.wsBinding = wsBinding;
    }

    public EntryPointContext createContext() throws ContextCreationException {
        EntryPointContext epc = super.createContext();
        initServlet(epc);
        return epc;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.MODULE));
        child.publish(new ModuleStart(this));
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        InvocationHandler handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(0, mockInterceptor.getCount());
        Object response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(1, mockInterceptor.getCount());
        Object id2 = new Object();
        child.publish(new RequestStart(this, id2));

        // second request
        Object id3 = new Object();
        child.publish(new RequestStart(this, id3));
        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(1, mockInterceptor.getCount());
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(2, mockInterceptor.getCount());
        HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        Object session = new Object();
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        child.publish(new HttpSessionBound(this, session));

        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        InvocationHandler handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(0, mockInterceptor.getCount());
        Object response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(1, mockInterceptor.getCount());
        child.publish(new RequestEnd(this, id));

        Object id2 = new Object();
        child.publish(new RequestStart(this, id2));
        child.publish(new HttpSessionBound(this, session));
        EntryPointContext ctx2 = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx2);
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(2, mockInterceptor.getCount());
        HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.INSTANCE));
        child.publish(new ModuleStart(this));
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        InvocationHandler handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(0, mockInterceptor.getCount());
        Object response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(1, mockInterceptor.getCount());
        child.publish(new RequestEnd(this, id));

        // second request
        Object id2 = new Object();
        child.publish(new RequestStart(this, id2));
        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(1, mockInterceptor.getCount());
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(2, mockInterceptor.getCount());
        HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.REQUEST));
        child.publish(new ModuleStart(this));
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        InvocationHandler handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(0, mockInterceptor.getCount());
        Object response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(1, mockInterceptor.getCount());

        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        response = handler.invoke(null, hello, new Object[]{"foo"});
        HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
        Assert.assertEquals(2, service1.count());

        child.publish(new RequestEnd(this, id));

        // second request
        Object id2 = new Object();
        child.publish(new RequestStart(this, id2));
        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(2, mockInterceptor.getCount());
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(3, mockInterceptor.getCount());
        HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        this.webAppName = webAppName;
        this.tomcatHost = tomcatHost;
    }

    public EntryPointContext createContext() throws ContextCreationException {
        EntryPointContext epc = super.createContext();
        JSONRPCEntryPointServlet jsonrpcServlet = getServlet();
        jsonrpcServlet.addEntryPoint(epc);
        return epc;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModuleWithEntryPointToExternalService());
        child.publish(new ModuleStart(this));
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        InvocationHandler handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(0, mockInterceptor.getCount());
        Object response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("foo", response);
        Assert.assertEquals(1, mockInterceptor.getCount());

        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("foo", response);
        child.publish(new RequestEnd(this, id));

        // second request
        Object id2 = new Object();
        child.publish(new RequestStart(this, id2));
        ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
        handler = (InvocationHandler) ctx.getHandler();
        Assert.assertEquals(2, mockInterceptor.getCount());
        response = handler.invoke(null, hello, new Object[]{"foo"});
        Assert.assertEquals("foo", response);
        Assert.assertEquals(3, mockInterceptor.getCount());
        child.publish(new RequestEnd(this, id2));
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

            throw new IllegalStateException("Could not determine invoked web method");
        }
        boolean oneWay = method.getReturnType() == null;
        Object output;
        try {
            EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
                    .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
            InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
            output = handler.invoke(null, method, new Object[] { input });
        } catch (UndeclaredThrowableException e) {
            throw e;
        } catch (RuntimeException e) {
            throw e;
View Full Code Here

Examples of org.apache.tuscany.core.context.EntryPointContext

            throw new IllegalStateException("Could not determine invoked web method");
        }
        boolean oneWay = method.getReturnType() == null;
        Object output;
        try {
            EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
                    .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
            InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
            output = handler.invoke(null, method, new Object[] { input });
        } catch (UndeclaredThrowableException e) {
            throw e;
        } catch (RuntimeException e) {
            throw e;
View Full Code Here
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.