use of org.springframework.scheduling.Trigger in project spring-integration by spring-projects.
the class InboundChannelAdapterExpressionTests method fixedDelay.
@Test
public void fixedDelay() {
SourcePollingChannelAdapter adapter = context.getBean("fixedDelayProducer", SourcePollingChannelAdapter.class);
assertFalse(adapter.isAutoStartup());
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertEquals(PeriodicTrigger.class, trigger.getClass());
DirectFieldAccessor triggerAccessor = new DirectFieldAccessor(trigger);
assertEquals(1234L, triggerAccessor.getPropertyValue("period"));
assertEquals(Boolean.FALSE, triggerAccessor.getPropertyValue("fixedRate"));
assertEquals(context.getBean("fixedDelayChannel"), adapterAccessor.getPropertyValue("outputChannel"));
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);
assertEquals("'fixedDelayTest'", expression.getExpressionString());
}
use of org.springframework.scheduling.Trigger in project spring-integration by spring-projects.
the class InboundChannelAdapterExpressionTests method triggerRef.
@Test
public void triggerRef() {
SourcePollingChannelAdapter adapter = context.getBean("triggerRefProducer", SourcePollingChannelAdapter.class);
assertTrue(adapter.isAutoStartup());
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertEquals(context.getBean("customTrigger"), trigger);
assertEquals(context.getBean("triggerRefChannel"), adapterAccessor.getPropertyValue("outputChannel"));
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);
assertEquals("'triggerRefTest'", expression.getExpressionString());
}
use of org.springframework.scheduling.Trigger in project spring-integration by spring-projects.
the class InboundChannelAdapterWithDefaultPollerTests method verifyDefaultPollerInUse.
@Test
public void verifyDefaultPollerInUse() {
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertEquals(PeriodicTrigger.class, trigger.getClass());
DirectFieldAccessor triggerAccessor = new DirectFieldAccessor(trigger);
assertEquals(12345L, triggerAccessor.getPropertyValue("period"));
assertEquals(Boolean.TRUE, triggerAccessor.getPropertyValue("fixedRate"));
}
use of org.springframework.scheduling.Trigger in project spring-integration by spring-projects.
the class InboundChannelAdapterExpressionTests method fixedRate.
@Test
public void fixedRate() {
SourcePollingChannelAdapter adapter = context.getBean("fixedRateProducer", SourcePollingChannelAdapter.class);
assertFalse(adapter.isAutoStartup());
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertEquals(PeriodicTrigger.class, trigger.getClass());
DirectFieldAccessor triggerAccessor = new DirectFieldAccessor(trigger);
assertEquals(5678L, triggerAccessor.getPropertyValue("period"));
assertEquals(Boolean.TRUE, triggerAccessor.getPropertyValue("fixedRate"));
assertEquals(context.getBean("fixedRateChannel"), adapterAccessor.getPropertyValue("outputChannel"));
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);
assertEquals("'fixedRateTest'", expression.getExpressionString());
}
use of org.springframework.scheduling.Trigger in project spring-integration by spring-projects.
the class CronTriggerParserTests method checkConfigWithAttribute.
@Test
public void checkConfigWithAttribute() {
Object poller = context.getBean("pollerWithAttribute");
assertEquals(PollerMetadata.class, poller.getClass());
PollerMetadata metadata = (PollerMetadata) poller;
Trigger trigger = metadata.getTrigger();
assertEquals(CronTrigger.class, trigger.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
String expression = (String) new DirectFieldAccessor(accessor.getPropertyValue("sequenceGenerator")).getPropertyValue("expression");
assertEquals("*/10 * 9-17 * * MON-FRI", expression);
}
Aggregations