@Test(expected = IllegalArgumentException.class) public void testWrongArguments() { DatasetItemAddingHandler handler = getDatasetItemAddingHandler(); handler.parseAndVerifyArguments(Collections.singletonList(DATASET_NAME), new ApplicationOptions()); }
@Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() < 2) { throw new IllegalArgumentException(MessageConstants.getMessage(MINIMUM_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } datasetId = parseProjectId(arguments.get(0)); Long referenceUniqueId = null; for (int i = 1; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(id); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceIdFromDataset(datasetId) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredFiles = handler.registerItems(); registeredFiles.forEach(f -> items.add(f.getBioDataItemId())); } this.printTable = options.isPrintTable(); this.printJson = options.isPrintJson(); }
DatasetItemAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() < 2) { throw new IllegalArgumentException(MessageConstants.getMessage(MINIMUM_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } datasetId = parseProjectId(arguments.get(0)); Long referenceUniqueId = null; for (int i = 1; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(id); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceIdFromDataset(datasetId) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredFiles = handler.registerItems(); registeredFiles.forEach(f -> items.add(f.getBioDataItemId())); } this.printTable = options.isPrintTable(); this.printJson = options.isPrintJson(); } }
DatasetItemAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() < 2) { throw new IllegalArgumentException(MessageConstants.getMessage(MINIMUM_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } datasetId = parseProjectId(arguments.get(0)); Long referenceUniqueId = null; for (int i = 1; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(id); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceIdFromDataset(datasetId) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredFiles = handler.registerItems(); registeredFiles.forEach(f -> items.add(f.getBioDataItemId())); } this.printTable = options.isPrintTable(); this.printJson = options.isPrintJson(); }  }
DatasetItemAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() < 2) { throw new IllegalArgumentException(MessageConstants.getMessage(MINIMUM_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } datasetId = parseProjectId(arguments.get(0)); Long referenceUniqueId = null; for (int i = 1; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(id); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceIdFromDataset(datasetId) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredFiles = handler.registerItems(); registeredFiles.forEach(f -> items.add(f.getBioDataItemId())); } this.printTable = options.isPrintTable(); this.printJson = options.isPrintJson(); }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand(); }
DatasetItemAddingHandler extends AbstractHTTPCommandHandler { @Override public void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options) { if (arguments.size() < 2) { throw new IllegalArgumentException(MessageConstants.getMessage(MINIMUM_COMMAND_ARGUMENTS, getCommand(), 2, arguments.size())); } datasetId = parseProjectId(arguments.get(0)); Long referenceUniqueId = null; for (int i = 1; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(id); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceIdFromDataset(datasetId) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType("POST"); List<BiologicalDataItem> registeredFiles = handler.registerItems(); registeredFiles.forEach(f -> items.add(f.getBioDataItemId())); } this.printTable = options.isPrintTable(); this.printJson = options.isPrintJson(); }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand();  }