@Test public void testIsSetAutocommitOn() { Assert.assertEquals(ServerParseSet.AUTOCOMMIT_ON, ServerParseSet.parse("set autocommit=1", 3)); Assert.assertEquals( ServerParseSet.AUTOCOMMIT_ON, ServerParseSet.parse("set autoCOMMIT = 1", 3)); Assert.assertEquals(ServerParseSet.AUTOCOMMIT_ON, ServerParseSet.parse("SET AUTOCOMMIT=on", 3)); Assert.assertEquals( ServerParseSet.AUTOCOMMIT_ON, ServerParseSet.parse("set autoCOMMIT = ON", 3)); }
@Test public void testIsSetAutocommitOff() { Assert.assertEquals(ServerParseSet.AUTOCOMMIT_OFF, ServerParseSet.parse("set autocommit=0", 3)); Assert.assertEquals( ServerParseSet.AUTOCOMMIT_OFF, ServerParseSet.parse("SET AUTOCOMMIT= 0", 3)); Assert.assertEquals( ServerParseSet.AUTOCOMMIT_OFF, ServerParseSet.parse("set autoCOMMIT =OFF", 3)); Assert.assertEquals( ServerParseSet.AUTOCOMMIT_OFF, ServerParseSet.parse("set autoCOMMIT = off", 3)); }
@Test public void testTxSerializable() { Assert.assertEquals( ServerParseSet.TX_SERIALIZABLE, ServerParseSet.parse( " SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_SERIALIZABLE, ServerParseSet.parse( " set session transaction isolation level serializable ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_SERIALIZABLE, ServerParseSet.parse( " set session transaction isOLATION LEVEL SERIAlizable ", " SET".length())); }
@Test public void testTxRepeatedRead() { Assert.assertEquals( ServerParseSet.TX_REPEATED_READ, ServerParseSet.parse( " SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_REPEATED_READ, ServerParseSet.parse( " set session transaction isolation level repeatable read ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_REPEATED_READ, ServerParseSet.parse( " set session transaction isOLATION LEVEL REPEatable read ", " SET".length())); }
@Test public void testTxReadCommitted() { Assert.assertEquals( ServerParseSet.TX_READ_COMMITTED, ServerParseSet.parse( " SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_READ_COMMITTED, ServerParseSet.parse( " set session transaction isolation level read committed ", " SET".length())); Assert.assertEquals( ServerParseSet.TX_READ_COMMITTED, ServerParseSet.parse( " set session transaCTION ISOLATION LEVel read committed ", " SET".length())); }
@Test public void testIsCharacterSetResults() { Assert.assertEquals( ServerParseSet.CHARACTER_SET_RESULTS, 0xff & ServerParseSet.parse("SET character_set_results = NULL", 3)); Assert.assertEquals( ServerParseSet.CHARACTER_SET_RESULTS, 0xff & ServerParseSet.parse("SET CHARACTER_SET_RESULTS= NULL", 3)); Assert.assertEquals( ServerParseSet.CHARACTER_SET_RESULTS, 0xff & ServerParseSet.parse("Set chARActer_SET_RESults = NULL", 3)); Assert.assertEquals( ServerParseSet.CHARACTER_SET_CONNECTION, 0xff & ServerParseSet.parse("Set chARActer_SET_Connection = NULL", 3)); Assert.assertEquals( ServerParseSet.CHARACTER_SET_CLIENT, 0xff & ServerParseSet.parse("Set chARActer_SET_client = NULL", 3)); }
@Test public void testIsSetOther() { Assert.assertEquals(ServerParseSet.OTHER, ServerParseSet.parse("set ...", 3)); Assert.assertEquals(ServerParseSet.OTHER, ServerParseSet.parse("SET ...", 3)); Assert.assertEquals(ServerParseSet.OTHER, ServerParseSet.parse("sEt ...", 3)); }
@Test public void testIsSetNames() { Assert.assertEquals(ServerParseSet.NAMES, 0xff & ServerParseSet.parse("set names utf8", 3)); Assert.assertEquals(ServerParseSet.NAMES, 0xff & ServerParseSet.parse("SET NAMES UTF8", 3)); Assert.assertEquals(ServerParseSet.NAMES, 0xff & ServerParseSet.parse("set NAMES utf8", 3)); }