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

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

Introduction

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

Prototype

public static boolean isPositiveCompletion(int reply) 

Source Link

Document

Determine if a reply code is a positive completion response.

Usage

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

public void testREIN() throws Exception {
    assertTrue(client.login(ADMIN_USERNAME, ADMIN_PASSWORD));
    assertTrue(FTPReply.isPositiveCompletion(client.rein()));
    assertTrue(client.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
}

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

public void testLoginThenPass() throws Exception {
    assertTrue(client.login(ADMIN_USERNAME, ADMIN_PASSWORD));

    int reply = client.pass(ADMIN_PASSWORD);

    assertTrue(FTPReply.isPositiveCompletion(reply));
}

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

public void testRenameWithNoopInBetween() throws Exception {
    TEST_FILE1.createNewFile();//from   ww  w  .j a va  2 s  .  c  om

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

    assertTrue(FTPReply.isPositiveIntermediate(client.rnfr(TEST_FILE1.getName())));
    assertTrue(FTPReply.isPositiveCompletion(client.noop()));
    assertTrue(FTPReply.isNegativePermanent(client.rnto(TEST_FILE2.getName())));

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

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

public void testRenameWithDoubleRnfr() throws Exception {
    TEST_FILE1.createNewFile();//from  ww  w.j a  v  a2  s. c  o  m
    TEST_FILE3.createNewFile();

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

    assertTrue(FTPReply.isPositiveIntermediate(client.rnfr(TEST_FILE1.getName())));
    assertTrue(FTPReply.isPositiveIntermediate(client.rnfr(TEST_FILE3.getName())));
    assertTrue(FTPReply.isPositiveCompletion(client.rnto(TEST_FILE2.getName())));

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

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

public void testSizeOnFile() throws Exception {
    TestUtil.writeDataToFile(TEST_FILE1, TEST_DATA1);

    assertTrue(FTPReply.isPositiveCompletion(client.sendCommand("SIZE " + TEST_FILE1.getName())));
    assertSizeReply(client.getReplyString(), TEST_DATA1.length);

    assertTrue(FTPReply.isPositiveCompletion(client.sendCommand("SIZE /" + TEST_FILE1.getName())));
    assertSizeReply(client.getReplyString(), TEST_DATA1.length);
}

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

public void testSyst() throws Exception {
    assertTrue(FTPReply.isPositiveCompletion(client.syst()));
    // hardcoded to Unix as that's the type of list etc we use
    assertEquals("215 UNIX Type: Apache FtpServer", client.getReplyString().trim());
}

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

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

    // send TYPE I
    assertTrue(FTPReply.isPositiveCompletion(client.type(2)));

    assertEquals(DataType.BINARY, getFtpSession().getDataType());

    // send TYPE A
    assertTrue(FTPReply.isPositiveCompletion(client.type(0)));

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

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

public void testSite() throws Exception {
    client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
    assertTrue(FTPReply.isPositiveCompletion(client.site("HELP")));
}

From source file:org.apache.ftpserver.ssl.ExplicitSecurityTestTemplate.java

/**
 * Tests that we can send command over the command channel. This is, in fact
 * already tested by login in setup but an explicit test is good anyways.
 *///from   ww w . j  ava2s.c o  m
public void testCommandChannel() throws Exception {
    assertTrue(getActiveSession().isSecure());
    assertTrue(FTPReply.isPositiveCompletion(client.noop()));
}

From source file:org.apache.ftpserver.ssl.ExplicitSecurityTestTemplate.java

public void testReissueAuth() throws Exception {
    assertTrue(getActiveSession().isSecure());
    assertTrue(FTPReply.isPositiveCompletion(client.noop()));

    // we do not accept reissued AUTH or AUTH on implicitly secured socket
    assertEquals(534, client.sendCommand("AUTH SSL"));
}