Ability to run the JavaFX presenter in headless mode is useful for testing
authorJaroslav Tulach <jtulach@netbeans.org>
Fri, 02 Oct 2015 08:57:14 +0200
changeset 1006a0f79e32d526
parent 1005 c7f11fbd5475
child 1007 2ea65c6d3a8b
Ability to run the JavaFX presenter in headless mode is useful for testing
boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java
boot-fx/src/main/java/org/netbeans/html/boot/fx/FXBrwsr.java
boot-fx/src/main/resources/org/netbeans/html/boot/fx/Bundle.properties
boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersOnResourceTest.java
boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java
ko-felix-test/pom.xml
ko-osgi-test/pom.xml
pom.xml
src/main/javadoc/overview.html
     1.1 --- a/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java	Mon Sep 21 21:19:13 2015 +0200
     1.2 +++ b/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java	Fri Oct 02 08:57:14 2015 +0200
     1.3 @@ -62,8 +62,13 @@
     1.4   * application and based on other events in the application
     1.5   * {@link #runInBrowser(javafx.scene.web.WebView, java.lang.Runnable) re-execute code} 
     1.6   * inside of such {@link WebView}s.
     1.7 + * <p>
     1.8   * In case such detailed control is not necessary,
     1.9 - * consider using {@link BrowserBuilder}.
    1.10 + * consider using {@link BrowserBuilder}. Btw. when using the {@link BrowserBuilder}
    1.11 + * one can execute presenter in headless mode. Just specify: <code>
    1.12 + * {@link System}.{@link System#setProperty(java.lang.String, java.lang.String) setProperty}("fxpresenter.headless", "true");
    1.13 + * </code>
    1.14 + *
    1.15   * 
    1.16   * @author Jaroslav Tulach
    1.17   * @since 0.6
     2.1 --- a/boot-fx/src/main/java/org/netbeans/html/boot/fx/FXBrwsr.java	Mon Sep 21 21:19:13 2015 +0200
     2.2 +++ b/boot-fx/src/main/java/org/netbeans/html/boot/fx/FXBrwsr.java	Fri Oct 02 08:57:14 2015 +0200
     2.3 @@ -159,6 +159,9 @@
     2.4          if (arr[4] != null) {
     2.5              scene.getWindow().setOnCloseRequest((EventHandler<WindowEvent>) arr[4]);
     2.6          }
     2.7 +        if (Boolean.getBoolean("fxpresenter.headless")) {
     2.8 +            return;
     2.9 +        }
    2.10          primaryStage.show();
    2.11      }
    2.12  
     3.1 --- a/boot-fx/src/main/resources/org/netbeans/html/boot/fx/Bundle.properties	Mon Sep 21 21:19:13 2015 +0200
     3.2 +++ b/boot-fx/src/main/resources/org/netbeans/html/boot/fx/Bundle.properties	Fri Oct 02 08:57:14 2015 +0200
     3.3 @@ -51,3 +51,4 @@
     3.4  PromptTitle=Question
     3.5  PromptOKButton=OK
     3.6  PromptCancelButton=Cancel
     3.7 +
     4.1 --- a/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersOnResourceTest.java	Mon Sep 21 21:19:13 2015 +0200
     4.2 +++ b/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersOnResourceTest.java	Fri Oct 02 08:57:14 2015 +0200
     4.3 @@ -193,7 +193,6 @@
     4.4              pane.setCenter(getV1());
     4.5              pane.setBottom(getV2());
     4.6  
     4.7 -            stage.show();
     4.8              CDL.countDown();
     4.9          }
    4.10          
     5.1 --- a/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java	Mon Sep 21 21:19:13 2015 +0200
     5.2 +++ b/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java	Fri Oct 02 08:57:14 2015 +0200
     5.3 @@ -209,7 +209,6 @@
     5.4              pane.setCenter(getV1());
     5.5              pane.setBottom(getV2());
     5.6  
     5.7 -            stage.show();
     5.8              CDL.countDown();
     5.9          }
    5.10          
     6.1 --- a/ko-felix-test/pom.xml	Mon Sep 21 21:19:13 2015 +0200
     6.2 +++ b/ko-felix-test/pom.xml	Fri Oct 02 08:57:14 2015 +0200
     6.3 @@ -32,7 +32,6 @@
     6.4              </plugin>
     6.5              <plugin>
     6.6                  <artifactId>maven-failsafe-plugin</artifactId>
     6.7 -                <version>2.16</version>
     6.8                  <configuration>
     6.9                      <additionalClasspathElements>
    6.10                          <additionalClasspathElement>${project.build.directory}/${project.build.finalName}.jar</additionalClasspathElement>
     7.1 --- a/ko-osgi-test/pom.xml	Mon Sep 21 21:19:13 2015 +0200
     7.2 +++ b/ko-osgi-test/pom.xml	Fri Oct 02 08:57:14 2015 +0200
     7.3 @@ -32,7 +32,6 @@
     7.4              </plugin>
     7.5              <plugin>
     7.6                  <artifactId>maven-failsafe-plugin</artifactId>
     7.7 -                <version>2.16</version>
     7.8                  <configuration>
     7.9                      <additionalClasspathElements>
    7.10                          <additionalClasspathElement>${project.build.directory}/${project.build.finalName}.jar</additionalClasspathElement>
     8.1 --- a/pom.xml	Mon Sep 21 21:19:13 2015 +0200
     8.2 +++ b/pom.xml	Fri Oct 02 08:57:14 2015 +0200
     8.3 @@ -164,6 +164,21 @@
     8.4                  <groupId>org.apache.maven.plugins</groupId>
     8.5                  <artifactId>maven-surefire-plugin</artifactId>
     8.6                  <version>2.13</version>
     8.7 +                <configuration>
     8.8 +                    <systemPropertyVariables>
     8.9 +                        <fxpresenter.headless>true</fxpresenter.headless>
    8.10 +                    </systemPropertyVariables>
    8.11 +                </configuration>
    8.12 +              </plugin>
    8.13 +              <plugin>
    8.14 +                <groupId>org.apache.maven.plugins</groupId>
    8.15 +                <artifactId>maven-failsafe-plugin</artifactId>
    8.16 +                <version>2.18.1</version>
    8.17 +                <configuration>
    8.18 +                    <systemPropertyVariables>
    8.19 +                        <fxpresenter.headless>true</fxpresenter.headless>
    8.20 +                    </systemPropertyVariables>
    8.21 +                </configuration>
    8.22                </plugin>
    8.23                <plugin>
    8.24                  <groupId>org.apache.maven.plugins</groupId>
     9.1 --- a/src/main/javadoc/overview.html	Mon Sep 21 21:19:13 2015 +0200
     9.2 +++ b/src/main/javadoc/overview.html	Fri Oct 02 08:57:14 2015 +0200
     9.3 @@ -94,6 +94,25 @@
     9.4           yet the application code can be written in Java.
     9.5          </p>
     9.6  
     9.7 +        <h3>Improvements in version 1.3</h3>
     9.8 +
     9.9 +        The <em>JavaFX</em> presenter can be executed in headless mode -
    9.10 +        just specify <code>-Dfxpresenter.headless=true</code> when launching
    9.11 +        its virtual machine and no window will be shown. This is particularly
    9.12 +        useful for testing. Configure your <em>surefire</em> or <em>failsafe</em>
    9.13 +        plugins like: <pre>
    9.14 +&lt;plugin&gt;
    9.15 +  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    9.16 +  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
    9.17 +  &lt;version&gt;2.13&lt;/version&gt;
    9.18 +  &lt;configuration&gt;
    9.19 +      &lt;systemPropertyVariables&gt;
    9.20 +          &lt;fxpresenter.headless&gt;true&lt;/fxpresenter.headless&gt;
    9.21 +      &lt;/systemPropertyVariables&gt;
    9.22 +  &lt;/configuration&gt;
    9.23 +&lt;/plugin&gt;
    9.24 +</pre>
    9.25 +
    9.26          <h3>What's Been Improved in Version 1.2.3?</h3>
    9.27  
    9.28          One can control {@link net.java.html.json.OnReceive#headers() HTTP request headers}