use of org.apache.felix.dm.ComponentDeclaration in project felix by apache.
the class FELIX4158_DependencyDeclarationTest method testBundleDependencyDeclarationWithFilter.
public void testBundleDependencyDeclarationWithFilter() throws MalformedURLException {
DependencyManager m = getDM();
Component c = m.createComponent().setImplementation(new Object()).add(m.createBundleDependency().setStateMask(Bundle.ACTIVE).setFilter("(DependencyManager-Component=*)"));
ComponentDeclaration cd = c.getComponentDeclaration();
ComponentDependencyDeclaration[] cdds = cd.getComponentDependencies();
Assert.assertNotNull(cdds);
Assert.assertNotNull(cdds.length == 1);
Assert.assertEquals(cdds[0].getName(), "active (DependencyManager-Component=*)");
Assert.assertNotNull(cdds[0].getSimpleName());
Assert.assertEquals(cdds[0].getSimpleName(), "active");
Assert.assertNotNull(cdds[0].getFilter());
Assert.assertEquals(cdds[0].getFilter(), "(DependencyManager-Component=*)");
m.clear();
}
use of org.apache.felix.dm.ComponentDeclaration in project felix by apache.
the class FELIX4158_DependencyDeclarationTest method testBundleDependencyDeclaration.
public void testBundleDependencyDeclaration() throws MalformedURLException {
DependencyManager m = getDM();
Component c = m.createComponent().setImplementation(new Object()).add(m.createBundleDependency());
ComponentDeclaration cd = c.getComponentDeclaration();
ComponentDependencyDeclaration[] cdds = cd.getComponentDependencies();
Assert.assertNotNull(cdds);
Assert.assertNotNull(cdds.length == 1);
Assert.assertEquals(cdds[0].getName(), "active installed resolved");
Assert.assertNotNull(cdds[0].getSimpleName());
Assert.assertEquals(cdds[0].getSimpleName(), "active installed resolved");
Assert.assertNull(cdds[0].getFilter());
m.clear();
}
use of org.apache.felix.dm.ComponentDeclaration in project felix by apache.
the class FELIX4158_DependencyDeclarationTest method testBundleDependencyDeclarationWithMask.
public void testBundleDependencyDeclarationWithMask() throws MalformedURLException {
DependencyManager m = getDM();
Component c = m.createComponent().setImplementation(new Object()).add(m.createBundleDependency().setStateMask(Bundle.ACTIVE | Bundle.RESOLVED));
ComponentDeclaration cd = c.getComponentDeclaration();
ComponentDependencyDeclaration[] cdds = cd.getComponentDependencies();
Assert.assertNotNull(cdds);
Assert.assertNotNull(cdds.length == 1);
Assert.assertEquals(cdds[0].getName(), "active resolved");
Assert.assertNotNull(cdds[0].getSimpleName());
Assert.assertEquals(cdds[0].getSimpleName(), "active resolved");
Assert.assertNull(cdds[0].getFilter());
m.clear();
}
use of org.apache.felix.dm.ComponentDeclaration in project felix by apache.
the class FELIX4158_DependencyDeclarationTest method testServiceDependencyDeclaration.
public void testServiceDependencyDeclaration() {
DependencyManager m = getDM();
Component c = m.createComponent().setImplementation(new Object()).add(m.createServiceDependency().setService(LogService.class, "(foo=bar)"));
ComponentDeclaration cd = c.getComponentDeclaration();
ComponentDependencyDeclaration[] cdds = cd.getComponentDependencies();
Assert.assertNotNull(cdds);
Assert.assertNotNull(cdds.length == 1);
Assert.assertEquals(cdds[0].getName(), "org.osgi.service.log.LogService (foo=bar)");
Assert.assertEquals(cdds[0].getSimpleName(), "org.osgi.service.log.LogService");
Assert.assertNotNull(cdds[0].getFilter());
Assert.assertEquals(cdds[0].getFilter(), "(foo=bar)");
m.clear();
}
use of org.apache.felix.dm.ComponentDeclaration in project felix by apache.
the class FELIX4158_DependencyDeclarationTest method testConfigurationDependencyDeclaration.
public void testConfigurationDependencyDeclaration() {
DependencyManager m = getDM();
Component c = m.createComponent().setImplementation(new Object()).add(m.createConfigurationDependency().setPid("foo"));
ComponentDeclaration cd = c.getComponentDeclaration();
ComponentDependencyDeclaration[] cdds = cd.getComponentDependencies();
Assert.assertNotNull(cdds);
Assert.assertNotNull(cdds.length == 1);
Assert.assertEquals(cdds[0].getName(), "foo");
Assert.assertEquals(cdds[0].getSimpleName(), "foo");
Assert.assertNull(cdds[0].getFilter());
m.clear();
}
Aggregations