1
2
3
4
5
6
7 package org.mule.transport.http.functional;
8
9 import org.mule.tck.functional.CounterCallback;
10 import org.mule.tck.functional.FunctionalTestComponent;
11 import org.mule.tck.junit4.FunctionalTestCase;
12 import org.mule.tck.junit4.rule.DynamicPort;
13
14 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
15 import org.junit.Rule;
16 import org.junit.Test;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
20
21 public class PollingEtagTestCase extends FunctionalTestCase
22 {
23 private static final int WAIT_TIME = 2500;
24
25 @Rule
26 public DynamicPort dynamicPort = new DynamicPort("port1");
27
28 @Override
29 protected String getConfigResources()
30 {
31 return "polling-etag-test.xml";
32 }
33
34 @Test
35 public void testPollingReceiversRestart() throws Exception
36 {
37 Object ftc = getComponent("Test");
38 assertTrue("FunctionalTestComponent expected", ftc instanceof FunctionalTestComponent);
39
40 AtomicInteger pollCounter = new AtomicInteger(0);
41 ((FunctionalTestComponent) ftc).setEventCallback(new CounterCallback(pollCounter));
42
43
44 Thread.sleep(WAIT_TIME);
45
46 assertEquals(1, pollCounter.get());
47 }
48
49 }
50