Search in sources :

Example 1 with CreateLibraryException

use of ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException 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);
    }
}
Also used : CreateLibraryException(ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException) Library(com.github.jmchilton.blend4j.galaxy.beans.Library)

Example 2 with CreateLibraryException

use of ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException in project irida by phac-nml.

the class AnalysisWorkspaceServiceGalaxyTest method testPrepareAnalysisFilesNoCreateLibraryFail.

/**
 * Tests out successfully to preparing an analysis with single files.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowException
 */
@Test(expected = CreateLibraryException.class)
public void testPrepareAnalysisFilesNoCreateLibraryFail() throws ExecutionManagerException, IridaWorkflowException {
    submission = AnalysisSubmission.builder(workflowId).name("my analysis").inputFiles(Sets.newHashSet(sampleSingleSequenceFileMap.values())).referenceFile(referenceFile).build();
    submission.setRemoteAnalysisId(HISTORY_ID);
    submission.setRemoteWorkflowId(WORKFLOW_ID);
    when(iridaWorkflowsService.getIridaWorkflow(workflowId)).thenReturn(iridaWorkflowSingle);
    when(galaxyHistoriesService.findById(HISTORY_ID)).thenReturn(workflowHistory);
    when(galaxyLibrariesService.buildEmptyLibrary(any(GalaxyProjectName.class))).thenThrow(new CreateLibraryException(""));
    workflowPreparation.prepareAnalysisFiles(submission);
}
Also used : CreateLibraryException(ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException) GalaxyProjectName(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName) Test(org.junit.Test)

Aggregations

CreateLibraryException (ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException)2 GalaxyProjectName (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName)1 Library (com.github.jmchilton.blend4j.galaxy.beans.Library)1 Test (org.junit.Test)1