mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Update DbMigrationTest to include platform for some asserts
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.SqlRow;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.*;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.dbplatform.DbHistorySupport;
|
||||
import io.ebean.datasource.pool.ConnectionPool;
|
||||
import misc.migration.v1_1.EHistory;
|
||||
import misc.migration.v1_1.EHistory2;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -28,12 +20,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* This testcase tries to apply the migrationtests that are genearated by {@link DbMigrationGenerateTest}.
|
||||
*
|
||||
*
|
||||
* It does also some basic checks, if the migration is applied correctly.
|
||||
*
|
||||
*
|
||||
* Please note, that this test requires the scripts generated by DbMigrationGenerateTest. So you may have to execute this test
|
||||
* first.
|
||||
*
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*
|
||||
*/
|
||||
@@ -87,7 +79,7 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
"migtest_oto_master");
|
||||
((ConnectionPool)server().dataSource()).offline();
|
||||
((ConnectionPool)server().dataSource()).online();
|
||||
|
||||
|
||||
if (isSqlServer() || isMariaDB() || isMySql() || isHana()) {
|
||||
runScript("I__create_procs.sql");
|
||||
}
|
||||
@@ -212,7 +204,8 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
List<Version<EHistory>> versions = tmpServer.find(EHistory.class).setId(hist.getId())
|
||||
.findVersionsBetween(Timestamp.valueOf("1970-01-01 00:00:00"), Timestamp.valueOf("2100-01-01 00:00:00"));
|
||||
assertThat(versions).hasSize(2);
|
||||
assertThat(versions.get(0).getDiff().toString()).isEqualTo("{testString=45,42}");
|
||||
assertThat(versions.get(0).getDiff().toString()).as("using platform: %s", server().platform())
|
||||
.isEqualTo("{testString=45,42}");
|
||||
|
||||
EHistory2 hist2 = new misc.migration.v1_1.EHistory2();
|
||||
hist2.setId(2);
|
||||
@@ -235,7 +228,7 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
case SQLSERVER17: // these DBs are 'standard based' so they also do not support HistoryExclude
|
||||
case MARIADB:
|
||||
case HANA:
|
||||
assertThat(versions2.get(0).getDiff().toString())
|
||||
assertThat(versions2.get(0).getDiff().toString()).as("using platform: %s", server().platform())
|
||||
.contains("testString=foo2,foo1")
|
||||
.contains("testString2=bar2,bar1");
|
||||
break;
|
||||
@@ -243,7 +236,7 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
case MYSQL:
|
||||
case POSTGRES:
|
||||
case YUGABYTE:
|
||||
assertThat(versions2.get(0).getDiff().toString())
|
||||
assertThat(versions2.get(0).getDiff().toString()).as("using platform: %s", server().platform())
|
||||
.contains("testString=foo2,foo1")
|
||||
.contains("testString2=bar2,null");
|
||||
break;
|
||||
@@ -256,9 +249,6 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void createHistoryEntities() {
|
||||
SqlUpdate update = server().sqlUpdate("insert into migtest_e_history (id, test_string) values (1, '42')");
|
||||
assertThat(server().execute(update)).isEqualTo(1);
|
||||
|
||||
Reference in New Issue
Block a user