@@ -12,14 +12,6 @@ import org.testcontainers.utility.Base58
12
12
13
13
import scala .collection .JavaConverters ._
14
14
15
- sealed trait Services
16
- object Services {
17
- case object All extends Services
18
- final case class Specific (services : Seq [Service ]) extends Services
19
- }
20
-
21
- final case class Service (name : String )
22
-
23
15
object ExposedService {
24
16
def apply (name : String , port : Int , instance : Int , waitStrategy : WaitStrategy ): ExposedService =
25
17
ExposedService (name, port, waitStrategy, Option (instance))
@@ -36,6 +28,14 @@ final case class ServiceLogConsumer(serviceName: String, consumer: Consumer[Outp
36
28
37
29
final case class WaitingForService (serviceName : String , waitStrategy : WaitStrategy )
38
30
31
+ sealed trait Services
32
+ object Services {
33
+ case object All extends Services
34
+ final case class Specific (services : Seq [Service ]) extends Services
35
+ }
36
+
37
+ final case class Service (name : String )
38
+
39
39
object DockerComposeContainer {
40
40
val ID_LENGTH = 6
41
41
@@ -60,10 +60,9 @@ object DockerComposeContainer {
60
60
@ deprecated(" Please use expanded `apply` method" )
61
61
def apply (composeFiles : ComposeFile ,
62
62
exposedService : Map [String , Int ]): DockerComposeContainer =
63
- new DockerComposeContainer (composeFiles, Services . All , exposedService)
63
+ new DockerComposeContainer (composeFiles, exposedService)
64
64
65
65
def apply (composeFiles : ComposeFile ,
66
- services : Services = Services .All ,
67
66
exposedServices : Seq [ExposedService ] = Seq .empty,
68
67
identifier : String = DockerComposeContainer .randomIdentifier,
69
68
scaledServices : Seq [ScaledService ] = Seq .empty,
@@ -72,9 +71,9 @@ object DockerComposeContainer {
72
71
env : Map [String , String ] = Map .empty,
73
72
tailChildContainers : Boolean = false ,
74
73
logConsumers : Seq [ServiceLogConsumer ] = Seq .empty,
75
- waitingFor : Option [WaitingForService ] = None ): DockerComposeContainer =
74
+ waitingFor : Option [WaitingForService ] = None ,
75
+ services : Services = Services .All ): DockerComposeContainer =
76
76
new DockerComposeContainer (composeFiles,
77
- services,
78
77
exposedServices,
79
78
identifier,
80
79
scaledServices,
@@ -83,11 +82,11 @@ object DockerComposeContainer {
83
82
env,
84
83
tailChildContainers,
85
84
logConsumers,
86
- waitingFor)
85
+ waitingFor,
86
+ services)
87
87
88
88
case class Def (
89
89
composeFiles : ComposeFile ,
90
- services : Services = Services .All ,
91
90
exposedServices : Seq [ExposedService ] = Seq .empty,
92
91
identifier : String = DockerComposeContainer .randomIdentifier,
93
92
scaledServices : Seq [ScaledService ] = Seq .empty,
@@ -96,15 +95,15 @@ object DockerComposeContainer {
96
95
env : Map [String , String ] = Map .empty,
97
96
tailChildContainers : Boolean = false ,
98
97
logConsumers : Seq [ServiceLogConsumer ] = Seq .empty,
99
- waitingFor : Option [WaitingForService ] = None
98
+ waitingFor : Option [WaitingForService ] = None ,
99
+ services : Services = Services .All
100
100
) extends ContainerDef {
101
101
102
102
override type Container = DockerComposeContainer
103
103
104
104
override def createContainer (): DockerComposeContainer = {
105
105
DockerComposeContainer (
106
106
composeFiles,
107
- services,
108
107
exposedServices,
109
108
identifier,
110
109
scaledServices,
@@ -113,15 +112,15 @@ object DockerComposeContainer {
113
112
env,
114
113
tailChildContainers,
115
114
logConsumers,
116
- waitingFor
115
+ waitingFor,
116
+ services
117
117
)
118
118
}
119
119
}
120
120
121
121
}
122
122
123
123
class DockerComposeContainer (composeFiles : ComposeFile ,
124
- services : Services = Services .All ,
125
124
exposedServices : Seq [ExposedService ] = Seq .empty,
126
125
identifier : String = DockerComposeContainer .randomIdentifier,
127
126
scaledServices : Seq [ScaledService ] = Seq .empty,
@@ -130,7 +129,8 @@ class DockerComposeContainer(composeFiles: ComposeFile,
130
129
env : Map [String , String ] = Map .empty,
131
130
tailChildContainers : Boolean = false ,
132
131
logConsumers : Seq [ServiceLogConsumer ] = Seq .empty,
133
- waitingFor : Option [WaitingForService ] = None )
132
+ waitingFor : Option [WaitingForService ] = None ,
133
+ services : Services = Services .All )
134
134
extends TestContainerProxy [JavaDockerComposeContainer [_]] {
135
135
136
136
override val container : JavaDockerComposeContainer [_] = {
0 commit comments