Fine grained events, see #2202

* Defined the domain events in ClusterEvent.scala file
* Produce events from diff  and publish publish to event bus
  from separate actor, ClusterDomainEventPublisher
* Adjustments of tests
This commit is contained in:
Patrik Nordwall 2012-08-19 20:15:22 +02:00
parent 6389e1097b
commit 20a038fdfd
15 changed files with 458 additions and 214 deletions

View file

@ -46,17 +46,13 @@ abstract class NodeLeavingAndExitingSpec
val secondAddess = address(second)
val leavingLatch = TestLatch()
val exitingLatch = TestLatch()
val expectedAddresses = roles.toSet map address
cluster.subscribe(system.actorOf(Props(new Actor {
def receive = {
case MembersChanged(members)
def check(status: MemberStatus): Boolean =
(members.map(_.address) == expectedAddresses &&
members.exists(m m.address == secondAddess && m.status == status))
if (check(MemberStatus.Leaving)) leavingLatch.countDown()
if (check(MemberStatus.Exiting)) exitingLatch.countDown()
case MemberLeft(m) if m.address == secondAddess leavingLatch.countDown()
case MemberExited(m) if m.address == secondAddess exitingLatch.countDown()
}
})), classOf[MembersChanged])
})), classOf[MemberEvent])
enterBarrier("registered-listener")
runOn(third) {
@ -64,6 +60,9 @@ abstract class NodeLeavingAndExitingSpec
}
enterBarrier("second-left")
val expectedAddresses = roles.toSet map address
awaitCond(clusterView.members.map(_.address) == expectedAddresses)
// Verify that 'second' node is set to LEAVING
leavingLatch.await