Search in sources :

Example 11 with EntryEvent

use of com.hazelcast.core.EntryEvent in project camel by apache.

the class HazelcastMultimapConsumerTest method testAdd.

@Test
@SuppressWarnings("unchecked")
public void testAdd() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:added");
    out.expectedMessageCount(1);
    EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.ADDED.getType(), "4711", "my-foo");
    argument.getValue().entryAdded(event);
    assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.ADDED);
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) EntryEvent(com.hazelcast.core.EntryEvent) Test(org.junit.Test)

Example 12 with EntryEvent

use of com.hazelcast.core.EntryEvent in project camel by apache.

the class HazelcastMultimapConsumerTest method testEvict.

/*
     * mail from talip (hazelcast) on 21.02.2011: MultiMap doesn't support eviction yet. We can and should add this feature.
     */
@Test
@SuppressWarnings("unchecked")
public void testEvict() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:evicted");
    out.expectedMessageCount(1);
    EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.EVICTED.getType(), "4711", "my-foo");
    argument.getValue().entryEvicted(event);
    assertMockEndpointsSatisfied(30000, TimeUnit.MILLISECONDS);
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) EntryEvent(com.hazelcast.core.EntryEvent) Test(org.junit.Test)

Example 13 with EntryEvent

use of com.hazelcast.core.EntryEvent in project camel by apache.

the class HazelcastMultimapConsumerTest method testRemove.

@Test
@SuppressWarnings("unchecked")
public void testRemove() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:removed");
    out.expectedMessageCount(1);
    EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.REMOVED.getType(), "4711", "my-foo");
    argument.getValue().entryRemoved(event);
    assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.REMOVED);
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) EntryEvent(com.hazelcast.core.EntryEvent) Test(org.junit.Test)

Example 14 with EntryEvent

use of com.hazelcast.core.EntryEvent in project wildfly-camel by wildfly-extras.

the class HazelcastMapConsumerIntegrationTest method testUpdate.

@Test
@SuppressWarnings("unchecked")
public void testUpdate() throws Exception {
    CamelContext camelctx = createCamelContext();
    camelctx.start();
    try {
        MockEndpoint mock = camelctx.getEndpoint("mock:updated", MockEndpoint.class);
        mock.expectedMessageCount(1);
        EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.UPDATED.getType(), "4711", "my-foo");
        argument.getValue().entryUpdated(event);
        mock.assertIsSatisfied(3000);
        checkHeaders(mock.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.UPDATED);
    } finally {
        camelctx.stop();
    }
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) EntryEvent(com.hazelcast.core.EntryEvent) Test(org.junit.Test)

Example 15 with EntryEvent

use of com.hazelcast.core.EntryEvent in project wildfly-camel by wildfly-extras.

the class HazelcastMapConsumerIntegrationTest method testAdd.

@Test
@SuppressWarnings("unchecked")
public void testAdd() throws Exception {
    CamelContext camelctx = createCamelContext();
    camelctx.start();
    try {
        MockEndpoint mock = camelctx.getEndpoint("mock:added", MockEndpoint.class);
        mock.expectedMessageCount(1);
        EntryEvent<Object, Object> event = new EntryEvent<Object, Object>("foo", null, EntryEventType.ADDED.getType(), "4711", "my-foo");
        argument.getValue().entryAdded(event);
        mock.assertIsSatisfied(3000);
        checkHeaders(mock.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.ADDED);
    } finally {
        camelctx.stop();
    }
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) EntryEvent(com.hazelcast.core.EntryEvent) Test(org.junit.Test)

Aggregations

EntryEvent (com.hazelcast.core.EntryEvent)71 Test (org.junit.Test)62 QuickTest (com.hazelcast.test.annotation.QuickTest)47 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)39 EntryAdapter (com.hazelcast.core.EntryAdapter)22 HazelcastInstance (com.hazelcast.core.HazelcastInstance)22 Config (com.hazelcast.config.Config)19 CountDownLatch (java.util.concurrent.CountDownLatch)19 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)18 AssertTask (com.hazelcast.test.AssertTask)15 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)15 MapListener (com.hazelcast.map.listener.MapListener)11 MapListenerAdapter (com.hazelcast.map.impl.MapListenerAdapter)10 MapConfig (com.hazelcast.config.MapConfig)9 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)8 Predicate (com.hazelcast.query.Predicate)8 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)8 ParallelTest (com.hazelcast.test.annotation.ParallelTest)8 EntryAddedListener (com.hazelcast.map.listener.EntryAddedListener)7 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)6