Skip to content

Commit

Permalink
Merge pull request #157 from akara/issue76
Browse files Browse the repository at this point in the history
#76: Assigned name of proxied route or handler.
  • Loading branch information
az-qbradley committed Dec 15, 2015
2 parents 75bf3e2 + 38654e9 commit 58c952b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class CubeSupervisor extends Actor with ActorLogging with GracefulStopHelper {
val hostActor = context.actorOf(props, name) // disable proxy
(hostActor, SimpleActor(hostActor))
case Some(proc) =>
val hostActor = context.actorOf(props)
val hostActor = context.actorOf(props, name + "target")
(hostActor, ProxiedActor(context.actorOf(Props(classOf[CubeProxyActor], proc, hostActor), name)))
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import akka.actor.{Actor, ActorSystem}
import akka.io.IO
import akka.testkit.{ImplicitSender, TestKit}
import com.typesafe.config.ConfigFactory
import org.scalatest.OptionValues._
import org.scalatest.{BeforeAndAfterAll, FlatSpecLike, Matchers}
import org.squbs.lifecycle.GracefulStop
import spray.can.Http
Expand Down Expand Up @@ -56,8 +57,8 @@ object CubeActorErrorStatesSpec{
.initExtensions.start()
}

class CubeActorErrorStatesSpec extends TestKit(
CubeActorErrorStatesSpec.boot.actorSystem) with FlatSpecLike with Matchers with ImplicitSender with BeforeAndAfterAll {
class CubeActorErrorStatesSpec extends TestKit(CubeActorErrorStatesSpec.boot.actorSystem) with FlatSpecLike
with Matchers with ImplicitSender with BeforeAndAfterAll {

val port = system.settings.config getInt "default-listener.bind-port"

Expand All @@ -73,16 +74,17 @@ class CubeActorErrorStatesSpec extends TestKit(
IO(Http) ! HttpRequest(HttpMethods.GET, Uri(s"http://127.0.0.1:$port/test1?msg=2"))
Thread.sleep(1000) // wait the agent get refreshed
import org.squbs.unicomplex.JMX._
val errorStates = get(new ObjectName(prefix(system) + cubeStateName + "CubeActorErrorStates"), "ActorErrorStates").asInstanceOf[Array[CompositeData]]
val errorStates = get(new ObjectName(prefix(system) + cubeStateName + "CubeActorErrorStates"), "ActorErrorStates")
.asInstanceOf[Array[CompositeData]]
// val state = errorStates.get("akka://squbs/user/CubeActorErrorStates/$b")
// val state = errorStates.values()
errorStates.size should be(2)
val state1 = errorStates.find(_.get("actorPath").equals("/user/CubeActorErrorStates/$a")).get
state1.get("errorCount") should be(2)
state1.get("latestException").asInstanceOf[String] should include ("test1:2")
val state2 = errorStates.find(_.get("actorPath").equals("/user/CubeActorErrorStates/$b")).get
state2.get("errorCount") should be(1)
state2.get("latestException").asInstanceOf[String] should include ("test2:1")
val state1 = errorStates.find(_.get("actorPath") == "/user/CubeActorErrorStates/test1-CubeActorTest-handlertarget")
state1.value.get("errorCount") should be(2)
state1.value.get("latestException").asInstanceOf[String] should include ("test1:2")
val state2 = errorStates.find(_.get("actorPath") == "/user/CubeActorErrorStates/test2-CubeActorTest-handlertarget")
state2.value.get("errorCount") should be(1)
state2.value.get("latestException").asInstanceOf[String] should include ("test2:1")
}
}

Expand Down

0 comments on commit 58c952b

Please sign in to comment.