/** * loadJDBCPropのテストケース 異常系:DBMSの接続情報を記述したプロパティファイルの読み込みに失敗するケース * * @throws Exception */ @Test public void loadJDBCProp02() throws Exception { ConfigurationLoader.init(properties_db, true, false); // // LogInitializer.execute(ConfigurationLoader.getProperty(Constants.PROP_KEY_LOG_CONF_PATH)); try { ConfigurationLoader.loadJDBCProp("targetErr"); fail(); } catch (BulkLoaderSystemException e) { LOG.info(e.getCause(), e.getMessageId(), e.getMessageArgs()); } }
/** * loadJDBCPropのテストケース 正常系:DBMSの接続情報を記述したプロパティファイルを読み込むケース * * @throws Exception */ @Test public void loadJDBCProp01() throws Exception { ConfigurationLoader.init(properties_db, true, false); try { ConfigurationLoader.loadJDBCProp("target3"); } catch (Exception e) { e.printStackTrace(); fail(); } assertEquals("com.mysql.jdbc.Driver", ConfigurationLoader.getProperty("jdbc.driver")); assertEquals( "jdbc:mysql://localhost/__asakusa_utest_thundergate", ConfigurationLoader.getProperty("jdbc.url")); assertEquals("__asakusa_ut_tg", ConfigurationLoader.getProperty("jdbc.user")); assertEquals("__asakusa_ut_tg", ConfigurationLoader.getProperty("jdbc.password")); assertEquals(PATH_DB_PARAMETER, ConfigurationLoader.getProperty("db.parameter")); }
/** * loadJDBCPropのテストケース 異常系:DBMSのDB名が設定されていないケース * * @throws Exception */ @Test public void loadJDBCProp07() throws Exception { // ConfigurationLoader.init(propertys_db, true, false); // // LogInitializer.execute(ConfigurationLoader.getProperty(Constants.PROP_KEY_LOG_CONF_PATH)); ConfigurationLoader.init(properties_db, false, false); Properties p = ConfigurationLoader.getProperty(); p.setProperty("jdbc.driver", "com.mysql.jdbc.Driver"); p.setProperty("jdbc.url", "jdbc:mysql://localhost/asakusa"); p.setProperty("jdbc.user", "asakusa"); p.setProperty("jdbc.password", "asakusa"); p.setProperty("db.parameter", PATH_DB_PARAMETER); ConfigurationLoader.setProperty(p); try { ConfigurationLoader.loadJDBCProp("target2"); } catch (BulkLoaderSystemException e) { LOG.info(e.getCause(), e.getMessageId(), e.getMessageArgs()); } }