Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
package org.openrs2.db
|
|
|
|
import java.sql.SQLException
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertFalse
|
|
import kotlin.test.assertTrue
|
|
|
|
class DeadlockDetectorTest {
|
|
@Test
|
|
fun testDefault() {
|
|
assertTrue(DefaultDeadlockDetector.isDeadlock(SQLException()))
|
|
}
|
|
|
|
@Test
|
|
fun testH2() {
|
|
assertFalse(H2DeadlockDetector.isDeadlock(SQLException()))
|
|
assertTrue(H2DeadlockDetector.isDeadlock(SQLException(null, null, 40001)))
|
|
assertTrue(H2DeadlockDetector.isDeadlock(SQLException(null, null, 50200)))
|
|
}
|
|
|
|
@Test
|
|
fun testMysql() {
|
|
assertFalse(MysqlDeadlockDetector.isDeadlock(SQLException()))
|
|
assertTrue(MysqlDeadlockDetector.isDeadlock(SQLException(null, null, 1205)))
|
|
assertTrue(MysqlDeadlockDetector.isDeadlock(SQLException(null, null, 1213)))
|
|
}
|
|
|
|
@Test
|
|
fun testPostgres() {
|
|
assertFalse(PostgresDeadlockDetector.isDeadlock(SQLException()))
|
|
assertTrue(PostgresDeadlockDetector.isDeadlock(SQLException(null, "40001")))
|
|
assertTrue(PostgresDeadlockDetector.isDeadlock(SQLException(null, "40P01")))
|
|
}
|
|
|
|
@Test
|
|
fun testSqlite() {
|
|
assertFalse(SqliteDeadlockDetector.isDeadlock(SQLException()))
|
|
assertTrue(SqliteDeadlockDetector.isDeadlock(SQLException(null, null, 5)))
|
|
assertTrue(SqliteDeadlockDetector.isDeadlock(SQLException(null, null, 6)))
|
|
}
|
|
}
|
|
|