fakePeer

fun fakePeer(context: String, callers: Map<String, List<String>> = emptyMap()): FakePeer

Starts a fake of the peer service that serves context, on a port of the loopback interface the system chooses: the call routes of its internal port, which a saga's synchronous call and a service's wow-client send its commands to. Its commands and their routes are the ones its api module's contract on the class path declares, as the caller finds them. Give it to the server under test (wowServer's peers), which then calls it at its FakePeer.url.

callers are the commands each calling service may send it, by service name, as the peer's own wow.callers.<service>.commands gives them (CallPermits): none by default, a peer whose configuration lists no callers, which allows every domain command and refuses every system command (wow.*). A saga that calls a peer's system command states the peer's permit, as the peer's configuration must: fakePeer("eshop-ordering", callers = mapOf("eshop-basket" to listOf("wow.lifecycle.DeleteAggregate"))).

fakePeer("eshop-ordering").use { ordering ->
wowServer<BasketServer>("dev", peers = listOf(ordering)).use { basket ->
// check out the basket: its saga calls the ordering
ordering.called<SubmitOrder>().operator!!.id.assert().isEqualTo("alice")
}
}