You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lb...@apache.org on 2016/04/22 20:56:12 UTC
[1/3] incubator-toree git commit: Added unit tests for Comm Info
messages
Repository: incubator-toree
Updated Branches:
refs/heads/master d08b11744 -> c7b84a0ce
Added unit tests for Comm Info messages
Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/fa4d5cd4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/fa4d5cd4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/fa4d5cd4
Branch: refs/heads/master
Commit: fa4d5cd4283deb9d4bd134e4518e15d0c294bcb4
Parents: bb6a48d
Author: Michael Poplavski <mi...@gmail.com>
Authored: Thu Apr 21 11:14:49 2016 -0500
Committer: Michael Poplavski <mi...@gmail.com>
Committed: Fri Apr 22 09:20:29 2016 -0500
----------------------------------------------------------------------
.../v5/handler/CommInfoRequestHandlerSpec.scala | 116 +++++++++++++++++++
1 file changed, 116 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/fa4d5cd4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
new file mode 100644
index 0000000..a0be6c5
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.toree.kernel.protocol.v5.handler
+
+import akka.actor.{ActorSelection, ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.typesafe.config.ConfigFactory
+import org.apache.toree.comm.CommStorage
+import org.apache.toree.kernel.protocol.v5.content.CommInfoReply
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{Header, KernelMessage, SystemActorType}
+import org.mockito.AdditionalMatchers.{not => mockNot}
+import org.mockito.Matchers.{eq => mockEq}
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+object CommInfoRequestHandlerSpec {
+ val config = """
+ akka {
+ loglevel = "WARNING"
+ }"""
+}
+
+class CommInfoRequestHandlerSpec extends TestKit(
+ ActorSystem("CommInfoRequestHandlerSpec",
+ ConfigFactory.parseString(CommInfoRequestHandlerSpec.config))
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+
+ var mockCommStorage: CommStorage = mock[CommStorage]
+
+ val actorLoader: ActorLoader = mock[ActorLoader]
+ val actor = system.actorOf(Props(classOf[CommInfoRequestHandler], actorLoader, mockCommStorage))
+
+ val relayProbe : TestProbe = TestProbe()
+ val relaySelection : ActorSelection =
+ system.actorSelection(relayProbe.ref.path)
+ when(actorLoader.load(SystemActorType.KernelMessageRelay))
+ .thenReturn(relaySelection)
+ when(actorLoader.load(mockNot(mockEq(SystemActorType.KernelMessageRelay))))
+ .thenReturn(system.actorSelection(""))
+
+ val header = Header("","","","","")
+
+ describe("Comm Info Request Handler") {
+ it("should return a KernelMessage containing comm info response for a specific target name") {
+ val kernelMessage = new KernelMessage(
+ Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"test.name\"}"
+ )
+
+ when(mockCommStorage.getTargets()).thenReturn(Set("test.name"))
+ when(mockCommStorage.getCommIdsFromTarget("test.name")).thenReturn(Option(scala.collection.immutable.IndexedSeq("1", "2")))
+
+ actor ! kernelMessage
+ val reply = relayProbe.receiveOne(1.seconds).asInstanceOf[KernelMessage]
+ val commInfo = Json.parse(reply.contentString).as[CommInfoReply]
+
+ commInfo.comms.size should equal (2)
+ commInfo.comms.get("1").get.get("target_name").get should be ("test.name")
+ commInfo.comms.get("2").get.get("target_name").get should be ("test.name")
+ }
+ }
+
+ it("should return a KernelMessage containing comm info response for all comms when target name is empty string") {
+ val kernelMessage = new KernelMessage(
+ Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"\"}"
+ )
+
+ when(mockCommStorage.getTargets()).thenReturn(Set("test.name1", "test.name2"))
+ when(mockCommStorage.getCommIdsFromTarget("test.name1")).thenReturn(Option(scala.collection.immutable.IndexedSeq("1", "2")))
+ when(mockCommStorage.getCommIdsFromTarget("test.name2")).thenReturn(Option(scala.collection.immutable.IndexedSeq("3", "4")))
+
+ actor ! kernelMessage
+ val reply = relayProbe.receiveOne(1.seconds).asInstanceOf[KernelMessage]
+ val commInfo = Json.parse(reply.contentString).as[CommInfoReply]
+
+ commInfo.comms.size should equal (4)
+ commInfo.comms.get("1").get.get("target_name").get should be ("test.name1")
+ commInfo.comms.get("2").get.get("target_name").get should be ("test.name1")
+ commInfo.comms.get("3").get.get("target_name").get should be ("test.name2")
+ commInfo.comms.get("4").get.get("target_name").get should be ("test.name2")
+ }
+
+ it("should return a KernelMessage containing an empty comm info response when target name is not found") {
+ val kernelMessage = new KernelMessage(
+ Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"can't_find_me\"}"
+ )
+
+ when(mockCommStorage.getTargets()).thenReturn(Set("test.name"))
+ when(mockCommStorage.getCommIdsFromTarget("test.name")).thenReturn(Option(scala.collection.immutable.IndexedSeq("1", "2")))
+
+ actor ! kernelMessage
+ val reply = relayProbe.receiveOne(1.seconds).asInstanceOf[KernelMessage]
+ val commInfo = Json.parse(reply.contentString).as[CommInfoReply]
+
+ commInfo.comms.size should equal (0)
+ }
+}
[3/3] incubator-toree git commit: Resolve fixes needed for comm info
support
Posted by lb...@apache.org.
Resolve fixes needed for comm info support
Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/c7b84a0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/c7b84a0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/c7b84a0c
Branch: refs/heads/master
Commit: c7b84a0cef5c5d2639f3f973bffb48d8fb6128b2
Parents: fa4d5cd
Author: Michael Poplavski <mi...@gmail.com>
Authored: Fri Apr 22 12:44:31 2016 -0500
Committer: Michael Poplavski <mi...@gmail.com>
Committed: Fri Apr 22 12:44:31 2016 -0500
----------------------------------------------------------------------
.../protocol/v5/handler/CommInfoRequestHandler.scala | 15 +++++----------
.../v5/handler/CommInfoRequestHandlerSpec.scala | 8 ++++----
2 files changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c7b84a0c/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
index 4b72390..44021ce 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
@@ -56,16 +56,11 @@ class CommInfoRequestHandler(
val commMap = (Json.parse(kernelMessage.contentString) \ "target_name").asOpt[String] match {
case Some(targetName) => {
- if(targetName.equals("")) {
- //return all comms over every target in one map
- commStorage.getTargets().map(buildCommMap(_)).reduce(_ ++ _)
- } else {
- buildCommMap(targetName)
- }
- }
- case _ => {
- logger.debug("Code not parse kernel message content string")
- Map()
+ buildCommMap(targetName)
+ }
+ case None => {
+ //target_name is missing from the kernel message so return all comms over every target
+ commStorage.getTargets().map(buildCommMap(_)).reduce(_ ++ _)
}
}
val commInfoReply = CommInfoReply(commMap.asInstanceOf[Map[String, Map[String, String]]])
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c7b84a0c/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
index a0be6c5..818b45f 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandlerSpec.scala
@@ -61,7 +61,7 @@ class CommInfoRequestHandlerSpec extends TestKit(
val header = Header("","","","","")
describe("Comm Info Request Handler") {
- it("should return a KernelMessage containing comm info response for a specific target name") {
+ it("should return a KernelMessage containing a comm info response for a specific target name") {
val kernelMessage = new KernelMessage(
Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"test.name\"}"
)
@@ -79,9 +79,9 @@ class CommInfoRequestHandlerSpec extends TestKit(
}
}
- it("should return a KernelMessage containing comm info response for all comms when target name is empty string") {
+ it("should return a KernelMessage containing a comm info response for all comms when target_name is missing from the message") {
val kernelMessage = new KernelMessage(
- Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"\"}"
+ Seq[String](), "test message", header, header, Map[String, String](), "{}"
)
when(mockCommStorage.getTargets()).thenReturn(Set("test.name1", "test.name2"))
@@ -99,7 +99,7 @@ class CommInfoRequestHandlerSpec extends TestKit(
commInfo.comms.get("4").get.get("target_name").get should be ("test.name2")
}
- it("should return a KernelMessage containing an empty comm info response when target name is not found") {
+ it("should return a KernelMessage containing an empty comm info response when the target name value is not found") {
val kernelMessage = new KernelMessage(
Seq[String](), "test message", header, header, Map[String, String](), "{\"target_name\":\"can't_find_me\"}"
)
[2/3] incubator-toree git commit: Added support for Comm Info messages
Posted by lb...@apache.org.
Added support for Comm Info messages
Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/bb6a48da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/bb6a48da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/bb6a48da
Branch: refs/heads/master
Commit: bb6a48da8ac5b46b9e421ac89eba573d067591d1
Parents: d08b117
Author: Michael Poplavski <mi...@gmail.com>
Authored: Wed Apr 20 11:29:50 2016 -0500
Committer: Michael Poplavski <mi...@gmail.com>
Committed: Fri Apr 22 09:20:29 2016 -0500
----------------------------------------------------------------------
.../boot/layer/HandlerInitialization.scala | 3 +
.../v5/handler/CommInfoRequestHandler.scala | 93 ++++++++++++++++++++
.../org/apache/toree/comm/CommStorage.scala | 7 ++
.../protocol/v5/content/CommInfoReply.scala | 40 +++++++++
.../protocol/v5/content/CommInfoRequest.scala | 40 +++++++++
.../toree/kernel/protocol/v5/package.scala | 4 +-
6 files changed, 186 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
index ea2ebd5..c59f58d 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
@@ -162,6 +162,8 @@ trait StandardHandlerInitialization extends HandlerInitialization {
MessageType.Incoming.ExecuteRequest, kernel)
initializeRequestHandler(classOf[KernelInfoRequestHandler],
MessageType.Incoming.KernelInfoRequest)
+ initializeRequestHandler(classOf[CommInfoRequestHandler],
+ MessageType.Incoming.CommInfoRequest, commStorage)
initializeRequestHandler(classOf[CodeCompleteHandler],
MessageType.Incoming.CompleteRequest)
initializeInputHandler(classOf[InputRequestReplyHandler],
@@ -175,6 +177,7 @@ trait StandardHandlerInitialization extends HandlerInitialization {
// These are handlers for messages leaving the kernel through the sockets
initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.KernelInfoReply)
+ initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.CommInfoReply)
initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.ExecuteReply)
initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.CompleteReply)
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
new file mode 100644
index 0000000..4b72390
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.toree.kernel.protocol.v5.handler
+
+import org.apache.toree.comm.CommStorage
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.CommInfoReply
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.MessageLogSupport
+import play.api.libs.json.Json
+
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.concurrent.{Future, future}
+
+/**
+ * Receives a CommInfoRequest KernelMessage and returns a CommInfoReply
+ * KernelMessage.
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ * @param commStorage The Comm storage used for msg callbacks
+ */
+class CommInfoRequestHandler(
+ actorLoader: ActorLoader,
+ commStorage: CommStorage)
+ extends BaseHandler(actorLoader) with MessageLogSupport
+{
+
+ def buildCommMap(targetName: String) = {
+ commStorage.getCommIdsFromTarget(targetName) match {
+ case Some(commVector) => {
+ commVector.map(x => Map(x -> Map("target_name" -> targetName))).flatten.toMap
+ }
+ case _ => {
+ Map()
+ }
+ }
+ }
+
+ override def process(kernelMessage: KernelMessage): Future[_] = future {
+ logKernelMessageAction("Initiating CommInfo request for", kernelMessage)
+
+ val commMap = (Json.parse(kernelMessage.contentString) \ "target_name").asOpt[String] match {
+ case Some(targetName) => {
+ if(targetName.equals("")) {
+ //return all comms over every target in one map
+ commStorage.getTargets().map(buildCommMap(_)).reduce(_ ++ _)
+ } else {
+ buildCommMap(targetName)
+ }
+ }
+ case _ => {
+ logger.debug("Code not parse kernel message content string")
+ Map()
+ }
+ }
+ val commInfoReply = CommInfoReply(commMap.asInstanceOf[Map[String, Map[String, String]]])
+
+ val kernelInfo = SparkKernelInfo
+
+ val replyHeader = Header(
+ java.util.UUID.randomUUID.toString,
+ "",
+ java.util.UUID.randomUUID.toString,
+ CommInfoReply.toTypeString,
+ kernelInfo.protocolVersion)
+
+ val kernelResponseMessage = KMBuilder()
+ .withIds(kernelMessage.ids)
+ .withSignature("")
+ .withHeader(replyHeader)
+ .withParent(kernelMessage)
+ .withContentString(commInfoReply).build
+
+ actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelResponseMessage
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
index dbdefad..641c07c 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
@@ -123,6 +123,13 @@ class CommStorage(
def getCommIdsFromTarget(targetName: String) = linkStorage.get(targetName)
/**
+ * Retrieves all registered target names
+ *
+ * @return Some set of target names
+ */
+ def getTargets() = linkStorage.keySet
+
+ /**
* Retrieves the current target for the specified Comm id.
*
* @param commId The Comm id whose target to get
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoReply.scala
new file mode 100644
index 0000000..d460ac5
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoReply.scala
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.toree.kernel.protocol.v5.content
+
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class CommInfoReply(
+ comms: Map[String, Map[String, String]]
+) extends KernelMessageContent {
+ override def content : String =
+ Json.toJson(this)(CommInfoReply.commInfoReplyWrites).toString
+}
+
+object CommInfoReply extends TypeString {
+ implicit val commInfoReplyReads = Json.reads[CommInfoReply]
+ implicit val commInfoReplyWrites = Json.writes[CommInfoReply]
+
+ /**
+ * Returns the type string associated with this object.
+ *
+ * @return The type as a string
+ */
+ override def toTypeString: String = "comm_info_reply"
+}
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoRequest.scala
new file mode 100644
index 0000000..c2fc503
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommInfoRequest.scala
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.toree.kernel.protocol.v5.content
+
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class CommInfoRequest(
+ target_name: String
+) extends KernelMessageContent {
+ override def content : String =
+ Json.toJson(this)(CommInfoRequest.commInfoRequestWrites).toString
+}
+
+object CommInfoRequest extends TypeString {
+ implicit val commInfoRequestReads = Json.reads[CommInfoRequest]
+ implicit val commInfoRequestWrites = Json.writes[CommInfoRequest]
+
+ /**
+ * Returns the type string associated with this object.
+ *
+ * @return The type as a string
+ */
+ override def toTypeString: String = "comm_info_request"
+}
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bb6a48da/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
index cc483d9..aed5b8e 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -18,7 +18,7 @@
package org.apache.toree.kernel.protocol
import org.apache.toree.kernel.protocol.v5.MIMEType.MIMEType
-import play.api.libs.json.{JsValue, Json, JsObject}
+import play.api.libs.json.{JsValue, Json}
package object v5 {
// Provide a UUID type representing a string (there is no object)
@@ -86,6 +86,7 @@ package object v5 {
val InspectRequest = Value("inspect_request")
val KernelInfoRequest = Value("kernel_info_request")
val ShutdownRequest = Value("shutdown_request")
+ val CommInfoRequest = Value("comm_info_request")
// Stdin Router/Dealer Messages
val InputReply = Value("input_reply")
@@ -108,6 +109,7 @@ package object v5 {
val InspectReply = Value("inspect_reply")
val KernelInfoReply = Value("kernel_info_reply")
val ShutdownReply = Value("shutdown_reply")
+ val CommInfoReply = Value("comm_info_reply")
// Stdin Router/Dealer Messages
val InputRequest = Value("input_request")