Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.Service


        Assert.assertEquals(1, composite.getReferences().size());
    }

    public void testServiceInterfaces() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service1 = getService("foo", Foo.class);
        composite.register(service1);
        Service service2 = getService("bar", Bar.class);
        composite.register(service2);

        List<Class<?>> interfaces = composite.getServiceInterfaces();
        assertEquals(2, interfaces.size());
        for (Class o : interfaces) {
View Full Code Here


        }
    }

    public void testGetServiceInstanceByName() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service = createMock(Service.class);
        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
        service.getName();
        expectLastCall().andReturn("foo").anyTimes();
        service.getInterface();
        expectLastCall().andReturn(Foo.class);
        service.getServiceInstance();
        expectLastCall().andReturn(new Foo() {
        });
        replay(service);
        composite.register(service);
        assertNotNull(composite.getServiceInstance("foo"));
View Full Code Here

        assertNotNull(composite.getServiceInstance("foo"));
    }

    public void testGetServiceInstanceNotFound() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service = getService("foo", Foo.class);
        composite.register(service);
        try {
            composite.getServiceInstance("bar");
            fail();
        } catch (TargetNotFoundException e) {
View Full Code Here

        replay(reference);
        return reference;
    }

    private Service getService(String name, Class<?> interfaze) {
        Service service = createMock(Service.class);
        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
        service.getName();
        expectLastCall().andReturn(name).anyTimes();
        service.getInterface();
        expectLastCall().andReturn(interfaze).atLeastOnce();
        replay(service);
        return service;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.component.Service

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.