コード例 #1
0
  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);
  }
コード例 #2
0
  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);
  }