diff options
author | Sam Guymer <sam@guymer.me> | 2018-05-21 20:54:10 +1000 |
---|---|---|
committer | Sam Guymer <sam@guymer.me> | 2018-05-21 21:02:24 +1000 |
commit | ccb1afe90e938fc2b8619dd960a1df1937f212be (patch) | |
tree | 0d7a6b1c653393de8422e9704b9e68bb5cf7ed91 /project | |
parent | bcb94e252a96c78b1db29aebe47b18bfd337e764 (diff) | |
download | sttp-ccb1afe90e938fc2b8619dd960a1df1937f212be.tar.gz sttp-ccb1afe90e938fc2b8619dd960a1df1937f212be.tar.bz2 sttp-ccb1afe90e938fc2b8619dd960a1df1937f212be.zip |
Code review updates
Start the test server before each backend test
Diffstat (limited to 'project')
-rw-r--r-- | project/PollingUtils.scala | 45 | ||||
-rw-r--r-- | project/plugins.sbt | 5 |
2 files changed, 1 insertions, 49 deletions
diff --git a/project/PollingUtils.scala b/project/PollingUtils.scala deleted file mode 100644 index 34b92ac..0000000 --- a/project/PollingUtils.scala +++ /dev/null @@ -1,45 +0,0 @@ -import java.io.FileNotFoundException -import java.net.{ConnectException, URL} - -import scala.concurrent.TimeoutException -import scala.concurrent.duration._ - -object PollingUtils { - - def waitUntilServerAvailable(url: URL): Unit = { - val connected = poll(5.seconds, 250.milliseconds)({ - urlConnectionAvailable(url) - }) - if (!connected) { - throw new TimeoutException(s"Failed to connect to $url") - } - } - - def poll(timeout: FiniteDuration, interval: FiniteDuration)(poll: => Boolean): Boolean = { - val start = System.nanoTime() - - def go(): Boolean = { - if (poll) { - true - } else if ((System.nanoTime() - start) > timeout.toNanos) { - false - } else { - Thread.sleep(interval.toMillis) - go() - } - } - go() - } - - def urlConnectionAvailable(url: URL): Boolean = { - try { - url.openConnection() - .getInputStream - .close() - true - } catch { - case _: ConnectException => false - case _: FileNotFoundException => true // on 404 - } - } -} diff --git a/project/plugins.sbt b/project/plugins.sbt index b334460..fa55342 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,4 @@ -// using '-coursier' because of https://github.com/lucidsoftware/neo-sbt-scalafmt/issues/64 -addSbtPlugin("com.lucidchart" % "sbt-scalafmt-coursier" % "1.15") +addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") @@ -8,5 +7,3 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7") addSbtPlugin("com.updateimpact" % "updateimpact-sbt-plugin" % "2.1.3") - -addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1") |