@Test public void parsePluginsFromCliOptionTest() { String[] pluginInput = new String[]{"git", "job-import-plugin:2.1", "docker:latest", "cloudbees-bitbucket-branch-source:2.4.4", "script-security::http: "script-security.hpi", "workflow-step-api:incrementals;org.jenkins-ci.plugins.workflow;2.19-rc289.d09828a05a74", "matrix-project:latest", "junit:experimental", "credentials:latest:http: "google-api-client-plugin::https: "blueocean:", "build-timeout:1.20"}; List<Plugin> plugins = pluginList.parsePluginsFromCliOption(pluginInput); List<String> pluginInfo = new ArrayList<>(); for (Plugin p : plugins) { pluginInfo.add(p.toString()); } assertThat(pluginInfo).containsExactlyInAnyOrder(expectedPluginInfo); List<Plugin> noPluginArrayList = pluginList.parsePluginsFromCliOption(null); assertThat(noPluginArrayList).isEmpty(); }
public List<Plugin> parsePluginsFromCliOption(String[] plugins) { if (plugins == null) { return new ArrayList<>(); } return Arrays.stream(plugins) .map(this::parsePluginLine) .collect(toList()); }
PluginListParser { public List<Plugin> parsePluginsFromCliOption(String[] plugins) { if (plugins == null) { return new ArrayList<>(); } return Arrays.stream(plugins) .map(this::parsePluginLine) .collect(toList()); } }
PluginListParser { public List<Plugin> parsePluginsFromCliOption(String[] plugins) { if (plugins == null) { return new ArrayList<>(); } return Arrays.stream(plugins) .map(this::parsePluginLine) .collect(toList()); } PluginListParser(boolean verbose); }
PluginListParser { public List<Plugin> parsePluginsFromCliOption(String[] plugins) { if (plugins == null) { return new ArrayList<>(); } return Arrays.stream(plugins) .map(this::parsePluginLine) .collect(toList()); } PluginListParser(boolean verbose); List<Plugin> parsePluginsFromCliOption(String[] plugins); List<Plugin> parsePluginTxtFile(File pluginTxtFile); List<Plugin> parsePluginYamlFile(File pluginYamlFile); boolean fileExists(File pluginFile); static boolean isURL(String url); }
PluginListParser { public List<Plugin> parsePluginsFromCliOption(String[] plugins) { if (plugins == null) { return new ArrayList<>(); } return Arrays.stream(plugins) .map(this::parsePluginLine) .collect(toList()); } PluginListParser(boolean verbose); List<Plugin> parsePluginsFromCliOption(String[] plugins); List<Plugin> parsePluginTxtFile(File pluginTxtFile); List<Plugin> parsePluginYamlFile(File pluginYamlFile); boolean fileExists(File pluginFile); static boolean isURL(String url);  }