From 46bee0b9772b9bf74f5b6fdc45f8764a73fa5137 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 27 Aug 2020 13:55:32 +0200 Subject: [PATCH] Cleaned up tests --- .../network/rmi/RmiDelayedInvocationSpamTest.kt | 13 ++++++++----- .../network/rmi/RmiDelayedInvocationTest.kt | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/dorkboxTest/network/rmi/RmiDelayedInvocationSpamTest.kt b/test/dorkboxTest/network/rmi/RmiDelayedInvocationSpamTest.kt index dd86a08a..413fc4b4 100644 --- a/test/dorkboxTest/network/rmi/RmiDelayedInvocationSpamTest.kt +++ b/test/dorkboxTest/network/rmi/RmiDelayedInvocationSpamTest.kt @@ -30,7 +30,6 @@ import java.io.IOException import java.util.concurrent.atomic.AtomicLong class RmiDelayedInvocationSpamTest : BaseTest() { - private val totalRuns = 1000000 private val counter = AtomicLong(0) private val RMI_ID = 12251 @@ -62,12 +61,17 @@ class RmiDelayedInvocationSpamTest : BaseTest() { fun rmi(config: (Configuration) -> Unit = {}) { val server: Server + val async = false + + val mod = if (async) 10_000L else 200L + val totalRuns = if (async) 1_000_000 else 70_000 + run { val configuration = serverConfig() config(configuration) register(configuration.serialization) - server = Server(configuration) + server = Server(configuration) addEndPoint(server) server.saveGlobalObject(TestObjectImpl(counter), RMI_ID) @@ -87,10 +91,9 @@ class RmiDelayedInvocationSpamTest : BaseTest() { addEndPoint(client) client.onConnect { connection -> - val remoteObject = connection.getGlobalObject(RMI_ID) val obj = remoteObject as RemoteObject - obj.async = true + obj.async = async var started = false for (i in 0 until totalRuns) { @@ -99,7 +102,7 @@ class RmiDelayedInvocationSpamTest : BaseTest() { System.err.println("Running for $totalRuns iterations....") } - if (i % 10000L == 0L) { + if (i % mod == 0L) { // this doesn't always output to the console. weird. client.logger.error("$i") } diff --git a/test/dorkboxTest/network/rmi/RmiDelayedInvocationTest.kt b/test/dorkboxTest/network/rmi/RmiDelayedInvocationTest.kt index 23f71dfe..b815b983 100644 --- a/test/dorkboxTest/network/rmi/RmiDelayedInvocationTest.kt +++ b/test/dorkboxTest/network/rmi/RmiDelayedInvocationTest.kt @@ -82,7 +82,7 @@ class RmiDelayedInvocationTest : BaseTest() { client.onConnect { connection -> val remoteObject = connection.getGlobalObject(OBJ_ID) - val totalRuns = 1000 + val totalRuns = 100 var abort = false System.err.println("Running for $totalRuns iterations....") @@ -90,7 +90,7 @@ class RmiDelayedInvocationTest : BaseTest() { if (abort) { break } - if (i % 10000 == 0) { + if (i % 10 == 0) { System.err.println(i) }