Search in sources :

Example 1 with IntegrationFlowDefinition

use of org.springframework.integration.dsl.IntegrationFlowDefinition in project spring-integration by spring-projects.

the class ManualFlowTests method testWrongLifecycle.

@Test
public void testWrongLifecycle() {
    class MyIntegrationFlow implements IntegrationFlow {

        @Override
        public void configure(IntegrationFlowDefinition<?> flow) {
            flow.bridge();
        }
    }
    IntegrationFlow testFlow = new MyIntegrationFlow();
    // This is fine because we are not going to start it automatically.
    assertNotNull(this.integrationFlowContext.registration(testFlow).autoStartup(false).register());
    try {
        this.integrationFlowContext.registration(testFlow).register();
        fail("IllegalStateException expected");
    } catch (Exception e) {
        assertThat(e, instanceOf(IllegalStateException.class));
        assertThat(e.getMessage(), containsString("Consider to implement it for [" + testFlow + "]."));
    }
    try {
        this.integrationFlowContext.remove("foo");
        fail("IllegalStateException expected");
    } catch (Exception e) {
        assertThat(e, instanceOf(IllegalStateException.class));
        assertThat(e.getMessage(), containsString("But [" + "foo" + "] ins't one of them."));
    }
}
Also used : IntegrationFlowDefinition(org.springframework.integration.dsl.IntegrationFlowDefinition) IntegrationFlow(org.springframework.integration.dsl.IntegrationFlow) StandardIntegrationFlow(org.springframework.integration.dsl.StandardIntegrationFlow) MessagingException(org.springframework.messaging.MessagingException) BeanCreationNotAllowedException(org.springframework.beans.factory.BeanCreationNotAllowedException) MessageDeliveryException(org.springframework.messaging.MessageDeliveryException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BeanCreationNotAllowedException (org.springframework.beans.factory.BeanCreationNotAllowedException)1 IntegrationFlow (org.springframework.integration.dsl.IntegrationFlow)1 IntegrationFlowDefinition (org.springframework.integration.dsl.IntegrationFlowDefinition)1 StandardIntegrationFlow (org.springframework.integration.dsl.StandardIntegrationFlow)1 MessageDeliveryException (org.springframework.messaging.MessageDeliveryException)1 MessagingException (org.springframework.messaging.MessagingException)1