@Test @Transactional(propagation = Propagation.REQUIRES_NEW) public void testRegisterExtraChromosome() throws IOException, InterruptedException, NoSuchAlgorithmException { Resource resource = context.getResource("classpath:templates/invalid/extra_chr.maf"); IndexedFileRegistrationRequest request = new IndexedFileRegistrationRequest(); request.setPath(resource.getFile().getAbsolutePath()); request.setReferenceId(referenceId); MafFile mafFile = mafManager.registerMafFile(request); Assert.assertTrue(mafFile != null); }
public MafFile registerMafFile(IndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } MafFile mafFile; try { switch (request.getType()) { case FILE: mafFile = registerMafFileFromFile(request); break; case DOWNLOAD: mafFile = downloadMafFile(request, requestPath); break; default: throw new IllegalArgumentException(getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } } catch (IOException | NoSuchAlgorithmException e) { throw new RegistrationException("Error while registering MAF file " + requestPath, e); } return mafFile; }
MafManager { public MafFile registerMafFile(IndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } MafFile mafFile; try { switch (request.getType()) { case FILE: mafFile = registerMafFileFromFile(request); break; case DOWNLOAD: mafFile = downloadMafFile(request, requestPath); break; default: throw new IllegalArgumentException(getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } } catch (IOException | NoSuchAlgorithmException e) { throw new RegistrationException("Error while registering MAF file " + requestPath, e); } return mafFile; } }
MafManager { public MafFile registerMafFile(IndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } MafFile mafFile; try { switch (request.getType()) { case FILE: mafFile = registerMafFileFromFile(request); break; case DOWNLOAD: mafFile = downloadMafFile(request, requestPath); break; default: throw new IllegalArgumentException(getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } } catch (IOException | NoSuchAlgorithmException e) { throw new RegistrationException("Error while registering MAF file " + requestPath, e); } return mafFile; }  }
MafManager { public MafFile registerMafFile(IndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } MafFile mafFile; try { switch (request.getType()) { case FILE: mafFile = registerMafFileFromFile(request); break; case DOWNLOAD: mafFile = downloadMafFile(request, requestPath); break; default: throw new IllegalArgumentException(getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } } catch (IOException | NoSuchAlgorithmException e) { throw new RegistrationException("Error while registering MAF file " + requestPath, e); } return mafFile; }  MafFile registerMafFile(IndexedFileRegistrationRequest request); MafFile unregisterMafFile(final long mafFileId); MafFile updateMafFile(long mafFileId); Track<MafRecord> loadFeatures(Track<MafRecord> track); }
MafManager { public MafFile registerMafFile(IndexedFileRegistrationRequest request) { final String requestPath = request.getPath(); Assert.isTrue(StringUtils.isNotBlank(requestPath), getMessage( MessagesConstants.ERROR_NULL_PARAM, "path")); Assert.notNull(request.getReferenceId(), getMessage(MessagesConstants.ERROR_NULL_PARAM, "referenceId")); if (request.getType() == null) { request.setType(BiologicalDataItemResourceType.FILE); } MafFile mafFile; try { switch (request.getType()) { case FILE: mafFile = registerMafFileFromFile(request); break; case DOWNLOAD: mafFile = downloadMafFile(request, requestPath); break; default: throw new IllegalArgumentException(getMessage(MessagesConstants.ERROR_INVALID_PARAM)); } } catch (IOException | NoSuchAlgorithmException e) { throw new RegistrationException("Error while registering MAF file " + requestPath, e); } return mafFile; }  MafFile registerMafFile(IndexedFileRegistrationRequest request); MafFile unregisterMafFile(final long mafFileId); MafFile updateMafFile(long mafFileId); Track<MafRecord> loadFeatures(Track<MafRecord> track);  }