use of com.github.jmchilton.blend4j.galaxy.beans.Library in project irida by phac-nml.
the class GalaxyLibrariesServiceTest method testBuildEmptyLibrary.
/**
* Tests create empty library.
* @throws CreateLibraryException
*/
@Test
public void testBuildEmptyLibrary() throws CreateLibraryException {
when(librariesClient.createLibrary(any(Library.class))).thenReturn(testLibrary);
Library library = new GalaxyLibrariesService(librariesClient, 1, 2, 1).buildEmptyLibrary(new GalaxyProjectName("test"));
assertNotNull(library);
assertEquals("test", library.getName());
assertEquals(LIBRARY_ID, library.getId());
}
use of com.github.jmchilton.blend4j.galaxy.beans.Library in project irida by phac-nml.
the class GalaxyLibrariesServiceTest method testBuildEmptyLibraryFail.
/**
* Tests create empty library.
*
* @throws CreateLibraryException
*/
@Test(expected = CreateLibraryException.class)
public void testBuildEmptyLibraryFail() throws CreateLibraryException {
when(librariesClient.createLibrary(any(Library.class))).thenReturn(null);
new GalaxyLibrariesService(librariesClient, 1, 2, 1).buildEmptyLibrary(new GalaxyProjectName("test"));
}
use of com.github.jmchilton.blend4j.galaxy.beans.Library 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);
}
use of com.github.jmchilton.blend4j.galaxy.beans.Library in project irida by phac-nml.
the class GalaxyLibrariesService method buildEmptyLibrary.
/**
* Builds a new empty library with the given name.
*
* @param libraryName
* The name of the new library.
* @return A Library object for the newly created library.
* @throws CreateLibraryException
* If no library could be created.
*/
public Library buildEmptyLibrary(GalaxyProjectName libraryName) throws CreateLibraryException {
checkNotNull(libraryName, "libraryName is null");
Library persistedLibrary;
Library library = new Library(libraryName.getName());
persistedLibrary = librariesClient.createLibrary(library);
if (persistedLibrary != null) {
logger.debug("Created library=" + library.getName() + " libraryId=" + persistedLibrary.getId());
return persistedLibrary;
} else {
throw new CreateLibraryException("Could not create library named " + libraryName);
}
}
use of com.github.jmchilton.blend4j.galaxy.beans.Library in project irida by phac-nml.
the class GalaxyHistoriesServiceIT method testFilesToLibraryToHistoryRemoteSuccess.
/**
* Tests successful upload of a file to a Galaxy history through a Library (where files are remote files).
*
* @throws UploadException
* @throws GalaxyDatasetException
*/
@Test
public void testFilesToLibraryToHistoryRemoteSuccess() 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.REMOTE);
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);
}
Aggregations