Search in sources :

Example 36 with Test

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));
}
Also used : Exchange(org.apache.camel.Exchange) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) Document(org.apache.chemistry.opencmis.client.api.Document) Test(org.junit.Test)

Example 37 with Test

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();
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 38 with Test

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();
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 39 with Test

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();
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 40 with Test

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();
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)198823 ArrayList (java.util.ArrayList)9546 File (java.io.File)9168 HashMap (java.util.HashMap)5749 IOException (java.io.IOException)5434 List (java.util.List)4309 QuickTest (com.hazelcast.test.annotation.QuickTest)4024 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3265 Configuration (org.apache.hadoop.conf.Configuration)3260 Properties (java.util.Properties)3016 Date (java.util.Date)2950 Path (org.apache.hadoop.fs.Path)2924 Map (java.util.Map)2907 Response (javax.ws.rs.core.Response)2884 InputStream (java.io.InputStream)2876 ByteArrayInputStream (java.io.ByteArrayInputStream)2777 CountDownLatch (java.util.concurrent.CountDownLatch)2681 Connection (java.sql.Connection)2478 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)2462 Session (org.hibernate.Session)2419