Code cleanup

This commit is contained in:
Robinson 2023-09-21 12:54:07 +02:00
parent e6b4cbd386
commit 19d6d6ebaf
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
4 changed files with 19 additions and 30 deletions

View File

@ -20,6 +20,7 @@ import dorkbox.network.Client
import dorkbox.network.Server
import dorkbox.network.aeron.AeronDriver
import dorkbox.network.connection.Connection
import dorkbox.network.connection.EndPoint
import dorkbox.network.rmi.RemoteObject
import kotlinx.atomicfu.atomic
import org.junit.Assert
@ -284,6 +285,10 @@ class DisconnectReconnectTest : BaseTest() {
@Test
fun reconnectWithFallbackClient() {
if (EndPoint.DEBUG_CONNECTIONS) {
throw RuntimeException("DEBUG_CONNECTIONS is enabled. This will cause the test to run forever!!")
}
val latch = CountDownLatch(reconnects+1)
val reconnectCount = atomic(0)

View File

@ -25,7 +25,6 @@ import dorkboxTest.network.BaseTest
import dorkboxTest.network.rmi.cows.MessageWithTestCow
import dorkboxTest.network.rmi.cows.TestCow
import dorkboxTest.network.rmi.cows.TestCowImpl
import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Test
@ -130,9 +129,7 @@ class RmiSimpleActionsTest : BaseTest() {
client.onConnect {
rmi.create<TestCow>(23) {
client.logger.error("Running test for: Client -> Server")
runBlocking {
RmiCommonTest.runTests(this@onConnect, this@create, 23)
}
RmiCommonTest.runTests(this@onConnect, this@create, 23)
client.logger.error("Done with test for: Client -> Server")
}
}
@ -205,9 +202,7 @@ class RmiSimpleActionsTest : BaseTest() {
client.onConnect {
rmi.create<TestCow>(23) {
client.logger.error("Running test for: Client -> Server")
runBlocking {
RmiCommonTest.runTests(this@onConnect, this@create, 23)
}
RmiCommonTest.runTests(this@onConnect, this@create, 23)
client.logger.error("Done with test for: Client -> Server")
}
}

View File

@ -193,9 +193,7 @@ class RmiSimpleTest : BaseTest() {
// normally this is in the 'connected', but we do it here, so that it's more linear and easier to debug
server.logger.error("Running test for: Server -> Client")
runBlocking {
RmiCommonTest.runTests(this@onMessage, rmi.get(4), 4)
}
RmiCommonTest.runTests(this@onMessage, rmi.get(4), 4)
server.logger.error("Done with test for: Server -> Client")
}
@ -281,11 +279,9 @@ class RmiSimpleTest : BaseTest() {
server.logger.error("Starting test for: Server -> Client")
// NOTE: THIS IS BI-DIRECTIONAL!
rmi.create<TestCow>(123) {
runBlocking {
server.logger.error("Running test for: Server -> Client")
RmiCommonTest.runTests(this@onMessage, this@create, 123)
server.logger.error("Done with test for: Server -> Client")
}
server.logger.error("Running test for: Server -> Client")
RmiCommonTest.runTests(this@onMessage, this@create, 123)
server.logger.error("Done with test for: Server -> Client")
}
}
server
@ -303,11 +299,9 @@ class RmiSimpleTest : BaseTest() {
client.onConnect {
rmi.create<TestCow>(23) {
runBlocking {
client.logger.error("Running test for: Client -> Server")
RmiCommonTest.runTests(this@onConnect, this@create, 23)
client.logger.error("Done with test for: Client -> Server")
}
client.logger.error("Running test for: Client -> Server")
RmiCommonTest.runTests(this@onConnect, this@create, 23)
client.logger.error("Done with test for: Client -> Server")
}
}
@ -408,11 +402,9 @@ class RmiSimpleTest : BaseTest() {
client.onConnect {
rmi.create<TestCow>(23) {
runBlocking {
client.logger.error("Running test for: Client -> Server")
runFun(this@onConnect, this@create)
client.logger.error("Done with test for: Client -> Server")
}
client.logger.error("Running test for: Client -> Server")
runFun(this@onConnect, this@create)
client.logger.error("Done with test for: Client -> Server")
}
}

View File

@ -28,7 +28,6 @@ import dorkbox.storage.Storage
import dorkboxTest.network.BaseTest
import dorkboxTest.network.rmi.RmiCommonTest
import dorkboxTest.network.rmi.cows.TestCow
import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.slf4j.LoggerFactory
@ -79,10 +78,8 @@ object TestClient {
logger.error("Starting test for: Client -> Server")
rmi.getGlobal<TestCow>(12123).apply {
runBlocking {
RmiCommonTest.runTests(this@onConnect, this@apply, 12123)
logger.error("DONE")
}
RmiCommonTest.runTests(this@onConnect, this@apply, 12123)
logger.error("DONE")
// now send this remote object ACROSS the wire to the server (on the server, this is where the IMPLEMENTATION lives)
send(this)