Ignore:
Timestamp:
06/18/13 16:51:22 (11 years ago)
Author:
stoda
Message:

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

Location:
trunk/src/test/java/omq/test/exception
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/test/java/omq/test/exception/ClientTest.java

    r46 r47  
    44
    55import java.lang.reflect.UndeclaredThrowableException;
     6import java.util.Arrays;
     7import java.util.Collection;
    68import java.util.Properties;
    79
     
    1012import omq.common.util.Serializer;
    1113
    12 import org.junit.BeforeClass;
     14import org.junit.After;
    1315import org.junit.Test;
     16import org.junit.runner.RunWith;
     17import org.junit.runners.Parameterized;
     18import org.junit.runners.Parameterized.Parameters;
    1419
     20@RunWith(value = Parameterized.class)
    1521public class ClientTest {
    16         private static ClientInterface client;
     22        private ClientInterface client;
    1723
    18         @BeforeClass
    19         public static void startClient() throws Exception {
     24        public ClientTest(String type) throws Exception {
    2025                Properties env = new Properties();
    2126                env.setProperty(ParameterQueue.USER_NAME, "guest");
     
    2631                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
    2732                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
    28                 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.kryo);
     33                env.setProperty(ParameterQueue.SERIALIZER_NAME, type);
    2934                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
    3035
     
    3944                Broker.initBroker(env);
    4045                client = (ClientInterface) Broker.lookup("server", ClientInterface.class);
     46        }
     47
     48        @Parameters
     49        public static Collection<Object[]> data() {
     50                Object[][] data = new Object[][] { { Serializer.java }, { Serializer.gson }, { Serializer.kryo } };
     51                return Arrays.asList(data);
     52        }
     53
     54        @After
     55        public void stop() throws Exception {
     56                Broker.stopBroker();
    4157        }
    4258
  • trunk/src/test/java/omq/test/exception/ServerTest.java

    r46 r47  
    55import omq.common.broker.Broker;
    66import omq.common.util.ParameterQueue;
    7 import omq.common.util.Serializer;
     7
     8import org.junit.Test;
    89
    910public class ServerTest {
    1011
    11         public static void main(String[] args) throws Exception {
     12        @Test
     13        public void test() throws Exception {
    1214                Properties env = new Properties();
    1315                env.setProperty(ParameterQueue.USER_NAME, "guest");
     
    1820                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
    1921                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
    20                 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.kryo);
    2122                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
    2223
     
    2930                Broker.initBroker(env);
    3031                Broker.bind("server", server);
     32
     33                Thread.sleep(60 * 60 * 1000);
    3134        }
    3235}
Note: See TracChangeset for help on using the changeset viewer.