Examples of Architecture


Examples of org.apache.felix.ipojo.architecture.Architecture

        ipojoHelper.createComponentInstance(factName, compName);

        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
        assertNotNull("Architecture not available", arch_ref);

        Architecture arch = (Architecture) osgiHelper.getRawServiceObject(arch_ref);
        InstanceDescription id = arch.getInstanceDescription();

        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooBarProviderType1");

        HandlerDescription[] handlers = id.getHandlers();
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

        ipojoHelper.createComponentInstance(factName, compName);

        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
        assertNotNull("Architecture not available", arch_ref);

        Architecture arch = (Architecture) osgiHelper.getRawServiceObject(arch_ref);
        InstanceDescription id = arch.getInstanceDescription();

        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooProviderType1");

        HandlerDescription[] handlers = id.getHandlers();
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

    }

    @Test
    public void testArchitectureForInstance1() {

        Architecture arch = osgiHelper.getServiceObject(Architecture.class,
                "(architecture.instance=instance)");
        assertNotNull(arch);

        // Test on String representation.
        String desc = arch.getInstanceDescription().getDescription().toString();
        assertTrue(desc.contains("managed.service.pid=\"FooProvider-3\""));

        // Test on handler description
        ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties");
        assertNotNull(hd);

        assertEquals(2, hd.getProperties().length);
        assertEquals("FooProvider-3", hd.getManagedServicePid());

        // Check the getInstance() method
        assertSame(arch.getInstanceDescription().getInstance(), instance1);

    }
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

    }

    @Test
    public void testArchitectureForInstance2() {
        Architecture arch = osgiHelper.getServiceObject(Architecture.class, "(architecture.instance=instance-2)");
        assertNotNull(arch);

        // Test on String representation.
        String desc = arch.getInstanceDescription().getDescription().toString();
        assertTrue(desc.contains("managed.service.pid=\"instance\""));

        // Test on handler description
        ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties");
        assertNotNull(hd);

        assertEquals(2, hd.getProperties().length);
        assertEquals("instance", hd.getManagedServicePid());

        // Check the getInstance() method
        assertSame(arch.getInstanceDescription().getInstance(), instance2);

    }
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

     */
    @Test
    public void testArchitectureServiceAvailability() {
        String instanceName = instance1.getInstanceName();
        // Check architecture of instance1
        Architecture arch = ipojoHelper.getArchitectureByName(instanceName);
        assertNotNull(arch);
        assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState());

        // We stop the instance
        instance1.stop();
        arch = ipojoHelper.getArchitectureByName(instanceName);
        assertNotNull(arch);
        assertEquals(ComponentInstance.STOPPED, arch.getInstanceDescription().getState());

        // Restart.
        instance1.start();
        arch = ipojoHelper.getArchitectureByName(instanceName);
        assertNotNull(arch);
        assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState());

        // Disposal
        instance1.dispose();
        arch = ipojoHelper.getArchitectureByName(instanceName);
        assertNull(arch);
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

        osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=c)", 10000);
        osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=d)", 10000);

        Object[] arch = osgiHelper.getServiceObjects(Architecture.class.getName(), null);
        for (Object o : arch) {
            Architecture a = (Architecture) o;
            if (a.getInstanceDescription().getState() != ComponentInstance.VALID) {
                Assert.fail("Instance " + a.getInstanceDescription().getName() + " not valid : " + a.getInstanceDescription().getDescription());
            }
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

        osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=d)", 10000);
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "d");
        Assert.assertNotNull(ref);

        Architecture arch = (Architecture) osgiHelper.getRawServiceObject(ref);

        System.out.println(arch.getInstanceDescription().getDescription());

        Assert.assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState());
        DependencyDescription dd = getDependency(arch, "org.apache.felix.ipojo.runtime.core.components.inheritance.b.IB");

        Assert.assertTrue(!dd.getServiceReferences().isEmpty());

        ServiceReference dref = (ServiceReference) dd.getServiceReferences().get(0);
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

        } catch (Exception e) {
            fail("Cannot instantiate under : " + e.getMessage());
        }
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under");
        assertNotNull("Check architecture availability", ref);
        Architecture arch = (Architecture) getContext().getService(ref);
        CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();

        assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
        InstanceDescription[] contained = id.getContainedInstances();
        assertEquals("Check contained instances count", contained.length, 1);
        assertEquals("Check instance name", id.getName(), "under");
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

            fail("Cannot instantiate under : " + e.getMessage());
        }
        ServiceReference ref = osgiHelper.getServiceReference(Architecture.class.getName(),
                "(architecture.instance=under)");
        assertNotNull("Check architecture availability", ref);
        Architecture arch = (Architecture) getContext().getService(ref);
        CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();

        assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
        InstanceDescription[] contained = id.getContainedInstances();
        assertEquals("Check contained instances count (" + contained.length + ")", contained.length, 1);
        assertEquals("Check instance name", id.getName(), "under");
View Full Code Here

Examples of org.apache.felix.ipojo.architecture.Architecture

      fail("Cannot instantiate under : " + e.getMessage());
    }
   
    ServiceReference ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under");
    assertNotNull("Check architecture availability", ref);
    Architecture arch = (Architecture) getContext().getService(ref);
    assertNotNull("Check architecture", arch);
        CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();
    assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
    InstanceDescription[] contained = id.getContainedInstances();
    assertNotNull("Check contained not null", contained);
    assertEquals("Check contained instances count ("+contained.length+") - 1", contained.length, 1);
    assertEquals("Check instance name" , id.getName(), "under");
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.