[ 
https://issues.apache.org/jira/browse/PIO-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16642818#comment-16642818
 ] 

ASF GitHub Bot commented on PIO-31:
-----------------------------------

shimamoto commented on a change in pull request #474: [PIO-31] Move from spray 
to akka-http
URL: https://github.com/apache/predictionio/pull/474#discussion_r223561854
 
 

 ##########
 File path: 
tools/src/test/scala/org/apache/predictionio/tools/admin/AdminAPISpec.scala
 ##########
 @@ -17,67 +17,27 @@
 
 package org.apache.predictionio.tools.admin
 
-import akka.actor.{ActorSystem, Props}
-import akka.testkit.TestProbe
-import org.apache.predictionio.data.storage.Storage
 import org.specs2.mutable.Specification
-import spray.http._
-import spray.httpx.RequestBuilding._
-import spray.util._
+import akka.http.scaladsl.testkit.Specs2RouteTest
 
-
-class AdminAPISpec extends Specification{
-
-  val system = ActorSystem(Utils.actorSystemNameFrom(getClass))
-  val config = AdminServerConfig(
-    ip = "localhost",
-    port = 7071)
-
-  val commandClient = new CommandClient(
-    appClient = Storage.getMetaDataApps,
-    accessKeyClient = Storage.getMetaDataAccessKeys,
-    eventClient = Storage.getLEvents()
-  )
-
-  val adminActor= system.actorOf(Props(classOf[AdminServiceActor], 
commandClient))
+class AdminAPISpec extends Specification with Specs2RouteTest {
+  val route = AdminServer.createRoute()
 
   "GET / request" should {
     "properly produce OK HttpResponses" in {
-      val probe = TestProbe()(system)
-      probe.send(adminActor, Get("/"))
-
-      probe.expectMsg(
-        HttpResponse(
-          200,
-          HttpEntity(
-            contentType = ContentTypes.`application/json`,
-            string = """{"status":"alive"}"""
-          )
-        )
-      )
-      success
-    }
-  }
-
-  "GET /cmd/app request" should {
-    "properly produce OK HttpResponses" in {
-      /*
-      val probe = TestProbe()(system)
-      probe.send(adminActor,Get("/cmd/app"))
-
-      //TODO: Need to convert the response string to the corresponding case 
object to assert some properties on the object
-      probe.expectMsg(
-        HttpResponse(
-          200,
-          HttpEntity(
-            contentType = ContentTypes.`application/json`,
-            string = """{"status":1}"""
-          )
-        )
-      )*/
-      pending
+      Get() ~> route ~> check {
+        response.status.intValue() shouldEqual 200
+        responseAs[String] shouldEqual """{"status":"alive"}"""
+      }
     }
   }
 
-  step(system.shutdown())
+//  "GET /cmd/app request" should {
+//    "properly produce OK HttpResponses" in {
+//      Get("/cmd/app") ~> route ~> check {
+//        status.intValue() shouldEqual 200
+//        responseAs[String] shouldEqual """{"status":1}"""
+//      }
+//    }
+//  }
 
 Review comment:
   unused?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Move from spray to akka-http in servers
> ---------------------------------------
>
>                 Key: PIO-31
>                 URL: https://issues.apache.org/jira/browse/PIO-31
>             Project: PredictionIO
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Marcin ZiemiƄski
>            Assignee: Naoki Takezoe
>            Priority: Major
>              Labels: gsoc2017, newbie
>
> On account of the death of spray for http and it being reborn as akka-http we 
> should update EventServer and Dashbord. It should be fairly simple, as 
> described in the following guide: 
> http://doc.akka.io/docs/akka/2.4/scala/http/migration-from-spray.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to