Add version to logic evaluating @SkipForDialect and @RequiresDialect
This commit is contained in:
parent
39d5d344fb
commit
a8cf8165ae
|
@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
* @author Vlad Mihalcea
|
||||
*/
|
||||
@RequiresDialectFeature(feature = SupportsIdentityColumns.class, jiraKey = "HHH-9271")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 12, matchSubTypes = true, reason = "Oracle and identity column: java.sql.Connection#prepareStatement(String sql, int columnIndexes[]) does not work with quoted table names and/or quoted columnIndexes")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 1200, matchSubTypes = true, reason = "Oracle and identity column: java.sql.Connection#prepareStatement(String sql, int columnIndexes[]) does not work with quoted table names and/or quoted columnIndexes")
|
||||
@DomainModel(
|
||||
annotatedClasses = {
|
||||
QuotedIdentifierTest.QuotedIdentifier.class
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
* @author <a href="mailto:p.krauzowicz@visiona.pl">Piotr Krauzowicz</a>
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@SkipForDialect(dialectClass = MySQLDialect.class, version = 5, matchSubTypes = true, reason = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 9, matchSubTypes = true, reason = "ORA-02329: column of datatype LOB cannot be unique or a primary key")
|
||||
@SkipForDialect(dialectClass = MySQLDialect.class, version = 500, matchSubTypes = true, reason = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 900, matchSubTypes = true, reason = "ORA-02329: column of datatype LOB cannot be unique or a primary key")
|
||||
@DomainModel(
|
||||
annotatedClasses = ByteArrayIdTest.DemoEntity.class
|
||||
)
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
* @author <a href="mailto:p.krauzowicz@visiona.pl">Piotr Krauzowicz</a>
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@SkipForDialect(dialectClass = MySQLDialect.class, version = 5, reason = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 9, matchSubTypes = true, reason = "ORA-02329: column of datatype LOB cannot be unique or a primary key")
|
||||
@SkipForDialect(dialectClass = MySQLDialect.class, version = 500, reason = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||
@SkipForDialect(dialectClass = OracleDialect.class, version = 900, matchSubTypes = true, reason = "ORA-02329: column of datatype LOB cannot be unique or a primary key")
|
||||
@DomainModel(
|
||||
annotatedClasses = PrimitiveByteArrayIdTest.DemoEntity.class
|
||||
)
|
||||
|
|
|
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
* @author Vlad Mhalcea
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-13106")
|
||||
@RequiresDialect(value = PostgreSQLDialect.class, version = 10)
|
||||
@RequiresDialect(value = PostgreSQLDialect.class, version = 1000)
|
||||
@Jpa(
|
||||
annotatedClasses = PostgreSQLIdentitySequenceTest.Role.class
|
||||
)
|
||||
|
|
|
@ -33,7 +33,7 @@ import static org.junit.Assert.assertThat;
|
|||
*/
|
||||
@DomainModel( annotatedClasses = RowIdTest.Product.class )
|
||||
@SessionFactory(statementInspectorClass = SQLStatementInspector.class)
|
||||
@RequiresDialect( value = OracleDialect.class, version = 9)
|
||||
@RequiresDialect( value = OracleDialect.class, version = 900)
|
||||
public class RowIdTest {
|
||||
|
||||
@BeforeEach
|
||||
|
|
|
@ -46,14 +46,30 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
for ( RequiresDialect requiresDialect : effectiveRequiresDialects ) {
|
||||
requiredDialects.append(requiresDialect.value() );
|
||||
requiredDialects.append( " " );
|
||||
if ( requiresDialect.matchSubTypes() ) {
|
||||
final int requiredVersion = requiresDialect.version();
|
||||
if ( requiredVersion > -1 ) {
|
||||
requiredDialects.append( ", version = " );
|
||||
requiredDialects.append( requiredVersion );
|
||||
requiredDialects.append( " " );
|
||||
if ( requiresDialect.value().isInstance( dialect ) ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
if ( requiredVersion == dialect.getVersion() ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
}
|
||||
if ( requiresDialect.matchSubTypes() && dialect.getVersion() > requiredVersion ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( requiresDialect.value().equals( dialect.getClass() ) ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
if ( requiresDialect.matchSubTypes() ) {
|
||||
if ( requiresDialect.value().isInstance( dialect ) ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( requiresDialect.value().equals( dialect.getClass() ) ) {
|
||||
return ConditionEvaluationResult.enabled( "Matched @RequiresDialect" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,9 +77,10 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
return ConditionEvaluationResult.disabled(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"Failed @RequiresDialect(dialect=%s) check - found %s]",
|
||||
requiredDialects.toString(),
|
||||
dialect.getClass().getName()
|
||||
"Failed @RequiresDialect(dialect=%s) check - found %s version %s]",
|
||||
requiredDialects,
|
||||
dialect.getClass().getName(),
|
||||
dialect.getVersion()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -75,14 +92,27 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
);
|
||||
|
||||
for ( SkipForDialect effectiveSkipForDialect : effectiveSkips ) {
|
||||
if ( effectiveSkipForDialect.matchSubTypes() ) {
|
||||
final int skipForVersion = effectiveSkipForDialect.version();
|
||||
if ( skipForVersion > -1 ) {
|
||||
if ( effectiveSkipForDialect.dialectClass().isInstance( dialect ) ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect(group)" );
|
||||
if ( skipForVersion == dialect.getVersion() ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect(group)" );
|
||||
}
|
||||
if ( effectiveSkipForDialect.matchSubTypes() && dialect.getVersion() > skipForVersion ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect(group)" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( effectiveSkipForDialect.dialectClass().equals( dialect.getClass() ) ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect" );
|
||||
if ( effectiveSkipForDialect.matchSubTypes() ) {
|
||||
if ( effectiveSkipForDialect.dialectClass().isInstance( dialect ) ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect(group)" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( effectiveSkipForDialect.dialectClass().equals( dialect.getClass() ) ) {
|
||||
return ConditionEvaluationResult.disabled( "Matched @SkipForDialect" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue