Skip to content

Commit

Permalink
test: Print datasource metadata
Browse files Browse the repository at this point in the history
Related to #4516
  • Loading branch information
joaquinfelici committed Aug 21, 2024
1 parent 5f44d4f commit 1c008df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,9 @@ public NotValidException logErrorNoTTLConfigured() {
+ "* Set a default historyTimeToLive as a global process engine configuration\n"
+ "* (Not recommended) Deactivate the enforceTTL config to disable this check"));
}

@Override
protected void logError(String id, String messageTemplate, Object... parameters) {
super.logError(id, messageTemplate, parameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
Expand All @@ -31,6 +33,7 @@
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -42,6 +45,7 @@
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.stream.Collectors;
import javax.naming.InitialContext;
import javax.script.ScriptEngineManager;
import javax.sql.DataSource;
Expand Down Expand Up @@ -1707,13 +1711,23 @@ protected void initDataSource() {
// ACT-233: connection pool of Ibatis is not properely initialized if this is not called!
((PooledDataSource) dataSource).forceCloseAll();
}

logDataSourceMetadata();
}

if (databaseType == null) {
initDatabaseType();
}
}

private void logDataSourceMetadata() {
Class<?> clazz = dataSource.getClass();
String canonicalName = clazz.getCanonicalName();
List<String> declaredFields = Arrays.stream(clazz.getDeclaredFields()).map(Field::toString).collect(Collectors.toList());
List<String> declaredMethods = Arrays.stream(clazz.getDeclaredMethods()).map(Method::toString).collect(Collectors.toList());
LOG.logError("999", "Datasource metadata: " + "\n\nClass name: {}" + "\n\nDeclared fields: {}" + "\n\nDeclared methods: {}", canonicalName, declaredFields, declaredMethods);
}

protected static Properties databaseTypeMappings = getDefaultDatabaseTypeMappings();
protected static final String MY_SQL_PRODUCT_NAME = "MySQL";
protected static final String MARIA_DB_PRODUCT_NAME = "MariaDB";
Expand Down
3 changes: 2 additions & 1 deletion qa/integration-tests-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<wildfly.container.adapter.groupId>org.wildfly.arquillian</wildfly.container.adapter.groupId>
<wildfly.container.adapter.version>2.2.0.Final</wildfly.container.adapter.version>

<redirect.test.output>true</redirect.test.output>
<!-- Print directly to job logs-->
<redirect.test.output>false</redirect.test.output>
</properties>

<!-- import shrinkwrap and arquillian bom for artifact versions,
Expand Down

0 comments on commit 1c008df

Please sign in to comment.