use of org.junit.Test in project camel by apache.
the class ChunkDifferentThemeFolderSubfolderAndExtensionTest method testChunkSubfolder.
/**
* Test using themeFolder, themeSubfolder and extension parameters
*/
@Test
public void testChunkSubfolder() throws Exception {
// Prepare
Exchange exchange = createExchangeWithBody("The Body");
exchange.getIn().setHeader("name", "Andrew");
endSimpleMock.expectedMessageCount(1);
endSimpleMock.expectedBodiesReceived("Earth to Andrew. Come in, Andrew.\n");
// Act
startSimpleProducerTemplate.send(exchange);
// Verify
assertMockEndpointsSatisfied();
}
use of org.junit.Test in project camel by apache.
the class CMISProducerTest method createDocumentAtSpecificPath.
@Test
public void createDocumentAtSpecificPath() throws Exception {
Folder folder1 = createFolderWithName("Folder1");
createChildFolderWithName(folder1, "Folder2");
String existingFolderStructure = "/Folder1/Folder2";
Exchange exchange = createExchangeWithInBody("Some content to be stored");
exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.file");
exchange.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, existingFolderStructure);
template.send(exchange);
String newNodeId = exchange.getOut().getBody(String.class);
Document document = (Document) retrieveCMISObjectByIdFromServer(newNodeId);
String documentFullPath = document.getPaths().get(0);
assertEquals(existingFolderStructure + "/test.file", documentFullPath);
}
use of org.junit.Test in project camel by apache.
the class CMISProducerTest method namePropertyIsAlwaysRequired.
@Test
public void namePropertyIsAlwaysRequired() {
Exchange exchange = createExchangeWithInBody("Some content that will fail to be stored");
exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
template.send(exchange);
Exception exception = exchange.getException();
Object body = exchange.getOut().getBody();
assertNull(body);
assertTrue(exception instanceof NoSuchHeaderException);
}
use of org.junit.Test in project camel by apache.
the class CMISProducerTest method storeMessageBodyAsTextDocument.
@Test
public void storeMessageBodyAsTextDocument() throws Exception {
String content = "Some content to be store";
Exchange exchange = createExchangeWithInBody(content);
exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.file");
template.send(exchange);
String newNodeId = exchange.getOut().getBody(String.class);
assertNotNull(newNodeId);
String newNodeContent = getDocumentContentAsString(newNodeId);
assertEquals(content, newNodeContent);
}
use of org.junit.Test in project camel by apache.
the class CMISQueryProducerTest method getResultCountFromHeader.
@Test
public void getResultCountFromHeader() throws Exception {
Endpoint endpoint = context.getEndpoint("cmis://" + getUrl() + "?queryMode=true");
Producer producer = endpoint.createProducer();
Exchange exchange = createExchangeWithInBody("SELECT * FROM cmis:document WHERE CONTAINS('Camel test content.')");
producer.process(exchange);
@SuppressWarnings("unchecked") List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
assertEquals(2, documents.size());
assertEquals(2, exchange.getOut().getHeader("CamelCMISResultCount"));
}
Aggregations