Search in sources :

Example 1 with Library

use of com.github.jmchilton.blend4j.galaxy.beans.Library 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 Library

use of com.github.jmchilton.blend4j.galaxy.beans.Library 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 3 with Library

use of com.github.jmchilton.blend4j.galaxy.beans.Library 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 4 with Library

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

the class GalaxyLibrariesServiceIT method testFilesToLibraryWaitFail.

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

Example 5 with Library

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

the class GalaxyLibrariesServiceIT method testFileToLibrarySuccess.

/**
 * Tests successful upload of a file to a Galaxy Library.
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test
public void testFileToLibrarySuccess() throws UploadException, GalaxyDatasetException {
    String filename = dataFile.toFile().getName();
    Library library = buildEmptyLibrary("testFileToLibrarySuccess");
    String datasetId = galaxyLibrariesService.fileToLibrary(dataFile, FILE_TYPE, library, DataStorage.LOCAL);
    assertNotNull(datasetId);
    LibraryDataset actualDataset = localGalaxy.getGalaxyInstanceAdmin().getLibrariesClient().showDataset(library.getId(), datasetId);
    assertNotNull(actualDataset);
    assertEquals(filename, actualDataset.getName());
    assertEquals(Long.toString(dataFile.toFile().length()), actualDataset.getFileSize());
}
Also used : LibraryDataset(com.github.jmchilton.blend4j.galaxy.beans.LibraryDataset) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) Test(org.junit.Test)

Aggregations

Library (com.github.jmchilton.blend4j.galaxy.beans.Library)20 Test (org.junit.Test)17 History (com.github.jmchilton.blend4j.galaxy.beans.History)9 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)4 Path (java.nio.file.Path)4 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)3 GalaxyProjectName (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName)3 GalaxyLibrariesService (ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService)3 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)3 LibrariesClient (com.github.jmchilton.blend4j.galaxy.LibrariesClient)3 Dataset (com.github.jmchilton.blend4j.galaxy.beans.Dataset)3 CollectionResponse (com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionResponse)3 HashMap (java.util.HashMap)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 IridaSequenceFilePair (ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair)2 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)2 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)2 LibraryDataset (com.github.jmchilton.blend4j.galaxy.beans.LibraryDataset)2 CollectionElementResponse (com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionElementResponse)2 SampleAnalysisDuplicateException (ca.corefacility.bioinformatics.irida.exceptions.SampleAnalysisDuplicateException)1