@Test(expected = IllegalArgumentException.class) public void testDatasetRegistrationWrongArguments() { DatasetRegistrationHandler handler = getDatasetRegistrationHandler(); handler.parseAndVerifyArguments(Collections.singletonList(String.valueOf(REFERENCE_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())); } name = arguments.get(1); prettyName = options.getPrettyName(); if (options.getParent() != null) { parentId = parseProjectId(options.getParent()); } items = new ArrayList<>(); Long referenceId = parseFileId(arguments.get(0)); printJson = options.isPrintJson(); printTable = options.isPrintTable(); items.add(new ProjectItem(referenceId, false)); Long referenceUniqueId = null; for (int i = 2; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(new ProjectItem(id, false)); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceId(arguments.get(0)) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType(HttpPost.METHOD_NAME); List<BiologicalDataItem> registeredFiles = handler.registerItems(); if (!registeredFiles.isEmpty()) { registeredFiles.forEach(f -> items.add(new ProjectItem(f.getBioDataItemId(), false))); } } }
DatasetRegistrationHandler 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())); } name = arguments.get(1); prettyName = options.getPrettyName(); if (options.getParent() != null) { parentId = parseProjectId(options.getParent()); } items = new ArrayList<>(); Long referenceId = parseFileId(arguments.get(0)); printJson = options.isPrintJson(); printTable = options.isPrintTable(); items.add(new ProjectItem(referenceId, false)); Long referenceUniqueId = null; for (int i = 2; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(new ProjectItem(id, false)); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceId(arguments.get(0)) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType(HttpPost.METHOD_NAME); List<BiologicalDataItem> registeredFiles = handler.registerItems(); if (!registeredFiles.isEmpty()) { registeredFiles.forEach(f -> items.add(new ProjectItem(f.getBioDataItemId(), false))); } } } }
DatasetRegistrationHandler 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())); } name = arguments.get(1); prettyName = options.getPrettyName(); if (options.getParent() != null) { parentId = parseProjectId(options.getParent()); } items = new ArrayList<>(); Long referenceId = parseFileId(arguments.get(0)); printJson = options.isPrintJson(); printTable = options.isPrintTable(); items.add(new ProjectItem(referenceId, false)); Long referenceUniqueId = null; for (int i = 2; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(new ProjectItem(id, false)); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceId(arguments.get(0)) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType(HttpPost.METHOD_NAME); List<BiologicalDataItem> registeredFiles = handler.registerItems(); if (!registeredFiles.isEmpty()) { registeredFiles.forEach(f -> items.add(new ProjectItem(f.getBioDataItemId(), false))); } } }  }
DatasetRegistrationHandler 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())); } name = arguments.get(1); prettyName = options.getPrettyName(); if (options.getParent() != null) { parentId = parseProjectId(options.getParent()); } items = new ArrayList<>(); Long referenceId = parseFileId(arguments.get(0)); printJson = options.isPrintJson(); printTable = options.isPrintTable(); items.add(new ProjectItem(referenceId, false)); Long referenceUniqueId = null; for (int i = 2; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(new ProjectItem(id, false)); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceId(arguments.get(0)) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType(HttpPost.METHOD_NAME); List<BiologicalDataItem> registeredFiles = handler.registerItems(); if (!registeredFiles.isEmpty()) { registeredFiles.forEach(f -> items.add(new ProjectItem(f.getBioDataItemId(), false))); } } }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand(); }
DatasetRegistrationHandler 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())); } name = arguments.get(1); prettyName = options.getPrettyName(); if (options.getParent() != null) { parentId = parseProjectId(options.getParent()); } items = new ArrayList<>(); Long referenceId = parseFileId(arguments.get(0)); printJson = options.isPrintJson(); printTable = options.isPrintTable(); items.add(new ProjectItem(referenceId, false)); Long referenceUniqueId = null; for (int i = 2; i < arguments.size(); i++) { String file = arguments.get(i); try { Long id = parseFileId(file); items.add(new ProjectItem(id, false)); continue; } catch (ApplicationException e) { LOGGER.debug(e.getMessage(), e); } ApplicationOptions registerOptions = new ApplicationOptions(); registerOptions.setDoIndex(options.isDoIndex()); referenceUniqueId = referenceUniqueId == null ? loadReferenceId(arguments.get(0)) : referenceUniqueId; FileRegistrationHandler handler = new FileRegistrationHandler(file, referenceUniqueId, this, registerOptions); handler.setRequestUrl(handler.getServerParameters().getRegistrationUrl()); handler.setRequestType(HttpPost.METHOD_NAME); List<BiologicalDataItem> registeredFiles = handler.registerItems(); if (!registeredFiles.isEmpty()) { registeredFiles.forEach(f -> items.add(new ProjectItem(f.getBioDataItemId(), false))); } } }  @Override void parseAndVerifyArguments(List<String> arguments, ApplicationOptions options); @Override int runCommand();  }