[VIVO-1376] Smoke test for SDB that looks for signs that it hasn't been upgraded from Jena 2.
This commit is contained in:
parent
47f3f304cb
commit
121eb088d1
2 changed files with 26 additions and 8 deletions
|
@ -171,6 +171,8 @@ public class ApplicationImpl implements Application {
|
||||||
ss.info(this, "Started the ContentTripleSource: "
|
ss.info(this, "Started the ContentTripleSource: "
|
||||||
+ contentTripleSource);
|
+ contentTripleSource);
|
||||||
|
|
||||||
|
// Ensure that we haven't failed setting up the content triple store before continuing
|
||||||
|
if (!ss.isStartupAborted()) {
|
||||||
ConfigurationTripleSource configurationTripleSource = app
|
ConfigurationTripleSource configurationTripleSource = app
|
||||||
.getConfigurationTripleSource();
|
.getConfigurationTripleSource();
|
||||||
configurationTripleSource.startup(app, css);
|
configurationTripleSource.startup(app, css);
|
||||||
|
@ -180,6 +182,7 @@ public class ApplicationImpl implements Application {
|
||||||
configureJena();
|
configureJena();
|
||||||
prepareCombinedTripleSource(app, ctx);
|
prepareCombinedTripleSource(app, ctx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void configureJena() {
|
private void configureJena() {
|
||||||
// we do not want to fetch imports when we wrap Models in OntModels
|
// we do not want to fetch imports when we wrap Models in OntModels
|
||||||
|
|
|
@ -94,7 +94,22 @@ public class SDBConnectionSmokeTests {
|
||||||
|
|
||||||
try (Connection conn = DriverManager
|
try (Connection conn = DriverManager
|
||||||
.getConnection(url, connectionProps)) {
|
.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) {
|
} catch (SQLException e) {
|
||||||
ss.fatal("Can't connect to the database: " + PROPERTY_DB_URL + "='"
|
ss.fatal("Can't connect to the database: " + PROPERTY_DB_URL + "='"
|
||||||
+ url + "', " + PROPERTY_DB_USERNAME + "='" + username
|
+ url + "', " + PROPERTY_DB_USERNAME + "='" + username
|
||||||
|
|
Loading…
Add table
Reference in a new issue