Search in sources :

Example 1 with CompositeFactory

use of org.apache.felix.ipojo.composite.CompositeFactory in project felix by apache.

the class CompositeComponentType method createFactory.

/**
 * Creates the component factory.
 */
private void createFactory() {
    ensureValidity();
    m_metadata = generateComponentMetadata();
    try {
        m_factory = new CompositeFactory(m_context, m_metadata);
        m_factory.start();
    } catch (ConfigurationException e) {
        throw new IllegalStateException("An exception occurs during factory initialization", e);
    }
}
Also used : CompositeFactory(org.apache.felix.ipojo.composite.CompositeFactory) ConfigurationException(org.apache.felix.ipojo.ConfigurationException)

Example 2 with CompositeFactory

use of org.apache.felix.ipojo.composite.CompositeFactory in project felix by apache.

the class TestInstanceScope method testScopeUnvailability.

@Test
public void testScopeUnvailability() {
    CompositeFactory factory2 = (CompositeFactory) ipojoHelper.getFactory("SCOPE-badscope");
    assertNotNull("Factory", factory2);
    ComponentInstance instance2 = null;
    try {
        instance2 = factory2.createComponentInstance(null);
    } catch (Exception e) {
        fail("Fail instantiation : " + e.getMessage());
    }
    // System.out.println(instance2.getInstanceDescription().getDescription());
    assertEquals("Check invalidity", ComponentInstance.INVALID, instance2.getState());
    instance2.dispose();
}
Also used : CompositeFactory(org.apache.felix.ipojo.composite.CompositeFactory) ComponentInstance(org.apache.felix.ipojo.ComponentInstance) Test(org.junit.Test)

Aggregations

CompositeFactory (org.apache.felix.ipojo.composite.CompositeFactory)2 ComponentInstance (org.apache.felix.ipojo.ComponentInstance)1 ConfigurationException (org.apache.felix.ipojo.ConfigurationException)1 Test (org.junit.Test)1