Search in sources :

Example 26 with Test

use of org.junit.Test in project camel by apache.

the class CacheProducerTest method testQueringDataFromCacheUsingUrlParameters.

@Test
public void testQueringDataFromCacheUsingUrlParameters() throws Exception {
    context.addRoutes(new RouteBuilder() {

        public void configure() {
            onException(CacheException.class).handled(true).to("log:LOGGER").to("mock:CacheProducerTest.cacheException");
            from("direct:a").to("cache://TestCache1?operation=add&key=foo").setBody(constant("Don't care. This body will be overridden.")).to("cache://TestCache1?operation=get&key=foo").choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNotNull()).to("mock:CacheProducerTest.result").end();
        }
    });
    resultEndpoint.expectedMessageCount(1);
    cacheExceptionEndpoint.expectedMessageCount(0);
    resultEndpoint.expectedBodiesReceived(POETRY);
    context.start();
    log.debug("------------Beginning CacheProducer Query An Elements Test---------------");
    sendSerializedData();
    resultEndpoint.assertIsSatisfied();
    cacheExceptionEndpoint.assertIsSatisfied();
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) Test(org.junit.Test) BaseCacheTest(org.apache.camel.component.BaseCacheTest)

Example 27 with Test

use of org.junit.Test in project camel by apache.

the class CacheProducerTest method testAddingDataElementEternal.

@Test
public void testAddingDataElementEternal() throws Exception {
    context.addRoutes(new RouteBuilder() {

        public void configure() {
            from("direct:a").setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD)).setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")).setHeader(CacheConstants.CACHE_ELEMENT_EXPIRY_ETERNAL, constant(Boolean.TRUE)).to("cache://TestCache1");
        }
    });
    context.start();
    log.debug("------------Beginning CacheProducer Add Test---------------");
    sendOriginalFile();
    Element element = fetchElement("Ralph_Waldo_Emerson");
    assertTrue(element.isEternal());
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) Element(net.sf.ehcache.Element) Test(org.junit.Test) BaseCacheTest(org.apache.camel.component.BaseCacheTest)

Example 28 with Test

use of org.junit.Test in project camel by apache.

the class ChunkDifferentThemeFolderTest method testChunkSingleLayer.

/**
     * Test using themeFolder parameter
     */
@Test
public void testChunkSingleLayer() 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();
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 29 with Test

use of org.junit.Test in project camel by apache.

the class CMConfigurationTest method testNullProductToken.

// @After
// public void afterTest() {
@Test
public void testNullProductToken() throws Exception {
    final CMConfiguration configuration = new CMConfiguration();
    // length: 1-11
    configuration.setDefaultFrom("DefaultFrom");
    configuration.setProductToken(null);
    configuration.setDefaultMaxNumberOfParts(8);
    configuration.setTestConnectionOnStartup(false);
    final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) CMConfiguration(org.apache.camel.component.cm.CMConfiguration) Test(org.junit.Test)

Example 30 with Test

use of org.junit.Test in project camel by apache.

the class CMConfigurationTest method testMaxNumberOfParts.

@Test
public void testMaxNumberOfParts() throws Exception {
    final CMConfiguration configuration = new CMConfiguration();
    configuration.setProductToken(UUID.randomUUID().toString());
    configuration.setDefaultFrom("DefaultFrom");
    configuration.setDefaultMaxNumberOfParts(9);
    configuration.setTestConnectionOnStartup(false);
    final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) CMConfiguration(org.apache.camel.component.cm.CMConfiguration) 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