private static String[] prepareCommandArray(String command, List<String> args) { List<String> nCmd = Strings.splitAndTrimAsList(command, " "); List<String> nArgs = args != null ? args : new ArrayList<String>(); String[] commandWithArgs = new String[nCmd.size() + nArgs.size()]; for (int i = 0; i < nCmd.size(); i++) { commandWithArgs[i] = nCmd.get(i); } for (int i = 0; i < nArgs.size(); i++) { commandWithArgs[i + nCmd.size()] = nArgs.get(i); } return commandWithArgs; }
private static String[] prepareCommandArray(String command, List<String> args) { List<String> nCmd = Strings.splitAndTrimAsList(command, " "); List<String> nArgs = args != null ? args : new ArrayList<String>(); String[] commandWithArgs = new String[nCmd.size() + nArgs.size()]; for (int i = 0; i < nCmd.size(); i++) { commandWithArgs[i] = nCmd.get(i); } for (int i = 0; i < nArgs.size(); i++) { commandWithArgs[i + nCmd.size()] = nArgs.get(i); } return commandWithArgs; }
protected static void configureProtocolHandlers(Map<String, String> conf) { Set<String> handlers = new LinkedHashSet<>(); handlers.addAll(Strings.splitAndTrimAsList(System.getProperty(JAVA_PROTOCOL_HANDLER, ""), " ")); handlers.addAll(Strings.splitAndTrimAsList( conf.getOrDefault(PROTOCOL_HANDLERS, DEFAULT_MAVEN_PROTOCOL_HANDLER), " ")); System.setProperty(JAVA_PROTOCOL_HANDLER, Strings.join(handlers, " ")); }
protected static void configureProtocolHandlers(Map<String, String> conf) { Set<String> handlers = new LinkedHashSet<>(); handlers.addAll(Strings.splitAndTrimAsList(System.getProperty(JAVA_PROTOCOL_HANDLER, ""), " ")); handlers.addAll(Strings.splitAndTrimAsList( conf.getOrDefault(PROTOCOL_HANDLERS, DEFAULT_MAVEN_PROTOCOL_HANDLER), " ")); System.setProperty(JAVA_PROTOCOL_HANDLER, Strings.join(handlers, " ")); }
@Test public void should_split_test_separated_by_commas() { // given String content = "file://${basedir}/elasticsearch.yml,file://${basedir}/configmap.yml"; // when final List<String> strings = Strings.splitAndTrimAsList(content, "\\s*,\\s*"); //then assertThat(strings) .containsExactly("file://${basedir}/elasticsearch.yml", "file://${basedir}/configmap.yml"); }
.withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null)) .withFmpLogsEnabled(getBooleanProperty(FMP_LOGS, map, true)) .withFmpPomPath(getStringProperty(FMP_POM_PATH, map, DEFAULT_FMP_PATH)) .withFmpProfiles(Strings.splitAndTrimAsList(getStringProperty(FMP_PROFILES, map, ""), "\\s*,\\s*")) .withFmpSystemProperties(Strings.splitAndTrimAsList(getStringProperty(FMP_SYSTEM_PROPERTIES, map, ""), "\\s*,\\s*")) .withFmpBuildOptions(getStringProperty(FMP_BUILD_OPTIONS, map, null)) .build();
.withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null)) .withFmpLogsEnabled(getBooleanProperty(FMP_LOGS, map, true)) .withFmpPomPath(getStringProperty(FMP_POM_PATH, map, DEFAULT_FMP_PATH)) .withFmpProfiles(Strings.splitAndTrimAsList(getStringProperty(FMP_PROFILES, map, ""), "\\s*,\\s*")) .withFmpSystemProperties(Strings.splitAndTrimAsList(getStringProperty(FMP_SYSTEM_PROPERTIES, map, ""), "\\s*,\\s*")) .withFmpBuildOptions(getStringProperty(FMP_BUILD_OPTIONS, map, null)) .build();
.withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null)) .withFmpLogsEnabled(getBooleanProperty(FMP_LOGS, map, true)) .withFmpPomPath(getStringProperty(FMP_POM_PATH, map, DEFAULT_FMP_PATH)) .withFmpProfiles(Strings.splitAndTrimAsList(getStringProperty(FMP_PROFILES, map, ""), "\\s*,\\s*")) .withFmpSystemProperties(Strings.splitAndTrimAsList(getStringProperty(FMP_SYSTEM_PROPERTIES, map, ""), "\\s*,\\s*")) .withFmpBuildOptions(getStringProperty(FMP_BUILD_OPTIONS, map, "")) .withAwaitRouteRepetitions(getIntProperty(AWAIT_ROUTE_REPETITIONS, "arquillian.await.route.repetitions", map, 1))