use of nl.nn.adapterframework.util.MessageKeeperMessage in project iaf by ibissource.
the class ShowScheduler method getJobMessages.
private List<Map<String, Object>> getJobMessages(JobDetail jobDetail) throws ApiException {
List<Map<String, Object>> messages = new ArrayList<Map<String, Object>>();
IJob jobdef = (IJob) jobDetail.getJobDataMap().get(ConfiguredJob.JOBDEF_KEY);
for (int t = 0; t < jobdef.getMessageKeeper().size(); t++) {
Map<String, Object> message = new HashMap<String, Object>(3);
MessageKeeperMessage job = jobdef.getMessageKeeper().getMessage(t);
message.put("text", job.getMessageText());
message.put("date", job.getMessageDate());
message.put("level", job.getMessageLevel());
messages.add(message);
}
return messages;
}
use of nl.nn.adapterframework.util.MessageKeeperMessage in project iaf by ibissource.
the class ShowConfigurationStatus method mapAdapterMessages.
private ArrayList<Object> mapAdapterMessages(Adapter adapter) {
int totalMessages = adapter.getMessageKeeper().size();
// adapter.getMessageKeeper().get
ArrayList<Object> messages = new ArrayList<Object>(totalMessages);
for (int t = 0; t < totalMessages; t++) {
Map<String, Object> message = new HashMap<String, Object>();
MessageKeeperMessage msg = adapter.getMessageKeeper().getMessage(t);
message.put("message", msg.getMessageText());
message.put("date", msg.getMessageDate());
message.put("level", msg.getMessageLevel());
message.put("capacity", adapter.getMessageKeeper().capacity());
messages.add(message);
}
return messages;
}
use of nl.nn.adapterframework.util.MessageKeeperMessage in project iaf by ibissource.
the class IbisContextTest method nullClassLoader.
@Test
public void nullClassLoader() {
String configurationName = "ConfigWithNullClassLoader";
try (IbisContext context = new IbisTestContext(configurationName, TestClassLoader.class)) {
context.init(false);
assertEquals("TestConfiguration", context.getApplicationName());
assertEquals(0, context.getIbisManager().getConfigurations().size());
MessageEventListener events = context.getBean("MessageEventListener", MessageEventListener.class);
MessageKeeperMessage message = events.getMessageKeeper().getMessage(events.getMessageKeeper().size() - 2);
assertNotNull("unable to find MessageKeeperMessage", message);
assertThat(message.getMessageText(), Matchers.endsWith("error configuring ClassLoader for configuration [ConfigWithNullClassLoader]: (ClassLoaderException) test-exception"));
}
}
use of nl.nn.adapterframework.util.MessageKeeperMessage in project iaf by ibissource.
the class ShowScheduler method getJobMessages.
private List<Map<String, Object>> getJobMessages(JobDef jobdef) throws ApiException {
List<Map<String, Object>> messages = new ArrayList<Map<String, Object>>();
for (int t = 0; t < jobdef.getMessageKeeper().size(); t++) {
Map<String, Object> message = new HashMap<String, Object>(3);
MessageKeeperMessage job = jobdef.getMessageKeeper().getMessage(t);
message.put("text", job.getMessageText());
message.put("date", job.getMessageDate());
message.put("level", job.getMessageLevel());
messages.add(message);
}
return messages;
}
use of nl.nn.adapterframework.util.MessageKeeperMessage 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"));
}
}
}
Aggregations