Tests must use a (random) free port, rather than claiming 9998
authorJan Lahoda <jlahoda@netbeans.org>
Wed, 17 Apr 2013 20:53:48 +0200
changeset 94627d84606fcea
parent 945 3f6a3dfb7a2a
child 947 68a3efc1ea05
Tests must use a (random) free port, rather than claiming 9998
remoting/server/tests/integration/pom.xml
remoting/server/tests/integration/src/test/java/org/netbeans/modules/jackpot30/web/ui/test/OverallTest.java
remoting/server/tests/run-integration-tests
     1.1 --- a/remoting/server/tests/integration/pom.xml	Wed Apr 17 19:44:36 2013 +0200
     1.2 +++ b/remoting/server/tests/integration/pom.xml	Wed Apr 17 20:53:48 2013 +0200
     1.3 @@ -13,7 +13,22 @@
     1.4    <properties>
     1.5      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     1.6    </properties>
     1.7 -
     1.8 +  <build>
     1.9 +      <plugins>
    1.10 +          <plugin>
    1.11 +              <groupId>org.apache.maven.plugins</groupId>
    1.12 +              <artifactId>maven-surefire-plugin</artifactId>
    1.13 +              <configuration>
    1.14 +                  <systemProperties>
    1.15 +                      <property>
    1.16 +                          <name>PORT</name>
    1.17 +                          <value>${PORT}</value>
    1.18 +                      </property>
    1.19 +                  </systemProperties>
    1.20 +              </configuration>
    1.21 +          </plugin>
    1.22 +      </plugins>
    1.23 +  </build>
    1.24      <dependencies>
    1.25          <dependency>
    1.26              <groupId>org.seleniumhq.selenium</groupId>
     2.1 --- a/remoting/server/tests/integration/src/test/java/org/netbeans/modules/jackpot30/web/ui/test/OverallTest.java	Wed Apr 17 19:44:36 2013 +0200
     2.2 +++ b/remoting/server/tests/integration/src/test/java/org/netbeans/modules/jackpot30/web/ui/test/OverallTest.java	Wed Apr 17 20:53:48 2013 +0200
     2.3 @@ -70,7 +70,7 @@
     2.4          ((HtmlUnitDriver) driver).setJavascriptEnabled(true);
     2.5  
     2.6          try {
     2.7 -            driver.get("http://localhost:9998/index/ui/index.html");
     2.8 +            driver.get("http://localhost:" + System.getProperty("PORT", "9998") + "/index/ui/index.html");
     2.9  
    2.10              //wait for the page to be rendered:
    2.11              new WebDriverWait(driver, 20).until(new Predicate<WebDriver>() {
     3.1 --- a/remoting/server/tests/run-integration-tests	Wed Apr 17 19:44:36 2013 +0200
     3.2 +++ b/remoting/server/tests/run-integration-tests	Wed Apr 17 20:53:48 2013 +0200
     3.3 @@ -10,16 +10,15 @@
     3.4  
     3.5  OUT=`mktemp`;
     3.6  trap "rm $OUT" EXIT
     3.7 -#JACKPOT_WEB_OPTS=-Xmx128m ../../build/indexing-backend/web.sh --port 0 cache >"$OUT" &
     3.8 -JACKPOT_WEB_OPTS=-Xmx128m ../../build/indexing-backend/web.sh cache >"$OUT" &
     3.9 +JACKPOT_WEB_OPTS=-Xmx128m ../../build/indexing-backend/web.sh --port 0 cache >"$OUT" &
    3.10  
    3.11  trap "kill %1" EXIT
    3.12  
    3.13 -#while [ -z "$PORT" ] ; do
    3.14 -#     sleep 1s;
    3.15 -#     PORT=`cat "$OUT" | grep "Running on port: " | cut -d ':' -f 2 | tr -d ' '`;
    3.16 -#done
    3.17 +while [ -z "$PORT" ] ; do
    3.18 +     sleep 1s;
    3.19 +     PORT=`cat "$OUT" | grep "Running on port: " | cut -d ':' -f 2 | tr -d ' '`;
    3.20 +done
    3.21  
    3.22 -(cd integration; mvn test)
    3.23 +(cd integration; mvn -DPORT=$PORT test)
    3.24  
    3.25  exit 0