Search in sources :

Example 6 with DelayHandler

use of org.springframework.integration.handler.DelayHandler in project spring-integration by spring-projects.

the class DelayerParserTests method testInt2243Expression.

@Test
public void testInt2243Expression() {
    DelayHandler delayHandler = context.getBean("delayerWithExpression.handler", DelayHandler.class);
    assertEquals("100", TestUtils.getPropertyValue(delayHandler, "delayExpression", Expression.class).getExpressionString());
    assertFalse(TestUtils.getPropertyValue(delayHandler, "ignoreExpressionFailures", Boolean.class));
}
Also used : DelayHandler(org.springframework.integration.handler.DelayHandler) Test(org.junit.Test)

Example 7 with DelayHandler

use of org.springframework.integration.handler.DelayHandler in project spring-integration by spring-projects.

the class DelayerParserTests method adviceChainSubElement.

// INT-2649
@Test
public void adviceChainSubElement() {
    Object endpoint = context.getBean("delayerWithAdviceChain");
    DelayHandler delayHandler = TestUtils.getPropertyValue(endpoint, "handler", DelayHandler.class);
    List<?> adviceChain = TestUtils.getPropertyValue(delayHandler, "delayedAdviceChain", List.class);
    assertEquals(2, adviceChain.size());
    assertSame(context.getBean("testAdviceBean"), adviceChain.get(0));
    Object txAdvice = adviceChain.get(1);
    assertEquals(TransactionInterceptor.class, txAdvice.getClass());
    TransactionAttributeSource transactionAttributeSource = ((TransactionInterceptor) txAdvice).getTransactionAttributeSource();
    assertEquals(NameMatchTransactionAttributeSource.class, transactionAttributeSource.getClass());
    HashMap<?, ?> nameMap = TestUtils.getPropertyValue(transactionAttributeSource, "nameMap", HashMap.class);
    assertEquals("{*=PROPAGATION_REQUIRES_NEW,ISOLATION_DEFAULT,readOnly}", nameMap.toString());
}
Also used : NameMatchTransactionAttributeSource(org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource) TransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource) MatchAlwaysTransactionAttributeSource(org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource) DelayHandler(org.springframework.integration.handler.DelayHandler) TransactionInterceptor(org.springframework.transaction.interceptor.TransactionInterceptor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 DelayHandler (org.springframework.integration.handler.DelayHandler)7 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 MatchAlwaysTransactionAttributeSource (org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource)2 NameMatchTransactionAttributeSource (org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource)2 TransactionAttributeSource (org.springframework.transaction.interceptor.TransactionAttributeSource)2 TransactionInterceptor (org.springframework.transaction.interceptor.TransactionInterceptor)2 Method (java.lang.reflect.Method)1 TransactionDefinition (org.springframework.transaction.TransactionDefinition)1