@Test public void jdbcDriverLocatedInMavenRepository_bad_format() { thrown.expect(IllegalArgumentException.class); Locators locators = mock(Locators.class); Configuration config = Configuration.builder() .setProperty("sonar.jdbc.driverMavenKey", "foo") .build(); DatabaseFactory.create(config, locators); }
public static DatabaseClient create(Configuration config, Locators locators) { String url = config.getString("sonar.jdbc.url"); DatabaseClient.Builder builder = newBuilderForUrl(url); String s = config.getString("sonar.jdbc.schema"); if (!isEmpty(s)) { builder.setSchema(s); } s = config.getString("sonar.jdbc.username"); if (!isEmpty(s)) { builder.setLogin(s); } s = config.getString("sonar.jdbc.password"); if (!isEmpty(s)) { builder.setPassword(s); } s = config.getString("sonar.jdbc.rootUrl"); if (!isEmpty(s)) { builder.setRootUrl(s); } s = config.getString("sonar.jdbc.rootUsername"); if (!isEmpty(s)) { builder.setRootLogin(s); } s = config.getString("sonar.jdbc.rootPassword"); if (!isEmpty(s)) { builder.setRootPassword(s); } s = config.getString("sonar.jdbc.driverFile"); if (!isEmpty(s)) { builder.setDriverFile(new File(s)); } s = config.getString("sonar.jdbc.driverMavenKey"); if (!isEmpty(s)) { feedDriverMavenKey(locators, builder, s); } String value = config.getString("orchestrator.keepDatabase", "false"); boolean keepDatabase = !isEmpty(value) ? Boolean.valueOf(value) : false; if (keepDatabase) { builder.setDropAndCreate(false); } return builder.build(); }
DatabaseFactory { public static DatabaseClient create(Configuration config, Locators locators) { String url = config.getString("sonar.jdbc.url"); DatabaseClient.Builder builder = newBuilderForUrl(url); String s = config.getString("sonar.jdbc.schema"); if (!isEmpty(s)) { builder.setSchema(s); } s = config.getString("sonar.jdbc.username"); if (!isEmpty(s)) { builder.setLogin(s); } s = config.getString("sonar.jdbc.password"); if (!isEmpty(s)) { builder.setPassword(s); } s = config.getString("sonar.jdbc.rootUrl"); if (!isEmpty(s)) { builder.setRootUrl(s); } s = config.getString("sonar.jdbc.rootUsername"); if (!isEmpty(s)) { builder.setRootLogin(s); } s = config.getString("sonar.jdbc.rootPassword"); if (!isEmpty(s)) { builder.setRootPassword(s); } s = config.getString("sonar.jdbc.driverFile"); if (!isEmpty(s)) { builder.setDriverFile(new File(s)); } s = config.getString("sonar.jdbc.driverMavenKey"); if (!isEmpty(s)) { feedDriverMavenKey(locators, builder, s); } String value = config.getString("orchestrator.keepDatabase", "false"); boolean keepDatabase = !isEmpty(value) ? Boolean.valueOf(value) : false; if (keepDatabase) { builder.setDropAndCreate(false); } return builder.build(); } }
DatabaseFactory { public static DatabaseClient create(Configuration config, Locators locators) { String url = config.getString("sonar.jdbc.url"); DatabaseClient.Builder builder = newBuilderForUrl(url); String s = config.getString("sonar.jdbc.schema"); if (!isEmpty(s)) { builder.setSchema(s); } s = config.getString("sonar.jdbc.username"); if (!isEmpty(s)) { builder.setLogin(s); } s = config.getString("sonar.jdbc.password"); if (!isEmpty(s)) { builder.setPassword(s); } s = config.getString("sonar.jdbc.rootUrl"); if (!isEmpty(s)) { builder.setRootUrl(s); } s = config.getString("sonar.jdbc.rootUsername"); if (!isEmpty(s)) { builder.setRootLogin(s); } s = config.getString("sonar.jdbc.rootPassword"); if (!isEmpty(s)) { builder.setRootPassword(s); } s = config.getString("sonar.jdbc.driverFile"); if (!isEmpty(s)) { builder.setDriverFile(new File(s)); } s = config.getString("sonar.jdbc.driverMavenKey"); if (!isEmpty(s)) { feedDriverMavenKey(locators, builder, s); } String value = config.getString("orchestrator.keepDatabase", "false"); boolean keepDatabase = !isEmpty(value) ? Boolean.valueOf(value) : false; if (keepDatabase) { builder.setDropAndCreate(false); } return builder.build(); } private  DatabaseFactory(); }
DatabaseFactory { public static DatabaseClient create(Configuration config, Locators locators) { String url = config.getString("sonar.jdbc.url"); DatabaseClient.Builder builder = newBuilderForUrl(url); String s = config.getString("sonar.jdbc.schema"); if (!isEmpty(s)) { builder.setSchema(s); } s = config.getString("sonar.jdbc.username"); if (!isEmpty(s)) { builder.setLogin(s); } s = config.getString("sonar.jdbc.password"); if (!isEmpty(s)) { builder.setPassword(s); } s = config.getString("sonar.jdbc.rootUrl"); if (!isEmpty(s)) { builder.setRootUrl(s); } s = config.getString("sonar.jdbc.rootUsername"); if (!isEmpty(s)) { builder.setRootLogin(s); } s = config.getString("sonar.jdbc.rootPassword"); if (!isEmpty(s)) { builder.setRootPassword(s); } s = config.getString("sonar.jdbc.driverFile"); if (!isEmpty(s)) { builder.setDriverFile(new File(s)); } s = config.getString("sonar.jdbc.driverMavenKey"); if (!isEmpty(s)) { feedDriverMavenKey(locators, builder, s); } String value = config.getString("orchestrator.keepDatabase", "false"); boolean keepDatabase = !isEmpty(value) ? Boolean.valueOf(value) : false; if (keepDatabase) { builder.setDropAndCreate(false); } return builder.build(); } private  DatabaseFactory(); static DatabaseClient create(Configuration config, Locators locators); }
DatabaseFactory { public static DatabaseClient create(Configuration config, Locators locators) { String url = config.getString("sonar.jdbc.url"); DatabaseClient.Builder builder = newBuilderForUrl(url); String s = config.getString("sonar.jdbc.schema"); if (!isEmpty(s)) { builder.setSchema(s); } s = config.getString("sonar.jdbc.username"); if (!isEmpty(s)) { builder.setLogin(s); } s = config.getString("sonar.jdbc.password"); if (!isEmpty(s)) { builder.setPassword(s); } s = config.getString("sonar.jdbc.rootUrl"); if (!isEmpty(s)) { builder.setRootUrl(s); } s = config.getString("sonar.jdbc.rootUsername"); if (!isEmpty(s)) { builder.setRootLogin(s); } s = config.getString("sonar.jdbc.rootPassword"); if (!isEmpty(s)) { builder.setRootPassword(s); } s = config.getString("sonar.jdbc.driverFile"); if (!isEmpty(s)) { builder.setDriverFile(new File(s)); } s = config.getString("sonar.jdbc.driverMavenKey"); if (!isEmpty(s)) { feedDriverMavenKey(locators, builder, s); } String value = config.getString("orchestrator.keepDatabase", "false"); boolean keepDatabase = !isEmpty(value) ? Boolean.valueOf(value) : false; if (keepDatabase) { builder.setDropAndCreate(false); } return builder.build(); } private  DatabaseFactory(); static DatabaseClient create(Configuration config, Locators locators);  }