Skip to content

Commit

Permalink
Fix broken test, where assert was invoked in a separate thread, and c…
Browse files Browse the repository at this point in the history
…hecking the temporary getUserArgument() rather than the correct getUser() (FTPSERVER-418)

git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@1138603 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Niklas Gustavsson committed Jun 22, 2011
1 parent a7251f6 commit 25e4d86
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import org.apache.commons.net.ftp.FTPReply;
import org.apache.ftpserver.FtpServerFactory;
Expand All @@ -34,6 +36,7 @@
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.Ftplet;
import org.apache.ftpserver.ftplet.FtpletResult;
import org.apache.ftpserver.ftplet.User;
import org.apache.ftpserver.test.TestUtil;

/**
Expand Down Expand Up @@ -83,19 +86,22 @@ protected FtpServerFactory createServer() throws Exception {
}

public void testLogin() throws Exception {
final LinkedBlockingQueue<User> loggedInUser = new LinkedBlockingQueue<User>();

MockFtplet.callback = new MockFtpletCallback() {
@Override
public FtpletResult onLogin(FtpSession session, FtpRequest request)
throws FtpException, IOException {
assertNotNull(session.getUserArgument());

loggedInUser.add(session.getUser());
return super.onLogin(session, request);
}

};
MockFtpletCallback.returnValue = FtpletResult.DEFAULT;

assertTrue(client.login(ADMIN_USERNAME, ADMIN_PASSWORD));

assertNotNull(loggedInUser.poll(2000, TimeUnit.MILLISECONDS));
}

public void testDelete() throws Exception {
Expand Down

0 comments on commit 25e4d86

Please sign in to comment.