Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade versions #123

Merged
merged 3 commits into from Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -158,11 +158,11 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

def isLogin(username: String, password: String) =
hasMethod(HttpMethod.Post) and
hasUrl(uris.login) and
hasEmptyBody and
hasAuth(username, password) and
not(matcher = hasPassport(TestPassport)) and
hasTimeout(TestTimeout)
hasUrl(uris.login) and
hasEmptyBody and
hasAuth(username, password) and
not(matcher = hasPassport(TestPassport)) and
hasTimeout(TestTimeout)

"authenticate" should "return the user's passport when result code is 200" in {
val expectedPassport = generatePassport()
Expand Down Expand Up @@ -194,7 +194,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Refresh token requests

val isRefreshPassport = hasMethod(HttpMethod.Post) and
val isRefreshPassport =
hasMethod(HttpMethod.Post) and
hasUrl(uris.refreshPass) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -230,7 +231,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Logout requests

val isLogout = hasMethod(HttpMethod.Post) and
val isLogout =
hasMethod(HttpMethod.Post) and
hasUrl(uris.logout) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand All @@ -254,7 +256,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Get Cluster State

val isGetClusterState = hasMethod(HttpMethod.Get) and
val isGetClusterState =
hasMethod(HttpMethod.Get) and
hasUrl(uris.cluster) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand All @@ -273,7 +276,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Register Job

val isRegisterJob = hasMethod(HttpMethod.Put) and
val isRegisterJob =
hasMethod(HttpMethod.Put) and
hasUrl(uris.jobs) and
hasPassport(TestPassport) and
hasBody(TestJobSpec) and
Expand Down Expand Up @@ -305,7 +309,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Fetch Jobs

val isFetchJobs = hasMethod(HttpMethod.Get) and
val isFetchJobs =
hasMethod(HttpMethod.Get) and
hasUrl(uris.jobs) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand All @@ -325,7 +330,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Fetch Job

val isFetchJob = hasMethod(HttpMethod.Get) and
val isFetchJob =
hasMethod(HttpMethod.Get) and
hasUrl(uris.fetchJob) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -365,7 +371,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Enable Job

val isEnableJob = hasMethod(HttpMethod.Post) and
val isEnableJob =
hasMethod(HttpMethod.Post) and
hasUrl(uris.enableJob) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -399,7 +406,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Disable Job

val isDisableJob = hasMethod(HttpMethod.Post) and
val isDisableJob =
hasMethod(HttpMethod.Post) and
hasUrl(uris.disableJob) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -433,7 +441,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Get execution plans

val isGetExecutionPlans = hasMethod(HttpMethod.Get) and
val isGetExecutionPlans =
hasMethod(HttpMethod.Get) and
hasUrl(uris.executionPlans) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand All @@ -453,7 +462,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Get execution plan

val isGetExecutionPlan = hasMethod(HttpMethod.Get) and
val isGetExecutionPlan =
hasMethod(HttpMethod.Get) and
hasUrl(uris.executionPlan) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -493,7 +503,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Schedule job

def isScheduleJob(value: ScheduleJob) = hasMethod(HttpMethod.Put) and
def isScheduleJob(value: ScheduleJob) =
hasMethod(HttpMethod.Put) and
hasUrl(uris.executionPlans) and
hasPassport(TestPassport) and
hasBody(value) and
Expand All @@ -502,13 +513,17 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

"scheduleJob" should "return the started notification" in {
val payload = ScheduleJob(TestJobId)

def result(jobId: JobId) = ExecutionPlanStarted(jobId, TestPlanId, currentDateTime)
val expectedResult = result(TestJobId)

inProtocol[HttpProtocol] ensuringRequest isScheduleJob(payload) replyWith { req =>
val result = req.entity.as[ScheduleJob].
flatMap(cmd => DataBuffer(ExecutionPlanStarted(cmd.jobId, TestPlanId, currentDateTime)))
HttpSuccess(result)
val stubResult = req.entity.as[ScheduleJob].
flatMap(cmd => DataBuffer(result(cmd.jobId)))
HttpSuccess(stubResult)
} usingClient { client =>
client.scheduleJob(payload).map { returned =>
returned shouldBe ExecutionPlanStarted(TestJobId, TestPlanId, currentDateTime).asRight[JobNotFound]
returned shouldBe expectedResult.asRight[JobNotFound]
}
}
}
Expand All @@ -528,7 +543,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Cancel execution plan

val isCancelExecutionPlan = hasMethod(HttpMethod.Delete) and
val isCancelExecutionPlan =
hasMethod(HttpMethod.Delete) and
hasUrl(uris.executionPlan) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down Expand Up @@ -568,7 +584,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Get executions

val isGetExecutions = hasMethod(HttpMethod.Get) and
val isGetExecutions =
hasMethod(HttpMethod.Get) and
hasUrl(uris.executions) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand All @@ -588,7 +605,8 @@ class HttpProtocolSpec extends AsyncFlatSpec with HttpRequestMatchers with StubC

// -- Get execution

val isGetExecution = hasMethod(HttpMethod.Get) and
val isGetExecution =
hasMethod(HttpMethod.Get) and
hasUrl(uris.execution) and
hasPassport(TestPassport) and
hasEmptyBody and
Expand Down
Expand Up @@ -62,7 +62,8 @@ trait HttpRequestMatchers extends Matchers {
}
}

val isJsonRequest: Matcher[HttpRequest] = hasHeader("Content-Type", "application/json")
val isJsonRequest: Matcher[HttpRequest] =
hasHeader("Content-Type", "application/json")

def hasAuth(username: String, password: String): Matcher[HttpRequest] = {
val Right(creds) = DataBuffer.fromString(s"$username:$password").toBase64
Expand Down
Expand Up @@ -31,10 +31,10 @@ package object json extends TimeJson with Cron4s {
type JsonEncoder[A] = Encoder[A, String]
type JsonDecoder[A] = Decoder[String, A]

implicit def JsonEncoderInstance[A: CirceEncoder]: Encoder[A, String] =
implicit def JsonEncoderInstance[A: CirceEncoder]: JsonEncoder[A] =
(a: A) => Attempt(a.asJson.noSpaces)

implicit def JsonDecoderInstance[A: CirceDecoder]: Decoder[String, A] =
implicit def JsonDecoderInstance[A: CirceDecoder]: JsonDecoder[A] =
(input: String) => parse(input).flatMap(_.as[A])

implicit def JsonCodecInstance[A: CirceDecoder: CirceEncoder]: JsonCodec[A] = new JsonCodec[A] {
Expand Down
12 changes: 6 additions & 6 deletions project/Dependencies.scala
Expand Up @@ -10,7 +10,7 @@ object Dependencies {
// Logging -------

val slogging = "0.6.0"
val log4j = "2.8.2"
val log4j = "2.9.1"
val slf4j = "1.7.25"

// Testing --------
Expand All @@ -33,12 +33,12 @@ object Dependencies {
val main = "10.0.10"

// http extensions
val json = "1.18.0"
val json = "1.18.1"
val sse = "3.0.0"
}

// persistence plugins
val cassandra = "0.56"
val cassandra = "0.58"
val inmemory = "2.5.1.1"
}

Expand All @@ -51,7 +51,7 @@ object Dependencies {

// ScalaJS -------

val scalaJsReact = "1.1.0"
val scalaJsReact = "1.1.1"
val scalaJsDom = "0.9.3"
val scalaJsJQuery = "0.9.2"
val scalaJSScripts = "1.1.1"
Expand All @@ -60,7 +60,7 @@ object Dependencies {
// Other utils ---

val arm = "2.0"
val betterfiles = "3.1.0"
val betterfiles = "3.2.0"
val diode = "1.1.2"
val cats = "1.0.0-MF"
val catsEffect = "0.4"
Expand All @@ -74,7 +74,7 @@ object Dependencies {
val pureconfig = "0.8.0"
val refined = "0.8.4"
val scalaCss = "0.5.3"
val scalafmt = "1.2.0"
val scalafmt = "1.3.0"
val scalaTime = "2.0.0-M12"
val scopt = "3.7.0"
val xml = "1.0.6"
Expand Down
2 changes: 1 addition & 1 deletion project/QuckooWebServer.scala
Expand Up @@ -31,7 +31,7 @@ object QuckooApp extends AutoPlugin {
sigarLoaderOptions := Seq(s"-javaagent:${sigarLoader.value.getAbsolutePath}"),
sigarLoaderOptions in Test := sigarLoaderOptions.value :+ s"-Dkamon.sigar.folder=${baseDirectory.value / "target" / "native"}",
baseDirectory in reStart := baseDirectory.value / "target",
aspectjVersion in Aspectj := "1.8.11",
aspectjVersion in Aspectj := "1.8.12",
aspectjSourceLevel in Aspectj := "-1.8",
javaOptions in reStart ++= (aspectjWeaverOptions in Aspectj).value ++ (sigarLoaderOptions in Test).value,
javaOptions in Test ++= (sigarLoaderOptions in Test).value,
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.0.2
sbt.version=1.0.3
4 changes: 2 additions & 2 deletions project/plugins.sbt
Expand Up @@ -7,7 +7,7 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.12")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.14")
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1")

// Web plugins
Expand All @@ -16,7 +16,7 @@ addSbtPlugin("org.scala-native" % "sbt-crossproject" % "0.2.2")
addSbtPlugin("org.scala-native" % "sbt-scalajs-crossproject" % "0.2.2")
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.0.6")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.11")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.3.12")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.3.13")

// Server side plugins
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.0")
Expand Down