Search in sources :

Example 11 with ProcessAnnotatedType

use of javax.enterprise.inject.spi.ProcessAnnotatedType in project kie-wb-common by kiegroup.

the class ControllerExtensionTest method testEmbeddedAnnotationWithEmbeddedController.

@Test
public void testEmbeddedAnnotationWithEmbeddedController() {
    final ProcessAnnotatedType annotatedType = createAnnotatedType(KieServerEmbeddedControllerProducer.class);
    extension.processEmbeddedController(annotatedType);
    verify(annotatedType, never()).veto();
}
Also used : ProcessAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType) Test(org.junit.Test)

Example 12 with ProcessAnnotatedType

use of javax.enterprise.inject.spi.ProcessAnnotatedType in project kie-wb-common by kiegroup.

the class ControllerExtensionTest method testEmbeddedAnnotationWithStandaloneController.

@Test
public void testEmbeddedAnnotationWithStandaloneController() {
    ControllerUtils.getConfigProps().put(KIE_SERVER_CONTROLLER, "http://localhost:8080/controller");
    final ProcessAnnotatedType annotatedType = createAnnotatedType(KieServerEmbeddedControllerProducer.class);
    extension.processEmbeddedController(annotatedType);
    verify(annotatedType).veto();
}
Also used : ProcessAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType) Test(org.junit.Test)

Example 13 with ProcessAnnotatedType

use of javax.enterprise.inject.spi.ProcessAnnotatedType in project deltaspike by apache.

the class InterDynExtension method processAnnotatedType.

public void processAnnotatedType(@Observes ProcessAnnotatedType pat) {
    if (enabled) {
        AnnotatedType at = pat.getAnnotatedType();
        String beanClassName = at.getJavaClass().getName();
        AnnotatedTypeBuilder atb = null;
        for (AnnotationRule rule : interceptorRules) {
            if (beanClassName.matches(rule.getRule())) {
                if (rule.requiresProxy() && !ClassUtils.isProxyableClass(at.getJavaClass())) {
                    logger.info("Skipping unproxyable class " + beanClassName + " even if matches rule=" + rule.getRule());
                    return;
                }
                if (atb == null) {
                    atb = new AnnotatedTypeBuilder();
                    atb.readFromType(at);
                }
                atb.addToClass(rule.getAdditionalAnnotation());
                logger.info("Adding Dynamic Interceptor " + rule.getAdditionalAnnotation() + " to class " + beanClassName);
            }
        }
        if (atb != null) {
            pat.setAnnotatedType(atb.create());
        }
    }
}
Also used : ProcessAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType) AnnotatedType(javax.enterprise.inject.spi.AnnotatedType) AnnotatedTypeBuilder(org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder)

Aggregations

ProcessAnnotatedType (javax.enterprise.inject.spi.ProcessAnnotatedType)13 Test (org.junit.Test)8 AnnotatedType (javax.enterprise.inject.spi.AnnotatedType)3 Extension (javax.enterprise.inject.spi.Extension)3 ParameterizedType (java.lang.reflect.ParameterizedType)2 Type (java.lang.reflect.Type)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 RequestScoped (javax.enterprise.context.RequestScoped)2 AfterBeanDiscovery (javax.enterprise.inject.spi.AfterBeanDiscovery)2 AfterDeploymentValidation (javax.enterprise.inject.spi.AfterDeploymentValidation)2 AfterTypeDiscovery (javax.enterprise.inject.spi.AfterTypeDiscovery)2 BeforeBeanDiscovery (javax.enterprise.inject.spi.BeforeBeanDiscovery)2 BeforeShutdown (javax.enterprise.inject.spi.BeforeShutdown)2 ProcessBean (javax.enterprise.inject.spi.ProcessBean)2 ProcessBeanAttributes (javax.enterprise.inject.spi.ProcessBeanAttributes)2 ProcessInjectionPoint (javax.enterprise.inject.spi.ProcessInjectionPoint)2 ProcessManagedBean (javax.enterprise.inject.spi.ProcessManagedBean)2 ProcessObserverMethod (javax.enterprise.inject.spi.ProcessObserverMethod)2