Mercurial > hg > RemoteEditor > REPSessionManager
changeset 291:9e162e0a114f
*** empty log message ***
author | kono |
---|---|
date | Mon, 29 Sep 2008 06:34:13 +0900 |
parents | 4b773ba03556 |
children | 975383c0548e |
files | test/sematest/TestGUI.java test/sematest/TestSessionManager.java test/sematest/testGUI.java |
diffstat | 3 files changed, 51 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sematest/TestGUI.java Mon Sep 29 06:34:13 2008 +0900 @@ -0,0 +1,49 @@ +package test.sematest; + +import java.util.LinkedList; + +import rep.Editor; +import rep.SelectButtonEvent; +import rep.Session; +import rep.SessionManagerEvent; +import rep.SessionManagerEventListener; +import rep.SessionManagerGUI; + +/** + * @author kono + * Dummy GUI for test + * + * perform auto select operation + */ + +public class TestGUI implements SessionManagerGUI { + public LinkedList<Session> slist; + public LinkedList<Editor> elist; + SessionManagerEventListener manager; + int count = 0; + + public TestGUI(SessionManagerEventListener manager) { + this.manager = manager; + } + + public void invokeLater(Runnable doRun) { + doRun.run(); + } + + public void update(LinkedList<Session> slist, LinkedList<Editor> elist) { + this.slist = slist; + this.elist = elist; + // fair and deterministic select session for an empty editor + if (slist.size()==0) return; + Session s = slist.get(count++ % slist.size()); + for(Editor e :elist) { + if (!e.hasSession()) { + SessionManagerEvent event = new SelectButtonEvent(e, s, manager); + System.out.println("Select session "+s.getSID()+" and editor "+e.getEID()); + manager.buttonPressed(event); + s = slist.get(count++ % slist.size()); + } + } + } + +}
--- a/test/sematest/TestSessionManager.java Mon Sep 29 06:33:11 2008 +0900 +++ b/test/sematest/TestSessionManager.java Mon Sep 29 06:34:13 2008 +0900 @@ -68,15 +68,11 @@ REPServerSocketChannel.isSimulation = true; TestSessionManager test = new TestSessionManager(1, 0, 2); logger.setLogLevel(5); - try { - test.startTest(); - } catch (IOException e) { - } catch (InterruptedException e) { - } + test.startTest(); } - private void startTest() throws IOException, InterruptedException { + private void startTest() { int i = 0; for(SessionManager master:sessionManagers) { i = startSessionManager(master,i, masterPort + i);
--- a/test/sematest/testGUI.java Mon Sep 29 06:33:11 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -package test.sematest; - -import java.util.LinkedList; - -import rep.Editor; -import rep.SelectButtonEvent; -import rep.Session; -import rep.SessionManagerEvent; -import rep.SessionManagerEventListener; -import rep.SessionManagerGUI; - -/** - * @author kono - * Dummy GUI for test - * - * perform auto select operation - */ - -public class testGUI implements SessionManagerGUI { - public LinkedList<Session> slist; - public LinkedList<Editor> elist; - SessionManagerEventListener manager; - int count = 0; - - public testGUI(SessionManagerEventListener manager) { - this.manager = manager; - } - - public void invokeLater(Runnable doRun) { - doRun.run(); - } - - public void update(LinkedList<Session> slist, LinkedList<Editor> elist) { - this.slist = slist; - this.elist = elist; - // fair and deterministic select session for an empty editor - if (slist.size()==0) return; - Session s = slist.get(count++ % slist.size()); - for(Editor e :elist) { - if (!e.hasSession()) { - SessionManagerEvent event = new SelectButtonEvent(e, s, manager); - System.out.println("Select session "+s.getSID()+" and editor "+e.getEID()); - manager.buttonPressed(event); - s = slist.get(count++ % slist.size()); - } - } - } - -}