Skip to content

Commit

Permalink
#ESW-383 : Manish : Update sbt, dependency & plugin versions. Use Res…
Browse files Browse the repository at this point in the history
…tartSource overloaded method instead of deprecated one.
  • Loading branch information
Manish3323 committed Nov 3, 2020
1 parent c09d700 commit 0ee4dda
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 32 deletions.
46 changes: 23 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ inThisBuild(
organization := "com.github.tmtsoftware.embedded-keycloak",
homepage := Some(url("https://github.com/tmtsoftware/embedded-keycloak")),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
developers := List(
Developer("tmtsoftware", "TMT", "", url("https://github.com/tmtsoftware"))
),
Developer("tmtsoftware", "TMT", "", url("https://github.com/tmtsoftware"))
),
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code"
)
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code"
)
)
)

lazy val `embedded-keycloak` = (project in file("embedded-keycloak"))
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %% "requests" % "0.6.5",
"com.lihaoyi" %% "os-lib" % "0.7.1",
"com.lihaoyi" %% "upickle" % "1.2.0",
"com.lihaoyi" %% "ujson" % "1.2.0",
"com.iheart" %% "ficus" % "1.4.7",
//AKKA-DOWNLOADER
"com.typesafe.akka" %% "akka-http" % "10.2.0",
"com.typesafe.akka" %% "akka-stream" % "2.6.9",
//TEST
"org.scalatest" %% "scalatest" % "3.2.2" % Test
),
"com.lihaoyi" %% "requests" % "0.6.5",
"com.lihaoyi" %% "os-lib" % "0.7.1",
"com.lihaoyi" %% "upickle" % "1.2.2",
"com.lihaoyi" %% "ujson" % "1.2.2",
"com.iheart" %% "ficus" % "1.5.0",
//AKKA-DOWNLOADER
"com.typesafe.akka" %% "akka-http" % "10.2.1",
"com.typesafe.akka" %% "akka-stream" % "2.6.10",
//TEST
"org.scalatest" %% "scalatest" % "3.2.2" % Test
),
parallelExecution in Test in ThisBuild := false
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.tmt.embedded_keycloak.impl

import akka.NotUsed
import akka.actor.ActorSystem
import akka.stream.RestartSettings
import akka.stream.scaladsl.{RestartSource, Sink, Source}
import org.tmt.embedded_keycloak.Settings
import requests.Response
Expand All @@ -18,12 +19,9 @@ object HealthCheckFailedException extends NoStackTrace {

private[embedded_keycloak] class HealthCheck(settings: Settings)(implicit val system: ActorSystem) {

private def restartSource(url: String, successCode: Int): Source[Response, NotUsed] =
private def restartSource(url: String, successCode: Int): Source[Response, NotUsed] = {
RestartSource.onFailuresWithBackoff(
minBackoff = 3.seconds,
maxBackoff = 3.seconds,
randomFactor = 0.2,
maxRestarts = 10
RestartSettings(3.seconds, 3.seconds, 0.2).withMaxRestarts(10, 3.seconds)
) { () =>
Source
.future {
Expand All @@ -36,8 +34,9 @@ private[embedded_keycloak] class HealthCheck(settings: Settings)(implicit val sy
}
.log("Restarting ..")
}
}

def keycloakHealth(): Future[Response] = checkHealth(s"http://localhost:${settings.port}", 200)
def keycloakHealth(): Future[Response] = checkHealth(s"http://localhost:${settings.port}", 200)
def checkHealth(url: String, successCode: Int): Future[Response] =
restartSource(url, successCode).runWith(Sink.head)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.0-RC1
sbt.version=1.4.2
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.13")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.15")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")

scalacOptions ++= Seq(
"-encoding",
Expand Down

0 comments on commit 0ee4dda

Please sign in to comment.