Repository: oozie Updated Branches: refs/heads/master a4732f9e9 -> d55245667
OOZIE-3192 OozieDBCLI does not clean up temporary files (Prabhu Joseph via gezapeti) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/d5524566 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/d5524566 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/d5524566 Branch: refs/heads/master Commit: d55245667b259d858d4dded849ded001896ba2af Parents: a4732f9 Author: Gezapeti Cseh <[email protected]> Authored: Mon Apr 9 11:09:09 2018 +0200 Committer: Gezapeti Cseh <[email protected]> Committed: Mon Apr 9 11:09:09 2018 +0200 ---------------------------------------------------------------------- release-log.txt | 1 + .../java/org/apache/oozie/tools/OozieDBCLI.java | 3 ++- .../org/apache/oozie/tools/TestOozieDBCLI.java | 25 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/d5524566/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 0d79c35..00065c9 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.1.0 release (trunk - unreleased) +OOZIE-3192 OozieDBCLI does not clean up temporary files (Prabhu Joseph via gezapeti) OOZIE-3134 Potential inconsistency between the in-memory SLA map and the Oozie database (kmarton via andras.piros) OOZIE-3209 XML schema error when submitting pyspark example (kmarton via andras.piros) OOZIE-2937 Remove redundant groupId from the child POMs (Jan Hentschel via andras.piros) http://git-wip-us.apache.org/repos/asf/oozie/blob/d5524566/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java ---------------------------------------------------------------------- diff --git a/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java b/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java index ce18e1c..eeaaa60 100644 --- a/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java +++ b/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java @@ -165,7 +165,7 @@ public class OozieDBCLI { } } - private Map<String, String> getJdbcConf() throws Exception { + protected Map<String, String> getJdbcConf() throws Exception { Services services = new Services(); Configuration conf = services.getConf(); Map<String, String> jdbcConf = new HashMap<String, String>(); @@ -180,6 +180,7 @@ public class OozieDBCLI { } dbType = dbType.substring(0, dbType.indexOf(":")); jdbcConf.put("dbtype", dbType); + services.destroy(); return jdbcConf; } http://git-wip-us.apache.org/repos/asf/oozie/blob/d5524566/tools/src/test/java/org/apache/oozie/tools/TestOozieDBCLI.java ---------------------------------------------------------------------- diff --git a/tools/src/test/java/org/apache/oozie/tools/TestOozieDBCLI.java b/tools/src/test/java/org/apache/oozie/tools/TestOozieDBCLI.java index 96ea1f9..4cebb7a 100644 --- a/tools/src/test/java/org/apache/oozie/tools/TestOozieDBCLI.java +++ b/tools/src/test/java/org/apache/oozie/tools/TestOozieDBCLI.java @@ -19,6 +19,7 @@ package org.apache.oozie.tools; +import org.apache.oozie.service.Services; import org.apache.hadoop.fs.FileUtil; import org.apache.oozie.test.XTestCase; import org.junit.AfterClass; @@ -27,6 +28,7 @@ import org.junit.BeforeClass; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.io.PrintStream; import java.nio.charset.Charset; @@ -90,6 +92,29 @@ public class TestOozieDBCLI extends XTestCase { conn.close(); } + public void testServicesDestroy() throws Exception { + Services services = new Services(); + File runtimeDir = new File(services.getRuntimeDir()).getParentFile(); + String systemId = services.getSystemId(); + + File[] dirsBefore = runtimeDir.listFiles(new FilenameFilter() { + public boolean accept(final File dir, final String name) { + return name.contains(systemId) && name.endsWith(".dir"); + } + }); + + OozieDBCLI cli = new OozieDBCLI(); + cli.getJdbcConf(); + + File[] dirsAfter = runtimeDir.listFiles(new FilenameFilter() { + public boolean accept(final File dir, final String name) { + return name.contains(systemId) && name.endsWith(".dir"); + } + }); + + assertEquals(dirsBefore.length,dirsAfter.length); + } + public void testOozieDBCLI() throws Exception { // test script for create database File createSql = new File(getTestCaseConfDir() + File.separator + "out.sql");
