Package org.apache.tuscany.container.spring.mock

Examples of org.apache.tuscany.container.spring.mock.TestBean


    public void testInvocation() throws Exception {
        AbstractApplicationContext ctx = createSpringContext();
        SpringCompositeComponent parent = new SpringCompositeComponent("spring", ctx, null, null, null);
        parent.start();
        TestBean referenceTarget = new TestBeanImpl();
        Reference reference = createMock(Reference.class);
        expect(reference.getName()).andReturn("bar").anyTimes();
        expect(reference.isSystem()).andReturn(false).atLeastOnce();
        expect(reference.getInterface()).andStubReturn(TestBean.class);
        expect(reference.getServiceInstance()).andStubReturn(referenceTarget);
View Full Code Here


        connector.connect(inboundWire, outboundWire, true);
        for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
            chain.setTargetInvoker(composite.createTargetInvoker("foo", chain.getOperation()));
        }
        composite.register(service);
        TestBean serviceInstance = (TestBean) composite.getService("fooService").getServiceInstance();
        assertEquals("bar", serviceInstance.echo("bar"));
    }
View Full Code Here

        builder.setBuilderRegistry(registry);
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        DeploymentContext context = createNiceMock(DeploymentContext.class);
        SpringCompositeComponent component =
            (SpringCompositeComponent) builder.build(parent, componentDefinition, context);
        TestBean bean = (TestBean) component.getApplicationContext().getBean("foo");
        assertEquals("call foo", bean.echo("call foo"));
    }
View Full Code Here

        builder.setBuilderRegistry(registry);
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        DeploymentContext context = createNiceMock(DeploymentContext.class);
        CompositeComponent component = (CompositeComponent) builder.build(parent, componentDefinition, context);
        Service service = component.getService("fooService");
        TestBean bean = (TestBean) service.getServiceInstance();
        assertEquals("call foo", bean.echo("call foo"));
        verify(registry);
    }
View Full Code Here

    private CompositeContext context;

    public void testDemoBoot() {
        SpringCompositeComponent comp = (SpringCompositeComponent) component.getChild("Spring");
        Service service = (Service) comp.getChild("fooService");
        TestBean bean = (TestBean) service.getServiceInstance();
        bean.echo("foo");
        bean.getBean().echo("foo");
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.container.spring.mock.TestBean

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.