Search in sources :

Example 11 with GeneratorPropertiesFactory

use of uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory 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 12 with GeneratorPropertiesFactory

use of uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory in project microservice_framework by CJSCommonPlatform.

the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsEndpointAnnotatedWithControllerCommandAdapter.

@Test
public void shouldCreateJmsEndpointAnnotatedWithControllerCommandAdapter() throws Exception {
    SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:people.some.query", "people.abc", "abc", "COMMAND_CONTROLLER");
    generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, new GeneratorPropertiesFactory().withServiceComponentOf(COMMAND_CONTROLLER)));
    Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "AbcCommandControllerPeopleSomeQueryJmsListener");
    Adapter adapterAnnotation = clazz.getAnnotation(Adapter.class);
    assertThat(adapterAnnotation, not(nullValue()));
    assertThat(adapterAnnotation.value(), is(COMMAND_CONTROLLER));
}
Also used : GeneratorPropertiesFactory(uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory) Adapter(uk.gov.justice.services.core.annotation.Adapter) SubscriptionDescriptor(uk.gov.justice.subscription.domain.SubscriptionDescriptor) Test(org.junit.Test)

Aggregations

GeneratorPropertiesFactory (uk.gov.justice.raml.jms.config.GeneratorPropertiesFactory)12 Test (org.junit.Test)11 SubscriptionDescriptor (uk.gov.justice.subscription.domain.SubscriptionDescriptor)11 Adapter (uk.gov.justice.services.core.annotation.Adapter)5 TypeSpec (com.squareup.javapoet.TypeSpec)3 GeneratorProperties (uk.gov.justice.maven.generator.io.files.parser.core.GeneratorProperties)3 CommonGeneratorProperties (uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties)3 Event (uk.gov.justice.subscription.domain.Event)3 Subscription (uk.gov.justice.subscription.domain.Subscription)3 MessageDriven (javax.ejb.MessageDriven)2 Field (java.lang.reflect.Field)1 ActivationConfigProperty (javax.ejb.ActivationConfigProperty)1 Pool (org.jboss.ejb3.annotation.Pool)1 Before (org.junit.Before)1 JavaCompilerUtil (uk.gov.justice.services.test.utils.core.compiler.JavaCompilerUtil)1 ReflectionUtil.setField (uk.gov.justice.services.test.utils.core.reflection.ReflectionUtil.setField)1