Search in sources :

Example 1 with ResultSetBuilder

use of nl.nn.adapterframework.testutil.FixedQuerySenderMock.ResultSetBuilder in project iaf by ibissource.

the class DatabaseSchedulerTest method executeJob.

@Test
public void executeJob() throws Exception {
    ResultSetBuilder builder = FixedQuerySenderMock.ResultSetBuilder.create();
    builder.setValue("JOBNAME", "dummy name");
    builder.setValue("JOBGROUP", "dummy group");
    builder.setValue("ADAPTER", "testAdapter");
    builder.setValue("RECEIVER", "testReceiver");
    builder.setValue("CRON", "");
    builder.setValue("EXECUTIONINTERVAL", "10");
    builder.setValue("MESSAGE", "dummy message");
    Adapter adapter = configuration.createBean(Adapter.class);
    adapter.setName("testAdapter");
    configuration.registerAdapter(adapter);
    configuration.mockQuery("SELECT COUNT(*) FROM IBISSCHEDULES", builder.build());
    job.execute(configuration.getIbisManager());
    MessageKeeper messageKeeper = job.getMessageKeeper();
    for (int i = 0; i < messageKeeper.size(); i++) {
        MessageKeeperMessage message = messageKeeper.getMessage(i);
        if ("ERROR".equals(message.getMessageLevel())) {
            assertThat(message.getMessageText(), CoreMatchers.containsString("adapter [testAdapter] receiver [testReceiver] not registered"));
        }
    }
}
Also used : ResultSetBuilder(nl.nn.adapterframework.testutil.FixedQuerySenderMock.ResultSetBuilder) MessageKeeperMessage(nl.nn.adapterframework.util.MessageKeeperMessage) MessageKeeper(nl.nn.adapterframework.util.MessageKeeper) Adapter(nl.nn.adapterframework.core.Adapter) Test(org.junit.Test)

Aggregations

Adapter (nl.nn.adapterframework.core.Adapter)1 ResultSetBuilder (nl.nn.adapterframework.testutil.FixedQuerySenderMock.ResultSetBuilder)1 MessageKeeper (nl.nn.adapterframework.util.MessageKeeper)1 MessageKeeperMessage (nl.nn.adapterframework.util.MessageKeeperMessage)1 Test (org.junit.Test)1