From: Ovidiu F. <ov...@us...> - 2004-12-25 00:14:04
|
User: ovidiuf Date: 04/12/24 16:13:55 Added: tests/src/org/jboss/test/messaging/util RpcServerTest.java Log: Moved all messaging tests into org.jboss.test.messaging Revision Changes Path 1.1 jboss-jms/tests/src/org/jboss/test/messaging/util/RpcServerTest.java Index: RpcServerTest.java =================================================================== /** * JBoss, the OpenSource J2EE WebOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.test.messaging.util; import org.jboss.test.messaging.MessagingTestCase; import org.jboss.messaging.core.Pipe; import org.jboss.messaging.core.CoreMessage; import org.jboss.test.messaging.core.ReceiverImpl; import org.jboss.messaging.interfaces.Message; import org.jboss.messaging.util.RpcServer; import org.jboss.messaging.util.NoSuchServerException; import java.util.Iterator; /** * @author <a href="mailto:ov...@jb...">Ovidiu Feodorov</a> * @version <tt>$Revision: 1.1 $</tt> */ public class RpcServerTest extends MessagingTestCase { // Constructors -------------------------------------------------- public RpcServerTest(String name) { super(name); } // Public -------------------------------------------------------- public void testNoSuchServer() throws Exception { RpcServer rpcServer = new RpcServer(); try { rpcServer.invoke("noSuchServerID", "noSuchMethod", new Object[] {}, new String[] {}); fail("Should have thrown exception"); } catch(NoSuchServerException e) { // OK } } public void testArgumentClassNotFound() throws Exception { RpcServer rpcServer = new RpcServer(); rpcServer.register("serverID1", new ServerObject()); try { rpcServer.invoke("serverID1", "someMethod", new Object[] { new Integer(0)}, new String[] { "java.lang.NoSuchClass"}); fail("Should have thrown exception"); } catch(ClassNotFoundException e) { // OK } } public void testNoSuchMethodName() throws Exception { RpcServer rpcServer = new RpcServer(); rpcServer.register("serverID1", new ServerObject()); try { rpcServer.invoke("serverID1", "noSuchMethod", new Object[] { new Integer(0)}, new String[] { "java.lang.Integer"}); fail("Should have thrown exception"); } catch(NoSuchMethodException e) { // OK } } public void testNoSuchMethodSignature() throws Exception { RpcServer rpcServer = new RpcServer(); rpcServer.register("serverID1", new ServerObject()); try { rpcServer.invoke("serverID1", "methodWithOneIntegerArgument", new Object[] { new Float(0)}, new String[] { "java.lang.Float"}); fail("Should have thrown exception"); } catch(NoSuchMethodException e) { // OK } } // Inner classes ------------------------------------------------- private class ServerObject { public void someMethod() {} public void methodWithOneIntegerArgument(Integer i) { } } } |