1
2
3
4
5
6
7
8
9
10 package org.mule.transport.http.functional;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertTrue;
14
15 import org.mule.tck.AbstractServiceAndFlowTestCase;
16 import org.mule.tck.functional.CounterCallback;
17 import org.mule.tck.functional.FunctionalTestComponent;
18 import org.mule.tck.junit4.rule.DynamicPort;
19
20 import java.util.Arrays;
21 import java.util.Collection;
22 import java.util.concurrent.atomic.AtomicInteger;
23
24 import org.junit.Rule;
25 import org.junit.Test;
26 import org.junit.runners.Parameterized.Parameters;
27
28 public class PollingEtagTestCase extends AbstractServiceAndFlowTestCase
29 {
30 private static final int WAIT_TIME = 2500;
31
32 @Rule
33 public DynamicPort dynamicPort = new DynamicPort("port1");
34
35 @Test
36 public void testPollingReceiversRestart() throws Exception
37 {
38 Object ftc = getComponent("Test");
39 assertTrue("FunctionalTestComponent expected", ftc instanceof FunctionalTestComponent);
40
41 AtomicInteger pollCounter = new AtomicInteger(0);
42 ((FunctionalTestComponent) ftc).setEventCallback(new CounterCallback(pollCounter));
43
44
45 Thread.sleep(WAIT_TIME);
46
47 assertEquals(1, pollCounter.get());
48 }
49
50 public PollingEtagTestCase(ConfigVariant variant, String configResources)
51 {
52 super(variant, configResources);
53 }
54
55 @Parameters
56 public static Collection<Object[]> parameters()
57 {
58 return Arrays.asList(new Object[][]{
59 {ConfigVariant.SERVICE, "polling-etag-test-service.xml"},
60 {ConfigVariant.FLOW, "polling-etag-test-flow.xml"}
61 });
62 }
63
64 }
65