Mercurial > hg > RemoteEditor > REPSessionManager
annotate test/XMLTest.java @ 468:b800b33c6988
check quit2 and ackList
author | one |
---|---|
date | Mon, 11 Oct 2010 19:57:34 +0900 |
parents | 6f356d160e58 |
children |
rev | line source |
---|---|
37 | 1 package test; |
2 | |
386 | 3 import java.io.IOException; |
4 | |
5 import org.xml.sax.SAXException; | |
6 | |
39 | 7 import rep.Session; |
37 | 8 import rep.SessionList; |
382
4b87f89b3afd
REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents:
359
diff
changeset
|
9 import rep.handler.Editor; |
56 | 10 import rep.xml.SessionXMLDecoder; |
41 | 11 import rep.xml.SessionXMLEncoder; |
37 | 12 |
13 public class XMLTest { | |
39 | 14 |
37 | 15 public static void main(String[] args){ |
39 | 16 |
387 | 17 Editor editor = new Editor(0,null,null); |
76 | 18 editor.setEID(1); |
74 | 19 editor.setHost("firefly.cr.ie.u-ryukyu.ac.jp"); |
179 | 20 //editor.setPort("56789"); |
74 | 21 editor.setName("Test.java"); |
39 | 22 |
387 | 23 Editor editor2 = new Editor(1,null,null); |
76 | 24 editor2.setEID(2); |
74 | 25 editor2.setHost("teto.cr.ie.u-ryukyu.ac.jp"); |
179 | 26 //editor2.setPort("45678"); |
39 | 27 |
322 | 28 Session session = new Session(1,editor); |
39 | 29 session.addEditor(editor); |
30 session.addEditor(editor2); | |
31 | |
32 SessionList sessionlist = new SessionList(); | |
358 | 33 //sessionlist.setMaxHost("naha.ie.u-ryukyu.ac.jp"); |
359
fa041bae35f1
all code written for distributed session except gather.
kono
parents:
358
diff
changeset
|
34 sessionlist.put(session.getSID(),session); |
39 | 35 |
122 | 36 /*** SessionList から XML へ ***/ |
77 | 37 //SessionXMLEncoder encoder = new SessionXMLEncoder(sessionlist.getList()); |
358 | 38 SessionXMLEncoder encoder = new SessionXMLEncoder(); |
39 System.out.println(encoder.sessionListToXML(sessionlist)); | |
56 | 40 |
122 | 41 /*** XML から SessionList へ ***/ |
358 | 42 String t1 = encoder.sessionListToXML(sessionlist); |
322 | 43 System.out.println(t1); |
346 | 44 SessionList sessionlist2; |
358 | 45 SessionXMLDecoder decoder = new SessionXMLDecoder(); |
346 | 46 try { |
47 sessionlist2 = decoder.decode(t1); | |
386 | 48 } catch (SAXException e) { |
49 return; | |
50 } catch (IOException e) { | |
346 | 51 return; |
52 } | |
386 | 53 |
74 | 54 |
122 | 55 /*** SessionList から XML へ ***/ |
77 | 56 //SessionXMLEncoder encoder2 = new SessionXMLEncoder(sessionlist2.getList()); |
358 | 57 System.out.println(encoder.sessionListToXML(sessionlist2)); |
76 | 58 |
59 /*** TestSAX ***/ | |
358 | 60 String[] string = {encoder.sessionListToXML(sessionlist2),}; |
76 | 61 TestSax.main(string); |
37 | 62 } |
63 } |