source: trunk/src/test/java/omq/test/stopBroker/StopBrokerTest.java @ 73

Last change on this file since 73 was 73, checked in by stoda, 11 years ago

All the references of event removed

File size: 2.7 KB
Line 
1package omq.test.stopBroker;
2
3import java.util.Arrays;
4import java.util.Collection;
5import java.util.Properties;
6
7import omq.common.broker.Broker;
8import omq.common.util.ParameterQueue;
9import omq.common.util.Serializer;
10
11import org.junit.After;
12import org.junit.BeforeClass;
13import org.junit.Test;
14import org.junit.runner.RunWith;
15import org.junit.runners.Parameterized;
16import org.junit.runners.Parameterized.Parameters;
17
18@RunWith(value = Parameterized.class)
19public class StopBrokerTest {
20
21        private static Broker broker;
22        private static BrokerKiller bk;
23
24        public StopBrokerTest(String type) throws Exception {
25                Properties env = new Properties();
26                env.setProperty(ParameterQueue.USER_NAME, "guest");
27                env.setProperty(ParameterQueue.USER_PASS, "guest");
28
29                // Set host info of rabbimq (where it is)
30                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
31                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
32                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
33                env.setProperty(ParameterQueue.SERIALIZER_NAME, type);
34                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
35
36                // Set info about where the message will be sent
37                env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
38                // env.setProperty(ParameterQueue.DEBUGFILE, "c:\\middlewareDebug");
39
40                // Set info about the queue & the exchange where the ResponseListener
41                // will listen to.
42                env.setProperty(ParameterQueue.RPC_REPLY_QUEUE, "reply_queue");
43                env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "5000");
44
45                broker = new Broker(env);
46                bk = broker.lookup("bk", BrokerKiller.class);
47        }
48
49        @Parameters
50        public static Collection<Object[]> data() {
51                Object[][] data = new Object[][] { { Serializer.JAVA }, { Serializer.GSON }, { Serializer.KRYO } };
52                return Arrays.asList(data);
53        }
54
55        @BeforeClass
56        public static void server() throws Exception {
57                Properties env = new Properties();
58                env.setProperty(ParameterQueue.USER_NAME, "guest");
59                env.setProperty(ParameterQueue.USER_PASS, "guest");
60
61                // Get host info of rabbimq (where it is)
62                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
63                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
64                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
65                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
66
67                // Set info about where the message will be sent
68                env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
69                env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000");
70
71                Broker broker = new Broker(env);
72                BrokerKillerImpl bki = new BrokerKillerImpl(broker);
73                broker.bind("bk", bki);
74        }
75
76        @After
77        public void stop() throws Exception {
78                broker.stopBroker();
79        }
80
81        @Test
82        public void stopBroker() throws Exception {
83                bk.killServerBroker();
84        }
85
86}
Note: See TracBrowser for help on using the repository browser.