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