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

Fixes #3820 - Fix deployment steps serialization #3831

Merged
merged 1 commit into from
Apr 25, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ trait DeploymentFormats {

implicit lazy val DeploymentActionWrites: Writes[DeploymentAction] = Writes { action =>
Json.obj(
"type" -> action.getClass.getSimpleName,
"action" -> action.getClass.getSimpleName,
"app" -> action.app.id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class GroupsResourceTest extends MarathonSpec with Matchers with Mockito with Gi
assert(steps.size == 2)

val firstStep = (steps.head \ "actions").as[Seq[JsObject]].head
assert((firstStep \ "type").as[String] == "StartApplication")
assert((firstStep \ "action").as[String] == "StartApplication")
assert((firstStep \ "app").as[String] == "/test/app")

val secondStep = (steps.last \ "actions").as[Seq[JsObject]].head
assert((secondStep \ "type").as[String] == "ScaleApplication")
assert((secondStep \ "action").as[String] == "ScaleApplication")
assert((secondStep \ "app").as[String] == "/test/app")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ class DeploymentFormatsTest extends MarathonSpec {
Seq(genStep),
Timestamp.now()
)
val json = Json.toJson(plan)
val fieldMap = json.as[JsObject].fields.toMap
val json = Json.toJson(plan).as[JsObject]
val fieldMap = json.fields.toMap
fieldMap.keySet should be(Set("version", "id", "target", "original", "steps"))

val action = ((json \ "steps")(0) \ "actions")(0)
val actionFields = action.as[JsObject].fields.toMap.keySet
actionFields should be(Set("action", "app"))
}

// regression test for #1176
Expand Down