2
2
3
3
import com .google .common .base .Strings ;
4
4
import org .jetbrains .annotations .NotNull ;
5
- import org .testcontainers .containers .wait .strategy .LogMessageWaitStrategy ;
5
+ import org .testcontainers .containers .wait .strategy .Wait ;
6
+ import org .testcontainers .containers .wait .strategy .WaitAllStrategy ;
7
+ import org .testcontainers .images .builder .Transferable ;
6
8
import org .testcontainers .utility .DockerImageName ;
9
+ import org .testcontainers .utility .MountableFile ;
7
10
8
11
import java .sql .Connection ;
9
12
import java .sql .SQLException ;
10
- import java .time .Duration ;
11
- import java .time .temporal .ChronoUnit ;
12
13
import java .util .Set ;
13
14
14
15
/**
15
- * @deprecated Use {@code TrinoContainer} instead.
16
+ * Testcontainers implementation for Presto.
17
+ * <p>
18
+ * Supported image: {@code prestodb/presto}
19
+ * <p>
20
+ * Exposed ports: 8080
16
21
*/
17
- @ Deprecated
18
22
public class PrestoContainer <SELF extends PrestoContainer <SELF >> extends JdbcDatabaseContainer <SELF > {
19
23
20
24
public static final String NAME = "presto" ;
21
25
22
- private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName .parse ("ghcr.io/trinodb /presto" );
26
+ private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName .parse ("prestodb /presto" );
23
27
24
- public static final String IMAGE = "ghcr.io/trinodb /presto" ;
28
+ public static final String IMAGE = "prestodb /presto" ;
25
29
26
- public static final String DEFAULT_TAG = "344 " ;
30
+ public static final String DEFAULT_TAG = "0.290 " ;
27
31
28
32
public static final Integer PRESTO_PORT = 8080 ;
29
33
@@ -46,13 +50,18 @@ public PrestoContainer(final String dockerImageName) {
46
50
public PrestoContainer (final DockerImageName dockerImageName ) {
47
51
super (dockerImageName );
48
52
dockerImageName .assertCompatibleWith (DEFAULT_IMAGE_NAME );
49
-
50
- this .waitStrategy =
51
- new LogMessageWaitStrategy ()
52
- .withRegEx (".*======== SERVER STARTED ========.*" )
53
- .withStartupTimeout (Duration .of (60 , ChronoUnit .SECONDS ));
54
-
53
+ waitingFor (new WaitAllStrategy ()
54
+ .withStrategy (Wait .forHttp ("/v1/info/state" ).forPort (8080 ).forResponsePredicate ("\" ACTIVE\" " ::equals ))
55
+ .withStrategy (new PrestoWaitStrategy (this )));
55
56
addExposedPort (PRESTO_PORT );
57
+ withCopyFileToContainer (
58
+ MountableFile .forClasspathResource ("default/catalog" , Transferable .DEFAULT_DIR_MODE ),
59
+ "/opt/presto-server/etc/catalog"
60
+ );
61
+ withCopyFileToContainer (
62
+ MountableFile .forClasspathResource ("default/config.properties" , Transferable .DEFAULT_DIR_MODE ),
63
+ "/opt/presto-server/etc/config.properties"
64
+ );
56
65
}
57
66
58
67
/**
@@ -68,7 +77,7 @@ protected Set<Integer> getLivenessCheckPorts() {
68
77
69
78
@ Override
70
79
public String getDriverClassName () {
71
- return "io.prestosql .jdbc.PrestoDriver" ;
80
+ return "com.facebook.presto .jdbc.PrestoDriver" ;
72
81
}
73
82
74
83
@ Override
0 commit comments