Example usage for org.apache.commons.net.ftp FTPReply isNegativePermanent

List of usage examples for org.apache.commons.net.ftp FTPReply isNegativePermanent

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPReply isNegativePermanent.

Prototype

public static boolean isNegativePermanent(int reply) 

Source Link

Document

Determine if a reply code is a negative permanent response.

Usage

From source file:org.apache.ftpserver.clienttests.RenameTest.java

public void testRenameWithNullRnfrPath() throws Exception {
    TEST_FILE1.createNewFile();/*from  www.  j a va2 s.c  o  m*/

    assertTrue(TEST_FILE1.exists());
    assertFalse(TEST_FILE2.exists());

    assertTrue(FTPReply.isNegativePermanent(client.rnfr(null)));

    assertTrue(TEST_FILE1.exists());
    assertFalse(TEST_FILE2.exists());
}

From source file:org.apache.ftpserver.clienttests.RenameTest.java

public void testRenameWithNullRntoPath() throws Exception {
    TEST_FILE1.createNewFile();//from www.ja  va2s.c  o  m

    assertTrue(TEST_FILE1.exists());
    assertFalse(TEST_FILE2.exists());

    assertTrue(FTPReply.isPositiveIntermediate(client.rnfr(TEST_FILE1.getName())));
    assertTrue(FTPReply.isNegativePermanent(client.rnto(null)));

    assertTrue(TEST_FILE1.exists());
    assertFalse(TEST_FILE2.exists());
}

From source file:org.apache.ftpserver.clienttests.SiteTest.java

public void testAnonNotAllowed() throws Exception {
    client.login(ANONYMOUS_USERNAME, ANONYMOUS_PASSWORD);

    assertTrue(FTPReply.isNegativePermanent(client.sendCommand("SITE DESCUSER admin")));
}

From source file:org.apache.ftpserver.clienttests.TypeTest.java

public void testUnknownType() throws Exception {
    assertEquals(DataType.ASCII, getFtpSession().getDataType());

    // send TYPE N, not supported by FtpServer
    assertTrue(FTPReply.isNegativePermanent(client.type(4)));

    assertEquals(DataType.ASCII, getFtpSession().getDataType());
}

From source file:org.apache.ftpserver.clienttests.TypeTest.java

public void testTypeNoArgument() throws Exception {
    assertEquals(DataType.ASCII, getFtpSession().getDataType());

    // send TYPE N, not supported by FtpServer
    assertTrue(FTPReply.isNegativePermanent(client.sendCommand("TYPE")));

    assertEquals(DataType.ASCII, getFtpSession().getDataType());
}

From source file:org.apache.ftpserver.ftpletcontainer.FtpLetReturnSkipTest.java

public void testExceptionDuringDownloadStart() throws Exception {
    MockFtplet.callback = new MockFtpletCallback() {
        public FtpletResult onDownloadStart(FtpSession session, FtpRequest request)
                throws FtpException, IOException {
            session.write(new DefaultFtpReply(FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "foo"));

            throwException();//from   www  .  j  av  a2 s  .c  o  m
            return mockReturnValue;
        }
    };

    TestUtil.writeDataToFile(TEST_FILE1, TESTDATA);

    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    client.retrieveFileStream(TEST_FILE1.getName());

    assertTrue(FTPReply.isNegativePermanent(client.getReplyCode()));
}