ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/tools/PymolServerOutputStreamTest.java
Revision: 29
Committed: Fri Mar 10 10:57:12 2006 UTC (18 years, 6 months ago) by stehr
File size: 1172 byte(s)
Log Message:
changed server port to standard
Line File contents
1 package tools;
2
3 import java.io.PrintWriter;
4 import java.io.OutputStream;
5
6 import junit.framework.TestCase;
7
8 public class PymolServerOutputStreamTest extends TestCase {
9
10 /*
11 * Test method for 'tools.PymolServerOutputStream'
12 * Note that PyMol doesn't eat commands longer than 1060
13 * characters. It even crashes with a segfault.
14 */
15 public void testPymolServerOutputStream() {
16
17 final String serverUrl = "http://gelb:9123";
18 final int from = 10,
19 to = 1060,
20 inc = 10;
21 final char dummyChar = 'a';
22
23 // open connection
24 OutputStream serverOutOs = new PymolServerOutputStream(serverUrl);
25 assertNotNull(serverOutOs);
26
27 PrintWriter serverOutPw = new PrintWriter(serverOutOs, true);
28 assertNotNull(serverOutPw);
29
30 // send commands of different lenghths
31 for(int l = from; l <= to; l += inc) {
32 // make dummy command
33 StringBuffer cmd = new StringBuffer(l);
34 for(int i = 0; i < l; i++) {
35 cmd.append(dummyChar);
36 }
37 System.out.println("Sending string of length " + l + " to PyMol server");
38 serverOutPw.println(cmd.toString());
39 assertFalse(serverOutPw.checkError());
40 }
41 }
42 }