use of org.apache.felix.ipojo.Factory in project felix by apache.
the class TestUnacceptableConfiguration method testUnicity1.
/**
* Check instance name unicity.
*/
@Test
public void testUnicity1() {
Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2");
ComponentInstance ci1, ci2, ci3;
try {
ci1 = f.createComponentInstance(null);
ci2 = f.createComponentInstance(null);
ci3 = f.createComponentInstance(null);
assertThat("Check name ci1, ci2", ci1.getInstanceName(), not(ci2.getInstanceName()));
assertThat("Check name ci1, ci3", ci1.getInstanceName(), not(ci3.getInstanceName()));
assertThat("Check name ci3, ci2", ci3.getInstanceName(), not(ci2.getInstanceName()));
ci1.dispose();
ci2.dispose();
ci3.dispose();
} catch (Exception e) {
fail("An acceptable configuration is refused");
}
}
use of org.apache.felix.ipojo.Factory in project felix by apache.
the class TestUnacceptableConfiguration method testStaticOK.
/**
* Check static properties.
*/
@Test
public void testStaticOK() {
Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2");
Properties p = new Properties();
p.put("instance.name", "ok");
p.put("int", 3);
p.put("long", 42l);
p.put("string", "absdir");
p.put("strAProp", new String[] { "a" });
p.put("intAProp", new int[] { 1, 2 });
ComponentInstance ci;
try {
ci = f.createComponentInstance(p);
ci.dispose();
} catch (Exception e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
}
}
use of org.apache.felix.ipojo.Factory in project felix by apache.
the class TestUnacceptableConfiguration method testDynamicMore.
/**
* Check good configuration (more properties).
*/
@Test
public void testDynamicMore() {
Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name", "ok");
p.put("int", 3);
p.put("boolean", true);
p.put("string", "absdir");
p.put("strAProp", new String[] { "a" });
p.put("intAProp", new int[] { 1, 2 });
p.put("tralala", "foo");
ComponentInstance ci;
try {
ci = f.createComponentInstance(p);
ci.dispose();
} catch (Exception e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
}
}
use of org.apache.felix.ipojo.Factory in project felix by apache.
the class TestUnacceptableConfiguration method testEmptyConfiguration.
/**
* Empty configuration.
*/
@Test
public void testEmptyConfiguration() {
Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2");
Properties p = new Properties();
ComponentInstance ci;
try {
ci = f.createComponentInstance(p);
ci.dispose();
} catch (Exception e) {
fail("An acceptable configuration is refused");
}
}
use of org.apache.felix.ipojo.Factory in project felix by apache.
the class TestUnacceptableConfiguration method testNullOpt.
/**
* Null configuration (accept).
*/
@Test
public void testNullOpt() {
Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2opt");
ComponentInstance ci;
try {
ci = f.createComponentInstance(null);
ci.dispose();
} catch (Exception e) {
fail("An acceptable configuration is refused");
}
}
Aggregations