mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Junit5 bump - ebean-ddl-generator, autotune and api
This commit is contained in:
+2
-2
@@ -105,9 +105,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.autotune.service;
|
||||
|
||||
import io.ebeaninternal.server.autotune.model.Autotune;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.bean.ObjectGraphNode;
|
||||
import io.ebean.bean.ObjectGraphOrigin;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.autofetch.BaseTestCase;
|
||||
import org.tests.model.basic.Order;
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -12,12 +12,8 @@ import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.expression.platform.DbExpressionHandler;
|
||||
import io.ebeaninternal.server.expression.platform.DbExpressionHandlerFactory;
|
||||
import io.ebeaninternal.server.transaction.TransactionScopeManager;
|
||||
import org.assertj.core.api.AbstractCharSequenceAssert;
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -26,25 +22,24 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@RunWith(ConditionalTestRunner.class)
|
||||
@ExtendWith(PlatformCondition.class)
|
||||
public abstract class BaseTestCase {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(BaseTestCase.class);
|
||||
|
||||
@Rule public TestName name = new TestName();
|
||||
|
||||
@After
|
||||
public void checkForLeak() {
|
||||
TransactionScopeManager scope = spiEbeanServer().getTransactionManager().scope();
|
||||
SpiTransaction trans = scope.getInScope();
|
||||
if (trans != null) {
|
||||
String msg = getClass().getSimpleName() + "." + name.getMethodName() + " did not clear threadScope:" + trans;
|
||||
scope.clearExternal(); // clear for next test
|
||||
fail(msg);
|
||||
}
|
||||
}
|
||||
// @Rule public TestName name = new TestName();
|
||||
//
|
||||
// @After
|
||||
// public void checkForLeak() {
|
||||
// TransactionScopeManager scope = spiEbeanServer().getTransactionManager().scope();
|
||||
// SpiTransaction trans = scope.getInScope();
|
||||
// if (trans != null) {
|
||||
// String msg = getClass().getSimpleName() + "." + name.getMethodName() + " did not clear threadScope:" + trans;
|
||||
// scope.clearExternal(); // clear for next test
|
||||
// fail(msg);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.junit.runner.notification.RunNotifier;
|
||||
import org.junit.runners.BlockJUnit4ClassRunner;
|
||||
import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.InitializationError;
|
||||
|
||||
/**
|
||||
* This testrunner checks for an {@link IgnorePlatform} annotation and ignores the test.
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public class ConditionalTestRunner extends BlockJUnit4ClassRunner {
|
||||
public ConditionalTestRunner(Class<?> klass) throws InitializationError {
|
||||
super(klass);
|
||||
}
|
||||
@Override
|
||||
public void runChild(FrameworkMethod method, RunNotifier notifier) {
|
||||
ForPlatform forPlatform = method.getAnnotation(ForPlatform.class);
|
||||
if (forPlatform != null) {
|
||||
if (!platformMath(forPlatform.value())) {
|
||||
notifier.fireTestIgnored(describeChild(method));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IgnorePlatform ignore = method.getAnnotation(IgnorePlatform.class);
|
||||
|
||||
if (ignore == null || !platformMath(ignore.value())) {
|
||||
super.runChild(method, notifier);
|
||||
} else {
|
||||
notifier.fireTestIgnored(describeChild(method));
|
||||
}
|
||||
|
||||
}
|
||||
private boolean platformMath(Platform[] platforms) {
|
||||
Platform basePlatform = DB.getDefault().platform().base();
|
||||
for (Platform platform : platforms) {
|
||||
if (platform.equals(basePlatform)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.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;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -2,16 +2,19 @@ package io.ebean.dbmigration;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebeaninternal.api.DbOffline;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class DbMigrationSqlServerTest {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test
|
||||
public void need_explicitPlatform() {
|
||||
|
||||
try {
|
||||
DbMigration dbMigration = DbMigration.create();
|
||||
dbMigration.setPlatform(Platform.SQLSERVER);
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> dbMigration.setPlatform(Platform.SQLSERVER));
|
||||
} finally {
|
||||
DbOffline.reset();
|
||||
}
|
||||
@@ -19,7 +22,6 @@ public class DbMigrationSqlServerTest {
|
||||
|
||||
@Test
|
||||
public void explicit_16_isGood() {
|
||||
|
||||
DbMigration dbMigration = DbMigration.create();
|
||||
dbMigration.setPlatform(Platform.SQLSERVER16);
|
||||
DbOffline.reset();
|
||||
@@ -27,7 +29,6 @@ public class DbMigrationSqlServerTest {
|
||||
|
||||
@Test
|
||||
public void explicit_17_isGood() {
|
||||
|
||||
DbMigration dbMigration = DbMigration.create();
|
||||
dbMigration.setPlatform(Platform.SQLSERVER17);
|
||||
DbOffline.reset();
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.SqlUpdate;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.Helper;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DefaultDbMigrationTest {
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.config.dbplatform.h2.H2Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.hana.HanaPlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.h2.H2Platform;
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration;
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+4
-4
@@ -11,8 +11,8 @@ import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.dbmigration.migration.ChangeSet;
|
||||
import io.ebeaninternal.dbmigration.model.CurrentModel;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -223,7 +223,7 @@ public class BaseDdlHandlerTest extends BaseTestCase {
|
||||
assertThat(write.dropAll().getBuffer()).isEqualTo(rollbackLast);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Disabled
|
||||
@Test
|
||||
public void generateChangeSetFromModel() throws Exception {
|
||||
|
||||
@@ -243,7 +243,7 @@ public class BaseDdlHandlerTest extends BaseTestCase {
|
||||
assertThat(write.dropAll().getBuffer()).isEqualTo(rollbackLast);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Disabled
|
||||
@Test
|
||||
public void generateChangeSetFromModel_given_postgresTypes() throws Exception {
|
||||
|
||||
|
||||
+2
-2
@@ -13,13 +13,13 @@ import io.ebeaninternal.dbmigration.migration.AlterColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.Column;
|
||||
import io.ebeaninternal.dbmigration.migration.CreateTable;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
public class BaseTableDdlTest {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import io.ebean.config.DbConstraintNormalise;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import io.ebeaninternal.dbmigration.model.MConfiguration;
|
||||
import io.ebeaninternal.dbmigration.model.ModelContainer;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
import io.ebean.config.dbplatform.hana.HanaPlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.DdlWrite;
|
||||
import io.ebeaninternal.dbmigration.migration.Column;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class HanaDdlTest {
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.util.IndexSet;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
public class IndexSetTest {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import io.ebean.annotation.ConstraintMode;
|
||||
import io.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+4
-4
@@ -14,14 +14,14 @@ import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.migration.AlterColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.AlterForeignKey;
|
||||
import io.ebeaninternal.dbmigration.migration.Column;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class PlatformDdl_AlterColumnTest {
|
||||
|
||||
|
||||
+2
-2
@@ -10,10 +10,10 @@ import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import io.ebeaninternal.dbmigration.migration.CreateIndex;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class PlatformDdl_CreateIndexTest {
|
||||
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import io.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.PlatformDdlBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class PlatformDdl_dropUniqueConstraintTest {
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import io.ebean.config.dbplatform.DbPlatformTypeMapping;
|
||||
import io.ebean.config.dbplatform.h2.H2Platform;
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.platform.util.PlatformTypeConverter;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package io.ebeaninternal.dbmigration.ddlgeneration.platform.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class VowelRemoverTest {
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.dbmigration.migrationreader;
|
||||
|
||||
import io.ebeaninternal.dbmigration.migration.Migration;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.dbmigration.model;
|
||||
import io.ebean.migration.MigrationVersion;
|
||||
import io.ebeaninternal.dbmigration.migration.ChangeSet;
|
||||
import io.ebeaninternal.dbmigration.migration.DropColumn;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.dbmigration.model;
|
||||
|
||||
import io.ebeaninternal.dbmigration.migration.AlterColumn;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+3
-2
@@ -6,11 +6,12 @@ import io.ebeaninternal.dbmigration.migration.CreateTable;
|
||||
import io.ebeaninternal.dbmigration.migration.IdentityType;
|
||||
import io.ebeaninternal.server.deploy.IdentityMode;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployIdentityMode;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
public class MTableIdentityTest {
|
||||
|
||||
|
||||
+7
-9
@@ -6,13 +6,12 @@ import io.ebeaninternal.dbmigration.migration.AlterColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.DropColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.DropHistoryTable;
|
||||
import io.ebeaninternal.dbmigration.migration.DropTable;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class MTableTest {
|
||||
|
||||
@@ -155,27 +154,26 @@ public class MTableTest {
|
||||
assertThat(base.getColumn("name")).isNull();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test
|
||||
public void test_apply_dropColumn_doesNotExist() {
|
||||
|
||||
MTable base = base();
|
||||
|
||||
DropColumn dropColumn = new DropColumn();
|
||||
dropColumn.setTableName(base.getName());
|
||||
dropColumn.setColumnName("DoesNotExist");
|
||||
base.apply(dropColumn);
|
||||
assertThrows(IllegalStateException.class, () -> base.apply(dropColumn));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test
|
||||
public void test_apply_alterColumn_doesNotExist() {
|
||||
|
||||
MTable base = base();
|
||||
|
||||
AlterColumn alterColumn = new AlterColumn();
|
||||
alterColumn.setTableName(base.getName());
|
||||
alterColumn.setColumnName("DoesNotExist");
|
||||
alterColumn.setType("integer");
|
||||
base.apply(alterColumn);
|
||||
|
||||
assertThrows(IllegalStateException.class, () -> base.apply(alterColumn));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.model;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import io.ebean.migration.MigrationVersion;
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import io.ebeaninternal.dbmigration.migration.CreateTable;
|
||||
import io.ebeaninternal.dbmigration.migration.DropColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.Migration;
|
||||
import io.ebeaninternal.dbmigration.migrationreader.MigrationXmlReader;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import io.ebeaninternal.dbmigration.migration.DropIndex;
|
||||
import io.ebeaninternal.dbmigration.migration.DropTable;
|
||||
import io.ebeaninternal.dbmigration.migration.Migration;
|
||||
import io.ebeaninternal.dbmigration.migrationreader.MigrationXmlReader;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -158,7 +158,7 @@ public class ModelContainerTest {
|
||||
public void apply_renameColumn() {
|
||||
ModelContainer container = new ModelContainer();
|
||||
container.apply(mig("6.0__renameColumn.model.xml"), ver("6.0"));
|
||||
|
||||
|
||||
final MTable table = container.getTable("document");
|
||||
assertThat(table.getColumn("title")).isNotNull();
|
||||
assertThat(table.getColumn("short_title")).isNull();
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.dbmigration.model;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
+23
-27
@@ -4,29 +4,29 @@ import io.ebean.migration.MigrationVersion;
|
||||
import io.ebeaninternal.dbmigration.migration.ChangeSet;
|
||||
import io.ebeaninternal.dbmigration.migration.DropColumn;
|
||||
import io.ebeaninternal.dbmigration.migration.Migration;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
|
||||
public class PendingDropsTest {
|
||||
|
||||
static final MigrationVersion V1_1 = MigrationVersion.parse("1.1");
|
||||
|
||||
static final MigrationVersion V1_2 = MigrationVersion.parse("1.2");
|
||||
|
||||
@Test
|
||||
public void test_add() throws Exception {
|
||||
public void test_add() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
pendingDrops.add(V1_1, new ChangeSet());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_appliedDropsFor_when_matchesSome_then_removesMatched() throws Exception {
|
||||
public void test_appliedDropsFor_when_matchesSome_then_removesMatched() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_appliedDropsFor_when_matchesAll_then_removesChangeSet() throws Exception {
|
||||
public void test_appliedDropsFor_when_matchesAll_then_removesChangeSet() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_appliedDropsFor_when_changeSetSuppressed_isIgnored() throws Exception {
|
||||
public void test_appliedDropsFor_when_changeSetSuppressed_isIgnored() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
|
||||
@@ -81,7 +81,7 @@ public class PendingDropsTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void test_pendingDrops() throws Exception {
|
||||
public void test_pendingDrops() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
assertThat(pendingDrops.pendingDrops()).isEmpty();
|
||||
@@ -92,7 +92,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_pendingDrops_when_suppressForever() throws Exception {
|
||||
public void test_pendingDrops_when_suppressForever() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
assertThat(pendingDrops.pendingDrops()).isEmpty();
|
||||
@@ -105,7 +105,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_pendingDrops_when_both() throws Exception {
|
||||
public void test_pendingDrops_when_both() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
assertThat(pendingDrops.pendingDrops()).isEmpty();
|
||||
@@ -119,7 +119,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion() throws Exception {
|
||||
public void test_migrationForVersion() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
|
||||
@@ -137,7 +137,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion_when_both() throws Exception {
|
||||
public void test_migrationForVersion_when_both() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
|
||||
@@ -153,7 +153,7 @@ public class PendingDropsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion_when_next() throws Exception {
|
||||
public void test_migrationForVersion_when_next() {
|
||||
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
MigrationVersion version = V1_1;
|
||||
@@ -168,32 +168,28 @@ public class PendingDropsTest {
|
||||
assertThat(pendingDrops.testContainsEntryFor(version)).isTrue();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void test_migrationForVersion_when_next_isSuppressForever() throws Exception {
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion_when_next_isSuppressForever() {
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
pendingDrops.add(V1_1, newSuppressForeverChangeSet());
|
||||
pendingDrops.migrationForVersion("next");
|
||||
assertThrows(IllegalArgumentException.class, () -> pendingDrops.migrationForVersion("next"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void test_migrationForVersion_when_doesNotExist() throws Exception {
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion_when_doesNotExist() {
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
pendingDrops.migrationForVersion("1_1");
|
||||
assertThrows(IllegalArgumentException.class, () -> pendingDrops.migrationForVersion("1_1"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void test_migrationForVersion_when_next_doesNotExist() throws Exception {
|
||||
|
||||
@Test
|
||||
public void test_migrationForVersion_when_next_doesNotExist(){
|
||||
PendingDrops pendingDrops = new PendingDrops();
|
||||
pendingDrops.migrationForVersion("next");
|
||||
assertThrows(IllegalArgumentException.class, () -> pendingDrops.migrationForVersion("next"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test_registerPendingHistoryDropColumns() throws Exception {
|
||||
|
||||
public void test_registerPendingHistoryDropColumns() {
|
||||
TDModelContainer modelContainer = new TDModelContainer();
|
||||
|
||||
DropColumn drop1 = col("one");
|
||||
@@ -210,7 +206,7 @@ public class PendingDropsTest {
|
||||
assertThat(modelContainer.drops).containsExactly(changeSet);
|
||||
}
|
||||
|
||||
class TDModelContainer extends ModelContainer {
|
||||
static class TDModelContainer extends ModelContainer {
|
||||
|
||||
List<ChangeSet> drops = new ArrayList<>();
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import io.ebeaninternal.dbmigration.model.MCompoundForeignKey;
|
||||
import io.ebeaninternal.dbmigration.model.MTable;
|
||||
import io.ebeaninternal.dbmigration.model.ModelContainer;
|
||||
import io.ebeaninternal.dbmigration.model.visitor.VisitAllUsing;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.CKeyAssoc;
|
||||
import org.tests.model.basic.CKeyDetail;
|
||||
import org.tests.model.basic.CKeyParent;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import io.ebeaninternal.dbmigration.migrationreader.MigrationXmlReader;
|
||||
import io.ebeaninternal.dbmigration.model.CurrentModel;
|
||||
import io.ebeaninternal.dbmigration.model.MTable;
|
||||
import io.ebeaninternal.dbmigration.model.ModelContainer;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.CKeyAssoc;
|
||||
import org.tests.model.basic.CKeyDetail;
|
||||
import org.tests.model.basic.CKeyParent;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import io.ebeaninternal.dbmigration.migrationreader.MigrationXmlReader;
|
||||
import io.ebeaninternal.dbmigration.model.CurrentModel;
|
||||
import io.ebeaninternal.dbmigration.model.MTable;
|
||||
import io.ebeaninternal.dbmigration.model.ModelContainer;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.CKeyAssoc;
|
||||
import org.tests.model.basic.CKeyDetail;
|
||||
import org.tests.model.basic.CKeyParent;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.DdlOptions;
|
||||
import io.ebeaninternal.dbmigration.ddlgeneration.Helper;
|
||||
import io.ebeaninternal.dbmigration.model.CurrentModel;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Person;
|
||||
import org.tests.model.basic.Phone;
|
||||
|
||||
|
||||
+11
-10
@@ -2,13 +2,16 @@ package org.tests.inheritance.company.domain;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestInheritAbstract extends TestCase {
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class TestInheritAbstract {
|
||||
|
||||
@Test
|
||||
public void testMe() {
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
@@ -16,13 +19,13 @@ public class TestInheritAbstract extends TestCase {
|
||||
List<AbstractBar> list0 = server.find(AbstractBar.class)
|
||||
.findList();
|
||||
|
||||
Assert.assertNotNull(list0);
|
||||
assertNotNull(list0);
|
||||
|
||||
List<AbstractBar> list1 = server.find(AbstractBar.class)
|
||||
.fetch("foo", "importantText")
|
||||
.findList();
|
||||
|
||||
Assert.assertNotNull(list1);
|
||||
assertNotNull(list1);
|
||||
|
||||
Foo f = new Foo();
|
||||
f.setImportantText("blah");
|
||||
@@ -37,16 +40,14 @@ public class TestInheritAbstract extends TestCase {
|
||||
.fetch("foo", "importantText")
|
||||
.findList();
|
||||
|
||||
Assert.assertNotNull(list2);
|
||||
Assert.assertTrue(!list2.isEmpty());
|
||||
assertNotNull(list2);
|
||||
assertThat(list2).isNotEmpty();
|
||||
|
||||
for (AbstractBar abstractBar : list2) {
|
||||
Foo foo = abstractBar.getFoo();
|
||||
String importantText = foo.getImportantText();
|
||||
Assert.assertNotNull(importantText);
|
||||
assertNotNull(importantText);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user