@Test(expected = ApplicationException.class) public void testWrongReference() { GeneAddingHandler handler = getGeneAddingHandler(); ApplicationOptions applicationOptions = new ApplicationOptions(); handler.parseAndVerifyArguments(Arrays.asList(REFERENCE_NAME + "/", GENE_NAME), applicationOptions); }
@Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() != 2) { throw new IllegalArgumentException(MessageConstants.getMessage(ILLEGAL_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } referenceId = loadReferenceId(arguments.get(0)); try { geneFileId = loadFileByNameOrBioID(arguments.get(1)).getId(); } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); FileRegistrationHandler handler = new FileRegistrationHandler(arguments.get(1), referenceId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredItems = handler.registerItems(); if (!registeredItems.isEmpty()) { geneFileId = registeredItems.get(0).getId(); } } printJson = options.isPrintJson(); printTable = options.isPrintTable(); }
GeneAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() != 2) { throw new IllegalArgumentException(MessageConstants.getMessage(ILLEGAL_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } referenceId = loadReferenceId(arguments.get(0)); try { geneFileId = loadFileByNameOrBioID(arguments.get(1)).getId(); } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); FileRegistrationHandler handler = new FileRegistrationHandler(arguments.get(1), referenceId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredItems = handler.registerItems(); if (!registeredItems.isEmpty()) { geneFileId = registeredItems.get(0).getId(); } } printJson = options.isPrintJson(); printTable = options.isPrintTable(); } }
GeneAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() != 2) { throw new IllegalArgumentException(MessageConstants.getMessage(ILLEGAL_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } referenceId = loadReferenceId(arguments.get(0)); try { geneFileId = loadFileByNameOrBioID(arguments.get(1)).getId(); } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); FileRegistrationHandler handler = new FileRegistrationHandler(arguments.get(1), referenceId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredItems = handler.registerItems(); if (!registeredItems.isEmpty()) { geneFileId = registeredItems.get(0).getId(); } } printJson = options.isPrintJson(); printTable = options.isPrintTable(); }  }
GeneAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() != 2) { throw new IllegalArgumentException(MessageConstants.getMessage(ILLEGAL_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } referenceId = loadReferenceId(arguments.get(0)); try { geneFileId = loadFileByNameOrBioID(arguments.get(1)).getId(); } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); FileRegistrationHandler handler = new FileRegistrationHandler(arguments.get(1), referenceId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredItems = handler.registerItems(); if (!registeredItems.isEmpty()) { geneFileId = registeredItems.get(0).getId(); } } printJson = options.isPrintJson(); printTable = options.isPrintTable(); }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand(); }
GeneAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() != 2) { throw new IllegalArgumentException(MessageConstants.getMessage(ILLEGAL_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } referenceId = loadReferenceId(arguments.get(0)); try { geneFileId = loadFileByNameOrBioID(arguments.get(1)).getId(); } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); FileRegistrationHandler handler = new FileRegistrationHandler(arguments.get(1), referenceId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredItems = handler.registerItems(); if (!registeredItems.isEmpty()) { geneFileId = registeredItems.get(0).getId(); } } printJson = options.isPrintJson(); printTable = options.isPrintTable(); }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand();  }