mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-06-25 06:44:19 +00:00
sorted out some tests for the event systems
This commit is contained in:
parent
14da36dabe
commit
f05a0ab96a
20 changed files with 111 additions and 132 deletions
|
|
@ -101,7 +101,7 @@ object Server {
|
|||
val zones = Zones.zones :+ Zone.Nowhere
|
||||
val serviceManager = ServiceManager.boot
|
||||
serviceManager ! ServiceManager.Register(classic.Props[AccountIntermediaryService](), "accountIntermediary")
|
||||
serviceManager ! ServiceManager.Register(classic.Props[GalaxyService](), "galaxy")
|
||||
serviceManager ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
serviceManager ! ServiceManager.Register(classic.Props[SquadService](), "squad")
|
||||
serviceManager ! ServiceManager.Register(classic.Props[AccountPersistenceService](), "accountPersistence")
|
||||
serviceManager ! ServiceManager.Register(classic.Props[PropertyOverrideManager](), "propertyOverrideManager")
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import scala.concurrent.duration._
|
|||
class AutoRepairFacilityIntegrationTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
val avatarProbe = new TestProbe(system)
|
||||
|
|
@ -105,7 +105,7 @@ class AutoRepairFacilityIntegrationTest extends FreedContextActorTest {
|
|||
class AutoRepairFacilityIntegrationGiveNtuTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
val avatarProbe = new TestProbe(system)
|
||||
|
|
@ -160,7 +160,7 @@ class AutoRepairFacilityIntegrationGiveNtuTest extends FreedContextActorTest {
|
|||
class AutoRepairFacilityIntegrationAntGiveNtuTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
var buildingMap = new TrieMap[Int, Building]()
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
|
|
@ -251,7 +251,7 @@ class AutoRepairFacilityIntegrationAntGiveNtuTest extends FreedContextActorTest
|
|||
class AutoRepairFacilityIntegrationTerminalDestroyedTerminalAntTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
var buildingMap = new TrieMap[Int, Building]()
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
|
|
@ -353,7 +353,7 @@ class AutoRepairFacilityIntegrationTerminalDestroyedTerminalAntTest extends Free
|
|||
class AutoRepairFacilityIntegrationTerminalIncompleteRepairTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
var buildingMap = new TrieMap[Int, Building]()
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
|
|
@ -469,7 +469,7 @@ class AutoRepairFacilityIntegrationTerminalIncompleteRepairTest extends FreedCon
|
|||
class AutoRepairTowerIntegrationTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
system.spawn(InterstellarClusterService(Nil), InterstellarClusterService.InterstellarClusterServiceKey.id)
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
val avatarProbe = new TestProbe(system)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import net.psforever.objects.serverobject.structures.StructureType
|
|||
import net.psforever.objects.{GlobalDefinitions, Player, Vehicle}
|
||||
import net.psforever.objects.zones.Zone
|
||||
import net.psforever.types.{PlanetSideGUID, _}
|
||||
import net.psforever.services.vehicle.{VehicleAction, VehicleServiceMessage}
|
||||
import net.psforever.services.vehicle.VehicleAction
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
import net.psforever.actors.zone.ZoneActor
|
||||
import net.psforever.objects.avatar.Avatar
|
||||
import net.psforever.objects.serverobject.terminals.Terminal
|
||||
import net.psforever.services.base.envelope.GenericMessageEnvelope
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ class VehicleSpawnControl2Test extends ActorTest {
|
|||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player, vehicle, terminal) //order
|
||||
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.ConcealPlayer])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleServiceMessage])
|
||||
probe.expectMsgClass(1 minute, classOf[GenericMessageEnvelope])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.AttachToRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.StartPlayerSeatedInVehicle])
|
||||
vehicle.Seats(0).mount(player)
|
||||
|
|
@ -69,11 +70,11 @@ class VehicleSpawnControl3Test extends ActorTest {
|
|||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player2, vehicle, terminal) //second order (vehicle shared)
|
||||
|
||||
assert(probe.receiveOne(1 seconds) match {
|
||||
case VehicleSpawnPad.PeriodicReminder(_, VehicleSpawnPad.Reminders.Queue, _) => true
|
||||
case _ => false
|
||||
case VehicleSpawnPad.PeriodicReminder(VehicleSpawnPad.Reminders.Queue, _) => true
|
||||
case _ => false
|
||||
})
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.ConcealPlayer])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleServiceMessage])
|
||||
probe.expectMsgClass(1 minute, classOf[GenericMessageEnvelope])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.AttachToRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.StartPlayerSeatedInVehicle])
|
||||
vehicle.Seats(0).mount(player)
|
||||
|
|
@ -110,14 +111,6 @@ class VehicleSpawnControl4Test extends ActorTest {
|
|||
player.Continent = "problem" //problem
|
||||
|
||||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player, vehicle, terminal) //order
|
||||
|
||||
val msg = probe.receiveOne(1 minute)
|
||||
// assert(
|
||||
// msg match {
|
||||
// case VehicleServiceMessage.Decon(RemoverActor.AddTask(v, z, _)) => (v == vehicle) && (z == zone)
|
||||
// case _ => false
|
||||
// }
|
||||
// )
|
||||
probe.expectNoMessage(5 seconds)
|
||||
}
|
||||
}
|
||||
|
|
@ -133,18 +126,18 @@ class VehicleSpawnControl5Test extends ActorTest() {
|
|||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player, vehicle, terminal) //order
|
||||
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.ConcealPlayer])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleServiceMessage])
|
||||
probe.expectMsgClass(1 minute, classOf[GenericMessageEnvelope])
|
||||
vehicle.Health = 0 //problem
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.AttachToRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.DetachFromRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.RevealPlayer])
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleServiceMessage(_, _, VehicleAction.LoadVehicle(_, _, _, _, _)) => true
|
||||
case _ => false
|
||||
case GenericMessageEnvelope(_, _, VehicleAction.LoadVehicle(_, _, _, _)) => true
|
||||
case _ => false
|
||||
})
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleSpawnPad.PeriodicReminder(_, VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
case VehicleSpawnPad.PeriodicReminder(VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -160,18 +153,18 @@ class VehicleSpawnControl6Test extends ActorTest() {
|
|||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player, vehicle, terminal) //order
|
||||
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.ConcealPlayer])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleServiceMessage])
|
||||
probe.expectMsgClass(1 minute, classOf[GenericMessageEnvelope])
|
||||
player.Die
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.AttachToRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.DetachFromRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.RevealPlayer])
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleServiceMessage(_, _, VehicleAction.LoadVehicle(_, _, _, _, _)) => true
|
||||
case _ => false
|
||||
case GenericMessageEnvelope(_, _, VehicleAction.LoadVehicle(_, _, _, _)) => true
|
||||
case _ => false
|
||||
})
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleSpawnPad.PeriodicReminder(_, VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
case VehicleSpawnPad.PeriodicReminder(VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -188,18 +181,18 @@ class VehicleSpawnControl7Test extends ActorTest {
|
|||
pad.Actor ! VehicleSpawnPad.VehicleOrder(player, vehicle, terminal) //order
|
||||
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.ConcealPlayer])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleServiceMessage])
|
||||
probe.expectMsgClass(1 minute, classOf[GenericMessageEnvelope])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.AttachToRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.StartPlayerSeatedInVehicle])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.DetachFromRails])
|
||||
probe.expectMsgClass(1 minute, classOf[VehicleSpawnPad.RevealPlayer])
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleServiceMessage(_, _, VehicleAction.LoadVehicle(_, _, _, _, _)) => true
|
||||
case _ => false
|
||||
case GenericMessageEnvelope(_, _, VehicleAction.LoadVehicle(_, _, _, _)) => true
|
||||
case _ => false
|
||||
})
|
||||
assert(probe.receiveOne(1 minute) match {
|
||||
case VehicleSpawnPad.PeriodicReminder(_, VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
case VehicleSpawnPad.PeriodicReminder(VehicleSpawnPad.Reminders.Blocked, _) => true
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AvatarService1Test extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"construct" in {
|
||||
ServiceManager.boot(system)
|
||||
system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
assert(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ class AvatarService2Test extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"subscribe" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
assert(true)
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ class AvatarService3Test extends ActorTest {
|
|||
"AvatarService" should {
|
||||
ServiceManager.boot(system)
|
||||
"subscribe to a specific channel" in {
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! Service.LeaveAll
|
||||
assert(true)
|
||||
|
|
@ -56,7 +56,7 @@ class AvatarService4Test extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"subscribe" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! Service.LeaveAll
|
||||
assert(true)
|
||||
|
|
@ -68,7 +68,7 @@ class AvatarService5Test extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass an unhandled message" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! "hello"
|
||||
expectNoMessage()
|
||||
|
|
@ -80,7 +80,7 @@ class ArmorChangedTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ArmorChanged" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ArmorChanged(ExoSuitType.Reinforced, 0))
|
||||
expectMsg(
|
||||
|
|
@ -98,7 +98,7 @@ class ConcealPlayerTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ConcealPlayer" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", ConcealPlayer(PlanetSideGUID(10)))
|
||||
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), ConcealPlayer(PlanetSideGUID(10))))
|
||||
|
|
@ -108,7 +108,7 @@ class ConcealPlayerTest extends ActorTest {
|
|||
|
||||
class EquipmentInHandTest extends ActorTest {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), "release-test-service")
|
||||
val service = system.actorOf(AvatarService(), "release-test-service")
|
||||
val toolDef = GlobalDefinitions.beamer
|
||||
val tool = Tool(toolDef)
|
||||
tool.GUID = PlanetSideGUID(40)
|
||||
|
|
@ -135,7 +135,7 @@ class EquipmentInHandTest extends ActorTest {
|
|||
|
||||
class DroptItemTest extends ActorTest {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), "release-test-service")
|
||||
val service = system.actorOf(AvatarService(), "release-test-service")
|
||||
val toolDef = GlobalDefinitions.beamer
|
||||
val tool = Tool(toolDef)
|
||||
tool.Position = Vector3(1, 2, 3)
|
||||
|
|
@ -174,7 +174,7 @@ class LoadPlayerTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass LoadPlayer" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
//no parent data
|
||||
service ! AvatarServiceMessage(
|
||||
|
|
@ -198,7 +198,7 @@ class ObjectDeleteTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ObjectDelete" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), ObjectDelete(PlanetSideGUID(11)))
|
||||
expectMsg(
|
||||
|
|
@ -217,7 +217,7 @@ class ObjectHeldTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ObjectHeld" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ObjectHeld(1, 2))
|
||||
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), AvatarAction.ObjectHeld(1, 2)))
|
||||
|
|
@ -229,7 +229,7 @@ class PutDownFDUTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass PutDownFDU" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", AvatarAction.PutDownFDU(PlanetSideGUID(10)))
|
||||
expectMsg(
|
||||
|
|
@ -243,7 +243,7 @@ class PlanetsideAttributeTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass PlanetsideAttribute" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), PlanetsideAttribute(PlanetSideGUID(10), 5, 1200L))
|
||||
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), PlanetsideAttribute(PlanetSideGUID(10), 5, 1200L)))
|
||||
|
|
@ -272,7 +272,7 @@ class PlayerStateTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass PlayerState" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage(
|
||||
"test",
|
||||
|
|
@ -323,7 +323,7 @@ class PickupItemTest extends ActorTest {
|
|||
|
||||
"pass PickUpItem" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! PickupItemEnvelope("test", AvatarAction.PickupItem(tool), Zone.Nowhere)
|
||||
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), ObjectDelete(tool.GUID, 0)))
|
||||
|
|
@ -334,7 +334,7 @@ class ReloadTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass Reload" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), ReloadTool(PlanetSideGUID(40)))
|
||||
expectMsg(AvatarServiceResponse("/test/Avatar", PlanetSideGUID(10), ReloadTool(PlanetSideGUID(40))))
|
||||
|
|
@ -349,7 +349,7 @@ class ChangeAmmoTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ChangeAmmo" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage(
|
||||
"test",
|
||||
|
|
@ -388,7 +388,7 @@ class ChangeFireModeTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ChangeFireMode" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), AvatarAction.ChangeFireMode(PlanetSideGUID(40), 0))
|
||||
expectMsg(
|
||||
|
|
@ -402,7 +402,7 @@ class ChangeFireStateStartTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ChangeFireState_Start" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), ChangeFireState_Start(PlanetSideGUID(40)))
|
||||
expectMsg(
|
||||
|
|
@ -420,7 +420,7 @@ class ChangeFireStateStopTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass ChangeFireState_Stop" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), ChangeFireState_Stop(PlanetSideGUID(40)))
|
||||
expectMsg(
|
||||
|
|
@ -438,7 +438,7 @@ class WeaponDryFireTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass WeaponDryFire" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage("test", PlanetSideGUID(10), WeaponDryFire(PlanetSideGUID(40)))
|
||||
expectMsg(
|
||||
|
|
@ -454,7 +454,7 @@ class AvatarStowEquipmentTest extends ActorTest {
|
|||
"AvatarService" should {
|
||||
"pass StowEquipment" in {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[AvatarService]), AvatarServiceTest.TestName)
|
||||
val service = system.actorOf(AvatarService(), AvatarServiceTest.TestName)
|
||||
service ! Service.Join("test")
|
||||
service ! AvatarServiceMessage(
|
||||
"test",
|
||||
|
|
@ -525,8 +525,8 @@ class AvatarReleaseTest extends FreedContextActorTest {
|
|||
val reply2msg = reply2.asInstanceOf[AvatarServiceResponse]
|
||||
assert(reply2msg.channel.equals("/test/Avatar"))
|
||||
assert(reply2msg.filter == Service.defaultPlayerGUID)
|
||||
assert(reply2msg.reply.isInstanceOf[AvatarAction.ObjectDelete])
|
||||
assert(reply2msg.reply.asInstanceOf[AvatarAction.ObjectDelete].item_guid == guid)
|
||||
assert(reply2msg.reply.isInstanceOf[ObjectDelete])
|
||||
assert(reply2msg.reply.asInstanceOf[ObjectDelete].obj_guid == guid)
|
||||
|
||||
subscriber.expectNoMessage(1 seconds)
|
||||
assert(zone.Corpses.isEmpty)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import net.psforever.objects.avatar.ModePermissions
|
|||
import net.psforever.objects.avatar.scoring.{Assist, Death, EquipmentStat, KDAStat, Kill, Life, ScoreCard, SupportActivity}
|
||||
import net.psforever.objects.sourcing.{TurretSource, VehicleSource}
|
||||
import net.psforever.packet.game.ImplantAction
|
||||
import net.psforever.services.avatar.AvatarServiceResponse
|
||||
import net.psforever.types.{ChatMessageType, StatisticalCategory, StatisticalElement}
|
||||
import net.psforever.zones.Zones
|
||||
import org.joda.time.{LocalDateTime, Seconds}
|
||||
|
|
@ -3490,6 +3489,7 @@ class AvatarActor(
|
|||
value: Int
|
||||
): Unit = {
|
||||
import akka.actor.typed.scaladsl.adapter.TypedActorRefOps
|
||||
import net.psforever.services.avatar.AvatarServiceResponse
|
||||
sessionActor.toClassic ! AvatarServiceResponse("", guid, AvatarAction.AvatarImplant(action, index, value))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1624,10 +1624,9 @@ object Zone {
|
|||
if (zone.id.startsWith("tzsh")) {
|
||||
zone.npcPopulation = context.actorOf(Props(classOf[ShootingRangeTargetSpawnerActor], zone), s"$id-npcs")
|
||||
}
|
||||
|
||||
zone.avatarEvents = context.actorOf(Props(classOf[AvatarService], zone), s"$id-avatar-events")
|
||||
zone.localEvents = context.actorOf(Props(classOf[LocalService], zone), s"$id-local-events")
|
||||
zone.vehicleEvents = context.actorOf(Props(classOf[VehicleService]), s"$id-vehicle-events")
|
||||
zone.avatarEvents = context.actorOf(AvatarService(), s"$id-avatar-events")
|
||||
zone.localEvents = context.actorOf(LocalService(zone), s"$id-local-events")
|
||||
zone.vehicleEvents = context.actorOf(VehicleService(), s"$id-vehicle-events")
|
||||
|
||||
zone.timeOfDayOrigin = System.currentTimeMillis()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ case object LitterRemovalSupport
|
|||
|
||||
case object AvatarStamp extends EventSystemStamp
|
||||
|
||||
class AvatarService
|
||||
extends GenericEventServiceWithCacheAndSupport(
|
||||
stamp = AvatarStamp,
|
||||
eventSupportServices = List(CorpseRemovalSupport, LitterRemovalSupport)
|
||||
)
|
||||
object AvatarService {
|
||||
def apply(): Props = {
|
||||
Props(
|
||||
classOf[GenericEventServiceWithCacheAndSupport],
|
||||
AvatarStamp,
|
||||
List(CorpseRemovalSupport, LitterRemovalSupport)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ trait EventSystemStamp {
|
|||
* and, dispatches the response to all subscribers associated with the channel provided in the message.
|
||||
* @param stamp distinct tag associated with an event system
|
||||
*/
|
||||
abstract class GenericEventService(stamp: EventSystemStamp)
|
||||
class GenericEventService(stamp: EventSystemStamp)
|
||||
extends Actor {
|
||||
protected lazy val log: Logger = org.log4s.getLogger(getClass.getSimpleName)
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ private case object FlushCachedMessages extends GenericMessageEnvelope {
|
|||
def filter: PlanetSideGUID = Service.defaultPlayerGUID
|
||||
}
|
||||
|
||||
abstract class GenericEventServiceWithCacheAndSupport
|
||||
class GenericEventServiceWithCacheAndSupport
|
||||
(
|
||||
stamp: EventSystemStamp,
|
||||
eventSupportServices: List[EventServiceSupport]
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ trait GenericSupportEnvelopeOnly
|
|||
* @param stamp distinct tag associated with an event system
|
||||
* @param eventSupportServices list of support actors to initialize
|
||||
*/
|
||||
abstract class GenericEventServiceWithSupport
|
||||
class GenericEventServiceWithSupport
|
||||
(
|
||||
stamp: EventSystemStamp,
|
||||
eventSupportServices: List[EventServiceSupport]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2017-2026 PSForever
|
||||
package net.psforever.services.galaxy
|
||||
|
||||
import akka.actor.Props
|
||||
import net.psforever.services.base.{EventSystemStamp, GenericEventService}
|
||||
|
||||
case object GalaxyStamp extends EventSystemStamp {
|
||||
|
|
@ -13,5 +14,8 @@ case object GalaxyStamp extends EventSystemStamp {
|
|||
}
|
||||
}
|
||||
|
||||
class GalaxyService
|
||||
extends GenericEventService(stamp = GalaxyStamp)
|
||||
object GalaxyService {
|
||||
def apply(): Props = {
|
||||
Props(classOf[GenericEventService], GalaxyStamp)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,12 @@ case class CaptureFlagSupport(zone: Zone)
|
|||
|
||||
case object LocalStamp extends EventSystemStamp
|
||||
|
||||
class LocalService(zone: Zone)
|
||||
extends GenericEventServiceWithSupport(
|
||||
stamp = LocalStamp,
|
||||
eventSupportServices = List(DoorCloserSupport, HackClearSupport, HackCaptureSupport, CaptureFlagSupport(zone))
|
||||
)
|
||||
object LocalService {
|
||||
def apply(zone: Zone): Props = {
|
||||
Props(
|
||||
classOf[GenericEventServiceWithSupport],
|
||||
LocalStamp,
|
||||
List(DoorCloserSupport, HackClearSupport, HackCaptureSupport, CaptureFlagSupport(zone))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,12 @@ case object TurretUpgradeSupport
|
|||
|
||||
case object VehicleStamp extends EventSystemStamp
|
||||
|
||||
class VehicleService
|
||||
extends GenericEventServiceWithCacheAndSupport(
|
||||
stamp = VehicleStamp,
|
||||
eventSupportServices = List(TurretUpgradeSupport)
|
||||
)
|
||||
object VehicleService {
|
||||
def apply(): Props = {
|
||||
Props(
|
||||
classOf[GenericEventServiceWithCacheAndSupport],
|
||||
VehicleStamp,
|
||||
List(TurretUpgradeSupport)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ class DamageCalculationsTests extends Specification {
|
|||
val projectile = Projectile(proj, wep, wep_fmode, player, Vector3(2, 2, 0), Vector3.Zero)
|
||||
val target = Vehicle(GlobalDefinitions.fury)
|
||||
target.Position = Vector3(10, 0, 0)
|
||||
player.GUID = PlanetSideGUID(1)
|
||||
projectile.GUID = PlanetSideGUID(2)
|
||||
target.GUID = PlanetSideGUID(3)
|
||||
val resprojectile = DamageInteraction(
|
||||
SourceEntry(target),
|
||||
ProjectileReason(
|
||||
|
|
@ -271,6 +274,7 @@ class DamageCalculationsTests extends Specification {
|
|||
)
|
||||
val minDamageBase = charge_weapon.Projectile.Charging.get.min.Damage0
|
||||
val chargeBaseDamage = charge_weapon.Projectile.Damage0
|
||||
charge_projectile.GUID = PlanetSideGUID(1)
|
||||
|
||||
"charge (none)" in {
|
||||
val cprojectile = charge_projectile.quality(ProjectileQuality.Modified(0))
|
||||
|
|
@ -329,6 +333,7 @@ class DamageCalculationsTests extends Specification {
|
|||
Vector3(2, 2, 0),
|
||||
Vector3.Zero
|
||||
)
|
||||
flak_projectile.GUID = PlanetSideGUID(1)
|
||||
|
||||
"flak hit (resolution is splash, no degrade)" in {
|
||||
val resfprojectile = DamageInteraction(
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import scala.concurrent.duration._
|
|||
class OrbitalShuttlePadControlTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
val services: ActorRef = ServiceManager.boot(system)
|
||||
services ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
services ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
services ! ServiceManager.Register(Props[HartService](), "hart")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
var buildingMap = new TrieMap[Int, Building]()
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class ResourceSiloControlStartupMessageSomeTest extends ActorTest {
|
|||
|
||||
class ResourceSiloControlUseTest extends FreedContextActorTest {
|
||||
import akka.actor.typed.scaladsl.adapter._
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(Props[GalaxyService](), "galaxy")
|
||||
ServiceManager.boot(system) ! ServiceManager.Register(GalaxyService(), "galaxy")
|
||||
expectNoMessage(1000 milliseconds)
|
||||
var buildingMap = new TrieMap[Int, Building]()
|
||||
val guid = new NumberPoolHub(new MaxNumberSource(max = 10))
|
||||
|
|
|
|||
|
|
@ -429,9 +429,4 @@ object ProximityTest {
|
|||
val avatarId = new AtomicInteger(0)
|
||||
|
||||
class SampleTerminal extends Terminal(GlobalDefinitions.dropship_vehicle_terminal) with ProximityUnit
|
||||
|
||||
class ProbedLocalService(probe: TestProbe, zone: Zone) extends LocalService(zone) {
|
||||
self.tell(Service.Join("test"), probe.ref)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class EnvelopeTest extends Specification {
|
|||
"construct (quick)" in {
|
||||
val input = GenericResponseEnvelope(TestStamp, "test", TestFilter, TestMessage(5))
|
||||
input match {
|
||||
case reply @ GenericResponseEnvelope("test", TestFilter, TestMessage(5)) =>
|
||||
case reply @ GenericResponseEnvelope("/test/out", TestFilter, TestMessage(5)) =>
|
||||
reply.stamp mustEqual TestStamp
|
||||
case _ =>
|
||||
ko
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import net.psforever.services.Service
|
|||
import net.psforever.services.base.message.EventMessage
|
||||
import net.psforever.services.base.{CachedEnvelope, CachedGenericEventEnvelope, EventServiceSupport, GenericEventServiceWithCacheAndSupport, GenericSupportEnvelope}
|
||||
import net.psforever.types.PlanetSideGUID
|
||||
import service.base.EventServiceSupportTest.TestSupportService
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
|
@ -29,7 +28,7 @@ object EventServiceCacheSupportTest {
|
|||
|
||||
def SpawnTestSystem(eventSupportServices: List[EventServiceSupport])(implicit system: ActorSystem, self: ActorRef): ActorRef = {
|
||||
val name = self.getClass.getSimpleName.replace("EventServiceCacheSupportTest", "")
|
||||
system.actorOf(Props(classOf[TestSupportService], eventSupportServices), name = s"EventServiceCacheSupportTest.$name")
|
||||
system.actorOf(Props(classOf[TestCacheService], eventSupportServices), name = s"EventServiceCacheSupportTest.$name")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,9 +134,9 @@ class EventServiceCacheSupportTestMultipleCachedSameMessages extends ActorTest {
|
|||
val secondMessage = CachedEnvelope(PlanetSideGUID(1), "test", TestMessage(2))
|
||||
val thirdMessage = CachedEnvelope(PlanetSideGUID(1), "test", TestMessage(3)) //this one!
|
||||
events ! firstMessage
|
||||
mainProbe.expectNoMessage(50 milliseconds)
|
||||
events ! secondMessage
|
||||
events ! thirdMessage
|
||||
mainProbe.expectNoMessage(50 milliseconds)
|
||||
val reply = mainProbe.receiveOne(125 milliseconds)
|
||||
reply match {
|
||||
case badmsg if badmsg == firstMessage =>
|
||||
|
|
@ -148,6 +147,7 @@ class EventServiceCacheSupportTestMultipleCachedSameMessages extends ActorTest {
|
|||
case badmsg =>
|
||||
assert(false, s"(7) expected delivery of test envelope, but received $badmsg instead")
|
||||
}
|
||||
mainProbe.expectNoMessage(150 milliseconds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class EventServiceTestNotSubscribed extends ActorTest {
|
|||
events ! MessageEnvelope("test", Service.defaultPlayerGUID, TestMessage(5))
|
||||
val reply = probe.receiveOne(100 milliseconds)
|
||||
reply match {
|
||||
case GenericResponseEnvelope("/test", _, TestMessage(5)) => ()
|
||||
case GenericResponseEnvelope("/test/out", _, TestMessage(5)) => ()
|
||||
case _ => assert(false, "(2) message expected but not received")
|
||||
}
|
||||
missedProbe.expectNoMessage(100 milliseconds)
|
||||
|
|
@ -127,11 +127,11 @@ class EventServiceTestLeave extends ActorTest {
|
|||
events ! MessageEnvelope("anotherTest", Service.defaultPlayerGUID, TestMessage(5))
|
||||
val reply1 = probe.receiveN(2, 100 milliseconds)
|
||||
reply1.head match {
|
||||
case GenericResponseEnvelope("/test", _, _) => ()
|
||||
case GenericResponseEnvelope("/test/out", _, _) => ()
|
||||
case _ => assert(false, "(3) message expected but not received")
|
||||
}
|
||||
reply1(1) match {
|
||||
case GenericResponseEnvelope("/anotherTest", _, _) => ()
|
||||
case GenericResponseEnvelope("/anotherTest/out", _, _) => ()
|
||||
case _ => assert(false, "(4) message expected but not received")
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ class EventServiceTestLeave extends ActorTest {
|
|||
events ! MessageEnvelope("anotherTest", Service.defaultPlayerGUID, TestMessage(6))
|
||||
val reply2 = probe.receiveOne(100 milliseconds)
|
||||
reply2 match {
|
||||
case GenericResponseEnvelope("/test", _, TestMessage(5)) => ()
|
||||
case GenericResponseEnvelope("/test/out", _, TestMessage(5)) => ()
|
||||
case _ => assert(false, "(5) message expected but not received")
|
||||
}
|
||||
probe.expectNoMessage(250 milliseconds)
|
||||
|
|
@ -148,7 +148,7 @@ class EventServiceTestLeave extends ActorTest {
|
|||
}
|
||||
}
|
||||
|
||||
class EventServiceTestLeaveAll1 extends ActorTest {
|
||||
class EventServiceTestLeaveAll extends ActorTest {
|
||||
import EventServiceTestBase._
|
||||
"GenericEventSystem" should {
|
||||
"leave all channels (1)" in {
|
||||
|
|
@ -161,40 +161,11 @@ class EventServiceTestLeaveAll1 extends ActorTest {
|
|||
events ! MessageEnvelope("anotherTest", Service.defaultPlayerGUID, TestMessage(6))
|
||||
val reply = probe.receiveN(2,100 milliseconds)
|
||||
reply.head match {
|
||||
case GenericResponseEnvelope("/test", _, TestMessage(5)) => ()
|
||||
case GenericResponseEnvelope("/test/out", _, TestMessage(5)) => ()
|
||||
case _ => assert(false, "(6) message expected but not received")
|
||||
}
|
||||
reply(1) match {
|
||||
case GenericResponseEnvelope("/anotherTest", _, TestMessage(6)) => ()
|
||||
case _ => assert(false, "(7) message expected but not received")
|
||||
}
|
||||
|
||||
events.tell(Service.LeaveAll, probe.ref)
|
||||
events ! MessageEnvelope("test", Service.defaultPlayerGUID, TestMessage(5))
|
||||
events ! MessageEnvelope("anotherTest", Service.defaultPlayerGUID, TestMessage(6))
|
||||
probe.expectNoMessage(250 milliseconds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class EventServiceTestLeaveAll2 extends ActorTest {
|
||||
import EventServiceTestBase._
|
||||
"GenericEventSystem" should {
|
||||
"leave all channels" in {
|
||||
val probe = TestProbe("testProbe")
|
||||
val events = EventServiceTest.SpawnTestSystem()
|
||||
events.tell(Service.Join("test"), probe.ref)
|
||||
events.tell(Service.Join("anotherTest"), probe.ref)
|
||||
|
||||
events ! MessageEnvelope("test", Service.defaultPlayerGUID, TestMessage(5))
|
||||
events ! MessageEnvelope("anotherTest", Service.defaultPlayerGUID, TestMessage(6))
|
||||
val reply = probe.receiveN(2,100 milliseconds)
|
||||
reply.head match {
|
||||
case GenericResponseEnvelope("/test", _, TestMessage(5)) => ()
|
||||
case _ => assert(false, "(6) message expected but not received")
|
||||
}
|
||||
reply(1) match {
|
||||
case GenericResponseEnvelope("/anotherTest", _, TestMessage(6)) => ()
|
||||
case GenericResponseEnvelope("/anotherTest/out", _, TestMessage(6)) => ()
|
||||
case _ => assert(false, "(7) message expected but not received")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue