use of org.junit.Test in project camel by apache.
the class CMISProducerTest method getDocumentMimeTypeFromMessageContentType.
@Test
public void getDocumentMimeTypeFromMessageContentType() throws Exception {
Exchange exchange = createExchangeWithInBody("Some content to be store");
exchange.getIn().getHeaders().put(Exchange.CONTENT_TYPE, "text/plain");
exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.file");
template.send(exchange);
String newNodeId = exchange.getOut().getBody(String.class);
CmisObject cmisObject = retrieveCMISObjectByIdFromServer(newNodeId);
Document doc = (Document) cmisObject;
assertEquals("text/plain", doc.getPropertyValue(PropertyIds.CONTENT_STREAM_MIME_TYPE));
}
use of org.junit.Test in project camel by apache.
the class ChunkComponentLayersTest method testChunkLayer.
/**
* Test using themeLayer parameter without Resource URI header defined
*/
@Test
public void testChunkLayer() throws Exception {
// Prepare
Exchange exchange = createExchangeWithBody("The Body");
exchange.getIn().setHeader("name", "Andrew");
endSimpleMock.expectedMessageCount(1);
endSimpleMock.expectedBodiesReceived("<div>\nEarth to Andrew. Come in, Andrew.\n</div>\n");
// Act
startSimpleProducerTemplate.send(exchange);
// Verify
assertMockEndpointsSatisfied();
}
use of org.junit.Test in project camel by apache.
the class ChunkComponentNestedLayersTest method testChunkDoubleLayers.
/**
* Test using two following distinct themeLayer of the same theme without Resource URI header defined
*/
@Test
public void testChunkDoubleLayers() throws Exception {
// Prepare
Exchange exchange = createExchangeWithBody("The Body");
exchange.getIn().setHeader("name", "Andrew");
endSimpleMock.expectedMessageCount(1);
endSimpleMock.expectedBodiesReceived("<div>\nMars to Andrew. Come in, Andrew. This is the body: <div>\nEarth to Andrew. Come in, Andrew.\n</div>\n\n</div>\n");
// Act
startSimpleProducerTemplate.send(exchange);
// Verify
assertMockEndpointsSatisfied();
}
use of org.junit.Test in project camel by apache.
the class ChunkComponentTemplateTest method testChunkWithTemplateHeader.
/**
* Test using code Template header
*/
@Test
public void testChunkWithTemplateHeader() throws Exception {
// Prepare
Exchange exchange = createExchangeWithBody("The Body");
exchange.getIn().setHeader("someHeader", "Some Header");
exchange.getIn().setHeader(ChunkConstants.CHUNK_TEMPLATE, "Body='{$body}'|SomeHeader='{$headers.someHeader}'");
endSimpleMock.expectedMessageCount(1);
endSimpleMock.expectedBodiesReceived("Body='The Body'|SomeHeader='Some Header'");
// Act
startSimpleProducerTemplate.send(exchange);
// Verify
assertMockEndpointsSatisfied();
}
use of org.junit.Test in project camel by apache.
the class ChunkComponentTest method testChunkWithResourceUriHeader.
/**
* Test using Resource URI header
*/
@Test
public void testChunkWithResourceUriHeader() throws Exception {
// Prepare
Exchange exchange = createExchangeWithBody("The Body");
exchange.getIn().setHeader("name", "Andrew");
exchange.getIn().setHeader(ChunkConstants.CHUNK_RESOURCE_URI, "hello");
endSimpleMock.expectedMessageCount(1);
endSimpleMock.expectedBodiesReceived("Earth to Andrew. Come in, Andrew.\n");
// Act
startSimpleProducerTemplate.send(exchange);
// Verify
assertMockEndpointsSatisfied();
}
Aggregations