Skip to content

Commit

Permalink
Added build-helper-maven-plugin to use a random port for tomcat
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlau committed Jul 4, 2013
1 parent 93d9b21 commit 8aef215
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<systemProperties>
<fixture.base.url>http://localhost:${tomcat.http.port}/fixture</fixture.base.url>
</systemProperties>
</configuration>
</execution>
<execution>
<id>verify</id>
Expand Down Expand Up @@ -343,6 +348,7 @@
<phase>pre-integration-test</phase>
<configuration>
<fork>true</fork>
<port>${tomcat.http.port}</port>
</configuration>
</execution>
<execution>
Expand All @@ -357,6 +363,24 @@
<useTestClasspath>true</useTestClasspath>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<configuration>
<portNames>
<portName>tomcat.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down Expand Up @@ -422,6 +446,10 @@
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -977,6 +1005,7 @@
<versions-maven-plugin.version>2.1</versions-maven-plugin.version>

<!-- Plugin versions -->
<build-helper-maven-plugin.version>1.8</build-helper-maven-plugin.version>
<kotlin-maven-plugin.version>0.5.748</kotlin-maven-plugin.version>
<maven-clean-plugin.version>2.5</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
Expand Down
9 changes: 7 additions & 2 deletions src/test/kotlin/io/fixture/feature/step/StepDefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ import kotlin.test.assertTrue
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import java.net.URI

class StepDefs [Autowired] (
val driver: WebDriver
) {

[Value("#{systemProperties['fixture.base.url']}")]
var baseUri: String? = null

[Given("""^I open any page""")]
fun I_open_any_page() {
driver.get("http://localhost:8080/fixture/")
driver.get("${baseUri}")
}

[Given("""^I select the theme "([^"]*)"$""")]
Expand All @@ -25,7 +30,7 @@ class StepDefs [Autowired] (

[When("""^I go to the page "([^"]*)"$""")]
fun I_go_to_the_page(page: String) {
driver.get("http://localhost:8080/fixture/${page}")
driver.get("${baseUri}${page}")
}

[When("""^I click on the link "([^"]*)"$""")]
Expand Down

0 comments on commit 8aef215

Please sign in to comment.