public void visitType(
     EagerInit annotation,
     Class<?> type,
     InjectingComponentType componentType,
     IntrospectionContext context) {
   componentType.setInitLevel(50);
 }
Ejemplo n.º 2
0
 public void visitType(
     Domain annotation,
     Class<?> type,
     InjectingComponentType componentType,
     IntrospectionContext context) {
   componentType.setScope(org.fabric3.api.model.type.component.Scope.DOMAIN);
 }
  public void testName() throws Exception {
    Field field = TestClass.class.getDeclaredField("producer2");
    Producer annotation = field.getAnnotation(Producer.class);
    IntrospectionContext context = new DefaultIntrospectionContext();
    TypeMapping mapping = new TypeMapping();
    context.addTypeMapping(TestClass.class, mapping);

    processor.visitField(annotation, field, TestClass.class, componentType, context);
    assertEquals(0, context.getErrors().size());
    assertTrue(componentType.getProducers().containsKey("foo"));
  }
  public void testMethod() throws Exception {
    Method method = TestClass.class.getDeclaredMethod("setProducer", TestProducer.class);
    Producer annotation = method.getAnnotation(Producer.class);
    IntrospectionContext context = new DefaultIntrospectionContext();
    TypeMapping mapping = new TypeMapping();
    context.addTypeMapping(TestClass.class, mapping);

    processor.visitMethod(annotation, method, TestClass.class, componentType, context);
    assertEquals(0, context.getErrors().size());
    assertTrue(componentType.getProducers().containsKey("producer"));
  }