Maven
Şöyle yaparız
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>1.18.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>11.2.2.jre8</version>
<scope>test</scope>
</dependency>
Örnek
Şöyle yaparız
@Container
private static final MSSQLServerContainer<?> SQLSERVER_CONTAINER =
new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2022-latest").acceptLicense();
acceptLicense metodu
Örnek
Şöyle yaparız
MSQLServerContainer mssqlserver = new MSSQLServerContainer<>(...).acceptLicense();
getDatabaseName metodu
UnsupportedOperationException fırlatıyor. Neden bilmiyorum
withDatabaseName metodu
UnsupportedOperationException fırlatıyor. Neden bilmiyorum
withUrlParam metodu
Örnek
Şöyle yaparız
MSSQLServerContainer<> container = new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2017-CU12"); container.withUrlParam("user", container.getUsername()) .withUrlParam("password", container.getPassword()); container.start(); String jdbcUrl = container.getJdbcUrl();
withStartupCheckStrategy metodu
Şöyle yaparız
new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2017-latest").withStartupCheckStrategy(new MinimumDurationRunningStartupCheckStrategy(Duration.ofSeconds(5)));
No comments:
Post a Comment