AbstractProviderService implements ProviderService,
    YarnServiceConstants { public ResolvedLaunchParams buildContainerLaunchContext( AbstractLauncher launcher, Service service, ComponentInstance instance, SliderFileSystem fileSystem, Configuration yarnConf, Container container, ContainerLaunchService.ComponentLaunchContext compLaunchContext) throws IOException, SliderException { ResolvedLaunchParams resolved = new ResolvedLaunchParams(); processArtifact(launcher, instance, fileSystem, service, compLaunchContext); ServiceContext context = instance.getComponent().getScheduler().getContext(); Map<String, String> tokensForSubstitution = buildContainerTokens(instance, container, compLaunchContext); buildContainerEnvironment(launcher, service, instance, fileSystem, yarnConf, container, compLaunchContext, tokensForSubstitution); ProviderUtils.createConfigFileAndAddLocalResource(launcher, fileSystem, compLaunchContext, tokensForSubstitution, instance, context, resolved); ProviderUtils.handleStaticFilesForLocalization(launcher, fileSystem, compLaunchContext, resolved); buildContainerLaunchCommand(launcher, service, instance, fileSystem, yarnConf, container, compLaunchContext, tokensForSubstitution); buildContainerRetry(launcher, yarnConf, compLaunchContext, instance); return resolved; }  abstract void processArtifact(AbstractLauncher launcher,
      ComponentInstance compInstance, SliderFileSystem fileSystem,
      Service service,
      ContainerLaunchService.ComponentLaunchContext compLaunchCtx); Map<String, String> buildContainerTokens(ComponentInstance instance,
      Container container,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext); void buildContainerEnvironment(AbstractLauncher launcher,
      Service service, ComponentInstance instance,
      SliderFileSystem fileSystem, Configuration yarnConf, Container container,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      Map<String, String> tokensForSubstitution); void buildContainerLaunchCommand(AbstractLauncher launcher,
      Service service, ComponentInstance instance,
      SliderFileSystem fileSystem, Configuration yarnConf, Container container,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      Map<String, String> tokensForSubstitution); void buildContainerRetry(AbstractLauncher launcher,
      Configuration yarnConf,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext,
      ComponentInstance instance); ResolvedLaunchParams buildContainerLaunchContext(
      AbstractLauncher launcher,
      Service service, ComponentInstance instance,
      SliderFileSystem fileSystem, Configuration yarnConf, Container container,
      ContainerLaunchService.ComponentLaunchContext compLaunchContext);  }
@Test public void testBuildContainerLaunchContext() throws Exception { AbstractProviderService providerService = new DockerProviderService(); Component component = serviceContext.scheduler.getAllComponents().entrySet() .iterator().next().getValue(); ContainerLaunchService.ComponentLaunchContext clc = createEntryPointCLCFor(testService, component, "sleep,9000"); ComponentInstance instance = component.getAllComponentInstances().iterator() .next(); Container container = mock(Container.class); ContainerId containerId = ContainerId.newContainerId( ApplicationAttemptId.newInstance(ApplicationId.newInstance( System.currentTimeMillis(), 1), 1), 1L); when(container.getId()).thenReturn(containerId); providerService.buildContainerLaunchContext(launcher, testService, instance, rule.getFs(), serviceContext.scheduler.getConfig(), container, clc); Assert.assertEquals("artifact", clc.getArtifact().getId(), launcher.getDockerImage()); }