@BeforeClass public static void setUp() throws Exception { hsqldbLocalServer = new HsqldbLocalServer.Builder() .setHsqldbHostName(propertyParser.getProperty(ConfigVars.HSQLDB_HOSTNAME_KEY)) .setHsqldbPort(propertyParser.getProperty(ConfigVars.HSQLDB_PORT_KEY)) .setHsqldbTempDir(propertyParser.getProperty(ConfigVars.HSQLDB_TEMP_DIR_KEY)) .setHsqldbDatabaseName(propertyParser.getProperty(ConfigVars.HSQLDB_DATABASE_NAME_KEY)) .setHsqldbCompatibilityMode( propertyParser.getProperty(ConfigVars.HSQLDB_COMPATIBILITY_MODE_KEY)) .setHsqldbJdbcDriver(propertyParser.getProperty(ConfigVars.HSQLDB_JDBC_DRIVER_KEY)) .setHsqldbJdbcConnectionStringPrefix( propertyParser.getProperty(ConfigVars.HSQLDB_JDBC_CONNECTION_STRING_PREFIX_KEY)) .build(); hsqldbLocalServer.start(); }
@Test public void testHsqldbMysqlCompatibilityMode() throws SQLException { Connection connection = DriverManager.getConnection( propertyParser.getProperty(ConfigVars.HSQLDB_JDBC_CONNECTION_STRING_PREFIX_KEY) + propertyParser.getProperty(ConfigVars.HSQLDB_HOSTNAME_KEY) + ":" + propertyParser.getProperty(ConfigVars.HSQLDB_PORT_KEY) + "/" + propertyParser.getProperty(ConfigVars.HSQLDB_DATABASE_NAME_KEY), "SA", ""); Statement statement = connection.createStatement(); statement.executeQuery(hsqldbLocalServer.getHsqldbCompatibilityModeStatement()); statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( "SELECT PROPERTY_VALUE FROM INFORMATION_SCHEMA.SYSTEM_PROPERTIES WHERE PROPERTY_NAME = 'sql.syntax_mys'"); while (resultSet.next()) { assertTrue(Boolean.parseBoolean(resultSet.getString(1))); } }
@AfterClass public static void tearDown() throws Exception { hsqldbLocalServer.stop(); }