Package org.apache.ftpserver.command

Examples of org.apache.ftpserver.command.CommandFactory


            final FtpRequest request) throws Exception {
        try {
            session.updateLastAccessTime();
           
            String commandName = request.getCommand();
            CommandFactory commandFactory = context.getCommandFactory();
            Command command = commandFactory.getCommand(commandName);

            // make sure the user is authenticated before he issues commands
            if (!session.isLoggedIn()
                    && !isCommandOkWithoutAuthentication(commandName)) {
                session.write(LocalizedFtpReply.translate(session, request,
View Full Code Here


*
*/
public class DefaultCommandFactoryTest extends TestCase {

    public void testReturnFromDefaultUpper() {
        CommandFactory factory = new CommandFactoryFactory().createCommandFactory();
        Command command = factory.getCommand("STOR");

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }
View Full Code Here

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }

    public void testReturnFromDefaultLower() {
        CommandFactory factory = new CommandFactoryFactory().createCommandFactory();
        Command command = factory.getCommand("stor");

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }
View Full Code Here

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }

    public void testReturnFromDefaultUnknown() {
        CommandFactory factory = new CommandFactoryFactory().createCommandFactory();
        Command command = factory.getCommand("dummy");

        assertNull(command);
    }
View Full Code Here

    public void testOverride() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("stor", new NOOP());

        CommandFactory factory = factoryFactory.createCommandFactory();

        Command command = factory.getCommand("Stor");

        assertTrue(command instanceof NOOP);
    }
View Full Code Here

    public void testAppend() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("foo", new NOOP());

        CommandFactory factory = factoryFactory.createCommandFactory();

        assertTrue(factory.getCommand("FOO") instanceof NOOP);
        assertTrue(factory.getCommand("stor") instanceof STOR);
    }
View Full Code Here

    public void testAppendWithoutDefault() {
        CommandFactoryFactory factoryFactory = new CommandFactoryFactory();
        factoryFactory.addCommand("foo", new NOOP());
        factoryFactory.setUseDefaultCommands(false);

        CommandFactory factory = factoryFactory.createCommandFactory();
       
        assertTrue(factory.getCommand("FOO") instanceof NOOP);
        assertNull(factory.getCommand("stor"));
    }
View Full Code Here

        listener = listeners.get("listener2");
        assertNotNull(listener);
        assertTrue(listener instanceof MyCustomListener);
        assertEquals(2224, listener.getPort());

        CommandFactory cf = server.getCommandFactory();
        assertTrue(cf.getCommand("FOO") instanceof HELP);
        assertTrue(cf.getCommand("FOO2") instanceof STAT);

        List<String> languages = server.getServerContext().getMessageResource()
                .getAvailableLanguages();

        assertEquals(2, languages.size());
View Full Code Here

        listener = listeners.get("listener2");
        assertNotNull(listener);
        assertTrue(listener instanceof MyCustomListener);
        assertEquals(2224, listener.getPort());

        CommandFactory cf = server.getCommandFactory();
        assertTrue(cf.getCommand("FOO") instanceof HELP);
        assertTrue(cf.getCommand("FOO2") instanceof STAT);

        List<String> languages = server.getServerContext().getMessageResource()
                .getAvailableLanguages();

        assertEquals(2, languages.size());
View Full Code Here

*
*/
public class DefaultCommandFactoryTest extends TestCase {

    public void testReturnFromDefaultUpper() {
        CommandFactory factory = new CommandFactoryFactory().createCommandFactory();
        Command command = factory.getCommand("STOR");

        assertNotNull(command);
        assertTrue(command instanceof STOR);
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.command.CommandFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.