How to use testInitScript method of org.testcontainers.containers.PrestoContainerTest class

Best Testcontainers-java code snippet using org.testcontainers.containers.PrestoContainerTest.testInitScript

Source:PrestoContainerTest.java Github

copy

Full Screen

...68 }69 }70 }71 @Test72 public void testInitScript() throws Exception {73 try (PrestoContainer<?> prestoSql = new PrestoContainer<>(PrestoTestImages.PRESTO_TEST_IMAGE)) {74 prestoSql.withInitScript("initial.sql");75 prestoSql.start();76 try (Connection connection = prestoSql.createConnection();77 Statement statement = connection.createStatement();78 ResultSet resultSet = statement.executeQuery("SELECT a FROM memory.default.test_table")) {79 assertTrue("No result", resultSet.next());80 assertEquals("Value", 12345678909324L, resultSet.getObject("a"));81 assertFalse("Too many result", resultSet.next());82 }83 }84 }85 @Test86 public void testTcJdbcUri() throws Exception {...

Full Screen

Full Screen

testInitScript

Using AI Code Generation

copy

Full Screen

1PrestoContainer prestoContainer = new PrestoContainer();2prestoContainer.start();3String jdbcUrl = prestoContainer.getJdbcUrl();4String username = prestoContainer.getUsername();5String password = prestoContainer.getPassword();6try (Connection connection = DriverManager.getConnection(jdbcUrl, username, password)) {7try (Statement statement = connection.createStatement()) {8try (ResultSet resultSet = statement.executeQuery("SELECT 123 x")) {9resultSet.next();10assertEquals(123, resultSet.getInt

Full Screen

Full Screen

testInitScript

Using AI Code Generation

copy

Full Screen

1import org.testcontainers.containers.PrestoContainer2import org.testcontainers.containers.output.Slf4jLogConsumer3import org.testcontainers.containers.wait.strategy.Wait4import org.testcontainers.utility.DockerImageName5import org.testcontainers.containers.PrestoContainerTest6import org.testcontainers.utility.MountableFile7import java.time.Duration8class PrestoTest {9 def "test presto container"() {10 def presto = new PrestoContainer(DockerImageName.parse("prestosql/presto:latest"))11 def logConsumer = new Slf4jLogConsumer(logger)12 presto.withLogConsumer(logConsumer)13 presto.withStartupTimeout(Duration.ofSeconds(120))14 presto.withFileSystemBind("src/test/resources", "/etc/presto", BindMode.READ_ONLY)15 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto/etc", BindMode.READ_ONLY)16 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto/lib", BindMode.READ_ONLY)17 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto/plugin", BindMode.READ_ONLY)18 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto/bin", BindMode.READ_ONLY)19 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto/data", BindMode.READ_ONLY)20 presto.withFileSystemBind("src/test/resources", "/usr/lib/presto", BindMode.READ_ONLY)21 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/node.properties"), "/etc/presto/node.properties")22 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/jvm.config"), "/etc/presto/jvm.config")23 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/config.properties"), "/etc/presto/config.properties")24 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/catalog/jmx.properties"), "/etc/presto/catalog/jmx.properties")25 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/catalog/memory.properties"), "/etc/presto/catalog/memory.properties")26 presto.withCopyFileToContainer(MountableFile.forClasspathResource("etc/catalog/system.properties"), "/etc/presto/catalog/system.properties")

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testcontainers-java automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful