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

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

Source:PrestoContainerTest.java Github

copy

Full Screen

...20 * @author findepi21 */22public class PrestoContainerTest {23 @Test24 public void testSimple() throws Exception {25 try (PrestoContainer<?> prestoSql = new PrestoContainer<>(PrestoTestImages.PRESTO_TEST_IMAGE)) {26 prestoSql.start();27 try (Connection connection = prestoSql.createConnection();28 Statement statement = connection.createStatement();29 ResultSet resultSet = statement.executeQuery("SELECT DISTINCT node_version FROM system.runtime.nodes")) {30 assertTrue("No result", resultSet.next());31 assertEquals("Presto version", PrestoContainer.DEFAULT_TAG, resultSet.getString("node_version"));32 }33 }34 }35 @Test36 public void testSpecificVersion() throws Exception {37 try (PrestoContainer<?> prestoSql = new PrestoContainer<>(PrestoTestImages.PRESTO_PREVIOUS_VERSION_TEST_IMAGE)) {38 prestoSql.start();...

Full Screen

Full Screen

testSimple

Using AI Code Generation

copy

Full Screen

1import org.testcontainers.containers.PrestoContainer2import org.testcontainers.utility.DockerImageName3PrestoContainer presto = new PrestoContainer(DockerImageName.parse("prestosql/presto:latest"))4presto.start()5presto.testSimple()6presto.stop()7presto.withCommand("bash", "-c", "echo 'test' > /tmp/test.txt")8presto.start()9presto.testSimple()10presto.stop()11The first call to testSimple() will succeed, but the second call will fail with the following error:12at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:503)13at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:318)14at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)15at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:316)16at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:298)17at org.testcontainers.containers.PrestoContainerTest.testSimple(PrestoContainerTest.java:22)18at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)19at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)20at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)21at java.base/java.lang.reflect.Method.invoke(Method.java:566)22at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)23at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)24at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)25at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)26at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)27at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)28at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)29at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)

Full Screen

Full Screen

testSimple

Using AI Code Generation

copy

Full Screen

1@DisplayName("Simple Presto test")2public void testSimple() throws Exception {3 try (PrestoContainer<?> presto = new PrestoContainer<>()) {4 presto.start();5 try (Connection connection = DriverManager.getConnection(presto.getJdbcUrl())) {6 try (Statement statement = connection.createStatement()) {7 try (ResultSet resultSet = statement.executeQuery("SELECT 123 x")) {8 assertTrue(resultSet.next());9 assertEquals(resultSet.getInt("x"), 123);10 assertFalse(resultSet.next());11 }12 }13 }14 }15}16dependencies {17}

Full Screen

Full Screen

testSimple

Using AI Code Generation

copy

Full Screen

1import org.testcontainers.containers.PrestoContainer;2import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy;3import org.testcontainers.utility.DockerImageName;4import org.testcontainers.utility.MountableFile;5import org.testcontainers.utility.TestEnvironment;6import org.testng.annotations.Test;7import java.io.IOException;8import java.sql.Connection;9import java.sql.DriverManager;10import java.sql.SQLException;11import java.sql.Statement;12import java.util.Collections;13import java.util.List;14import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals;15import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;16public class PrestoContainerTest {17 public void testSimple() throws SQLException, IOException {18 try (PrestoContainer presto = new PrestoContainer(DockerImageName.parse("prestosql/presto:0.187"))) {19 presto.start();20 try (Connection connection = DriverManager.getConnection(presto.getJdbcUrl(), "test", null)) {21 try (Statement statement = connection.createStatement()) {22 statement.execute("CREATE TABLE test (id bigint, name varchar(100))");23 statement.execute("INSERT INTO test VALUES (1, 'test')");24 }25 }26 }27 }28 public void testWithConnector() throws SQLException, IOException {29 try (PrestoContainer presto = new PrestoContainer(DockerImageName.parse("prestosql/presto:0.187"))) {30 MountableFile plugin = MountableFile.forClasspathResource("/presto-example-http-0.187-SNAPSHOT.zip");31 presto.withPlugin(plugin);32 presto.start();33 try (Connection connection = DriverManager.getConnection(p

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