Search in sources :

Example 1 with HistoriesClient

use of com.github.jmchilton.blend4j.galaxy.HistoriesClient 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 2 with HistoriesClient

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

the class GalaxyHistoriesServiceIT method setup.

/**
 * Sets up files for history tests.
 * @throws URISyntaxException
 * @throws IOException
 * @throws CreateLibraryException
 * @throws ExecutionManagerObjectNotFoundException
 */
@Before
public void setup() throws URISyntaxException, IOException, CreateLibraryException, ExecutionManagerObjectNotFoundException {
    setupDataFiles();
    galaxyInstanceAdmin = localGalaxy.getGalaxyInstanceAdmin();
    HistoriesClient historiesClient = galaxyInstanceAdmin.getHistoriesClient();
    ToolsClient toolsClient = galaxyInstanceAdmin.getToolsClient();
    LibrariesClient librariesClient = galaxyInstanceAdmin.getLibrariesClient();
    galaxyLibrariesService = new GalaxyLibrariesService(librariesClient, LIBRARY_POLLING_TIME, LIBRARY_TIMEOUT, 1);
    galaxyHistory = new GalaxyHistoriesService(historiesClient, toolsClient, galaxyLibrariesService);
}
Also used : GalaxyHistoriesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyHistoriesService) ToolsClient(com.github.jmchilton.blend4j.galaxy.ToolsClient) LibrariesClient(com.github.jmchilton.blend4j.galaxy.LibrariesClient) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) GalaxyLibrariesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService) Before(org.junit.Before)

Example 3 with HistoriesClient

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

the class AnalysisCollectionServiceGalaxyIT method testUploadSequenceFilesPairedFailForward.

/**
 * Tests failing to upload a paired-end sequence file to Galaxy and
 * constructing a collection due to no found forward file.
 *
 * @throws ExecutionManagerException
 */
@Test(expected = NoSuchElementException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testUploadSequenceFilesPairedFailForward() throws ExecutionManagerException {
    History history = new History();
    history.setName("testUploadSequenceFilesPairedFailForward");
    HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
    LibrariesClient librariesClient = localGalaxy.getGalaxyInstanceAdmin().getLibrariesClient();
    History createdHistory = historiesClient.create(history);
    Library library = new Library();
    library.setName("testUploadSequenceFilesPairedFailForward");
    Library createdLibrary = librariesClient.createLibrary(library);
    Set<SequenceFilePair> sequenceFiles = Sets.newHashSet(databaseSetupGalaxyITService.setupSampleSequenceFileInDatabase(1L, pairSequenceFiles1AInvalidName, pairSequenceFiles2A));
    Map<Sample, IridaSequenceFilePair> sampleSequenceFilePairs = new HashMap<>(sequencingObjectService.getUniqueSamplesForSequencingObjects(sequenceFiles));
    analysisCollectionServiceGalaxy.uploadSequenceFilesPaired(sampleSequenceFilePairs, createdHistory, createdLibrary);
}
Also used : IridaSequenceFilePair(ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) IridaSequenceFilePair(ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair) HashMap(java.util.HashMap) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) LibrariesClient(com.github.jmchilton.blend4j.galaxy.LibrariesClient) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 4 with HistoriesClient

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

the class AnalysisWorkspaceServiceGalaxyIT method testPrepareAnalysisFilesParametersFailInvalidParameter.

/**
 * Tests out failing to prepare paired workflow input files for execution
 * with parameters due to an invalid parameter passed.
 *
 * @throws InterruptedException
 * @throws ExecutionManagerException
 * @throws IOException
 * @throws IridaWorkflowException
 */
@Test(expected = IridaWorkflowParameterException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testPrepareAnalysisFilesParametersFailInvalidParameter() throws InterruptedException, ExecutionManagerException, IOException, IridaWorkflowException {
    History history = new History();
    history.setName("testPrepareAnalysisFilesParametersFailInvalidParameter");
    HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
    WorkflowsClient workflowsClient = localGalaxy.getGalaxyInstanceAdmin().getWorkflowsClient();
    History createdHistory = historiesClient.create(history);
    IridaWorkflow iridaWorkflow = iridaWorkflowsService.getIridaWorkflow(validWorkflowIdPairedWithParameters);
    Path workflowPath = iridaWorkflow.getWorkflowStructure().getWorkflowFile();
    String workflowString = new String(Files.readAllBytes(workflowPath), StandardCharsets.UTF_8);
    Workflow galaxyWorkflow = workflowsClient.importWorkflow(workflowString);
    Map<String, String> parameters = ImmutableMap.of("invalid", "20");
    AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairSequenceFiles1A, pairSequenceFiles2A, referenceFilePath, parameters, validWorkflowIdPairedWithParameters);
    analysisSubmission.setRemoteAnalysisId(createdHistory.getId());
    analysisSubmission.setRemoteWorkflowId(galaxyWorkflow.getId());
    analysisWorkspaceService.prepareAnalysisFiles(analysisSubmission);
}
Also used : Path(java.nio.file.Path) WorkflowsClient(com.github.jmchilton.blend4j.galaxy.WorkflowsClient) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Workflow(com.github.jmchilton.blend4j.galaxy.beans.Workflow) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) History(com.github.jmchilton.blend4j.galaxy.beans.History) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 5 with HistoriesClient

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

the class AnalysisWorkspaceServiceGalaxyIT method testPrepareAnalysisFilesFail.

/**
 * Tests out failure to prepare workflow input files for execution.
 *
 * @throws InterruptedException
 * @throws ExecutionManagerException
 * @throws IOException
 * @throws IridaWorkflowException
 */
@Test(expected = WorkflowException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testPrepareAnalysisFilesFail() throws InterruptedException, ExecutionManagerException, IOException, IridaWorkflowException {
    History history = new History();
    history.setName("testPrepareAnalysisFilesFail");
    HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
    History createdHistory = historiesClient.create(history);
    AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePathA, referenceFilePath, validWorkflowIdSingle, false);
    analysisSubmission.setRemoteAnalysisId(createdHistory.getId());
    analysisSubmission.setRemoteWorkflowId("invalid");
    analysisWorkspaceService.prepareAnalysisFiles(analysisSubmission);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) History(com.github.jmchilton.blend4j.galaxy.beans.History) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)25 History (com.github.jmchilton.blend4j.galaxy.beans.History)23 Test (org.junit.Test)23 WithMockUser (org.springframework.security.test.context.support.WithMockUser)22 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)19 Path (java.nio.file.Path)19 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)18 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 ToolsClient (com.github.jmchilton.blend4j.galaxy.ToolsClient)10 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)8 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)8 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)7 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)7 LibrariesClient (com.github.jmchilton.blend4j.galaxy.LibrariesClient)7 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)6 ArrayList (java.util.ArrayList)6 WorkflowInputsGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy)5 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)4 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)3