Search in sources :

Example 6 with TestEmailController

use of ca.corefacility.bioinformatics.irida.service.impl.TestEmailController in project irida by phac-nml.

the class ExportUploadServiceTest method testUploadSubmissionBadCredentials.

@Test(expected = UploadException.class)
public void testUploadSubmissionBadCredentials() throws UploadException, IOException {
    NcbiExportSubmission submission = createFakeSubmission();
    String ftpHost = "localhost";
    String ftpUser = "test";
    String ftpPassword = "password";
    String baseDirectory = "/home/test/submit/Test";
    FakeFtpServer server = new FakeFtpServer();
    // finds an open port
    server.setServerControlPort(0);
    ExportUploadService exportUploadService = new ExportUploadService(null, null, new TestEmailController());
    try {
        server.start();
        int ftpPort = server.getServerControlPort();
        exportUploadService.setConnectionDetails(ftpHost, ftpPort, ftpUser, ftpPassword, baseDirectory);
        String xml = "<xml></xml>";
        exportUploadService.uploadSubmission(submission, xml);
    } finally {
        server.stop();
    }
}
Also used : NcbiExportSubmission(ca.corefacility.bioinformatics.irida.model.NcbiExportSubmission) FakeFtpServer(org.mockftpserver.fake.FakeFtpServer) TestEmailController(ca.corefacility.bioinformatics.irida.service.impl.TestEmailController) Test(org.junit.Test)

Aggregations

NcbiExportSubmission (ca.corefacility.bioinformatics.irida.model.NcbiExportSubmission)6 TestEmailController (ca.corefacility.bioinformatics.irida.service.impl.TestEmailController)6 Test (org.junit.Test)6 FakeFtpServer (org.mockftpserver.fake.FakeFtpServer)5 UserAccount (org.mockftpserver.fake.UserAccount)4 DirectoryEntry (org.mockftpserver.fake.filesystem.DirectoryEntry)4 FileSystem (org.mockftpserver.fake.filesystem.FileSystem)4 UnixFakeFileSystem (org.mockftpserver.fake.filesystem.UnixFakeFileSystem)4 NcbiBioSampleFiles (ca.corefacility.bioinformatics.irida.model.export.NcbiBioSampleFiles)2 Set (java.util.Set)2 FileEntry (org.mockftpserver.fake.filesystem.FileEntry)2 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1