use of org.neo4j.driver.v1.Driver in project sonarqube by SonarSource.
the class DdlUtilsTest method shouldCreateSchema_without_schema_migrations.
@Test
public void shouldCreateSchema_without_schema_migrations() throws SQLException {
DriverManager.registerDriver(new Driver());
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:sonar_test2")) {
try (Statement statement = connection.createStatement()) {
statement.execute("create table schema_migrations (version varchar(255) not null)");
}
DdlUtils.createSchema(connection, "h2", false);
verifySchemaMigrations(connection);
}
}
use of org.neo4j.driver.v1.Driver in project sonarqube by SonarSource.
the class DdlUtilsTest method shouldCreateSchema_with_schema_migrations.
@Test
public void shouldCreateSchema_with_schema_migrations() throws SQLException {
DriverManager.registerDriver(new Driver());
try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:sonar_test")) {
DdlUtils.createSchema(connection, "h2", true);
int tableCount = countTables(connection);
assertThat(tableCount).isGreaterThan(30);
verifySchemaMigrations(connection);
}
}
use of org.neo4j.driver.v1.Driver in project sonarqube by SonarSource.
the class EmbeddedDatabase method createDatabase.
private static void createDatabase(File dbHome, String user, String password) throws SQLException {
String url = format("jdbc:h2:%s/sonar;USER=%s;PASSWORD=%s", dbHome.getAbsolutePath(), user, password);
DriverManager.registerDriver(new Driver());
DriverManager.getConnection(url).close();
}
use of org.neo4j.driver.v1.Driver in project sonarqube by SonarSource.
the class EmbeddedDatabaseTest method checkDbIsUp.
private void checkDbIsUp(int port, String user, String password) {
try {
String driverUrl = String.format("jdbc:h2:tcp://localhost:%d/sonar;USER=%s;PASSWORD=%s", port, user, password);
DriverManager.registerDriver(new Driver());
DriverManager.getConnection(driverUrl).close();
} catch (Exception ex) {
fail("Unable to connect after start");
}
}
use of org.neo4j.driver.v1.Driver in project neo4j by neo4j.
the class ProcedureTest method calls_simplistic_procedure.
@Test
public void calls_simplistic_procedure() {
try (Driver driver = GraphDatabase.driver(graphDb.boltURI(), configuration());
Session session = driver.session()) {
StatementResult result = session.run("CALL " + procedureNamespace + ".theAnswer()");
assertThat(result.single().get("value").asLong()).isEqualTo(42L);
}
}
Aggregations