Compare commits

..

No commits in common. "main" and "v2.4.3" have entirely different histories.
main ... v2.4.3

14 changed files with 33 additions and 105 deletions

View file

@ -1,3 +1,2 @@
#!/bin/bash
docker build --target deploy -t rasilon/ujetl docker/multistage
docker tag rasilon/ujetl:latest rasilon/ujetl:$(xpath -q -e '/project/version/text()' pom.xml)

View file

@ -1,4 +0,0 @@
#!/bin/bash
docker push rasilon/ujetl:latest
docker push rasilon/ujetl:$(xpath -q -e '/project/version/text()' pom.xml)

View file

@ -4,11 +4,6 @@
<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>

View file

@ -1,4 +0,0 @@
id,dat
1,banana
2,potato
3,nugget
1 id dat
2 1 banana
3 2 potato
4 3 nugget

View file

@ -44,14 +44,10 @@ 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;

View file

@ -30,9 +30,9 @@ fi
/usr/bin/java \
-Xms1g \
-Xmx2g \
-Dlog4j.configurationFile="$LOG_PROPS" \
-cp /usr/share/ujetl/lib/CopyingApp.jar \
com.rasilon.ujetl.CopyingApp \
--log4j "$LOG_PROPS" \
--config "/etc/ujetl/${JOBNAME}_config_live.xml"
#rm -f $LOCKFILE

19
pom.xml
View file

@ -6,7 +6,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>com.rasilon.ujetl</groupId>
<artifactId>CopyingApp</artifactId>
<packaging>jar</packaging>
<version>2.5.2</version>
<version>2.4.3</version>
<name>uJETL</name>
<url>https://github.com/rasilon/ujetl</url>
<properties>
@ -35,13 +35,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.220</version>
<version>2.1.210</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.18.0</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@ -51,12 +51,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.10.1</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.11.0</version>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
@ -71,17 +71,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.25.3</version>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.csvjdbc</groupId>
<artifactId>csvjdbc</artifactId>
<version>1.0.40</version>
<version>42.4.3</version>
</dependency>
</dependencies>
<build>

View file

@ -34,6 +34,10 @@ public class CopyingApp {
public static void main(String[] args) {
CopyingAppCommandParser cli = new CopyingAppCommandParser(args);
LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false);
String log4jConfigLocation = cli.getLog4jConfigFile();
File file = new File(log4jConfigLocation);
context.setConfigLocation(file.toURI());
System.out.println("Config set from "+file.toURI());
CopyingApp app = new CopyingApp(cli);
try {
@ -75,7 +79,6 @@ 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);
@ -241,21 +244,4 @@ public class CopyingApp {
return c;
}
// Even with JDBC 4, some drivers don't play nicely with whatever
// the classloaders are up to. So this allows us to force it the
// old fashioned way, and works around the
// "But it works fine when it's the /only/ driver!"
// cross-database problem
private void loadDrivers(Configuration config) {
String[] drivers = config.get(String[].class, "drivers.driver");
for(String d:drivers) {
try {
Class.forName(d);
log.info("Preloaded driver "+d);
} catch(ClassNotFoundException e) {
log.error("Could not preload driver "+d,e);
}
}
}
}

View file

@ -12,7 +12,7 @@ public class CopyingAppCommandParser {
private String configFile;
@Parameter(names = {"-log4j","--log4j"}, description = "Log4J config file for this run")
private String log4jConfigFile = "/etc/ujetl/default_log4j_config.properties";
private String log4jConfigFile = "/etc/ppl/default_log4j_config.properties";
public CopyingAppCommandParser(String[] args) {
super();
@ -23,4 +23,8 @@ public class CopyingAppCommandParser {
return configFile;
}
public String getLog4jConfigFile() {
return log4jConfigFile;
}
}

View file

@ -1,37 +0,0 @@
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 test001VerifyArrayOfDrivers() {
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());
}
}
}

View file

@ -42,7 +42,7 @@ public class TestJob {
dest,
"jUnit Test Config",
"jUnit Test Job",
"SELECT -1 AS \"key\"",
"SELECT -1 AS key",
"SELECT id,dat FROM src WHERE id > ?",
"INSERT INTO dest VALUES(?,?)",
null,

View file

@ -13,12 +13,15 @@ public class TestParser {
public void test001Parset() {
try {
String[] args = {
"--log4j",
"log4j_test_banana.xml",
"--config",
"config_test_banana.xml"
};
CopyingAppCommandParser p = new CopyingAppCommandParser(args);
assertEquals(p.getConfigFile(),"config_test_banana.xml");
assertEquals(p.getLog4jConfigFile(),"log4j_test_banana.xml");
} catch(Exception e) {
fail(e.toString());

View file

@ -42,7 +42,7 @@ public class TestPrePost {
dest,
"jUnit Test Config",
"jUnit Test Job",
"SELECT -1 AS \"key\"",
"SELECT -1 AS key",
"SELECT id,dat FROM src WHERE id > ?",
"INSERT INTO tmp_dest VALUES(?,?)",
"CREATE TEMP TABLE tmp_dest(id bigint not null primary key, dat varchar);",

View file

@ -4,11 +4,6 @@
<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>