source: trunk/src/test/java/omq/test/calculator/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.calculator;
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;
10
11public class ServerTest {
12
13        private CalculatorImpl calc;
14        private CalculatorImpl calc2;
15
16        @Test
17        public void serverTest() throws Exception {
18                Properties env = new Properties();
19                env.setProperty(ParameterQueue.USER_NAME, "guest");
20                env.setProperty(ParameterQueue.USER_PASS, "guest");
21
22                // Get host info of rabbimq (where it is)
23                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
24                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
25                env.setProperty(ParameterQueue.DURABLE_QUEUES, "true");
26                env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);
27                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
28
29                // Set info about where the message will be sent
30                env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
31                env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000");
32
33                calc = new CalculatorImpl();
34                calc2 = new CalculatorImpl();
35
36                Broker.initBroker(env);
37                Broker.bind("calculator1", calc);
38                Broker.bind("calculator2", calc2);
39
40                System.out.println("Server started");
41
42                Thread.sleep(60 * 60 * 1000);
43        }
44}
Note: See TracBrowser for help on using the repository browser.