예제 #1
0
 @Before
 public void setUp() {
   ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
   context.setConfigLocation(
       "/org/springframework/xd/dirt/module/ModuleDeployerTests-context.xml");
   OptionUtils.configureRuntime(new SingleNodeOptions(), context.getEnvironment());
   context.refresh();
   moduleDeployer = context.getBean(ModuleDeployer.class);
 }
  /**
   * Creates a new instance of ContainerLauncher.
   *
   * @param options The options that select transport, analytics, and other infrastructure options.
   * @param parentContext an optional parent context to set on the XDContainer's ApplicationContext.
   * @return a new ContainerLauncher instance
   */
  @SuppressWarnings("resource")
  public ContainerLauncher createContainerLauncher(
      ContainerOptions options, ApplicationContext parentContext) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
    context.setConfigLocation(LAUNCHER_CONFIG_LOCATION);

    OptionUtils.configureRuntime(options, context.getEnvironment());

    if (parentContext == null) {
      parentContext = createParentContext();
    }

    context.setParent(parentContext);
    context.refresh();
    context.registerShutdownHook();

    ContainerLauncher launcher = context.getBean(ContainerLauncher.class);
    return launcher;
  }