Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.ScopeContainer.register()


    private ScopeContainer createMock() {
        ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
        scope.start();
        scope.stop();
        scope.register(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().atLeastOnce();
        EasyMock.expect(scope.getScope()).andReturn(Scope.MODULE).atLeastOnce();
        scope.getInstance(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
View Full Code Here


    private ScopeContainer createMock() {
        ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
        scope.start();
        scope.stop();
        scope.register(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().atLeastOnce();
        EasyMock.expect(scope.getScope()).andReturn(Scope.MODULE).atLeastOnce();
        scope.getInstance(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
View Full Code Here

    private ScopeContainer createMock() {
        ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
        scope.start();
        scope.stop();
        scope.register(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().atLeastOnce();
        EasyMock.expect(scope.getScope()).andReturn(Scope.MODULE).atLeastOnce();
        scope.getInstance(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
View Full Code Here

    }

    private ScopeContainer createMock() {
        ScopeContainer container = EasyMock.createMock(ScopeContainer.class);
        container.start();
        container.register(EasyMock.isA(AtomicComponent.class));
        EasyMock.expectLastCall().anyTimes();
        EasyMock.expect(container.getScope()).andReturn(Scope.MODULE).anyTimes();
        EasyMock.expect(container.getInstance(EasyMock.isA(AtomicComponent.class))).andAnswer(new IAnswer<Object>() {
            private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
View Full Code Here

*/
public class GetServiceByNameTestCase extends TestCase {

    public void testServiceLocate() throws Exception {
        ScopeContainer scope = createMock(ScopeContainer.class);
        scope.register(EasyMock.isA(JavaAtomicComponent.class));
        expect(scope.getScope()).andReturn(Scope.MODULE);
        replay(scope);
        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(scope);
        configuration.setInstanceFactory(new PojoObjectFactory<TargetImpl>(TargetImpl.class.getConstructor()));
View Full Code Here

    public void testScopedInvoke() throws Exception {
        ScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        JavaAtomicComponent component =
            MockFactory.createJavaComponent("foo", scope, Echo.class);
        scope.register(component);
        JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component);
        invoker.setCacheable(false);
        assertEquals("foo", invoker.invokeTarget("foo"));
        scope.stop();
    }
View Full Code Here

    public void testClone() throws Exception {
        ScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        JavaAtomicComponent component =
            MockFactory.createJavaComponent("foo", scope, Echo.class);
        scope.register(component);
        JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component);
        invoker.setCacheable(false);
        JavaTargetInvoker clone = invoker.clone();
        assertEquals("foo", clone.invokeTarget("foo"));
        scope.stop();
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.