source: trunk/src/test/java/omq/test/faultTolerance/ServerTest.java @ 47

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

Refactoring Environment class - deleted.
StopBroker? problems solved (?)
Server can receive send and receive messages in different formats.
Some tests modified

TODO: finish all the tests, add log4j

File size: 1.2 KB
Line 
1package omq.test.faultTolerance;
2
3import java.util.Properties;
4
5import org.junit.Test;
6
7import omq.common.broker.Broker;
8import omq.common.util.ParameterQueue;
9import omq.common.util.Serializer;
10import omq.test.calculator.CalculatorImpl;
11
12public class ServerTest {
13        private static CalculatorImpl calc;
14
15        @Test
16        public void test() throws Exception {
17                Properties env = new Properties();
18                env.setProperty(ParameterQueue.USER_NAME, "guest");
19                env.setProperty(ParameterQueue.USER_PASS, "guest");
20
21                // Get host info of rabbimq (where it is)
22                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
23                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
24                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
25                env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);
26                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
27
28                // Set info about where the message will be sent
29                env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
30                env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000");
31
32                calc = new CalculatorImpl();
33
34                Broker.initBroker(env);
35                Broker.bind("calculator1", calc);
36
37                System.out.println("Server started");
38               
39                Thread.sleep(60 * 1000);
40        }
41}
Note: See TracBrowser for help on using the repository browser.