aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-04 09:13:12 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-04 09:13:12 +0200
commitb87a4ac9478262ad261dbd6ec3378a7d4a46efd1 (patch)
treed6dcd047abe051df9f917b95418e151404f4df1b /sonar-core/src
parent73ff883cef3197b994c148b7e7d7c21d69a7774e (diff)
downloadsonarqube-b87a4ac9478262ad261dbd6ec3378a7d4a46efd1.tar.gz
sonarqube-b87a4ac9478262ad261dbd6ec3378a7d4a46efd1.zip
Fix test false-positives when port is already in use
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
index f19f42c5345..576d274a669 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
@@ -111,9 +111,9 @@ public class DefaultHttpDownloaderTest {
}
}
});
- SocketAddress address = socketConnection.connect(new InetSocketAddress(0));
+ SocketAddress address = socketConnection.connect(new InetSocketAddress("localhost", 0));
- baseUrl = "http://0.0.0.0:" + ((InetSocketAddress) address).getPort();
+ baseUrl = String.format("http://%s:%d", ((InetSocketAddress) address).getAddress().getHostAddress(), ((InetSocketAddress) address).getPort());
}
@AfterClass
@@ -197,7 +197,7 @@ public class DefaultHttpDownloaderTest {
File toFile = new File(toDir, "downloadToFile.txt");
try {
- int port = new InetSocketAddress(0).getPort();
+ int port = new InetSocketAddress("localhost", 0).getPort();
new DefaultHttpDownloader(new Settings()).download(new URI("http://localhost:" + port), toFile);
} catch (SonarException e) {
assertThat(toFile).doesNotExist();