mirror of
https://github.com/rasilon/ujetl.git
synced 2026-04-11 10:29:29 +00:00
Add forced driver loading
This commit is contained in:
parent
866d02fb52
commit
1b1ba551c8
7 changed files with 69 additions and 1 deletions
|
|
@ -75,6 +75,7 @@ public class CopyingApp {
|
|||
|
||||
Configuration config = configs.xml(cli.getConfigFile());
|
||||
|
||||
loadDrivers(config);
|
||||
String hardLimitSeconds = config.getString("hardLimitSeconds");
|
||||
if(hardLimitSeconds != null) {
|
||||
TimeLimiter hardLimit = new TimeLimiter(Integer.decode(hardLimitSeconds).intValue(),true);
|
||||
|
|
@ -240,4 +241,11 @@ public class CopyingApp {
|
|||
|
||||
return c;
|
||||
}
|
||||
|
||||
private void loadDrivers(Configuration config){
|
||||
String[] drivers = config.get(String[].class, "drivers.driver");
|
||||
for(String d:drivers){
|
||||
log.info("Would load "+d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
37
src/test/java/com/rasilon/ujetl/TestConfig.java
Normal file
37
src/test/java/com/rasilon/ujetl/TestConfig.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package com.rasilon.ujetl;
|
||||
|
||||
import org.apache.commons.configuration2.Configuration;
|
||||
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils; // Why does config need this?
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.MethodOrderer.Alphanumeric;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
|
||||
/**
|
||||
* @author derryh
|
||||
*
|
||||
*/
|
||||
public class TestConfig {
|
||||
|
||||
@Test
|
||||
public void test002verifyH2Works() {
|
||||
try {
|
||||
Configurations configs = new Configurations();
|
||||
Configuration config = configs.xml("TEST_config_live.xml");
|
||||
String[] drivers = config.get(String[].class, "drivers.driver");
|
||||
int ndrivers =drivers.length;
|
||||
if(ndrivers != 3){
|
||||
fail("Expected 3 drivers, but found "+ndrivers);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
fail(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,11 @@
|
|||
<nRowsToLog>10000</nRowsToLog>
|
||||
<blockSize>1000</blockSize>
|
||||
<pollTimeout>500</pollTimeout>
|
||||
<drivers>
|
||||
<driver>org.postgresql.Driver</driver>
|
||||
<driver>org.h2.Driver</driver>
|
||||
<driver>org.relique.jdbc.csv.CsvDriver</driver>
|
||||
</drivers>
|
||||
<source>
|
||||
<dsn>jdbc:postgresql://localhost:5432/test</dsn>
|
||||
<username>test</username>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue