Search in sources :

Example 6 with Binding

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);
}
Also used : NullBinding(org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding) Binding(org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding) NullBinding(org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding)

Example 7 with Binding

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);
}
Also used : NullBinding(org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding) Binding(org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding) GenericVisitorFactory(org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory)

Example 8 with Binding

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());
}
Also used : NullBinding(org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding) Binding(org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding) Requires(org.apache.felix.ipojo.annotations.Requires) Provides(org.apache.felix.ipojo.annotations.Provides)

Aggregations

Binding (org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding)8 NullBinding (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding)8 Provides (org.apache.felix.ipojo.annotations.Provides)5 Requires (org.apache.felix.ipojo.annotations.Requires)1 GenericVisitorFactory (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory)1 StereotypeVisitorFactory (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.stereotype.StereotypeVisitorFactory)1