public void testLaunchWithProperties() throws Exception {
    createLaunchReadyProject(TEST_PROJECT);
    ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();

    BootLaunchConfigurationDelegate.setProperties(
        wc,
        Arrays.asList(
            pv("foo", "foo is enabled", true),
            pv("bar", "bar is not enabled", false),
            pv("zor", "zor enabled", true),
            pv("zor", "zor disabled", false)));

    int jmxPort = JmxBeanSupport.randomPort(); // must set or it will be generated randomly
    // and then we can't make the 'assert' below pass easily.
    BootLaunchConfigurationDelegate.setJMXPort(wc, "" + jmxPort);

    LaunchResult result = LaunchUtil.synchLaunch(wc);

    assertContains(":: Spring Boot ::", result.out);
    assertPropertyDump(
        result.out,
        "debug=null\n"
            + "zor='zor enabled'\n"
            + "foo='foo is enabled'\n"
            + "bar=null\n"
            + "com.sun.management.jmxremote.port='"
            + jmxPort
            + "'");
    assertOk(result);
  }
 public void testLaunchAllOptsDisable() throws Exception {
   createLaunchReadyProject(TEST_PROJECT);
   ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
   LaunchResult result = LaunchUtil.synchLaunch(wc);
   assertContains(":: Spring Boot ::", result.out);
   assertOk(result);
 }
  public void testLaunchWithProfile() throws Exception {
    createLaunchReadyProject(TEST_PROJECT);
    ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();

    BootLaunchConfigurationDelegate.setProfile(wc, "special");

    LaunchResult result = LaunchUtil.synchLaunch(wc);

    assertContains(":: Spring Boot ::", result.out);
    assertContains("foo='special foo'", result.out);
    assertOk(result);
  }
  public void testLaunchWithDebugOutput() throws Exception {
    createLaunchReadyProject(TEST_PROJECT);
    ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();

    BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, true);

    LaunchResult result = LaunchUtil.synchLaunch(wc);

    assertContains(":: Spring Boot ::", result.out);
    assertContains("AUTO-CONFIGURATION REPORT", result.out);
    assertOk(result);
  }
  public void testRunAsLaunch() throws Exception {
    IProject project = createLaunchReadyProject(TEST_PROJECT);

    // Creates a launch conf similar to that created by 'Run As' menu.
    ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
    BootLaunchConfigurationDelegate.setDefaults(wc, project, TEST_MAIN_CLASS);

    LaunchResult result = LaunchUtil.synchLaunch(wc);
    System.out.println(result); // Great help in debugging this :-)
    assertContains(":: Spring Boot ::", result.out);
    assertOk(result);
  }
  public void testLaunchWithLiveBeans() throws Exception {
    createLaunchReadyProject(TEST_PROJECT);
    ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();

    BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, true);
    int port = JmxBeanSupport.randomPort();
    BootLaunchConfigurationDelegate.setJMXPort(wc, "" + port);

    LaunchResult result = LaunchUtil.synchLaunch(wc);

    System.out.println(result);

    assertContains(":: Spring Boot ::", result.out);
    // The following check doesn't real prove the live bean graph works, but at least it shows the
    // VM args are
    // taking effect.
    assertContains("com.sun.management.jmxremote.port='" + port + "'", result.out);
    assertOk(result);
  }