diff --git a/pom.xml b/pom.xml index 5f2abed..d9338dd 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,13 @@ jsr305 3.0.2 + + org.slf4j + slf4j-api + 1.7.25 + + + org.junit.jupiter junit-jupiter-api @@ -53,6 +60,13 @@ ${junit.jupiter.version} test + + + ch.qos.logback + logback-classic + 1.2.3 + test + diff --git a/src/main/java/org/utplsql/api/TestRunner.java b/src/main/java/org/utplsql/api/TestRunner.java index 83ee237..033f67d 100644 --- a/src/main/java/org/utplsql/api/TestRunner.java +++ b/src/main/java/org/utplsql/api/TestRunner.java @@ -1,5 +1,7 @@ package org.utplsql.api; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.utplsql.api.compatibility.CompatibilityProxy; import org.utplsql.api.db.DatabaseInformation; import org.utplsql.api.db.DefaultDatabaseInformation; @@ -24,6 +26,8 @@ */ public class TestRunner { + private static final Logger logger = LoggerFactory.getLogger(TestRunner.class); + private final TestRunnerOptions options = new TestRunnerOptions(); private CompatibilityProxy compatibilityProxy; private ReporterFactory reporterFactory; @@ -122,9 +126,13 @@ private void delayedAddReporters() { public void run(Connection conn) throws SQLException { + logger.info("TestRunner initialized"); + DatabaseInformation databaseInformation = new DefaultDatabaseInformation(); compatibilityProxy = new CompatibilityProxy(conn, options.skipCompatibilityCheck, databaseInformation); + logger.info("Running on utPLSQL {}", compatibilityProxy.getDatabaseVersion()); + if ( reporterFactory == null ) reporterFactory = ReporterFactory.createDefault(compatibilityProxy); @@ -133,6 +141,7 @@ public void run(Connection conn) throws SQLException { // First of all check version compatibility compatibilityProxy.failOnNotCompatible(); + logger.info("Initializing reporters"); for (Reporter r : options.reporterList) validateReporter(conn, r); @@ -141,12 +150,14 @@ public void run(Connection conn) throws SQLException { } if (options.reporterList.isEmpty()) { + logger.info("No reporter given so choosing ut_documentation_reporter"); options.reporterList.add(new DocumentationReporter().init(conn)); } - DBHelper.enableDBMSOutput(conn); try(TestRunnerStatement testRunnerStatement = compatibilityProxy.getTestRunnerStatement(options, conn)) { + logger.info("Running tests"); testRunnerStatement.execute(); + logger.info("Running tests finished."); } catch (SQLException e) { if (e.getErrorCode() == SomeTestsFailedException.ERROR_CODE) { throw new SomeTestsFailedException(e.getMessage(), e); @@ -157,8 +168,6 @@ else if (e.getErrorCode() == UtPLSQLNotInstalledException.ERROR_CODE) { else { throw e; } - } finally { - DBHelper.disableDBMSOutput(conn); } } diff --git a/src/main/java/org/utplsql/api/compatibility/OptionalFeatures.java b/src/main/java/org/utplsql/api/compatibility/OptionalFeatures.java index 5f0b629..4e264cc 100644 --- a/src/main/java/org/utplsql/api/compatibility/OptionalFeatures.java +++ b/src/main/java/org/utplsql/api/compatibility/OptionalFeatures.java @@ -8,9 +8,9 @@ public enum OptionalFeatures { - FAIL_ON_ERROR("3.0.3", null), - FRAMEWORK_COMPATIBILITY_CHECK("3.0.3", null), - CUSTOM_REPORTERS("3.1.0", null); + FAIL_ON_ERROR("3.0.3.1266", null), + FRAMEWORK_COMPATIBILITY_CHECK("3.0.3.1266", null), + CUSTOM_REPORTERS("3.1.0.1849", null); private final Version minVersion; private final Version maxVersion; diff --git a/src/main/java/org/utplsql/api/reporter/Reporter.java b/src/main/java/org/utplsql/api/reporter/Reporter.java index 7797c57..639e0c6 100644 --- a/src/main/java/org/utplsql/api/reporter/Reporter.java +++ b/src/main/java/org/utplsql/api/reporter/Reporter.java @@ -5,6 +5,8 @@ import oracle.jdbc.OracleTypes; import oracle.sql.Datum; import oracle.sql.ORAData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.utplsql.api.compatibility.CompatibilityProxy; import org.utplsql.api.outputBuffer.OutputBuffer; @@ -18,6 +20,8 @@ */ public abstract class Reporter implements ORAData { + private static final Logger logger = LoggerFactory.getLogger(Reporter.class); + private String selfType; private String id; private Object[] attributes; @@ -73,6 +77,8 @@ private void initDbReporter( OracleConnection oraConn, ReporterFactory reporterF Reporter obj = (Reporter) callableStatement.getORAData(1, reporterFactory); setAttributes(obj.getAttributes()); + + logger.debug("Database-reporter initialized, Type: {}, ID: {}", selfType, id); } protected void setAttributes(Object[] attributes ) {