use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class SimpleCamelProducerTest method testCamelProducer.
@Test
public void testCamelProducer() throws Exception {
// Starting Spring context.
try (GenericApplicationContext context = new AnnotationConfigApplicationContext(ExampleConfiguration.class)) {
context.start();
// Sending Camel message.
CamelContext camel = context.getBean(CamelContext.class);
ProducerTemplate producerTemplate = camel.createProducerTemplate();
producerTemplate.sendBody("direct:start", "Send me to the Sponge");
// Waiting for the engine to process an event.
SpongeEngine engine = context.getBean(SpongeEngine.class);
await().atMost(60, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable(AtomicBoolean.class, "sentCamelMessage").get());
assertFalse(engine.isError());
context.stop();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class CamelRssNewsTest method testCamelRssNews.
@Test
public void testCamelRssNews() throws InterruptedException {
CamelRssNewsExampleMain example = new CamelRssNewsExampleMain();
try {
example.startup();
SpongeEngine engine = example.getEngine();
await().atMost(60, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable(AtomicBoolean.class, "alarmSounded").get() && engine.getOperations().getVariable(AtomicBoolean.class, "alarmForwarded").get() && engine.getOperations().getVariable(AtomicBoolean.class, "sourceRoutesStopped").get());
if (engine.isError()) {
Assert.fail(engine.getError().toString());
}
} finally {
example.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class StandaloneCamelGroovyTest method testCamelRouteXml.
@Test
public void testCamelRouteXml() {
StandaloneEngineMain engineMain = new StandaloneEngineMain(true);
try {
engineMain.startup("-c", "config/config.xml");
SpongeEngine engine = engineMain.getEngine();
await().atMost(60, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("message") != null && engine.getOperations().getVariable(Boolean.class, "sent"));
assertTrue(engine.getOperations().getVariable(String.class, "message").contains("Send me to Camel"));
} finally {
engineMain.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ConfigurationKnowledgeBaseFileTest method testKnowledgeBaseFileOptionalNonExisting.
@Test
public void testKnowledgeBaseFileOptionalNonExisting() {
SpongeEngine engine = DefaultSpongeEngine.builder().config(DIR + "configuration_kb_file_optional_non_existing.xml").build();
engine.startup();
try {
assertFalse(engine.getOperations().existsVariable("loaded"));
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ConfigurationTest method testRelativeFiles.
@Test
public void testRelativeFiles() throws InterruptedException {
SpongeEngine engine = DefaultSpongeEngine.builder().config("examples/core/configuration/relative_files.xml").build();
engine.startup();
try {
assertTrue(engine.getOperations().getVariable(Boolean.class, "loaded"));
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
Aggregations