view test/sematest/TestSessionManager.java @ 192:6fb97c7a0b42

*** empty log message ***
author pin
date Fri, 29 Aug 2008 19:50:15 +0900
parents d03e34861a26
children 311847db7429
line wrap: on
line source

package test.sematest;

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<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 = true;
		TestSessionManager test = new TestSessionManager(1, 0, 2);
		logger.setLogLevel(5);
		test.startTest();
	}

	private void startTest() {
		String host = "localhost";
		int masterPort = 11000;
		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) {
		new Thread(new Runnable(){
			public void run(){
				try {
					SessionManager.main(strs);
				} catch (InterruptedException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}).start();
	}

}