mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-16 10:30:36 +00:00
Facility Turrets (#223)
* object class, actor class, and definitions for base turrets; untested * wired base turrets into existence, with hoop jumping; created interface for objects with mounted weapons (vehicles and turrets); working example phalanx_sgl_hevgatcan in Anguta, Ceryshen * re-wiring manned turrets so that the turreted weapon itself never changes externally but merely identifies different and changes internally; workflow for upgrading wall turrets in place (30s); clarifications and documentation for HackMessage and UseItemMessage; getting rid of orphaned packages from previous location of services * added a simple task that reverts upgraded manned turrets to their None state after a certain amount of time has passed; it works but need improvement * turret weapon upgrades now last for a duration of 30 minutes before reverting; created a service support actor base actor that underlies all current support actors; nano-dispenser now properly loads 1 unit of upgrade canister, rather than 100 units; all canister types have appropriate 2x3 inventory size * forgot to hurry; moved over the Services tests from main/test folder into the common/test folder and needed to change the location of ActorTest to accommodate it; test and documentation for MannedTurret; codecov ignore update * wired facility turrets in Anguta, Ceryshen; Akna tower, Ceryshen; and S.Villa tower, home3 (Anguta tower is a watchtower); attempted workaround for Travis CI issues with receiveN; re-introduced RemoveActorTest, at least the first test; expanded how ZoneActor performs tests on MannedTurret setup * getting rid of useless commented-out code; making common operations for mounting and dismounting * removed outdated comment; added ResourceSilo tests; added extra test for Zone
This commit is contained in:
parent
61a51c1dd1
commit
b81ff2bbf4
75 changed files with 2246 additions and 680 deletions
51
common/src/test/scala/base/ActorTest.scala
Normal file
51
common/src/test/scala/base/ActorTest.scala
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package base
|
||||
|
||||
// Copyright (c) 2017 PSForever
|
||||
import akka.actor.ActorSystem
|
||||
import akka.testkit.{ImplicitSender, TestKit}
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
|
||||
import org.specs2.specification.Scope
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
abstract class ActorTest(sys : ActorSystem = ActorSystem("system", ConfigFactory.parseMap(ActorTest.LoggingConfig)))
|
||||
extends TestKit(sys) with Scope with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
|
||||
override def afterAll {
|
||||
TestKit.shutdownActorSystem(system)
|
||||
}
|
||||
}
|
||||
|
||||
object ActorTest {
|
||||
import scala.collection.JavaConverters._
|
||||
private val LoggingConfig = Map(
|
||||
"akka.loggers" -> List("akka.testkit.TestEventListener").asJava,
|
||||
"akka.loglevel" -> "OFF",
|
||||
"akka.stdout-loglevel" -> "OFF",
|
||||
"akka.log-dead-letters" -> "OFF"
|
||||
).asJava
|
||||
|
||||
/**
|
||||
* A (potential) workaround to a Travis CI issue involving polling a series of messages over a period of time.
|
||||
* Running the test in isolation works every time.
|
||||
* Running the test as part of a series produces mixed results.
|
||||
* Travis CI fails the test every time by not getting any messages.
|
||||
* @see TestKit.receiveN
|
||||
* @param n the number of messages to poll
|
||||
* @param timeout how long to wait for each message
|
||||
* @param sys what to poll
|
||||
* @return a list of messages
|
||||
*/
|
||||
def receiveMultiple(n : Int, timeout : FiniteDuration, sys : TestKit) : List[Any] = {
|
||||
assert(0 < n, s"number of expected messages must be positive non-zero integer - $n")
|
||||
val out = {
|
||||
val msgs = mutable.ListBuffer[Any]()
|
||||
(0 until n).foreach(_ => {
|
||||
msgs += sys.receiveOne(timeout)
|
||||
})
|
||||
msgs.toList
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue