CmdUser cmdUser = new CmdUser(FtpTestConfig.USER_ID);
assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(cmdUser));
}
{
CmdPass cmdPass = new CmdPass(FtpTestConfig.USER_PASS);
assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(cmdPass));
}
{
CmdSyst cmdSyst = new CmdSyst();
assertEquals(FtpConst.Replyes.REPLY_215, client.executeCommand(cmdSyst));
}
{
CmdCwd cmdCwd = new CmdCwd(FtpTestConfig.TEST_FOLDER);
if (FtpConst.Replyes.REPLY_550 == client.executeCommand(cmdCwd))
{
CmdMkd cmdMkd = new CmdMkd(FtpTestConfig.TEST_FOLDER);
assertEquals(FtpConst.Replyes.REPLY_257, client.executeCommand(cmdMkd));
cmdCwd = new CmdCwd(FtpTestConfig.TEST_FOLDER);
assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(cmdCwd));
}
for (int i1 = 0; i1 < 10; i1++)
{
String folderName = FtpTestConfig.TEST_FOLDER + "/" + i1;
assertEquals(FtpConst.Replyes.REPLY_257, client.executeCommand(new CmdMkd(folderName)));
for (int i2 = 0; i2 < 10; i2++)
{
String testSubFolder = folderName + "/" + i2;
assertEquals(FtpConst.Replyes.REPLY_257, client.executeCommand(new CmdMkd(testSubFolder)));
}
}
}
client.close();
}
HashMap<Integer, TestAgent> clients = new HashMap<Integer, TestAgent>();
int count = 0;
Random random = new Random();
while (count < FtpTestConfig.CLIENTS_COUNT)
{
int nextId = random.nextInt(Integer.MAX_VALUE);
log.info("NEXT ID: [" + nextId + "]");
if (nextId < 10000)
{
continue;
}
Integer curInteger = new Integer(nextId);
if (clients.containsKey(curInteger))
{
continue;
}
TestAgent testAgent = new TestAgent(curInteger, FtpTestConfig.CLIENT_DEPTH);
clients.put(curInteger, testAgent);
count++;
}
log.info("CLIENTS: [" + clients.size() + "]");
Thread.sleep(3000);
log.info("START ALL!!!!!!!!!!!!!!!!!!!!!!!!");
IsNeedWaitAll = false;
Thread.sleep(3000);
{
boolean alive = true;
while (alive)
{
alive = false;
Thread.sleep(2000);
int live = 0;
Iterator<Integer> keyIter = clients.keySet().iterator();
while (keyIter.hasNext())
{
Integer agentKey = keyIter.next();
TestAgent agent = clients.get(agentKey);
if (agent.isAlive())
{
alive = true;
live++;
}
}
log.info(">>>>>>>>>>>>> LIVE: [" + live + "]");
}
}
{
{
FtpClientSession client = new FtpClientSessionImpl(FtpTestConfig.FTP_HOST, FtpTestConfig.FTP_PORT);
client.connect();
{
CmdUser cmdUser = new CmdUser(FtpTestConfig.USER_ID);
assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(cmdUser));
}
{
CmdPass cmdPass = new CmdPass(FtpTestConfig.USER_PASS);
assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(cmdPass));
}
{
CmdSyst cmdSyst = new CmdSyst();