[VIVO-1376] Smoke test for SDB that looks for signs that it hasn't been upgraded from Jena 2.

This commit is contained in:
Graham Triggs 2017-08-27 22:11:18 +01:00
parent 47f3f304cb
commit 121eb088d1
2 changed files with 26 additions and 8 deletions

View file

@ -171,14 +171,17 @@ public class ApplicationImpl implements Application {
ss.info(this, "Started the ContentTripleSource: "
+ contentTripleSource);
ConfigurationTripleSource configurationTripleSource = app
.getConfigurationTripleSource();
configurationTripleSource.startup(app, css);
ss.info(this, "Started the ConfigurationTripleSource: "
+ configurationTripleSource);
// Ensure that we haven't failed setting up the content triple store before continuing
if (!ss.isStartupAborted()) {
ConfigurationTripleSource configurationTripleSource = app
.getConfigurationTripleSource();
configurationTripleSource.startup(app, css);
ss.info(this, "Started the ConfigurationTripleSource: "
+ configurationTripleSource);
configureJena();
prepareCombinedTripleSource(app, ctx);
configureJena();
prepareCombinedTripleSource(app, ctx);
}
}
private void configureJena() {

View file

@ -94,7 +94,22 @@ public class SDBConnectionSmokeTests {
try (Connection conn = DriverManager
.getConnection(url, connectionProps)) {
// Just open the connection and close it.
// We have an SQL connection - see if we have any XSD Strings in the database
String skip = props.getProperty("skip.Jena3StringTest", "false");
if (!Boolean.parseBoolean(skip)) {
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT COUNT(1) AS total FROM Nodes WHERE datatype='http://www.w3.org/2001/XMLSchema#string'");
if (rs != null && rs.next()) {
long total = rs.getLong("total");
if (total > 0) {
ss.fatal("XSD Strings exist in Nodes table. Requires upgrade for Jena 3");
}
}
} catch (SQLException e) {
// Ignore SQL Exception here, as it likely represents a triple store that's not initialised yet.
}
}
} catch (SQLException e) {
ss.fatal("Can't connect to the database: " + PROPERTY_DB_URL + "='"
+ url + "', " + PROPERTY_DB_USERNAME + "='" + username