/[xulu]/branches/1.8-gt2-2.6/src/appl/parallel/test/XuluServerTest.java
ViewVC logotype

Contents of /branches/1.8-gt2-2.6/src/appl/parallel/test/XuluServerTest.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Feb 25 11:54:01 2009 UTC (15 years, 9 months ago) by mojays
Original Path: trunk/src/appl/parallel/test/XuluServerTest.java
File size: 2716 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 package appl.parallel.test;
2
3 import java.io.Serializable;
4 import java.net.MalformedURLException;
5 import java.rmi.Naming;
6 import java.rmi.NotBoundException;
7 import java.rmi.RemoteException;
8
9 import appl.parallel.server.XuluServer;
10
11 import junit.framework.Test;
12 import junit.framework.TestCase;
13 import junit.framework.TestSuite;
14
15 /**
16 * Generated code for the test suite <b>XuluServerTest</b> located at
17 * <i>/XuluSVN/javasrc/appl/parallel/test/XuluServerTest.testsuite</i>.
18 *
19 * Tests the Server functionality
20 */
21 public class XuluServerTest extends TestCase {
22 public final String IP = "192.168.18.238";
23 XuluServer server;
24
25 /**
26 * @see junit.framework.TestCase#setUp()
27 */
28 protected void setUp() throws Exception {
29 String name = "rmi://" + IP + "/XuluServer";
30
31 server = (XuluServer) Naming.lookup(name);
32
33
34 }
35
36 /**
37 * Constructor for XuluServerTest.
38 * @param whatsthis
39 */
40 public XuluServerTest(String whatsthis) {
41 super(whatsthis);
42 }
43
44 /**
45 * Returns the JUnit test suite that implements the <b>XuluServerTest</b>
46 * definition.
47 */
48 public static Test suite() {
49 TestSuite xuluServerTest = new TestSuite("XuluServerTest");
50 // xuluServerTest.setArbiter(DefaultTestArbiter.INSTANCE).setId(
51 // "F534D0796F99AD6BA80D9B00A9AA11DB");
52
53 return xuluServerTest;
54 }
55
56
57 /**
58 * @see junit.framework.TestCase#tearDown()
59 */
60 protected void tearDown() throws Exception {
61 }
62
63 /**
64 * testServer
65 * @throws Exception
66 */
67 public void testPingServer()
68 throws Exception
69 {
70 try{
71 Object data;
72 PingTestObject pingObj = new PingTestObject(32);
73 // do 10 pings
74 long sum1 = 0;
75 for (int i = 0; i < 10; i++) {
76 long mstime = System.currentTimeMillis();
77 data = server.ping(pingObj);
78 long mstimediff = System.currentTimeMillis() - mstime;
79 sum1 += mstimediff;
80 // Thread.sleep(100);
81 }
82 long sum2 = 0;
83 for (int i = 0; i < 10; i++) {
84 long nanotime = System.nanoTime();
85 data = server.ping(pingObj);
86 long nanolatency = System.nanoTime() - nanotime;
87 double timediff = (double)nanolatency / 1000000.0;
88 sum2+= nanolatency;
89 //Thread.sleep(100);
90 }
91 System.out.println("Average MS: " + sum1/10 + " Average nano: " + (double)sum2 / 10000000.0 );
92
93
94 } catch (RemoteException e) {
95 // TODO Auto-generated catch block
96 e.printStackTrace();
97 }
98
99
100 }
101
102 /**
103 * sendModel
104 * @throws Exception
105 */
106 public void testSendModel()
107 throws Exception
108 {
109 System.out.println("fu");
110 // Enter your code here
111 }
112
113 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26