Search in sources :

Example 1 with HistoryDeleteResponse

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

the class AnalysisExecutionServiceGalaxyTest method setup.

/**
 * Setup variables for tests.
 *
 * @throws IridaWorkflowNotFoundException
 * @throws IOException
 * @throws ExecutionManagerException
 * @throws NoSuchValueException
 * @throws IridaWorkflowAnalysisTypeException
 */
@Before
public void setup() throws IridaWorkflowNotFoundException, IOException, ExecutionManagerException, NoSuchValueException, IridaWorkflowAnalysisTypeException, AnalysisAlreadySetException {
    MockitoAnnotations.initMocks(this);
    String submissionName = "name";
    Set<SequencingObject> submissionInputFiles = Sets.newHashSet(new SingleEndSequenceFile(new SequenceFile()));
    analysisSubmission = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "intial").inputFiles(submissionInputFiles).build();
    analysisPreparing = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "preparing").inputFiles(submissionInputFiles).build();
    analysisPrepared = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "prepared").inputFiles(submissionInputFiles).build();
    analysisSubmitting = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "submitting").inputFiles(submissionInputFiles).build();
    analysisRunning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "running").inputFiles(submissionInputFiles).build();
    analysisFinishedRunning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "finishedrunning").inputFiles(submissionInputFiles).build();
    analysisCompleting = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "completing").inputFiles(submissionInputFiles).build();
    analysisCompleted = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "completed").inputFiles(submissionInputFiles).build();
    analysisCompletedCleaning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "cleaning").inputFiles(submissionInputFiles).build();
    analysisCompletedCleaned = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "cleaned").inputFiles(submissionInputFiles).build();
    analysisError = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "error").inputFiles(submissionInputFiles).build();
    analysisErrorCleaning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "errorcleaning").inputFiles(submissionInputFiles).build();
    analysisErrorCleaned = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "errorcleaned").inputFiles(submissionInputFiles).build();
    AnalysisExecutionServiceGalaxyAsync workflowManagementAsync = new AnalysisExecutionServiceGalaxyAsync(analysisSubmissionService, analysisService, galaxyWorkflowService, analysisWorkspaceService, iridaWorkflowsService, analysisSubmissionSampleProcessor);
    AnalysisExecutionServiceGalaxyCleanupAsync analysisExecutionServiceGalaxyCleanupAsync = new AnalysisExecutionServiceGalaxyCleanupAsync(analysisSubmissionService, galaxyWorkflowService, galaxyHistoriesService, galaxyLibrariesService);
    workflowManagement = new AnalysisExecutionServiceGalaxy(analysisSubmissionService, galaxyHistoriesService, workflowManagementAsync, analysisExecutionServiceGalaxyCleanupAsync);
    when(iridaWorkflowsService.getIridaWorkflow(WORKFLOW_ID)).thenReturn(iridaWorkflow);
    when(iridaWorkflow.getWorkflowStructure()).thenReturn(iridaWorkflowStructure);
    when(iridaWorkflowStructure.getWorkflowFile()).thenReturn(workflowFile);
    when(analysisSubmissionService.create(analysisSubmission)).thenReturn(analysisSubmission);
    when(analysisSubmissionService.read(INTERNAL_ANALYSIS_ID)).thenReturn(analysisSubmission);
    analysisSubmission.setId(INTERNAL_ANALYSIS_ID);
    analysisPreparing.setId(INTERNAL_ANALYSIS_ID);
    analysisPreparing.setAnalysisState(AnalysisState.PREPARING);
    when(analysisWorkspaceService.prepareAnalysisWorkspace(analysisPreparing)).thenReturn(ANALYSIS_ID);
    analysisPrepared.setId(INTERNAL_ANALYSIS_ID);
    analysisPrepared.setAnalysisState(AnalysisState.PREPARED);
    analysisPrepared.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisPrepared.setRemoteAnalysisId(ANALYSIS_ID);
    analysisSubmitting.setId(INTERNAL_ANALYSIS_ID);
    analysisSubmitting.setAnalysisState(AnalysisState.SUBMITTING);
    analysisSubmitting.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisSubmitting.setRemoteAnalysisId(ANALYSIS_ID);
    analysisRunning.setId(INTERNAL_ANALYSIS_ID);
    analysisRunning.setAnalysisState(AnalysisState.RUNNING);
    analysisRunning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisRunning.setRemoteAnalysisId(ANALYSIS_ID);
    analysisRunning.setRemoteInputDataId(LIBRARY_ID);
    analysisFinishedRunning.setId(INTERNAL_ANALYSIS_ID);
    analysisFinishedRunning.setAnalysisState(AnalysisState.FINISHED_RUNNING);
    analysisFinishedRunning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisFinishedRunning.setRemoteAnalysisId(ANALYSIS_ID);
    analysisFinishedRunning.setRemoteInputDataId(LIBRARY_ID);
    analysisCompleting.setId(INTERNAL_ANALYSIS_ID);
    analysisCompleting.setAnalysisState(AnalysisState.COMPLETING);
    analysisCompleting.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisCompleting.setRemoteAnalysisId(ANALYSIS_ID);
    analysisCompleting.setRemoteInputDataId(LIBRARY_ID);
    when(analysisWorkspaceService.getAnalysisResults(analysisCompleting)).thenReturn(analysisResults);
    when(analysisService.create(analysisResults)).thenReturn(analysisResults);
    analysisCompleted.setId(INTERNAL_ANALYSIS_ID);
    analysisCompleted.setAnalysisState(AnalysisState.COMPLETED);
    analysisCompleted.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisCompleted.setRemoteAnalysisId(ANALYSIS_ID);
    analysisCompleted.setAnalysisCleanedState(AnalysisCleanedState.NOT_CLEANED);
    analysisCompleted.setAnalysis(analysisResults);
    analysisCompleted.setRemoteInputDataId(LIBRARY_ID);
    analysisCompleted.setUpdateSamples(true);
    analysisCompletedCleaning.setId(INTERNAL_ANALYSIS_ID);
    analysisCompletedCleaning.setAnalysisState(AnalysisState.COMPLETED);
    analysisCompletedCleaning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisCompletedCleaning.setRemoteAnalysisId(ANALYSIS_ID);
    analysisCompletedCleaning.setAnalysisCleanedState(AnalysisCleanedState.CLEANING);
    analysisCompletedCleaning.setAnalysis(analysisResults);
    analysisCompletedCleaning.setRemoteInputDataId(LIBRARY_ID);
    analysisCompletedCleaned.setId(INTERNAL_ANALYSIS_ID);
    analysisCompletedCleaned.setAnalysisState(AnalysisState.COMPLETED);
    analysisCompletedCleaned.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisCompletedCleaned.setRemoteAnalysisId(ANALYSIS_ID);
    analysisCompletedCleaned.setAnalysisCleanedState(AnalysisCleanedState.CLEANED);
    analysisCompletedCleaned.setAnalysis(analysisResults);
    analysisCompletedCleaned.setRemoteInputDataId(LIBRARY_ID);
    analysisError.setId(INTERNAL_ANALYSIS_ID);
    analysisError.setAnalysisState(AnalysisState.ERROR);
    analysisError.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisError.setAnalysisCleanedState(AnalysisCleanedState.NOT_CLEANED);
    analysisErrorCleaning.setId(INTERNAL_ANALYSIS_ID);
    analysisErrorCleaning.setAnalysisState(AnalysisState.ERROR);
    analysisErrorCleaning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisErrorCleaning.setAnalysisCleanedState(AnalysisCleanedState.CLEANING);
    analysisErrorCleaned.setId(INTERNAL_ANALYSIS_ID);
    analysisErrorCleaned.setAnalysisState(AnalysisState.ERROR);
    analysisErrorCleaned.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
    analysisErrorCleaned.setAnalysisCleanedState(AnalysisCleanedState.CLEANED);
    analysisPrepared.setRemoteAnalysisId(ANALYSIS_ID);
    preparedWorkflow = new PreparedWorkflowGalaxy(ANALYSIS_ID, LIBRARY_ID, workflowInputsGalaxy);
    when(galaxyWorkflowService.uploadGalaxyWorkflow(workflowFile)).thenReturn(REMOTE_WORKFLOW_ID);
    when(galaxyHistoriesService.deleteHistory(ANALYSIS_ID)).thenReturn(new HistoryDeleteResponse());
}
Also used : AnalysisExecutionServiceGalaxyAsync(ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxyAsync) SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) AnalysisExecutionServiceGalaxy(ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxy) AnalysisExecutionServiceGalaxyCleanupAsync(ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxyCleanupAsync) PreparedWorkflowGalaxy(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy) HistoryDeleteResponse(com.github.jmchilton.blend4j.galaxy.beans.HistoryDeleteResponse) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Before(org.junit.Before)

Example 2 with HistoryDeleteResponse

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

the class GalaxyHistoriesServiceIT method testDeleteHistorySuccess.

/**
 * Tests deleting a history from Galaxy successfully.
 * @throws ExecutionManagerException
 */
@Test
public void testDeleteHistorySuccess() throws ExecutionManagerException {
    History history = galaxyHistory.newHistoryForWorkflow();
    assertNotNull("History contents should not be null", galaxyHistory.showHistoryContents(history.getId()));
    HistoryDeleteResponse deleteResponse = galaxyHistory.deleteHistory(history.getId());
    assertTrue("History is not deleted", deleteResponse.getDeleted());
}
Also used : HistoryDeleteResponse(com.github.jmchilton.blend4j.galaxy.beans.HistoryDeleteResponse) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Aggregations

HistoryDeleteResponse (com.github.jmchilton.blend4j.galaxy.beans.HistoryDeleteResponse)2 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)1 AnalysisExecutionServiceGalaxy (ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxy)1 AnalysisExecutionServiceGalaxyAsync (ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxyAsync)1 AnalysisExecutionServiceGalaxyCleanupAsync (ca.corefacility.bioinformatics.irida.service.analysis.execution.galaxy.AnalysisExecutionServiceGalaxyCleanupAsync)1 History (com.github.jmchilton.blend4j.galaxy.beans.History)1 Before (org.junit.Before)1 Test (org.junit.Test)1