File tree Expand file tree Collapse file tree 4 files changed +99
-0
lines changed
main/java/org/testcontainers/containers
test/java/org/testcontainers/containers Expand file tree Collapse file tree 4 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .testcontainers .containers ;
2+
3+ import org .testcontainers .containers .wait .strategy .Wait ;
4+ import org .testcontainers .utility .DockerImageName ;
5+
6+ public class ServicebusEmulatorContainer extends GenericContainer <ServicebusEmulatorContainer > {
7+ private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName .parse (
8+ "mcr.microsoft.com/azure-messaging/servicebus-emulator"
9+ );
10+
11+ private static final int PORT = 1433 ;
12+
13+ /**
14+ * @param dockerImageName specified docker image name to run
15+ */
16+ public ServicebusEmulatorContainer (final DockerImageName dockerImageName ) {
17+ super (dockerImageName );
18+ dockerImageName .assertCompatibleWith (DEFAULT_IMAGE_NAME );
19+ withExposedPorts (PORT );
20+ waitingFor (Wait .forLogMessage (".*Emulator Service is Successfully Up!\\ r\\ n$" , 1 ));
21+ Network network = Network .newNetwork ();
22+ withNetwork (network );
23+ withNetworkAliases ("sb-emulator" );
24+ dependsOn (
25+ new SqlEdgeContainer (DockerImageName .parse ("mcr.microsoft.com/azure-sql-edge:latest" ))
26+ .withNetwork (network )
27+ .withNetworkAliases ("sqledge" )
28+ );
29+ addEnv ("ACCEPT_EULA" , "Y" );
30+ addEnv ("CONFIG_PATH" , "/home/marv/Downloads/asb/config.json" );
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package org .testcontainers .containers ;
2+
3+ import org .testcontainers .containers .wait .strategy .Wait ;
4+ import org .testcontainers .utility .DockerImageName ;
5+
6+ /**
7+ * Testcontainers implementation for Sql Edge.
8+ * <p>
9+ * Supported image: {@code mcr.microsoft.com/azure-sql-edge}
10+ * <p>
11+ * Exposed ports: 1433
12+ */
13+ public class SqlEdgeContainer extends GenericContainer <SqlEdgeContainer > {
14+ private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName .parse (
15+ "mcr.microsoft.com/azure-sql-edge"
16+ );
17+
18+ private static final int PORT = 1433 ;
19+
20+ /**
21+ * @param dockerImageName specified docker image name to run
22+ */
23+ public SqlEdgeContainer (final DockerImageName dockerImageName ) {
24+ super (dockerImageName );
25+ dockerImageName .assertCompatibleWith (DEFAULT_IMAGE_NAME );
26+ withExposedPorts (PORT );
27+ waitingFor (Wait .forLogMessage (".*Service Broker manager has started.\\ r\\ n$" , 1 ));
28+ addEnv ("ACCEPT_EULA" , "Y" );
29+ addEnv ("MSSQL_SA_PASSWORD" , "J3R4uUWLTjDqTXoQnvXu" );
30+ }
31+
32+ }
Original file line number Diff line number Diff line change 1+ package org .testcontainers .containers ;
2+
3+ import org .junit .Rule ;
4+ import org .junit .Test ;
5+ import org .testcontainers .utility .DockerImageName ;
6+
7+ public class ServicebusEmulatorContainerTest {
8+ @ Rule
9+ public ServicebusEmulatorContainer servicebusEmulatorContainer = new ServicebusEmulatorContainer (
10+ DockerImageName .parse ("mcr.microsoft.com/azure-messaging/servicebus-emulator" )
11+ );
12+
13+ @ Test
14+ public void testWIthASBClient () {
15+ String containerId = servicebusEmulatorContainer .getContainerId ();
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ package org .testcontainers .containers ;
2+
3+
4+ import org .junit .Rule ;
5+ import org .junit .Test ;
6+ import org .testcontainers .utility .DockerImageName ;
7+
8+ public class SqlEdgeContainerTest {
9+ @ Rule
10+ public SqlEdgeContainer sqlEdgeContainer = new SqlEdgeContainer (
11+ DockerImageName .parse ("mcr.microsoft.com/azure-sql-edge:latest" )
12+ );
13+
14+ @ Test
15+ public void testWithJdbc () {
16+ String host = sqlEdgeContainer .getHost ();
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments