-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
2,572 additions
and
2,226 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package mondrian.junit5; | ||
|
||
public interface DataLoader { | ||
/** | ||
* @param jdbcConnectionUrl - jdbcConnectionUrl | ||
* @return jdbc connection String | ||
*/ | ||
boolean loadDataData(String jdbcConnectionUrl); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
mondrian/src/test/java/mondrian/junit5/DatabaseHandler.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,15 @@ | ||
package mondrian.junit5; | ||
|
||
import java.io.Closeable; | ||
import java.util.Map; | ||
|
||
public interface DatabaseHandler extends Closeable { | ||
|
||
/** | ||
* | ||
* @param props - properties | ||
* @return jdbc connection String | ||
*/ | ||
String setUpDatabase(Map<String,Object> props); | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
mondrian/src/test/java/mondrian/junit5/FoodmardDataLoader.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,24 @@ | ||
package mondrian.junit5; | ||
|
||
import mondrian.test.loader.MondrianFoodMartLoaderX; | ||
|
||
public class FoodmardDataLoader implements DataLoader{ | ||
|
||
@Override | ||
public boolean loadDataData(String jdbcUrl) { | ||
String[] args=new String[]{ | ||
"-verbose", | ||
"-tables", | ||
"-data", | ||
"-indexes", | ||
"-outputJdbcURL="+jdbcUrl, | ||
// "-outputJdbcUser="+mySQLContainer.getUsername(), | ||
// "-outputJdbcPassword="+mySQLContainer.getPassword(), | ||
"-outputJdbcBatchSize=50", | ||
"-jdbcDrivers=com.mysql.cl.jdbc.Driver" | ||
}; | ||
MondrianFoodMartLoaderX.main(args); | ||
return true; | ||
} | ||
|
||
} |
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
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
45 changes: 45 additions & 0 deletions
45
mondrian/src/test/java/mondrian/junit5/MySQLDatabaseHandler.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,45 @@ | ||
package mondrian.junit5; | ||
|
||
import java.io.IOException; | ||
import java.sql.DriverManager; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
import java.util.function.Consumer; | ||
|
||
import org.testcontainers.containers.MySQLContainer; | ||
import org.testcontainers.containers.output.OutputFrame; | ||
|
||
public class MySQLDatabaseHandler implements DatabaseHandler { | ||
|
||
private static MySQLContainer<?> mySQLContainer; | ||
static Consumer<OutputFrame> x = t -> System.out.println(t.getUtf8String()); | ||
|
||
@Override | ||
public void close() throws IOException { | ||
if (mySQLContainer != null) { | ||
mySQLContainer.stop(); | ||
mySQLContainer.close(); | ||
} | ||
} | ||
|
||
@Override | ||
public String setUpDatabase(Map<String, Object> props) { | ||
String user=props.getOrDefault("username", UUID.randomUUID().toString().replace("-","")).toString(); | ||
String pass=props.getOrDefault("password", UUID.randomUUID().toString().replace("-","")).toString(); | ||
|
||
|
||
mySQLContainer = new MySQLContainer<>("mysql:5.7.34").withDatabaseName(user).withUsername(pass) | ||
.withPassword("pass").withEnv("MYSQL_ROOT_HOST", "%").withLogConsumer(x); | ||
|
||
mySQLContainer.start(); | ||
|
||
return mySQLContainer.getJdbcUrl()+"?user="+user+"&password="+pass; | ||
// Connection con = DriverManager.getConnection(url, "user", "pass"); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
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
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
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
2,262 changes: 2,262 additions & 0 deletions
2,262
mondrian/src/test/java/mondrian/test/FoodmartTestContextImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
2,354 changes: 197 additions & 2,157 deletions
2,354
mondrian/src/test/java/mondrian/test/TestContext.java
Large diffs are not rendered by default.
Oops, something went wrong.