Search in sources :

Example 11 with Library

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

the class GalaxyHistoriesServiceIT method testFilesToLibraryToHistoryFailNoLibrary.

/**
 * Tests failure to upload a list of files to a Galaxy history through a Library (no library).
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test(expected = UploadException.class)
public void testFilesToLibraryToHistoryFailNoLibrary() throws UploadException, GalaxyDatasetException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Library library = buildEmptyLibrary("testFilesToLibraryToHistoryFail");
    library.setId("invalid");
    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 12 with Library

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

the class GalaxyLibrariesServiceIT method testDeleteLibrarySuccess.

/**
 * Tests successfully deleting a data library.
 *
 * @throws ExecutionManagerException
 */
@Test
public void testDeleteLibrarySuccess() throws ExecutionManagerException {
    Library library = buildEmptyLibrary("testDeleteLibrarySuccess");
    Map<Path, String> datasetsMap = galaxyLibrariesService.filesToLibraryWait(ImmutableSet.of(dataFile), FILE_TYPE, library, DataStorage.LOCAL);
    String datasetId = datasetsMap.get(dataFile);
    assertNotNull("Dataset not uploaded correctly", librariesClient.showDataset(library.getId(), datasetId));
    // Note: I cannot do much more to test deleting a library beyond making
    // sure no exception is thrown.
    // The Galaxy API still provides access to libraries even when deleted,
    // but sets a deleted status.
    // The status is not available in blend4j right now.
    galaxyLibrariesService.deleteLibrary(library.getId());
}
Also used : Path(java.nio.file.Path) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) Test(org.junit.Test)

Example 13 with Library

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

the class GalaxyLibrariesServiceIT method testFilesToLibraryWaitSuccess.

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

Example 14 with Library

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

the class GalaxyLibrariesServiceIT method testFileToLibraryFailure.

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

Example 15 with Library

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

the class GalaxyLibrariesServiceIT method testFilesToLibraryWaitFailTimeout.

/**
 * Tests failure to upload to a library due to a timeout issue.
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test(expected = UploadTimeoutException.class)
public void testFilesToLibraryWaitFailTimeout() throws UploadException, GalaxyDatasetException {
    galaxyLibrariesService = new GalaxyLibrariesService(librariesClient, 1, 2, 1);
    Library library = buildEmptyLibrary("testFilesToLibraryWaitFailTimeout");
    galaxyLibrariesService.filesToLibraryWait(Sets.newHashSet(dataFile, dataFile2), FILE_TYPE, library, DataStorage.LOCAL);
}
Also used : Library(com.github.jmchilton.blend4j.galaxy.beans.Library) GalaxyLibrariesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService) 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