Mercurial > hg > RemoteEditor > REPSessionManager
changeset 220:216d64cd5f3a
*** empty log message ***
author | pin |
---|---|
date | Sun, 31 Aug 2008 11:19:59 +0900 |
parents | 13e0520470dc |
children | 6cd4aab9fea3 |
files | test/sematest/PutTester.java test/sematest/TestSessionManager.java test/sematest/Tester.java |
diffstat | 3 files changed, 21 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/test/sematest/PutTester.java Sun Aug 31 10:59:34 2008 +0900 +++ b/test/sematest/PutTester.java Sun Aug 31 11:19:59 2008 +0900 @@ -4,6 +4,7 @@ import rep.REP; import rep.REPCommand; +import rep.channel.REPServerSocketChannel; import rep.channel.REPSocketChannel; public class PutTester extends Tester { @@ -14,7 +15,7 @@ @Override public void sendCommand(REPSocketChannel<REPCommand> channel)throws IOException { - + REPCommand command = new REPCommand(); command.setCMD(REP.SMCMD_PUT); command.setString("put test");
--- a/test/sematest/TestSessionManager.java Sun Aug 31 10:59:34 2008 +0900 +++ b/test/sematest/TestSessionManager.java Sun Aug 31 11:19:59 2008 +0900 @@ -1,7 +1,6 @@ package test.sematest; import java.io.IOException; -import java.util.ArrayList; import rep.SessionManager; import rep.channel.REPLogger; import rep.channel.REPServerSocketChannel; @@ -9,36 +8,15 @@ public class TestSessionManager { - private ArrayList<TestEditor> editorList; - private int numberEditor; static public REPLogger logger = REPLogger.singleton(); public TestSessionManager(int sm, int ss, int e) { - editorList = new ArrayList<TestEditor>(); - numberEditor = e; - } - - public static void main(String[] args){ - REPServerSocketChannel.isSimulation = false; - TestSessionManager test = new TestSessionManager(1, 0, 2); - logger.setLogLevel(5); - test.startTest(); } private void startTest() { - String host = "localhost"; int masterPort = 8766; String[] strs ={String.valueOf(masterPort), String.valueOf(masterPort)}; - startSessionManager(strs); - -// for (int i=0; i<numberEditor; i++){ -// logger.writeLog("create Editors", 1); -// TestEditor te = new TestEditor("Editor"+i,host, masterPort); -// editorList.add(te); -// te.start(); -// } - } private void startSessionManager(final String[] strs) { @@ -55,4 +33,11 @@ }).start(); } + public static void main(String[] args){ + REPServerSocketChannel.isSimulation = false; + TestSessionManager test = new TestSessionManager(1, 0, 2); + logger.setLogLevel(5); + test.startTest(); + } + }
--- a/test/sematest/Tester.java Sun Aug 31 10:59:34 2008 +0900 +++ b/test/sematest/Tester.java Sun Aug 31 11:19:59 2008 +0900 @@ -4,18 +4,22 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; +import rep.REP; import rep.REPCommand; import rep.REPCommandPacker; import rep.channel.REPLogger; +import rep.channel.REPServerSocketChannel; import rep.channel.REPSocketChannel; -import test.channeltest.StringPacker; public abstract class Tester extends Thread{ private SocketAddress semaIP; private REPLogger ns; + private boolean running = true; public Tester(String name, String _host,int _port){ super(name); + + REPServerSocketChannel.isSimulation = false; semaIP = new InetSocketAddress(_host, _port); ns = REPLogger.singleton(); ns.setLogLevel(5); @@ -37,9 +41,13 @@ sendCommand(channel); ns.writeLog("wrote packet", 1); - REPCommand packet = channel.read(); - - ns.writeLog("gets return string==> `"+packet+"\'", 1); + while(running){ + REPCommand packet = channel.read(); + ns.writeLog("gets return string==> `"+packet+"\'", 1); + if(packet.cmd == REP.SMCMD_QUIT){ + running = false; + } + } ns.writeLog("testEditor exits.", 1);