ProviderUtils implements YarnServiceConstants { public static String replaceSpacesWithDelimiter(String content, String delimiter) { List<String> parts = new ArrayList<String>(); Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(content); while (m.find()) { String part = m.group(1); if(part.startsWith("\"") && part.endsWith("\"")) { part = part.replaceAll("^\"|\"$", ""); } parts.add(part); } return String.join(delimiter, parts); }  static boolean addProviderJar(
      Map<String, LocalResource> providerResources,
      Class providerClass,
      String jarName,
      SliderFileSystem sliderFileSystem,
      Path tempPath,
      String libdir,
      boolean miniClusterTestRun); static void addAllDependencyJars(
      Map<String, LocalResource> providerResources,
      SliderFileSystem sliderFileSystem,
      Path tempPath,
      String libDir,
      String libLocalSrcDir); static String substituteStrWithTokens(String content,
      Map<String, String> tokensForSubstitution); static String replaceSpacesWithDelimiter(String content,
      String delimiter); static void substituteMapWithTokens(Map<String, String> configs,
      Map<String, String> tokenMap); static Path initCompInstanceDir(SliderFileSystem fs,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      ComponentInstance instance); static Path initCompPublicResourceDir(SliderFileSystem fs,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      ComponentInstance instance); static synchronized void createConfigFileAndAddLocalResource(
      AbstractLauncher launcher, SliderFileSystem fs,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      Map<String, String> tokensForSubstitution, ComponentInstance instance,
      ServiceContext context, ProviderService.ResolvedLaunchParams
      resolvedParams); static synchronized void handleStaticFilesForLocalization(
      AbstractLauncher launcher, SliderFileSystem fs, ContainerLaunchService
      .ComponentLaunchContext componentLaunchCtx,
      ProviderService.ResolvedLaunchParams resolvedParams); static Map<String, String> initCompTokensForSubstitute(
      ComponentInstance instance, Container container,
      ContainerLaunchService.ComponentLaunchContext componentLaunchContext);  }
@Test public void testReplaceSpacesWithDelimiter() { String command = "ls -l \" space\""; String expected = "ls,-l, space"; String actual = ProviderUtils.replaceSpacesWithDelimiter(command, ","); Assert.assertEquals("replaceSpaceWithDelimiter produces unexpected result.", expected, actual); }