Search in sources :

Example 6 with AbstractMessageChannel

use of org.springframework.integration.channel.AbstractMessageChannel in project spring-integration by spring-projects.

the class JpaMessageHandlerParserTests method testJpaMessageHandlerParser.

@Test
public void testJpaMessageHandlerParser() throws Exception {
    setUp("JpaMessageHandlerParserTests.xml", getClass());
    final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class);
    assertEquals("target", inputChannel.getComponentName());
    final JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.consumer, "handler.jpaExecutor", JpaExecutor.class);
    assertNotNull(jpaExecutor);
    final String query = TestUtils.getPropertyValue(jpaExecutor, "jpaQuery", String.class);
    assertEquals("from Student", query);
    final JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class);
    assertNotNull(jpaOperations);
    final PersistMode persistMode = TestUtils.getPropertyValue(jpaExecutor, "persistMode", PersistMode.class);
    assertEquals(PersistMode.PERSIST, persistMode);
    @SuppressWarnings("unchecked") List<JpaParameter> jpaParameters = TestUtils.getPropertyValue(jpaExecutor, "jpaParameters", List.class);
    assertNotNull(jpaParameters);
    assertTrue(jpaParameters.size() == 3);
    assertEquals(Integer.valueOf(10), TestUtils.getPropertyValue(jpaExecutor, "flushSize", Integer.class));
    assertTrue(TestUtils.getPropertyValue(jpaExecutor, "clearOnFlush", Boolean.class));
}
Also used : PersistMode(org.springframework.integration.jpa.support.PersistMode) JpaParameter(org.springframework.integration.jpa.support.JpaParameter) AbstractMessageChannel(org.springframework.integration.channel.AbstractMessageChannel) JpaExecutor(org.springframework.integration.jpa.core.JpaExecutor) JpaOperations(org.springframework.integration.jpa.core.JpaOperations) Test(org.junit.Test)

Example 7 with AbstractMessageChannel

use of org.springframework.integration.channel.AbstractMessageChannel in project spring-integration by spring-projects.

the class JpaInboundChannelAdapterParserTests method testJpaInboundChannelAdapterParser.

@Test
public void testJpaInboundChannelAdapterParser() throws Exception {
    AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(this.jpaInboundChannelAdapter1, "outputChannel", AbstractMessageChannel.class);
    assertEquals("out", outputChannel.getComponentName());
    JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.jpaInboundChannelAdapter1, "source.jpaExecutor", JpaExecutor.class);
    assertNotNull(jpaExecutor);
    Class<?> entityClass = TestUtils.getPropertyValue(jpaExecutor, "entityClass", Class.class);
    assertEquals("org.springframework.integration.jpa.test.entity.StudentDomain", entityClass.getName());
    JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class);
    assertNotNull(jpaOperations);
    assertTrue(TestUtils.getPropertyValue(jpaExecutor, "expectSingleResult", Boolean.class));
    ParameterSource parameterSource = this.context.getBean(ParameterSource.class);
    assertSame(parameterSource, TestUtils.getPropertyValue(jpaExecutor, "parameterSource"));
}
Also used : AbstractMessageChannel(org.springframework.integration.channel.AbstractMessageChannel) JpaExecutor(org.springframework.integration.jpa.core.JpaExecutor) ParameterSource(org.springframework.integration.jpa.support.parametersource.ParameterSource) JpaOperations(org.springframework.integration.jpa.core.JpaOperations) Test(org.junit.Test)

Example 8 with AbstractMessageChannel

use of org.springframework.integration.channel.AbstractMessageChannel in project spring-integration by spring-projects.

the class IntegrationManagementConfigurerTests method testEmptyAnnotation.

@Test
public void testEmptyAnnotation() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ConfigEmptyAnnotation.class);
    AbstractMessageChannel channel = ctx.getBean("channel", AbstractMessageChannel.class);
    assertTrue(channel.isCountsEnabled());
    assertTrue(channel.isStatsEnabled());
    assertThat(TestUtils.getPropertyValue(channel, "channelMetrics"), instanceOf(DefaultMessageChannelMetrics.class));
    channel = ctx.getBean("loggingOffChannel", AbstractMessageChannel.class);
    assertFalse(channel.isLoggingEnabled());
    ctx.close();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) AbstractMessageChannel(org.springframework.integration.channel.AbstractMessageChannel) Test(org.junit.Test)

Example 9 with AbstractMessageChannel

use of org.springframework.integration.channel.AbstractMessageChannel in project spring-integration by spring-projects.

the class FileInboundChannelAdapterParserTests method channelName.

@Test
public void channelName() throws Exception {
    AbstractMessageChannel channel = context.getBean("inputDirPoller", AbstractMessageChannel.class);
    assertEquals("Channel should be available under specified id", "inputDirPoller", channel.getComponentName());
}
Also used : AbstractMessageChannel(org.springframework.integration.channel.AbstractMessageChannel) Test(org.junit.Test)

Example 10 with AbstractMessageChannel

use of org.springframework.integration.channel.AbstractMessageChannel in project spring-integration by spring-projects.

the class EnableIntegrationTests method testParentChildAnnotationConfiguration.

@Test
public void testParentChildAnnotationConfiguration() {
    AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();
    child.register(ChildConfiguration.class);
    child.setParent(this.context);
    child.refresh();
    AbstractMessageChannel foo = child.getBean("foo", AbstractMessageChannel.class);
    ChannelInterceptor baz = child.getBean("baz", ChannelInterceptor.class);
    assertTrue(foo.getChannelInterceptors().contains(baz));
    assertFalse(this.output.getChannelInterceptors().contains(baz));
    child.close();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) AbstractMessageChannel(org.springframework.integration.channel.AbstractMessageChannel) GlobalChannelInterceptor(org.springframework.integration.config.GlobalChannelInterceptor) ChannelInterceptor(org.springframework.messaging.support.ChannelInterceptor) Test(org.junit.Test)

Aggregations

AbstractMessageChannel (org.springframework.integration.channel.AbstractMessageChannel)19 Test (org.junit.Test)16 JpaExecutor (org.springframework.integration.jpa.core.JpaExecutor)7 JpaOperations (org.springframework.integration.jpa.core.JpaOperations)7 MessageHandler (org.springframework.messaging.MessageHandler)4 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)3 DirectChannel (org.springframework.integration.channel.DirectChannel)3 PersistMode (org.springframework.integration.jpa.support.PersistMode)3 LiteralExpression (org.springframework.expression.common.LiteralExpression)2 GlobalChannelInterceptor (org.springframework.integration.config.GlobalChannelInterceptor)2 EventDrivenConsumer (org.springframework.integration.endpoint.EventDrivenConsumer)2 AbstractReplyProducingMessageHandler (org.springframework.integration.handler.AbstractReplyProducingMessageHandler)2 JpaOutboundGateway (org.springframework.integration.jpa.outbound.JpaOutboundGateway)2 JpaParameter (org.springframework.integration.jpa.support.JpaParameter)2 OutboundGatewayType (org.springframework.integration.jpa.support.OutboundGatewayType)2 Message (org.springframework.messaging.Message)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1