1

When maven starts tests using gwt-maven-plugin, it firing up server, and use wrong ip, in my case

Starting http://10.0.14.67:60281/com.something.GwtTest.JUnit/junit-standards.html?gwt.codesvr=10.0.14.67:60278 on browser FF17

and get access denied error. I want it to start tests on 127.0.0.1, but dont know how. BUT if i run gwt plugin, not gwt:test but gwt:run it starts on 127.0.0.1 and all works fine! i have such config in maven plugin

<failOnError>true</failOnError>
                    <runTarget>http://127.0.0.1:8080/</runTarget>
                    <hostedWebapp>${project.build.directory}/${project.build.finalName}-gwt</hostedWebapp>
                    <noServer>true</noServer>

                    <includes>**/*TestSuiteGWT.java</includes>
                    <mode>htmlunit</mode>

So how i can make it start tests on same 127.0.0.1 ?

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
Wizzard
  • 345
  • 3
  • 13

1 Answers1

2

Tests use InetAddress.getLocalHost().getHostAddress(), so there's no way to change it other than changing the JVM's behavior for InetAddress.getLocalHost().
That behavior of the JUnitShell is to allow remote testing without reconfiguration (contrary to DevMode which requires -bindAddress).

A solution is to create a custom "run style" inheriting com.google.gwt.junit.RunStyleHtmlUnit and overriding getLocalHostName() to return 127.0.0.1, and using it through <mode>name.of.your.CustomRunStyleHtmlUnit</mode>.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164