org.testcontainers.containers.Db2Container Java Examples

The following examples show how to use org.testcontainers.containers.Db2Container. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleDb2Test.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void testSimple() throws SQLException {
    try (Db2Container db2 = new Db2Container()
        .acceptLicense()) {

        db2.start();

        ResultSet resultSet = performQuery(db2, "SELECT 1 FROM SYSIBM.SYSDUMMY1");

        int resultSetInt = resultSet.getInt(1);
        assertEquals("A basic SELECT query succeeds", 1, resultSetInt);
    }
}
 
Example #2
Source File: SimpleDb2Test.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void testWithAdditionalUrlParamInJdbcUrl() {
    try (Db2Container db2 = new Db2Container()
        .withUrlParam("sslConnection", "false")
        .acceptLicense()) {

        db2.start();

        String jdbcUrl = db2.getJdbcUrl();
        assertThat(jdbcUrl, containsString(":sslConnection=false;"));
    }
}
 
Example #3
Source File: Db2ServerConfig.java    From ShedLock with Apache License 2.0 4 votes vote down vote up
public void startDb() {
    db2 = new Db2Container()
        .acceptLicense()
        .withLogConsumer(outputFrame -> logger.debug(outputFrame.getUtf8String()));
    db2.start();
}