Search in sources :

Example 1 with Pool

use of org.jboss.ejb3.annotation.Pool in project microservice_framework by CJSCommonPlatform.

the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsEndpointAnnotatedWithoutPoolConfiguration.

@Test
public void shouldCreateJmsEndpointAnnotatedWithoutPoolConfiguration() throws Exception {
    SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:people.person-added", "people.abc", "people", "EVENT_LISTENER");
    generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties));
    Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "PeopleEventListenerPeoplePersonAddedJmsListener");
    Pool poolAnnotation = clazz.getAnnotation(Pool.class);
    assertThat(poolAnnotation, nullValue());
}
Also used : Pool(org.jboss.ejb3.annotation.Pool) SubscriptionDescriptor(uk.gov.justice.subscription.domain.SubscriptionDescriptor) Test(org.junit.Test)

Example 2 with Pool

use of org.jboss.ejb3.annotation.Pool in project microservice_framework by CJSCommonPlatform.

the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsEndpointAnnotatedWithPoolConfiguration.

@Test
public void shouldCreateJmsEndpointAnnotatedWithPoolConfiguration() throws Exception {
    SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:people.person-added", "people.abc", "people", "EVENT_LISTENER");
    generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, new GeneratorPropertiesFactory().withCustomMDBPool()));
    Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "PeopleEventListenerPeoplePersonAddedJmsListener");
    Pool poolAnnotation = clazz.getAnnotation(Pool.class);
    assertThat(poolAnnotation, not(nullValue()));
    assertThat(poolAnnotation.value(), is("people-person-added-event-listener-pool"));
}
Also used : GeneratorPropertiesFactory(uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory) Pool(org.jboss.ejb3.annotation.Pool) SubscriptionDescriptor(uk.gov.justice.subscription.domain.SubscriptionDescriptor) Test(org.junit.Test)

Example 3 with Pool

use of org.jboss.ejb3.annotation.Pool in project wildfly by wildfly.

the class AbstractPoolMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(DeploymentUnit deploymentUnit, EEApplicationClasses applicationClasses, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, T description) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    // we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<Pool, String> pool = clazz.getAnnotationInformation(Pool.class);
    if (pool == null) {
        return;
    }
    if (!pool.getClassLevelAnnotations().isEmpty()) {
        final String poolName = pool.getClassLevelAnnotations().get(0);
        if (poolName == null || poolName.trim().isEmpty()) {
            throw EjbLogger.ROOT_LOGGER.poolNameCannotBeEmptyString(description.getEJBName());
        }
        this.setPoolName(description, poolName);
    }
}
Also used : Pool(org.jboss.ejb3.annotation.Pool) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Aggregations

Pool (org.jboss.ejb3.annotation.Pool)3 Test (org.junit.Test)2 SubscriptionDescriptor (uk.gov.justice.subscription.domain.SubscriptionDescriptor)2 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 GeneratorPropertiesFactory (uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory)1