You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/08/24 12:05:24 UTC
cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi RmiTestCase.java
hammant 2002/08/24 03:05:23
Modified: altrmi/src/test/org/apache/excalibur/altrmi/test
AbstractHelloTestCase.java
SimpleHelloTestServerImpl.java
altrmi/src/test/org/apache/excalibur/altrmi/test/rmi
RmiTestCase.java
Log:
Speed test added.
Revision Changes Path
1.2 +50 -28 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/AbstractHelloTestCase.java
Index: AbstractHelloTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/AbstractHelloTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractHelloTestCase.java 18 Aug 2002 12:04:49 -0000 1.1
+++ AbstractHelloTestCase.java 24 Aug 2002 10:05:23 -0000 1.2
@@ -18,90 +18,112 @@
* Extended by classes that name the transport.
* @author Paul Hammant
*/
-public abstract class AbstractHelloTestCase extends TestCase {
+public abstract class AbstractHelloTestCase extends TestCase
+{
protected AbstractServer server;
protected SimpleHelloTestServerImpl testServer;
protected TestInterface testClient;
- public AbstractHelloTestCase(String name) {
+ public AbstractHelloTestCase(String name)
+ {
super(name);
}
- public void testHelloCall() throws Exception {
+ public void testHelloCall() throws Exception
+ {
// lookup worked ?
- assertNotNull (testClient);
+ assertNotNull(testClient);
// Invoke a method over AltRMI.
testClient.hello("Hello!?");
// test the server has logged the message.
- assertEquals("Hello!?",((SimpleHelloTestServerImpl) testServer).getStoredState("void:hello(String)"));
+ assertEquals("Hello!?", ((SimpleHelloTestServerImpl) testServer).getStoredState("void:hello(String)"));
}
- public void testHello2Call() throws Exception {
+ public void testHello2Call() throws Exception
+ {
// lookup worked ?
- assertNotNull (testClient);
+ assertNotNull(testClient);
// Invoke a method over AltRMI.
int retVal = testClient.hello2(11);
// test our returned result
- assertEquals (11,retVal);
+ assertEquals(11, retVal);
// test the server has logged the message.
- assertEquals("11",((SimpleHelloTestServerImpl) testServer).getStoredState("int:hello2(int)"));
+ assertEquals("11", ((SimpleHelloTestServerImpl) testServer).getStoredState("int:hello2(int)"));
}
- public void testHello3CallPart1() throws Exception {
+ public void testHello3CallPart1() throws Exception
+ {
// lookup worked ?
- assertNotNull (testClient);
+ assertNotNull(testClient);
// Invoke a method over AltRMI.
- boolean retVal = testClient.hello3((short)22);
+ boolean retVal = testClient.hello3((short) 22);
// test our returned result
- assertTrue (retVal);
+ assertTrue(retVal);
// test the server has logged the message.
- assertEquals("22",((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
+ assertEquals("22", ((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
}
- public void testHello3CallPart2() throws Exception {
+ public void testHello3CallPart2() throws Exception
+ {
// lookup worked ?
- assertNotNull (testClient);
+ assertNotNull(testClient);
// Invoke a method over AltRMI.
- try {
- testClient.hello3((short)90);
+ try
+ {
+ testClient.hello3((short) 90);
fail("Expected a Excaption to be throw for hardcoded test 90");
- } catch (PropertyVetoException e) {
+ } catch (PropertyVetoException e)
+ {
// expected
- } catch (IOException e) {
+ } catch (IOException e)
+ {
fail("Wrong exception throw for hardcoded test 90");
}
// test the server has logged the message.
- assertEquals("90",((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
+ assertEquals("90", ((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
}
- public void testHello3CallPart3() throws Exception {
+ public void testHello3CallPart3() throws Exception
+ {
// lookup worked ?
- assertNotNull (testClient);
+ assertNotNull(testClient);
// Invoke a method over AltRMI.
- try {
- testClient.hello3((short)91);
+ try
+ {
+ testClient.hello3((short) 91);
fail("Expected a Excaption to be throw for hardcoded test 91");
- } catch (PropertyVetoException e) {
+ } catch (PropertyVetoException e)
+ {
fail("Wrong exception throw for hardcoded test 91");
- } catch (IOException e) {
+ } catch (IOException e)
+ {
// expected
}
// test the server has logged the message.
- assertEquals("91",((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
+ assertEquals("91", ((SimpleHelloTestServerImpl) testServer).getStoredState("boolean:hello3(short)"));
}
+
+ public void testSpeed() throws Exception {
+
+ for (int i = 1; i < 10000; i++ ) {
+ testClient.testSpeed();
+ }
+
+ }
+
}
1.2 +1 -1 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/SimpleHelloTestServerImpl.java
Index: SimpleHelloTestServerImpl.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/SimpleHelloTestServerImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleHelloTestServerImpl.java 18 Aug 2002 12:04:49 -0000 1.1
+++ SimpleHelloTestServerImpl.java 24 Aug 2002 10:05:23 -0000 1.2
@@ -48,7 +48,7 @@
}
public void testSpeed() {
- throw new UnsupportedOperationException();
+ // do nothing
}
public String testSpeed2(String string) {
1.2 +4 -7 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi/RmiTestCase.java
Index: RmiTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi/RmiTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RmiTestCase.java 18 Aug 2002 12:59:20 -0000 1.1
+++ RmiTestCase.java 24 Aug 2002 10:05:23 -0000 1.2
@@ -71,15 +71,12 @@
super.tearDown();
}
- public void testHelloCall() throws Exception {
- // lookup worked ?
- assertNotNull (testClient);
+ public void testSpeed() throws Exception {
- // Invoke a method over AltRMI.
- testClient.hello("Hello!?");
+ for (int i = 1; i < 10000; i++ ) {
+ testClient.testSpeed();
+ }
- // test the server has logged the message.
- assertEquals("Hello!?",((SimpleHelloTestServerImpl) testServer).getStoredState("void:hello(String)"));
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>