@Throws(Throwable::class) private fun waitForUsers(hostUri: URI, authToken: String) { val usersLink: URI = UriUtils.buildUri(hostUri, UserService.FACTORY_LINK) val numberUsers = arrayOfNulls<Int>(1) for (i in 0..19) { val get: Operation = Operation.createGet(usersLink).forceRemote().addRequestHeader(Operation.REQUEST_AUTH_TOKEN_HEADER, authToken).setCompletion(null) this.host.testStart(1) this.host.send(get) this.host.testWait() if (numberUsers[0] == 2) { break } Thread.sleep(250) } assertTrue(numberUsers[0] == 2) }
Supports createUsers ( ) by waiting for two users to be created . They are n't created immediately , so this polls .