Skip to content

Commit

Permalink
Fix the review content
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzy15 committed Jul 8, 2023
1 parent bd00e74 commit 0d100d1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
public class UniqueDatabase {

private static final String[] CREATE_DATABASE_DDL =
new String[] {"CREATE DATABASE $DBNAME$;", "USE $DBNAME$;"};
new String[] {"CREATE DATABASE IF NOT EXISTS $DBNAME$;", "USE $DBNAME$;"};
private static final Pattern COMMENT_PATTERN = Pattern.compile("^(.*)--.*$");

private final MySqlContainer container;
Expand Down Expand Up @@ -82,6 +82,14 @@ private UniqueDatabase(
this.password = password;
}

public UniqueDatabase(MySqlContainer container, String databaseName) {
this.container = container;
this.databaseName = databaseName;
this.templateName = databaseName;
this.username = container.getUsername();
this.password = container.getPassword();
}

public String getHost() {
return container.getHost();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ public class MongodbCDCIT extends TestSuiteBase implements TestResource {
"https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar";

private final UniqueDatabase inventoryDatabase =
new UniqueDatabase(MYSQL_CONTAINER, MYSQL_DATABASE, "mysqluser", "mysqlpw");
new UniqueDatabase(MYSQL_CONTAINER, MYSQL_DATABASE);

private static MySqlContainer createMySqlContainer() {
MySqlContainer mySqlContainer = new MySqlContainer(MySqlVersion.V8_0);
mySqlContainer.withConfigurationOverride("docker/server-gtids/my.cnf");
mySqlContainer.withSetupSQL("docker/setup.sql");
mySqlContainer.withNetwork(NETWORK);
mySqlContainer.withNetworkAliases(MYSQL_HOST);
mySqlContainer.withDatabaseName(MYSQL_DATABASE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
--

-- ----------------------------------------------------------------------------------------------------------------
-- DATABASE: inventory
-- DATABASE: mongodb_cdc
-- ----------------------------------------------------------------------------------------------------------------
CREATE DATABASE IF NOT EXISTS `mongodb_cdc`;

Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 0d100d1

Please sign in to comment.