mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-14 06:45:21 +00:00
Moved DbMigrationTest/DbMigrationGenerateTest to ebean-test
This commit is contained in:
1 parent
dac3fbc120
commit
3fc11a6434
15 files changed
+218
-152
No files matched your search
-88
@@ -1,88 +0,0 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
|
||||
/**
|
||||
* This is the Migrationscript generator. It generates 3 migrationscript for the models
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*
|
||||
*/
|
||||
public class DbMigrationDropHistoryTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbMigrationDropHistoryTest.class);
|
||||
|
||||
@Test
|
||||
public void invokeTest() throws IOException {
|
||||
main(null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
logger.info("start");
|
||||
|
||||
DefaultDbMigration migration = new DefaultDbMigration();
|
||||
|
||||
// We use src/test/resources as output directory (so we see in GIT if files will change)
|
||||
|
||||
migration.setPathToResources("src/test/resources");
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName("migrationtest-history");
|
||||
config.loadFromProperties();
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
|
||||
|
||||
config.setPackages(Arrays.asList("misc.migration.history.v1_0"));
|
||||
Database server = DatabaseFactory.create(config);
|
||||
migration.setServer(server);
|
||||
|
||||
// First, we clean up the output-directory
|
||||
assertThat(migration.migrationDirectory().getAbsolutePath()).contains("migrationtest-history");
|
||||
Files.walk(migration.migrationDirectory().toPath())
|
||||
.filter(Files::isRegularFile).map(Path::toFile).forEach(File::delete);
|
||||
|
||||
// then we generate migration scripts for v1_0
|
||||
assertThat(migration.generateMigration()).isEqualTo("1.0__initial");
|
||||
// and we check repeatative calls
|
||||
assertThat(migration.generateMigration()).isNull();
|
||||
|
||||
// and now for v1_1
|
||||
config.setPackages(Arrays.asList("misc.migration.history.v1_1"));
|
||||
server.shutdown();
|
||||
server = DatabaseFactory.create(config);
|
||||
migration.setServer(server);
|
||||
assertThat(migration.generateMigration()).isEqualTo("1.1");
|
||||
assertThat(migration.generateMigration()).isNull(); // subsequent call
|
||||
|
||||
|
||||
List<String> pendingDrops = migration.getPendingDrops();
|
||||
assertThat(pendingDrops).contains("1.1");
|
||||
|
||||
migration.setGeneratePendingDrop("1.1");
|
||||
assertThat(migration.generateMigration()).isEqualTo("1.2__dropsFor_1.1");
|
||||
assertThatThrownBy(()->migration.generateMigration())
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.hasMessageContaining("No 'pendingDrops'"); // subsequent call
|
||||
|
||||
server.shutdown();
|
||||
logger.info("end");
|
||||
}
|
||||
|
||||
}
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* This is the Migrationscript generator. It generates 3 migrationscript for the models
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*
|
||||
*/
|
||||
public class DbMigrationGenerateTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbMigrationGenerateTest.class);
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
run("ebean-ddl-generator/src/test/resources");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invokeTest() throws IOException {
|
||||
run("src/test/resources");
|
||||
}
|
||||
|
||||
public static void run(String pathToResources) throws IOException {
|
||||
logger.info("start current directory: " + new File(".").getAbsolutePath());
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName("migrationtest");
|
||||
config.loadFromProperties();
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getProperties().put("ebean.migrationtest.migration.pathToResources", pathToResources);
|
||||
config.setPackages(Arrays.asList("misc.migration.v1_0"));
|
||||
|
||||
// First, we clean up the output-directory
|
||||
Files.walk(Paths.get(pathToResources, "dbmigration","migrationtest"))
|
||||
.filter(Files::isRegularFile).map(Path::toFile).forEach(File::delete);
|
||||
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
|
||||
// then we generate migration scripts for v1_0
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isEqualTo("1.0__initial");
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isEqualTo("1.0__initial");
|
||||
|
||||
// and we check repeatative calls
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isNull();
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isNull();
|
||||
|
||||
// and now for v1_1
|
||||
config.setPackages(Arrays.asList("misc.migration.v1_1"));
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isEqualTo("1.1,1.2__dropsFor_1.1");
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isEqualTo("1.2");
|
||||
|
||||
// subsequent call
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isNull();
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isNull();
|
||||
|
||||
// and now for v1_2
|
||||
config.setPackages(Arrays.asList("misc.migration.v1_2"));
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isEqualTo("1.3,1.4__dropsFor_1.3");
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isEqualTo("1.4");
|
||||
|
||||
logger.info("end");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import io.localtest.BaseTestCase;
|
||||
import io.ebean.SqlRow;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.localtest.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.Helper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class DbMigrationTest extends BaseTestCase {
|
||||
|
||||
private void runScript(boolean expectErrors, String scriptName) throws IOException {
|
||||
String ddl = Helper.asText(this, "/dbmigration/migrationtest/" + server().platform().name().toLowerCase() + "/" + scriptName);
|
||||
runScript(expectErrors, ddl, scriptName);
|
||||
}
|
||||
|
||||
private void runScript(boolean useAutoCommit, String content, String scriptName) {
|
||||
server().script().runScript(scriptName, content, useAutoCommit);
|
||||
}
|
||||
|
||||
@IgnorePlatform({Platform.ORACLE, Platform.NUODB, Platform.MARIADB})
|
||||
@Test
|
||||
public void testRunMigration() throws IOException {
|
||||
// first clean up previously created objects
|
||||
cleanup("migtest_ckey_assoc",
|
||||
"migtest_ckey_detail",
|
||||
"migtest_ckey_parent",
|
||||
"migtest_e_basic",
|
||||
"migtest_e_enum",
|
||||
"migtest_e_history",
|
||||
"migtest_e_history2",
|
||||
"migtest_e_history3",
|
||||
"migtest_e_history4",
|
||||
"migtest_e_history5",
|
||||
"migtest_e_history6",
|
||||
"migtest_e_ref",
|
||||
"migtest_e_softdelete",
|
||||
"migtest_e_user",
|
||||
"migtest_fk_cascade",
|
||||
"migtest_fk_cascade_one",
|
||||
"migtest_fk_none",
|
||||
"migtest_fk_none_via_join",
|
||||
"migtest_fk_one",
|
||||
"migtest_fk_set_null",
|
||||
"migtest_mtm_c",
|
||||
"migtest_mtm_m",
|
||||
"migtest_mtm_m_phone_numbers",
|
||||
"migtest_mtm_c_migtest_mtm_m",
|
||||
"migtest_mtm_m_migtest_mtm_c",
|
||||
"migtest_oto_child",
|
||||
"migtest_oto_master");
|
||||
|
||||
if (isSqlServer()) { // || isMySql()
|
||||
runScript(false, "I__create_procs.sql");
|
||||
}
|
||||
|
||||
runScript(false, "1.0__initial.sql");
|
||||
|
||||
if (isOracle() || isHana()) {
|
||||
SqlUpdate update = server().sqlUpdate("insert into migtest_e_basic (id, old_boolean, user_id) values (1, :false, 1)");
|
||||
update.setParameter("false", false);
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_basic (id, old_boolean, user_id) values (2, :true, 1)");
|
||||
update.setParameter("true", true);
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
} else {
|
||||
SqlUpdate update = server().sqlUpdate("insert into migtest_e_basic (id, old_boolean, user_id) values (1, :false, 1), (2, :true, 1)");
|
||||
update.setParameter("false", false);
|
||||
update.setParameter("true", true);
|
||||
|
||||
assertThat(server().execute(update)).isEqualTo(2);
|
||||
}
|
||||
|
||||
createHistoryEntities();
|
||||
|
||||
// Run migration
|
||||
runScript(false, "1.1.sql");
|
||||
List<SqlRow> result = server().sqlQuery("select * from migtest_e_basic order by id").findList();
|
||||
assertThat(result).hasSize(2);
|
||||
|
||||
SqlRow row = result.get(0);
|
||||
assertThat(row.keySet()).contains("old_boolean", "old_boolean2");
|
||||
|
||||
assertThat(row.getInteger("id")).isEqualTo(1);
|
||||
assertThat(row.getBoolean("old_boolean")).isFalse();
|
||||
assertThat(row.getBoolean("new_boolean_field")).isFalse(); // test if update old_boolean -> new_boolean_field works well
|
||||
|
||||
assertThat(row.getString("new_string_field")).isEqualTo("foo'bar");
|
||||
assertThat(row.getBoolean("new_boolean_field2")).isTrue();
|
||||
//assertThat(row.getTimestamp("some_date")).isCloseTo(new Date(), 86_000); // allow 1 minute delta
|
||||
|
||||
row = result.get(1);
|
||||
assertThat(row.getInteger("id")).isEqualTo(2);
|
||||
assertThat(row.getBoolean("old_boolean")).isTrue();
|
||||
assertThat(row.getBoolean("new_boolean_field")).isTrue(); // test if update old_boolean -> new_boolean_field works well
|
||||
|
||||
assertThat(row.getString("new_string_field")).isEqualTo("foo'bar");
|
||||
assertThat(row.getBoolean("new_boolean_field2")).isTrue();
|
||||
//assertThat(row.getTimestamp("some_date")).isCloseTo(new Date(), 60_000); // allow 1 minute delta
|
||||
|
||||
runScript(false, "1.2__dropsFor_1.1.sql");
|
||||
|
||||
// Oracle caches the statement and does not detect schema change. It fails with
|
||||
// an ORA-01007
|
||||
if (isOracle() || isDB2()) {
|
||||
result = server().sqlQuery("select * from migtest_e_basic order by id,id").findList();
|
||||
} else {
|
||||
result = server().sqlQuery("select * from migtest_e_basic order by id").findList();
|
||||
}
|
||||
assertThat(result).hasSize(2);
|
||||
row = result.get(0);
|
||||
assertThat(row.keySet()).doesNotContain("old_boolean", "old_boolean2");
|
||||
|
||||
runScript(false, "1.3.sql");
|
||||
runScript(false, "1.4__dropsFor_1.3.sql");
|
||||
|
||||
// now DB structure shoud be the same as v1_0
|
||||
result = server().sqlQuery("select * from migtest_e_basic order by id").findList();
|
||||
assertThat(result).hasSize(2);
|
||||
row = result.get(0);
|
||||
assertThat(row.keySet()).contains("old_boolean", "old_boolean2");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void createHistoryEntities() {
|
||||
SqlUpdate update = server().sqlUpdate("insert into migtest_e_history (id, test_string) values (1, '42')");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history set test_string = '45' where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_history2 (id, test_string, obsolete_string1, obsolete_string2) values (1, 'foo', 'bar', null)");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history2 set test_string = 'baz' where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_history3 (id, test_string) values (1, '42')");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history3 set test_string = '45' where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_history4 (id, test_number) values (1, 42)");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history4 set test_number = 45 where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_history5 (id, test_number) values (1, 42)");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history5 set test_number = 45 where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
update = server().sqlUpdate("insert into migtest_e_history6 (id, test_number1, test_number2) values (1, 2, 7)");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
update = server().sqlUpdate("update migtest_e_history6 set test_number2 = 45 where id = 1");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
}
|
||||
|
||||
private void cleanup(String ... tables) {
|
||||
|
||||
final boolean sqlServer = isSqlServer();
|
||||
final boolean postgres = isPostgres();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String table : tables) {
|
||||
// simple and stupid try to execute all commands on all dialects.
|
||||
if (sqlServer) {
|
||||
sb.append("alter table ").append(table).append(" set ( system_versioning = OFF );\n");
|
||||
sb.append("alter table ").append(table).append(" drop system versioning;\n");
|
||||
}
|
||||
if (postgres) {
|
||||
sb.append("drop table ").append(table).append(" cascade;\n");
|
||||
sb.append("drop table ").append(table).append("_history cascade;\n");
|
||||
} else {
|
||||
sb.append("drop table ").append(table).append(";\n");
|
||||
sb.append("drop table ").append(table).append("_history;\n");
|
||||
}
|
||||
sb.append("drop view ").append(table).append("_with_history;\n");
|
||||
sb.append("drop sequence ").append(table).append("_seq;\n");
|
||||
}
|
||||
System.err.println(sb);
|
||||
runScript(true, sb.toString(), "cleanup");
|
||||
runScript(true, sb.toString(), "cleanup");
|
||||
}
|
||||
}
|
||||
@@ -8,20 +8,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class LastMigrationTest {
|
||||
|
||||
@Test
|
||||
public void lastVersion() {
|
||||
File d = new File("src/test/resources/dbmigration/migrationtest/h2");
|
||||
assertThat(LastMigration.lastVersion(d, null)).isEqualTo("1.4");
|
||||
assertThat(LastMigration.nextVersion(d, null, false)).isEqualTo("1.5");
|
||||
assertThat(LastMigration.nextVersion(d, null, true)).isEqualTo("1.4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lastVersion_no_v_Prefix() {
|
||||
File d = new File("src/test/resources/dbmigration/migrationtest-history");
|
||||
assertThat(LastMigration.lastVersion(d, null)).isEqualTo("1.2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lastVersion_test() {
|
||||
File d = new File("src/test/resources/test-dbmigration");
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Class to test the alternative drop behaviour using stored procedures for MySql databases .
|
||||
*
|
||||
* @author Jonas Pöhler, FOCONIS AG
|
||||
*/
|
||||
public class MysqlGenerateMigrationTest {
|
||||
|
||||
@Test
|
||||
public void testMysqlStoredProcedures() throws Exception {
|
||||
|
||||
|
||||
String pathToResources = "src/test/resources";
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName("migrationtest");
|
||||
config.loadFromProperties();
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getPlatformConfig().setUseMigrationStoredProcedures(true);
|
||||
config.setRunMigration(false);
|
||||
config.getProperties().put("ebean.migrationtest.migration.pathToResources", pathToResources);
|
||||
config.getProperties().put("ebean.migrationtest.migration.platforms", "mysql");
|
||||
config.getProperties().put("ebean.migrationtest.migration.migrationPath", "dbmigration/migrationtest-procedures/");
|
||||
config.getProperties().put("ebean.migrationtest.migration.migrationInitPath", "dbinit/migrationtest-procedures/");
|
||||
config.setPackages(Arrays.asList("misc.migration.mysql_v1_0"));
|
||||
|
||||
// First, we clean up the output-directory
|
||||
Path path = Paths.get(pathToResources , "dbmigration","migrationtest-procedures");
|
||||
Files.walk(path)
|
||||
.filter(Files::isRegularFile).map(Path::toFile).forEach(File::delete);
|
||||
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
|
||||
// then we generate migration scripts for v1_0
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isEqualTo("1.0__initial");
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isEqualTo("1.0__initial");
|
||||
|
||||
|
||||
// and now for v1_1
|
||||
config.setPackages(Arrays.asList("misc.migration.mysql_v1_1"));
|
||||
DatabaseFactory.create(config).shutdown();
|
||||
assertThat(DbMigrationPlugin.getLastMigration()).isEqualTo("1.1,1.2__dropsFor_1.1");
|
||||
assertThat(DbMigrationPlugin.getLastInit()).isEqualTo("1.2");
|
||||
|
||||
final Path sqlFile = path.resolve("mysql/1.2__dropsFor_1.1.sql");
|
||||
|
||||
assertThat(sqlFile).isNotEmptyFile();
|
||||
assertThat(Files.readAllLines(sqlFile, StandardCharsets.UTF_8))
|
||||
.contains("CALL usp_ebean_drop_column('migtest_e_basic', 'status2');")
|
||||
.contains("CALL usp_ebean_drop_column('migtest_e_basic', 'description');");
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import java.sql.Types;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(PlatformCondition.class)
|
||||
public abstract class BaseTestCase {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(BaseTestCase.class);
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package io.localtest;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.localtest.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
|
||||
import org.junit.jupiter.api.extension.ExecutionCondition;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.Optional;
|
||||
|
||||
public class PlatformCondition implements ExecutionCondition {
|
||||
|
||||
private static final ConditionEvaluationResult ENABLED = ConditionEvaluationResult.enabled("ForPlatform is not present");
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||
Optional<AnnotatedElement> element = context.getElement();
|
||||
if (element.isPresent()) {
|
||||
final ForPlatform annotation = element.get().getAnnotation(ForPlatform.class);
|
||||
if (annotation != null && !platformMath(annotation.value())) {
|
||||
return ConditionEvaluationResult.disabled("@ForPlatform");
|
||||
}
|
||||
}
|
||||
return ENABLED;
|
||||
}
|
||||
|
||||
private boolean platformMath(Platform[] platforms) {
|
||||
Platform basePlatform = DB.getDefault().platform().base();
|
||||
for (Platform platform : platforms) {
|
||||
if (platform.equals(basePlatform)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package io.localtest.annotation;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to run a test for a certain platform.
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
@Target(ElementType.METHOD )
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ForPlatform {
|
||||
Platform[] value();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package io.localtest.annotation;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to ignore a test for a certain platform.
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
@Target(ElementType.METHOD )
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface IgnorePlatform {
|
||||
Platform[] value();
|
||||
}
|
||||
@@ -15,36 +15,4 @@ datasource.pg.username=sa
|
||||
datasource.pg.password=
|
||||
datasource.pg.url=jdbc:h2:mem:h2AutoTune
|
||||
|
||||
# parameters for migration test
|
||||
datasource.migrationtest.username=SA
|
||||
datasource.migrationtest.password=SA
|
||||
datasource.migrationtest.url=jdbc:h2:mem:migration;NON_KEYWORDS=KEY,VALUE
|
||||
ebean.migrationtest.applyPrefix=V
|
||||
ebean.migrationtest.ddl.generate=false
|
||||
ebean.migrationtest.ddl.run=false
|
||||
ebean.migrationtest.ddl.header=-- Migrationscripts for ebean unittest
|
||||
ebean.migrationtest.migration.appName=migrationtest
|
||||
ebean.migrationtest.migration.migrationPath=dbmigration/migrationtest
|
||||
ebean.migrationtest.migration.strict=true
|
||||
ebean.migrationtest.migration.generate=true
|
||||
ebean.migrationtest.migration.run=true
|
||||
ebean.migrationtest.migration.includeIndex=true
|
||||
ebean.migrationtest.migration.generateInit=true
|
||||
ebean.migrationtest.migration.generatePendingDrop=auto
|
||||
ebean.migrationtest.migration.platforms=db2luw=db2,h2,hsqldb,mysql,mysql55=mysql55,postgres,oracle,sqlite,sqlserver17=sqlserver17,hana
|
||||
|
||||
# need to generate unique statements to prevent them from being filtered out as duplicates by the DdlRunner
|
||||
ebean.hana.generateUniqueDdl=true
|
||||
|
||||
|
||||
# parameters for migration test
|
||||
datasource.migrationtest-history.username=SA
|
||||
datasource.migrationtest-history.password=SA
|
||||
datasource.migrationtest-history.url=jdbc:h2:mem:migration
|
||||
ebean.migrationtest-history.applyPrefix=V
|
||||
ebean.migrationtest-history.ddl.generate=false
|
||||
ebean.migrationtest-history.ddl.run=false
|
||||
ebean.migrationtest-history.ddl.header=-- Migrationscripts for ebean unittest DbMigrationDropHistoryTest
|
||||
ebean.migrationtest-history.migration.appName=migrationtest-history
|
||||
ebean.migrationtest-history.migration.migrationPath=dbmigration/migrationtest-history
|
||||
ebean.migrationtest-history.migration.strict=true
|
||||
Reference in new issue
Block a user