import java.rmi.RemoteException;
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import com.ardic.arcsp.ws.WsClientException;
import com.ardic.arcsp.ws.impl.GenericAxis2WsClientHelper;
import com.ardic.manager.configuration.PropertyLoader;

public class MainTest {

/**
* @param args
* @throws DataServiceFaultException
* @throws RemoteException
* @throws WsClientException
* @throws InterruptedException
*/
public static void main(String[] args) throws RemoteException, WsClientException, InterruptedException {
long t1 = System.currentTimeMillis();

System.out.println("start " + t1);
ExecutorService execSvc = Executors.newFixedThreadPool( 300 );
//String [] deviceList = {"device1", "device2", "device3", "device4", "device5","device6","device7","device8","device9","device10"};
String [] commandList = {"lock", "unlock"};
Random generator = new Random();
GenericAxis2WsClientHelper wsHelper = new GenericAxis2WsClientHelper("/home/guclu.akkaya/conf/axis2_client.xml");
for( int i = 0; i < 300; i++ ){

int index1 = generator.nextInt(5000) ;
String deviceId = "sss" + i;
//WorkerThread t = new WorkerThread(wsHelper, deviceId, "", i+ "-PUSH_UMUT" + deviceId + "", "", "", "", "requester", "responseDestination");
//WorkerThreadCsn t = new WorkerThreadCsn(i, wsHelper, "deviceId" + index1, "", "PUSH_UMUT", "", "", "", "requester", "responseDestination");
//WorkerThreadCsnSelect t = new WorkerThreadCsnSelect(i, wsHelper, "b07bc97f-fe7e-4eb2-8d8f-a2302e966322" );
//WorkerThreadEcho t = new WorkerThreadEcho(wsHelper, String.valueOf(index1));
WorkerThreadTest t = new WorkerThreadTest(wsHelper, 1000);
execSvc.execute(t);
}
System.out.println("end " + String.valueOf(System.currentTimeMillis() - t1));
execSvc.shutdown();

try {
execSvc.awaitTermination(1000, TimeUnit.SECONDS);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("real end " + String.valueOf(System.currentTimeMillis() - t1));
}

}




