use of uk.gov.justice.subscription.domain.SubscriptionDescriptor 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());
}
use of uk.gov.justice.subscription.domain.SubscriptionDescriptor in project microservice_framework by CJSCommonPlatform.
the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsClass.
@Test
public void shouldCreateJmsClass() throws Exception {
SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:structure.controller.command", "my-context.events.something-happened", serviceName, componentName);
generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties));
File packageDir = new File(outputFolder.getRoot().getAbsolutePath() + BASE_PACKAGE_FOLDER);
assertThat(asList(packageDir.listFiles()), hasItem(hasProperty("name", equalTo("ContextEventProcessorStructureControllerCommandJmsListener.java"))));
}
use of uk.gov.justice.subscription.domain.SubscriptionDescriptor in project microservice_framework by CJSCommonPlatform.
the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsEndpointImplementingMessageListener.
@Test
public void shouldCreateJmsEndpointImplementingMessageListener() throws Exception {
SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:somecontext.controller.command", "somecontext.command1", serviceName, componentName);
generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties));
Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "ContextEventProcessorSomecontextControllerCommandJmsListener");
assertThat(clazz.getInterfaces().length, equalTo(1));
assertThat(clazz.getInterfaces()[0], equalTo(MessageListener.class));
}
use of uk.gov.justice.subscription.domain.SubscriptionDescriptor in project microservice_framework by CJSCommonPlatform.
the class SubscriptionJmsEndpointGeneratorTest method shouldCreateJmsEndpointWithAnnotatedInterceptorChainProcessorProperty.
@Test
public void shouldCreateJmsEndpointWithAnnotatedInterceptorChainProcessorProperty() throws Exception {
SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:topic:somecontext.controller.command", "somecontext.command1", serviceName, componentName);
generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties));
Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "ContextEventProcessorSomecontextControllerCommandJmsListener");
Field chainProcessField = clazz.getDeclaredField(INTERCEPTOR_CHAIN_PROCESSOR);
assertThat(chainProcessField, not(nullValue()));
assertThat(chainProcessField.getType(), CoreMatchers.equalTo((InterceptorChainProcessor.class)));
assertThat(chainProcessField.getAnnotations(), arrayWithSize(1));
assertThat(chainProcessField.getAnnotation(Inject.class), not(nullValue()));
}
use of uk.gov.justice.subscription.domain.SubscriptionDescriptor in project microservice_framework by CJSCommonPlatform.
the class SubscriptionJmsEndpointGeneratorTest method shouldCreateAnnotatedControllerCommandEndpointWithQueueAsDestinationType.
@Test
public void shouldCreateAnnotatedControllerCommandEndpointWithQueueAsDestinationType() throws Exception {
SubscriptionDescriptor subscriptionDescriptor = setUpMessageSubscription("jms:queue:structure.something", "structure.abc", "people", "COMMAND_CONTROLLER");
generator.run(subscriptionDescriptor, configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties));
Class<?> clazz = compiler.compiledClassOf(BASE_PACKAGE, "PeopleCommandControllerStructureSomethingJmsListener");
assertThat(clazz.getAnnotation(MessageDriven.class), is(notNullValue()));
assertThat(clazz.getAnnotation(MessageDriven.class).activationConfig(), hasItemInArray(allOf(propertyName(equalTo("destinationType")), propertyValue(equalTo("javax.jms.Queue")))));
}
Aggregations