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
|
|
@ -4,6 +4,11 @@
|
|||
<nRowsToLog>10000</nRowsToLog>
|
||||
<blockSize>1000</blockSize>
|
||||
<pollTimeout>500</pollTimeout>
|
||||
<drivers>
|
||||
<driver>org.postgresql.Driver</driver>
|
||||
<driver>org.relique.jdbc.csv.CsvDriver</driver>
|
||||
</drivers>
|
||||
|
||||
<source>
|
||||
<dsn>jdbc:postgresql://testdb:5432/test</dsn>
|
||||
<username>test</username>
|
||||
|
|
|
|||
4
docker/multistage/small.csv
Normal file
4
docker/multistage/small.csv
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
id,dat
|
||||
1,banana
|
||||
2,potato
|
||||
3,nugget
|
||||
|
|
|
@ -44,10 +44,14 @@ CREATE TABLE denormalised_personalia(
|
|||
lname text
|
||||
);
|
||||
|
||||
CREATE TABLE test_csvjdbc(
|
||||
id integer not null primary key,
|
||||
dat text
|
||||
);
|
||||
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO test;
|
||||
GRANT SELECT,INSERT,UPDATE ON denormalised_personalia TO test;
|
||||
|
||||
|
||||
\c postgres
|
||||
CREATE TABLE public.container_ready AS SELECT 1 FROM(VALUES(1)) AS a(a);
|
||||
GRANT SELECT ON public.container_ready TO TEST;
|
||||
|
|
|
|||
5
pom.xml
5
pom.xml
|
|
@ -78,6 +78,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
|
|||
<artifactId>postgresql</artifactId>
|
||||
<version>42.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.csvjdbc</groupId>
|
||||
<artifactId>csvjdbc</artifactId>
|
||||
<version>1.0.40</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -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