Files
ebean/src/test/java/io/ebeaninternal/api/PlatformMatchTest.java
T
Rob BygraveandGitHub 2314fd267f Split Postgres platform into Postgres10 & Postgres9 (DDL - generated by default as identity) (#1921)
* Split Postgres platform into Postgres10 & Postgres9

- Use "generated by default as identity" for Postgres10 identity columns

* Add postgres9 migrationtest resources

* Set default back to h2

* Add postgres10 migration test resources
2020-02-22 09:18:05 +13:00

50 lines
1.9 KiB
Java

package io.ebeaninternal.api;
import io.ebean.annotation.Platform;
import org.junit.Test;
import static org.junit.Assert.*;
public class PlatformMatchTest {
@Test
public void match() {
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "h2"));
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "mysql,h2"));
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "mysql,h2,"));
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "mysql , h2 ,"));
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "mysql , h2, oracle"));
assertTrue(PlatformMatch.matchPlatform(Platform.H2, "mysql , h2, oracle"));
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER, "sqlserver"));
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER17, "sqlserver"));
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER16, "sqlserver"));
assertTrue(PlatformMatch.matchPlatform(Platform.POSTGRES, "postgres"));
assertTrue(PlatformMatch.matchPlatform(Platform.POSTGRES9, "postgres"));
assertTrue(PlatformMatch.matchPlatform(Platform.POSTGRES10, "postgres"));
}
@Test
public void match_sqlserver17_matchAlsoToGenericName() {
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER17, "sqlserver"));
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER17, "sqlserver17"));
}
@Test
public void matchPlatform_sqlserver16_matchAlsoToGenericName() {
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER16, "sqlserver"));
assertTrue(PlatformMatch.matchPlatform(Platform.SQLSERVER16, "sqlserver16"));
}
@Test
public void matchPlatform_sqlserver_nonMatch() {
assertFalse(PlatformMatch.matchPlatform(Platform.SQLSERVER16, "sqlserver17"));
assertFalse(PlatformMatch.matchPlatform(Platform.SQLSERVER17, "sqlserver16"));
assertFalse(PlatformMatch.matchPlatform(Platform.SQLSERVER, "sqlserver16"));
assertFalse(PlatformMatch.matchPlatform(Platform.SQLSERVER, "sqlserver17"));
}
}