# HG changeset patch # User pin # Date 1220007743 -32400 # Node ID 311847db74296a24f521cc838867a9a0f3e4cd93 # Parent 6fb97c7a0b4232bec9f1530350993ade78b10ba7 *** empty log message *** diff -r 6fb97c7a0b42 -r 311847db7429 test/sematest/TestEditor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sematest/TestEditor.java Fri Aug 29 20:02:23 2008 +0900 @@ -0,0 +1,48 @@ +package test.sematest; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; + +import rep.REP; +import rep.REPCommand; +import rep.REPCommandPacker; +import rep.channel.REPLogger; +import rep.channel.REPSocketChannel; + + +public class TestEditor extends Thread{ + private SocketAddress semaIP; + private REPLogger ns; + + public TestEditor(String name, String _host,int _port){ + super(name); + semaIP = new InetSocketAddress(_host, _port); + ns = REPLogger.singleton(); + } + + public void run(){ + try { + REPSocketChannel channel; + channel = REPSocketChannel.create(new REPCommandPacker()); + + ns.writeLog("try to connect to SessionManager whose ip is "+semaIP, 1); + while (!channel.connect(semaIP)){ + ns.writeLog("SeMa not listen to socket yet, wait", 1); + Thread.yield(); + } + ns.writeLog("successes to connect", 1); + + REPCommand command = new REPCommand(REP.SMCMD_JOIN,0,0,0,0,0,getName() + ": send hello"); + channel.write(command); + ns.writeLog("wrote packet", 1); + + REPCommand packet = channel.read(); + + ns.writeLog("gets return string==> `"+packet+"\'", 1); + + ns.writeLog("testEditor exits.", 1); + } catch (IOException e) { + } + } +} diff -r 6fb97c7a0b42 -r 311847db7429 test/sematest/TestSessionManager.java --- a/test/sematest/TestSessionManager.java Fri Aug 29 19:50:15 2008 +0900 +++ b/test/sematest/TestSessionManager.java Fri Aug 29 20:02:23 2008 +0900 @@ -2,21 +2,19 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.List; - import rep.SessionManager; import rep.channel.REPLogger; import rep.channel.REPServerSocketChannel; -import test.channeltest.testEditor; + public class TestSessionManager { - private ArrayList editorList; + private ArrayList editorList; private int numberEditor; static public REPLogger logger = REPLogger.singleton(); public TestSessionManager(int sm, int ss, int e) { - editorList = new ArrayList(); + editorList = new ArrayList(); numberEditor = e; } @@ -36,7 +34,7 @@ for (int i=0; i