# HG changeset patch # User pin # Date 1220136808 -32400 # Node ID 827c439d0da497b67a0623d3baec53619e5057a6 # Parent 4deaaaa6354e0008d285b81225dd9860f1f2c13d *** empty log message *** diff -r 4deaaaa6354e -r 827c439d0da4 rep/REPActionEvent.java --- a/rep/REPActionEvent.java Sun Aug 31 00:26:35 2008 +0900 +++ b/rep/REPActionEvent.java Sun Aug 31 07:53:28 2008 +0900 @@ -29,7 +29,6 @@ } public void exec() { - // TODO Auto-generated method stub manager.selectSession(this); } diff -r 4deaaaa6354e -r 827c439d0da4 rep/RPanel.java --- a/rep/RPanel.java Sun Aug 31 00:26:35 2008 +0900 +++ b/rep/RPanel.java Sun Aug 31 07:53:28 2008 +0900 @@ -108,8 +108,10 @@ actionListener.ActionOccured(new REPActionEvent((EditorPlus) comboEditor.getSelectedItem(), (SessionPlus)comboSession.getSelectedItem())); */ - actionListener.selectOccured(new REPActionEvent((EditorPlus) e_list.get(editor_table.getSelectedRow()), - (SessionPlus)s_list.get(session_table.getSelectedRow()), listener)); + //actionListener.selectOccured(new REPActionEvent((EditorPlus) e_list.get(editor_table.getSelectedRow()), + // (SessionPlus)s_list.get(session_table.getSelectedRow()), listener)); + manager.selectOccured(new REPActionEvent((EditorPlus) e_list.get(editor_table.getSelectedRow()), + (SessionPlus)s_list.get(session_table.getSelectedRow()), manager)); } } @@ -166,7 +168,7 @@ } protected void setTableSession(LinkedList list) { - e_tableModel.setRowCount(0); + s_tableModel.setRowCount(0); for(Session session : list){ setTableSession(session.getSID(), session.getName()); } diff -r 4deaaaa6354e -r 827c439d0da4 rep/handler/REPHandlerImpl.java --- a/rep/handler/REPHandlerImpl.java Sun Aug 31 00:26:35 2008 +0900 +++ b/rep/handler/REPHandlerImpl.java Sun Aug 31 07:53:28 2008 +0900 @@ -1,6 +1,8 @@ package rep.handler; import java.io.IOException; +import java.nio.channels.SelectableChannel; + import rep.REPCommand; import rep.REPCommandPacker; import rep.SessionManager; @@ -18,7 +20,11 @@ @SuppressWarnings("unchecked") public void handle(REPSelectionKey key) throws IOException { - REPSocketChannel channel = (REPSocketChannel) key.accept(new REPCommandPacker()); + SelectableChannel s = key.channel(); + if(!(s instanceof REPSocketChannel) ){ + System.out.println("error"); + } + REPSocketChannel channel = (REPSocketChannel) key.channel(new REPCommandPacker()); REPCommand command = channel.read(); manager.manage(channel, command); diff -r 4deaaaa6354e -r 827c439d0da4 test/sematest/JoinTester.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sematest/JoinTester.java Sun Aug 31 07:53:28 2008 +0900 @@ -0,0 +1,30 @@ +package test.sematest; + +import java.io.IOException; + +import rep.REP; +import rep.REPCommand; +import rep.channel.REPSocketChannel; + +public class JoinTester extends Tester { + + public JoinTester(String name, String _host, int _port) { + super(name, _host, _port); + } + + @Override + public void sendCommand(REPSocketChannel channel)throws IOException { + REPCommand command = new REPCommand(); + command.setCMD(REP.SMCMD_JOIN); + command.setString("join test"); + channel.write(command); + + channel.read(); + } + + public static void main(String[] args){ + Thread tester = new JoinTester("JoinTester", "localhost", 8766); + tester.start(); + } + +} diff -r 4deaaaa6354e -r 827c439d0da4 test/sematest/PutTester.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sematest/PutTester.java Sun Aug 31 07:53:28 2008 +0900 @@ -0,0 +1,32 @@ +package test.sematest; + +import java.io.IOException; + +import rep.REP; +import rep.REPCommand; +import rep.channel.REPSocketChannel; + +public class PutTester extends Tester { + + public PutTester(String name, String _host, int _port) { + super(name, _host, _port); + } + + @Override + public void sendCommand(REPSocketChannel channel)throws IOException { + + REPCommand command = new REPCommand(); + command.setCMD(REP.SMCMD_PUT); + command.setString("put test"); + channel.write(command); + + channel.read(); + + } + + public static void main(String[] args){ + Thread tester = new PutTester("PutTester", "localhost", 8766); + tester.start(); + } + +} diff -r 4deaaaa6354e -r 827c439d0da4 test/sematest/TestSessionManager.java --- a/test/sematest/TestSessionManager.java Sun Aug 31 00:26:35 2008 +0900 +++ b/test/sematest/TestSessionManager.java Sun Aug 31 07:53:28 2008 +0900 @@ -19,7 +19,7 @@ } public static void main(String[] args){ - REPServerSocketChannel.isSimulation = true; + REPServerSocketChannel.isSimulation = false; TestSessionManager test = new TestSessionManager(1, 0, 2); logger.setLogLevel(5); test.startTest(); @@ -32,12 +32,12 @@ startSessionManager(strs); - for (int i=0; i channel; + channel = REPSocketChannel.create(new REPCommandPacker()); + channel.configureBlocking(true); + + 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); + + sendCommand(channel); + ns.writeLog("wrote packet", 1); + + REPCommand packet = channel.read(); + + ns.writeLog("gets return string==> `"+packet+"\'", 1); + + ns.writeLog("testEditor exits.", 1); + + channel.close1(); + + } catch (IOException e) {} + } + + public abstract void sendCommand(REPSocketChannel channel) throws IOException; +}