Search in sources :

Example 6 with FtpletResult

use of org.apache.ftpserver.ftplet.FtpletResult in project ddf by codice.

the class FtpRequestHandlerTest method testOnRmdirStart.

@Test
public void testOnRmdirStart() throws FtpException, IOException {
    FtpletResult result = ftplet.onRmdirStart(session, request);
    assertEquals(FtpletResult.SKIP, result);
    assertThat(getReplyCodes(), hasItem(250));
}
Also used : FtpletResult(org.apache.ftpserver.ftplet.FtpletResult) Test(org.junit.Test)

Example 7 with FtpletResult

use of org.apache.ftpserver.ftplet.FtpletResult in project ddf by codice.

the class FtpRequestHandlerTest method testOnAppendStart.

@Test
public void testOnAppendStart() throws FtpException, IOException {
    FtpletResult result = ftplet.onAppendStart(session, request);
    assertEquals(FtpletResult.SKIP, result);
    assertThat(getReplyCodes(), hasItem(250));
}
Also used : FtpletResult(org.apache.ftpserver.ftplet.FtpletResult) Test(org.junit.Test)

Example 8 with FtpletResult

use of org.apache.ftpserver.ftplet.FtpletResult in project ddf by codice.

the class FtpRequestHandlerTest method testOnRenameStart.

@Test
public void testOnRenameStart() throws FtpException, IOException {
    FtpFile ftpFile = mock(FtpFile.class);
    when(ftpFile.getName()).thenReturn("test.txt");
    when(session.getRenameFrom()).thenReturn(ftpFile);
    FtpletResult result = ftplet.onRenameStart(session, request);
    assertEquals(FtpletResult.SKIP, result);
    assertThat(getReplyCodes(), hasItem(250));
}
Also used : FtpletResult(org.apache.ftpserver.ftplet.FtpletResult) FtpFile(org.apache.ftpserver.ftplet.FtpFile) Test(org.junit.Test)

Example 9 with FtpletResult

use of org.apache.ftpserver.ftplet.FtpletResult in project ddf by codice.

the class FtpRequestHandlerTest method testFileIngestUniqueSuccess.

@Test
public void testFileIngestUniqueSuccess() throws FtpException, IOException, SourceUnavailableException, IngestException {
    setupIngest();
    FtpletResult result = ftplet.onUploadUniqueStart(session, request);
    ArgumentCaptor<FtpReply> argumentCaptor = ArgumentCaptor.forClass(FtpReply.class);
    verify(session, atLeast(1)).write(argumentCaptor.capture());
    assertEquals(FtpletResult.SKIP, result);
    List<String> strReplies = argumentCaptor.getAllValues().stream().map(FtpReply::getMessage).collect(Collectors.toList());
    assertThat(strReplies, hasItem(containsString("Storing data with unique name: " + METACARD_ID)));
}
Also used : FtpletResult(org.apache.ftpserver.ftplet.FtpletResult) Matchers.containsString(org.hamcrest.Matchers.containsString) FtpReply(org.apache.ftpserver.ftplet.FtpReply) Test(org.junit.Test)

Aggregations

FtpletResult (org.apache.ftpserver.ftplet.FtpletResult)9 Test (org.junit.Test)9 FtpFile (org.apache.ftpserver.ftplet.FtpFile)1 FtpReply (org.apache.ftpserver.ftplet.FtpReply)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1