Cleaned up tests
This commit is contained in:
parent
59d58f27e8
commit
46bee0b977
|
@ -30,7 +30,6 @@ import java.io.IOException
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
|
||||||
class RmiDelayedInvocationSpamTest : BaseTest() {
|
class RmiDelayedInvocationSpamTest : BaseTest() {
|
||||||
private val totalRuns = 1000000
|
|
||||||
private val counter = AtomicLong(0)
|
private val counter = AtomicLong(0)
|
||||||
|
|
||||||
private val RMI_ID = 12251
|
private val RMI_ID = 12251
|
||||||
|
@ -62,12 +61,17 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
|
||||||
fun rmi(config: (Configuration) -> Unit = {}) {
|
fun rmi(config: (Configuration) -> Unit = {}) {
|
||||||
val server: Server<Connection>
|
val server: Server<Connection>
|
||||||
|
|
||||||
|
val async = false
|
||||||
|
|
||||||
|
val mod = if (async) 10_000L else 200L
|
||||||
|
val totalRuns = if (async) 1_000_000 else 70_000
|
||||||
|
|
||||||
run {
|
run {
|
||||||
val configuration = serverConfig()
|
val configuration = serverConfig()
|
||||||
config(configuration)
|
config(configuration)
|
||||||
register(configuration.serialization)
|
register(configuration.serialization)
|
||||||
|
|
||||||
server = Server<Connection>(configuration)
|
server = Server(configuration)
|
||||||
addEndPoint(server)
|
addEndPoint(server)
|
||||||
|
|
||||||
server.saveGlobalObject(TestObjectImpl(counter), RMI_ID)
|
server.saveGlobalObject(TestObjectImpl(counter), RMI_ID)
|
||||||
|
@ -87,10 +91,9 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
|
||||||
addEndPoint(client)
|
addEndPoint(client)
|
||||||
|
|
||||||
client.onConnect { connection ->
|
client.onConnect { connection ->
|
||||||
|
|
||||||
val remoteObject = connection.getGlobalObject<TestObject>(RMI_ID)
|
val remoteObject = connection.getGlobalObject<TestObject>(RMI_ID)
|
||||||
val obj = remoteObject as RemoteObject
|
val obj = remoteObject as RemoteObject
|
||||||
obj.async = true
|
obj.async = async
|
||||||
|
|
||||||
var started = false
|
var started = false
|
||||||
for (i in 0 until totalRuns) {
|
for (i in 0 until totalRuns) {
|
||||||
|
@ -99,7 +102,7 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
|
||||||
System.err.println("Running for $totalRuns iterations....")
|
System.err.println("Running for $totalRuns iterations....")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i % 10000L == 0L) {
|
if (i % mod == 0L) {
|
||||||
// this doesn't always output to the console. weird.
|
// this doesn't always output to the console. weird.
|
||||||
client.logger.error("$i")
|
client.logger.error("$i")
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class RmiDelayedInvocationTest : BaseTest() {
|
||||||
client.onConnect { connection ->
|
client.onConnect { connection ->
|
||||||
val remoteObject = connection.getGlobalObject<TestObject>(OBJ_ID)
|
val remoteObject = connection.getGlobalObject<TestObject>(OBJ_ID)
|
||||||
|
|
||||||
val totalRuns = 1000
|
val totalRuns = 100
|
||||||
var abort = false
|
var abort = false
|
||||||
System.err.println("Running for $totalRuns iterations....")
|
System.err.println("Running for $totalRuns iterations....")
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class RmiDelayedInvocationTest : BaseTest() {
|
||||||
if (abort) {
|
if (abort) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (i % 10000 == 0) {
|
if (i % 10 == 0) {
|
||||||
System.err.println(i)
|
System.err.println(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user