Changeset 39 for trunk


Ignore:
Timestamp:
06/14/13 15:11:13 (11 years ago)
Author:
stoda
Message:

Exception test revised.
Broker.lookup does not need the casting
GsonImp? arguments problem solved
MultiProcessTest? added

Location:
trunk/objectmq
Files:
5 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/objectmq/src/omq/client/proxy/Proxymq.java

    r38 r39  
    237237                if (resp.getError() != null) {
    238238                        OmqException error = resp.getError();
    239                         String name = error.getType();System.out.println("Name: "+name);
     239                        String name = error.getType();
    240240                        String message = error.getMessage();
    241241                        throw (Exception) Class.forName(name).getConstructor(String.class).newInstance(message);
  • trunk/objectmq/src/omq/common/broker/Broker.java

    r38 r39  
    108108        }
    109109
    110         public static Remote lookup(String reference, Class<?> contract) throws RemoteException {
     110        @SuppressWarnings("unchecked")
     111        public static <T extends Remote> T lookup(String reference, Class<T> contract) throws RemoteException {
    111112                try {
    112113                        Properties environment = Environment.getEnvironment();
     
    120121                                Proxymq proxy = new Proxymq(reference, contract, environment);
    121122                                Class<?>[] array = { contract };
    122                                 return (Remote) Proxymq.newProxyInstance(contract.getClassLoader(), array, proxy);
    123                         }
    124                         return (Remote) Proxymq.getInstance(reference);
     123                                return (T) Proxymq.newProxyInstance(contract.getClassLoader(), array, proxy);
     124                        }
     125                        return (T) Proxymq.getInstance(reference);
    125126
    126127                } catch (Exception e) {
  • trunk/objectmq/src/omq/common/util/Serializers/GsonImp.java

    r38 r39  
    3939
    4040                try {
    41                         JsonArray jsonArgs = (JsonArray) jsonObj.get("arguments");
     41                        JsonArray jsonArgs = (JsonArray) jsonObj.get("params");
    4242
    4343                        // TODO: if (jsonArgs.size() == types.size())
  • trunk/objectmq/src/omq/server/InvocationThread.java

    r38 r39  
    8181
    8282                }
    83                 System.out.println("Invocation Thread dies!!");
    8483        }
    8584
  • trunk/objectmq/test/exceptionTest/ClientTest.java

    r38 r39  
    33import static org.junit.Assert.assertEquals;
    44
     5import java.lang.reflect.UndeclaredThrowableException;
    56import java.util.Properties;
    67
     
    2526                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
    2627                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
    27                 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);
     28                env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.kryo);
    2829                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
    2930
     
    6768        }
    6869
    69         @Test(expected = NoSuchMethodException.class)
     70        @Test(expected = UndeclaredThrowableException.class)
     71        // This exception will be caused by java.lang.NoSuchMethodException
    7072        public void getTrailer() throws Exception {
    7173                client.getTrailer();
  • trunk/objectmq/test/exceptionTest/ServerTest.java

    r38 r39  
    1717                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
    1818                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
    19                 env.setProperty(ParameterQueue.DURABLE_QUEUES, "true");
    20                 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);
     19                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
     20                env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.kryo);
    2121                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
    2222
Note: See TracChangeset for help on using the changeset viewer.