use of org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding in project felix by apache.
the class AbsBindingModuleTestCase method testIgnoreBindings.
public void testIgnoreBindings() throws Exception {
AbsBindingModule module = new AbsBindingModule() {
public void configure() {
bindIgnore(Bound.class);
}
};
module.configure();
Iterator<Binding> i = module.iterator();
Binding one = i.next();
assertEquals(getType(Bound.class), one.getAnnotationType());
assertTrue(one instanceof NullBinding);
}
use of org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding in project felix by apache.
the class AbsBindingModuleTestCase method testHandlerBindings.
public void testHandlerBindings() throws Exception {
AbsBindingModule module = new AbsBindingModule() {
public void configure() {
bindHandlerBinding(Bound.class).to("com.acme", "foo");
}
};
module.configure();
Iterator<Binding> i = module.iterator();
Binding one = i.next();
assertNotNull(one);
assertEquals(getType(Bound.class), one.getAnnotationType());
assertTrue(one.getFactory() instanceof GenericVisitorFactory);
}
use of org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding in project felix by apache.
the class AbsBindingModuleTestCase method testTwoBindings.
public void testTwoBindings() throws Exception {
final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class);
AbsBindingModule module = new AbsBindingModule() {
public void configure() {
bind(Provides.class).to(factory);
bind(Requires.class).to(factory);
}
};
module.configure();
Iterator<Binding> i = module.iterator();
Binding one = i.next();
assertNotNull(one);
assertEquals(getType(Provides.class), one.getAnnotationType());
assertEquals(factory, one.getFactory());
// Second Binding
Binding two = i.next();
assertNotNull(two);
assertEquals(getType(Requires.class), two.getAnnotationType());
assertEquals(factory, two.getFactory());
}
Aggregations