Search in sources :

Example 6 with History

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

the class GalaxyHistoriesServiceIT method testConstructCollectionSuccess.

/**
 * Tests out successfully constructing a collection of datasets.
 * @throws ExecutionManagerException
 */
@Test
public void testConstructCollectionSuccess() throws ExecutionManagerException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Dataset dataset1 = galaxyHistory.fileToHistory(dataFile, FILE_TYPE, history);
    Dataset dataset2 = galaxyHistory.fileToHistory(dataFile2, FILE_TYPE, history);
    assertNotNull(dataset1);
    assertNotNull(dataset2);
    String collectionName = "collection";
    CollectionDescription description = new CollectionDescription();
    description.setName(collectionName);
    description.setCollectionType(DatasetCollectionType.LIST.toString());
    HistoryDatasetElement element1 = new HistoryDatasetElement();
    element1.setId(dataset1.getId());
    element1.setName(dataset1.getName());
    description.addDatasetElement(element1);
    HistoryDatasetElement element2 = new HistoryDatasetElement();
    element2.setId(dataset2.getId());
    element2.setName(dataset2.getName());
    description.addDatasetElement(element2);
    CollectionResponse collectionResponse = galaxyHistory.constructCollection(description, history);
    assertNotNull(collectionResponse);
    assertEquals(DatasetCollectionType.LIST.toString(), collectionResponse.getCollectionType());
    assertEquals(history.getId(), collectionResponse.getHistoryId());
    assertEquals(2, collectionResponse.getElements().size());
}
Also used : Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) CollectionResponse(com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionResponse) CollectionDescription(com.github.jmchilton.blend4j.galaxy.beans.collection.request.CollectionDescription) HistoryDatasetElement(com.github.jmchilton.blend4j.galaxy.beans.collection.request.HistoryDatasetElement) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 7 with History

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

the class GalaxyHistoriesServiceIT method testLibraryDatasetToHistorySuccess.

/**
 * Tests moving a library dataset to a history success.
 * @throws ExecutionManagerObjectNotFoundException
 * @throws CreateLibraryException
 */
@Test
public void testLibraryDatasetToHistorySuccess() throws CreateLibraryException, ExecutionManagerObjectNotFoundException {
    Library library = buildEmptyLibrary("GalaxyHistoriesServiceIT.testLibraryDatasetToHistory");
    String fileId = setupLibraries(library, galaxyInstanceAdmin);
    History history = galaxyHistory.newHistoryForWorkflow();
    HistoryDetails details = galaxyHistory.libraryDatasetToHistory(fileId, history);
    assertNotNull(details);
}
Also used : HistoryDetails(com.github.jmchilton.blend4j.galaxy.beans.HistoryDetails) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 8 with History

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

the class GalaxyHistoriesServiceIT method testLibraryDatasetToHistoryFail.

/**
 * Tests moving a library dataset to a history fail.
 */
@Test(expected = GalaxyResponseException.class)
public void testLibraryDatasetToHistoryFail() {
    History history = galaxyHistory.newHistoryForWorkflow();
    galaxyHistory.libraryDatasetToHistory("fake", history);
}
Also used : History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 9 with History

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

the class GalaxyHistoriesServiceIT method testFilesToLibraryToHistorySuccess.

/**
 * Tests successful upload of a file to a Galaxy history through a Library.
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test
public void testFilesToLibraryToHistorySuccess() throws UploadException, GalaxyDatasetException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Library library = buildEmptyLibrary("testFilesToLibraryToHistorySuccess");
    Map<Path, String> datasetsMap = galaxyHistory.filesToLibraryToHistory(Sets.newHashSet(dataFile, dataFile2), FILE_TYPE, history, library, DataStorage.LOCAL);
    assertNotNull(datasetsMap);
    assertEquals(2, datasetsMap.size());
    String datasetId1 = datasetsMap.get(dataFile);
    String datasetId2 = datasetsMap.get(dataFile2);
    Dataset actualDataset1 = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient().showDataset(history.getId(), datasetId1);
    assertNotNull(actualDataset1);
    Dataset actualDataset2 = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient().showDataset(history.getId(), datasetId2);
    assertNotNull(actualDataset2);
}
Also used : Path(java.nio.file.Path) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Example 10 with History

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

the class GalaxyHistoriesServiceIT method testGetStatusForHistory.

/**
 * Tests getting the status for a history successfully.
 * @throws ExecutionManagerException
 * @throws InterruptedException
 * @throws TimeoutException
 */
@Test
public void testGetStatusForHistory() throws ExecutionManagerException, TimeoutException, InterruptedException {
    History history = galaxyHistory.newHistoryForWorkflow();
    galaxyHistory.fileToHistory(dataFile, InputFileType.FASTQ_SANGER, history);
    Util.waitUntilHistoryComplete(history.getId(), galaxyHistory, 60);
    GalaxyWorkflowStatus status = galaxyHistory.getStatusForHistory(history.getId());
    assertEquals("state is invalid", GalaxyWorkflowState.OK, status.getState());
    assertEquals("proportion complete is invalid", 1.0f, status.getProportionComplete(), DELTA);
}
Also used : History(com.github.jmchilton.blend4j.galaxy.beans.History) GalaxyWorkflowStatus(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.GalaxyWorkflowStatus) 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