use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class ExecOutFileTest method testOutFile.
@Test
@DirtiesContext
public void testOutFile() throws Exception {
Exchange e = sendWithMockedExecutor();
ExecResult result = e.getIn().getBody(ExecResult.class);
assertNotNull(result);
File outFile = result.getCommand().getOutFile();
assertNotNull(outFile);
assertEquals(FILE_CONTENT, FileUtils.readFileToString(outFile));
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class ExecProducerTest method testOverrideExecutable.
@Test
@DirtiesContext
public void testOverrideExecutable() {
final String command = "java";
producerTemplate.send(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("noinput");
exchange.getIn().setHeader(EXEC_COMMAND_EXECUTABLE, command);
}
});
assertEquals(command, execCommandExecutorMock.lastCommandResult.getCommand().getExecutable());
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class ExecProducerTest method testOutCapableExchange.
@Test
@DirtiesContext
public void testOutCapableExchange() throws Exception {
Exchange exchange = producerTemplate.send(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
exchange.getIn().setBody("inout");
}
});
// test the conversion
ExecResult result = exchange.getOut().getBody(ExecResult.class);
assertNotNull(result);
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class ExecProducerTest method testOverrideTimeout.
@Test
@DirtiesContext
public void testOverrideTimeout() {
producerTemplate.send(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("noinput");
exchange.getIn().setHeader(EXEC_COMMAND_TIMEOUT, "1000");
}
});
assertEquals(1000, execCommandExecutorMock.lastCommandResult.getCommand().getTimeout());
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class ExecProducerTest method testInInOnlyExchange.
@Test
@DirtiesContext
public void testInInOnlyExchange() throws Exception {
Exchange exchange = producerTemplate.send(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOnly);
exchange.getIn().setBody("inonly");
}
});
// test the conversion
ExecResult result = exchange.getIn().getBody(ExecResult.class);
assertNotNull(result);
}
Aggregations