diff --git a/engine/src/main/scala/cromwell/webservice/routes/wes/WesResponse.scala b/engine/src/main/scala/cromwell/webservice/routes/wes/WesResponse.scala index 32e221272e0..58313cb5946 100644 --- a/engine/src/main/scala/cromwell/webservice/routes/wes/WesResponse.scala +++ b/engine/src/main/scala/cromwell/webservice/routes/wes/WesResponse.scala @@ -2,8 +2,7 @@ package cromwell.webservice.routes.wes import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport import cromwell.webservice.routes.wes.WesState.WesState -import spray.json.{DefaultJsonProtocol, RootJsonFormat} -import cromwell.webservice.routes.wes.WesRunLog +import spray.json.{DefaultJsonProtocol, JsObject, RootJsonFormat} sealed trait WesResponse extends Product with Serializable final case class WesErrorResponse(msg: String, status_code: Int) extends WesResponse @@ -12,6 +11,18 @@ final case class WesRunStatus(run_id: String, state: WesState) extends WesRespon final case class WesResponseRunList(runs: List[WesRunStatus]) extends WesResponse final case class WesResponseWorkflowMetadata(workflowLog: WesRunLog) extends WesResponse +final case class WesRunLog(run_id: String, + request: WesRunRequest, + state: WesState, + run_log: Option[WesLog], + task_logs: Option[List[WesLog]], + outputs: Option[JsObject] + ) extends WesResponse + +object WesRunLog { + def fromJson(json: String): WesRunLog = CromwellMetadata.fromJson(json).wesRunLog +} + final case class WesStatusInfoResponse(workflow_type_version: Map[String, Iterable[String]], supported_wes_versions: Iterable[String], @@ -48,6 +59,7 @@ object WesResponseJsonSupport extends SprayJsonSupport with DefaultJsonProtocol case i: WesStatusInfoResponse => i.toJson case l: WesResponseRunList => l.toJson case m: WesResponseWorkflowMetadata => m.toJson + case w: WesRunLog => w.toJson } } diff --git a/engine/src/main/scala/cromwell/webservice/routes/wes/WesRouteSupport.scala b/engine/src/main/scala/cromwell/webservice/routes/wes/WesRouteSupport.scala index ba6546fb3e3..41973bb8981 100644 --- a/engine/src/main/scala/cromwell/webservice/routes/wes/WesRouteSupport.scala +++ b/engine/src/main/scala/cromwell/webservice/routes/wes/WesRouteSupport.scala @@ -228,7 +228,7 @@ object WesRouteSupport { val metadataJsonResponse = metadataBuilderActorRequest(workflowId, request, serviceRegistryActor) metadataJsonResponse.map { - case SuccessfulMetadataJsonResponse(_, responseJson) => WesResponseWorkflowMetadata(WesRunLog.fromJson(responseJson.toString())) + case SuccessfulMetadataJsonResponse(_, responseJson) => WesRunLog.fromJson(responseJson.toString()) case FailedMetadataJsonResponse(_, reason) => WesErrorResponse(reason.getMessage, StatusCodes.InternalServerError.intValue) } } diff --git a/engine/src/main/scala/cromwell/webservice/routes/wes/WesRunLog.scala b/engine/src/main/scala/cromwell/webservice/routes/wes/WesRunLog.scala index 344498e51ab..c882ebf4f8b 100644 --- a/engine/src/main/scala/cromwell/webservice/routes/wes/WesRunLog.scala +++ b/engine/src/main/scala/cromwell/webservice/routes/wes/WesRunLog.scala @@ -1,6 +1,5 @@ package cromwell.webservice.routes.wes -import cromwell.webservice.routes.wes.WesState.WesState import spray.json.JsObject @@ -20,15 +19,3 @@ final case class WesRunRequest(workflow_params: Option[JsObject], workflow_engine_parameters: Option[JsObject], workflow_url: Option[String] ) - -final case class WesRunLog(run_id: String, - request: WesRunRequest, - state: WesState, - run_log: Option[WesLog], - task_logs: Option[List[WesLog]], - outputs: Option[JsObject] - ) - -object WesRunLog { - def fromJson(json: String): WesRunLog = CromwellMetadata.fromJson(json).wesRunLog -} diff --git a/engine/src/test/scala/cromwell/webservice/routes/wes/WesRouteSupportSpec.scala b/engine/src/test/scala/cromwell/webservice/routes/wes/WesRouteSupportSpec.scala index 6e9a390ad4a..00a361a3174 100644 --- a/engine/src/test/scala/cromwell/webservice/routes/wes/WesRouteSupportSpec.scala +++ b/engine/src/test/scala/cromwell/webservice/routes/wes/WesRouteSupportSpec.scala @@ -196,7 +196,7 @@ class WesRouteSupportSpec extends AsyncFlatSpec with ScalatestRouteTest with Mat wesRoutes ~> check { status should be(StatusCodes.OK) - val result = responseAs[JsObject].fields("workflowLog").asJsObject() + val result = responseAs[JsObject] result.fields.keys should contain allOf("request", "run_id", "state") result.fields("state") should be(JsString("RUNNING")) result.fields("run_id") should be(JsString(CromwellApiServiceSpec.wesWorkflowId.toString))