-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Valery Kharseko <[email protected]>
- Loading branch information
1 parent
6c4ab89
commit 2050033
Showing
6 changed files
with
262 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/MsSqlTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions Copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2025 3A Systems, LLC. | ||
*/ | ||
package org.opends.server.backends.jdbc; | ||
|
||
import org.testcontainers.containers.JdbcDatabaseContainer; | ||
import org.testcontainers.containers.MSSQLServerContainer; | ||
import org.testng.annotations.Test; | ||
|
||
//docker run --rm --name mssql -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=Passw0rd -p 1433:1433 mcr.microsoft.com/mssql/server:2017-CU12 | ||
|
||
@Test | ||
public class MsSqlTestCase extends TestCase { | ||
|
||
@Override | ||
protected JdbcDatabaseContainer<?> getContainer() { | ||
return new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2019-CU30-ubuntu-20.04") | ||
.withExposedPorts(1433) | ||
.acceptLicense() | ||
.withPassword("Passw0rd"); | ||
|
||
} | ||
|
||
@Override | ||
protected String getContainerDockerCommand() { | ||
return "run before test: docker run --rm --name mssql -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=Passw0rd -p 1433:1433 mcr.microsoft.com/mssql/server:2017-CU12"; | ||
} | ||
|
||
@Override | ||
protected String getBackendId() { | ||
return MsSqlTestCase.class.getSimpleName(); | ||
} | ||
|
||
@Override | ||
protected String getJdbcUrl() { | ||
return "jdbc:sqlserver://localhost:" + ((container==null)?"1433":container.getMappedPort(1433)) + ";encrypt=false;user=sa;password=Passw0rd;"; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/MySqlTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions Copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2025 3A Systems, LLC. | ||
*/ | ||
package org.opends.server.backends.jdbc; | ||
|
||
import org.testcontainers.containers.JdbcDatabaseContainer; | ||
import org.testcontainers.containers.MySQLContainer; | ||
import org.testng.annotations.Test; | ||
|
||
//docker run --rm --name mysql -p 3306:3306 -e MYSQL_DATABASE=database_name -e MYSQL_ROOT_PASSWORD=password mysql:latest | ||
|
||
@Test | ||
public class MySqlTestCase extends TestCase { | ||
|
||
@Override | ||
protected JdbcDatabaseContainer<?> getContainer() { | ||
return new MySQLContainer<>("mysql") | ||
.withExposedPorts(3306) | ||
.withUsername("root") | ||
.withPassword("password") | ||
.withDatabaseName("database_name"); | ||
} | ||
|
||
@Override | ||
protected String getContainerDockerCommand() { | ||
return "run before test: docker run --rm --name mysql -p 3306:3306 -e MYSQL_DATABASE=database_name -e MYSQL_ROOT_PASSWORD=password mysql:latest"; | ||
} | ||
|
||
@Override | ||
protected String getBackendId() { | ||
return MySqlTestCase.class.getSimpleName(); | ||
} | ||
|
||
@Override | ||
protected String getJdbcUrl() { | ||
return "jdbc:mysql://root:password@localhost:" + ((container==null)?"3306":container.getMappedPort(3306)) + "/database_name"; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/OracleTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions Copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2025 3A Systems, LLC. | ||
*/ | ||
package org.opends.server.backends.jdbc; | ||
|
||
import org.testcontainers.containers.JdbcDatabaseContainer; | ||
import org.testcontainers.oracle.OracleContainer; | ||
import org.testng.annotations.Test; | ||
|
||
//docker run --rm --name oracle-db -p 1521:1521 -e APP_USER=opendj -e ORACLE_DATABASE=database_name -e APP_USER_PASSWORD=password gvenzl/oracle-free:23.4-slim-faststart | ||
|
||
@Test | ||
public class OracleTestCase extends TestCase { | ||
|
||
@Override | ||
protected JdbcDatabaseContainer<?> getContainer() { | ||
return new OracleContainer("gvenzl/oracle-free:23.4-slim-faststart") | ||
.withExposedPorts(1521) | ||
.withUsername("opendj") | ||
.withPassword("password") | ||
.withDatabaseName("database_name"); | ||
} | ||
|
||
@Override | ||
protected String getContainerDockerCommand() { | ||
return "run before test: docker run --rm --name oracle-db -p 1521:1521 -e APP_USER=opendj -e ORACLE_DATABASE=database_name -e APP_USER_PASSWORD=password gvenzl/oracle-free:23.4-slim-faststart"; | ||
} | ||
|
||
@Override | ||
protected String getBackendId() { | ||
return OracleTestCase.class.getSimpleName(); | ||
} | ||
|
||
@Override | ||
protected String getJdbcUrl() { | ||
return "jdbc:oracle:thin:opendj/password@localhost: " + ((container==null)?"1521":container.getMappedPort(1521)) + "/database_name"; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/PgSqlTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions Copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2025 3A Systems, LLC. | ||
*/ | ||
package org.opends.server.backends.jdbc; | ||
|
||
import org.testcontainers.containers.JdbcDatabaseContainer; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testng.annotations.Test; | ||
|
||
//docker run --rm -it -p 5432:5432 -e POSTGRES_PASSWORD=password --name postgres postgres | ||
|
||
@Test | ||
public class PgSqlTestCase extends TestCase { | ||
|
||
@Override | ||
protected JdbcDatabaseContainer<?> getContainer() { | ||
return new PostgreSQLContainer<>("postgres:latest") | ||
.withExposedPorts(5432) | ||
.withUsername("postgres") | ||
.withPassword("password") | ||
.withDatabaseName("database_name"); | ||
} | ||
|
||
@Override | ||
protected String getContainerDockerCommand() { | ||
return "run before test: docker run --rm -it -p 5432:5432 -e POSTGRES_DB=database_name -e POSTGRES_PASSWORD=password --name postgres postgres"; | ||
} | ||
|
||
@Override | ||
protected String getBackendId() { | ||
return PgSqlTestCase.class.getSimpleName(); | ||
} | ||
|
||
@Override | ||
protected String getJdbcUrl() { | ||
return "jdbc:postgresql://localhost:"+ ((container==null)?"5432":container.getMappedPort(5432))+"/database_name?user=postgres&password=password"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters