Search in sources :

Example 1 with History

use of com.github.jmchilton.blend4j.galaxy.beans.History in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testFilesToLibraryToHistoryFailNoHistory.

/**
 * Tests failure to upload a list of files to a Galaxy history through a Library (no history).
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test(expected = UploadException.class)
public void testFilesToLibraryToHistoryFailNoHistory() throws UploadException, GalaxyDatasetException {
    History history = galaxyHistory.newHistoryForWorkflow();
    history.setId("invalid");
    Library library = buildEmptyLibrary("testFilesToLibraryToHistoryFail");
    galaxyHistory.filesToLibraryToHistory(Sets.newHashSet(dataFile), FILE_TYPE, history, library, DataStorage.LOCAL);
}
Also used : Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 2 with History

use of com.github.jmchilton.blend4j.galaxy.beans.History in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testDownloadDatasetFailDatasetId.

/**
 * Tests failing to download a dataset (invalid dataset id)
 * @throws IOException
 * @throws InterruptedException
 * @throws ExecutionManagerException
 * @throws TimeoutException
 */
@Test(expected = ExecutionManagerDownloadException.class)
public void testDownloadDatasetFailDatasetId() throws IOException, TimeoutException, ExecutionManagerException, InterruptedException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Dataset dataset = galaxyHistory.fileToHistory(dataFile, InputFileType.FASTQ_SANGER, history);
    Util.waitUntilHistoryComplete(history.getId(), galaxyHistory, 60);
    String invalidDatasetId = dataset.getId() + "a";
    Path datasetPath = Files.createTempFile("data", "fastq");
    galaxyHistory.downloadDatasetTo(history.getId(), invalidDatasetId, datasetPath);
}
Also used : Path(java.nio.file.Path) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 3 with History

use of com.github.jmchilton.blend4j.galaxy.beans.History in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testNewHistoryForWorkflow.

/**
 * Tests constructing new history for a workflow.
 */
@Test
public void testNewHistoryForWorkflow() {
    GalaxyInstance galaxyInstanceAdmin = localGalaxy.getGalaxyInstanceAdmin();
    HistoriesClient historiesClient = galaxyInstanceAdmin.getHistoriesClient();
    History actualHistory = galaxyHistory.newHistoryForWorkflow();
    assertNotNull(actualHistory);
    // make sure history is within Galaxy
    History foundHistory = null;
    for (History h : historiesClient.getHistories()) {
        if (h.getId().equals(actualHistory.getId())) {
            foundHistory = h;
        }
    }
    assertNotNull(foundHistory);
}
Also used : History(com.github.jmchilton.blend4j.galaxy.beans.History) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) Test(org.junit.Test)

Example 4 with History

use of com.github.jmchilton.blend4j.galaxy.beans.History in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testFileToHistoryInvalidType.

/**
 * Tests failure to upload file to history due to invalid file type.
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test(expected = NullPointerException.class)
public void testFileToHistoryInvalidType() throws UploadException, GalaxyDatasetException {
    History history = galaxyHistory.newHistoryForWorkflow();
    galaxyHistory.fileToHistory(dataFile, INVALID_FILE_TYPE, history);
}
Also used : History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 5 with History

use of com.github.jmchilton.blend4j.galaxy.beans.History in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testDownloadDatasetSuccess.

/**
 * Tests downloading a dataset successfully.
 * @throws IOException
 * @throws InterruptedException
 * @throws ExecutionManagerException
 * @throws TimeoutException
 */
@Test
public void testDownloadDatasetSuccess() throws IOException, TimeoutException, ExecutionManagerException, InterruptedException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Dataset dataset = galaxyHistory.fileToHistory(dataFile, InputFileType.FASTQ_SANGER, history);
    Util.waitUntilHistoryComplete(history.getId(), galaxyHistory, 60);
    Path datasetPath = Files.createTempFile("data", "fastq");
    galaxyHistory.downloadDatasetTo(history.getId(), dataset.getId(), datasetPath);
    assertEquals("file lengths should be equals", Files.size(dataFile), Files.size(datasetPath));
    assertTrue("uploaded and downloaded dataset should be equal", com.google.common.io.Files.equal(dataFile.toFile(), datasetPath.toFile()));
}
Also used : Path(java.nio.file.Path) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Aggregations

History (com.github.jmchilton.blend4j.galaxy.beans.History)61 Test (org.junit.Test)54 Path (java.nio.file.Path)25 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)24 WithMockUser (org.springframework.security.test.context.support.WithMockUser)22 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)19 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)19 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 Dataset (com.github.jmchilton.blend4j.galaxy.beans.Dataset)17 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)11 Library (com.github.jmchilton.blend4j.galaxy.beans.Library)10 ToolsClient (com.github.jmchilton.blend4j.galaxy.ToolsClient)9 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)8 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)8 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)7 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)7 CollectionResponse (com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionResponse)7 WorkflowInputsGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy)6 WorkflowInputs (com.github.jmchilton.blend4j.galaxy.beans.WorkflowInputs)6