HHH-15670 Implement RequiresDialectFeature.reverse()
- implement RequiresDialectFeature.reverse() - remove not-feature checks to reverse = true
This commit is contained in:
parent
0b733d4ba2
commit
4aede4ca88
|
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@RequiresDialectFeature(feature = DialectFeatureChecks.DoesReadCommittedNotCauseWritersToBlockReadersCheck.class)
|
||||
@RequiresDialectFeature(feature = DialectFeatureChecks.DoesReadCommittedCauseWritersToBlockReadersCheck.class, reverse = true)
|
||||
public class JPALockTest extends AbstractJPATest {
|
||||
|
||||
private SQLServerSnapshotIsolationConnectionProvider connectionProvider = new SQLServerSnapshotIsolationConnectionProvider();
|
||||
|
|
|
@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@RequiresDialectFeature(feature = DialectFeatureChecks.DoesReadCommittedNotCauseWritersToBlockReadersCheck.class)
|
||||
@RequiresDialectFeature(feature = DialectFeatureChecks.DoesReadCommittedCauseWritersToBlockReadersCheck.class, reverse = true)
|
||||
public class RepeatableReadTest extends AbstractJPATest {
|
||||
|
||||
private SQLServerSnapshotIsolationConnectionProvider connectionProvider = new SQLServerSnapshotIsolationConnectionProvider();
|
||||
|
|
|
@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@RequiresDialectFeature(
|
||||
feature = DialectFeatureChecks.DoesRepeatableReadNotCauseReadersToBlockWritersCheck.class,
|
||||
feature = DialectFeatureChecks.DoesRepeatableReadCauseReadersToBlockWritersCheck.class, reverse = true,
|
||||
comment = "potential deadlock"
|
||||
)
|
||||
@DomainModel(
|
||||
|
|
|
@ -16,6 +16,6 @@ import org.hibernate.testing.orm.junit.SessionFactory;
|
|||
*/
|
||||
@DomainModel( annotatedClasses = ExampleEntity.class )
|
||||
@SessionFactory
|
||||
@RequiresDialectFeature( feature = DialectFeatureChecks.DoesNotSupportNullPrecedence.class )
|
||||
@RequiresDialectFeature( feature = DialectFeatureChecks.SupportNullPrecedence.class, reverse = true )
|
||||
public class SupportingNotNativelyDialectTest extends AbstractNullPrecedenceTest {
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ public class CMTTest {
|
|||
|
||||
@Test
|
||||
@RequiresDialectFeature(
|
||||
feature = DialectFeatureChecks.DoesReadCommittedNotCauseWritersToBlockReadersCheck.class,
|
||||
feature = DialectFeatureChecks.DoesReadCommittedCauseWritersToBlockReadersCheck.class, reverse = true,
|
||||
comment = "write locks block readers"
|
||||
)
|
||||
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading a row that is exclusively locked by a different TX")
|
||||
|
|
|
@ -162,12 +162,6 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesReadCommittedNotCauseWritersToBlockReadersCheck implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return ! dialect.doesReadCommittedCauseWritersToBlockReaders();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoesRepeatableReadCauseReadersToBlockWritersCheck implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return dialect.doesRepeatableReadCauseReadersToBlockWriters();
|
||||
|
@ -217,9 +211,9 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportFollowOnLocking implements DialectFeatureCheck {
|
||||
public static class SupportFollowOnLocking implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return !dialect.useFollowOnLocking( null, null );
|
||||
return dialect.useFollowOnLocking( null, null );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,12 +235,6 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportNullPrecedence implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return !dialect.supportsNullPrecedence();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SupportsPadWithChar implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return !( dialect instanceof DerbyDialect );
|
||||
|
@ -370,12 +358,6 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesRepeatableReadNotCauseReadersToBlockWritersCheck implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return ! dialect.doesRepeatableReadCauseReadersToBlockWriters();
|
||||
}
|
||||
}
|
||||
|
||||
public static class CurrentTimestampHasMicrosecondPrecision implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return !dialect.currentTimestamp().contains( "6" );
|
||||
|
|
|
@ -192,18 +192,21 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
|
||||
for ( RequiresDialectFeature effectiveRequiresDialectFeature : effectiveRequiresDialectFeatures ) {
|
||||
try {
|
||||
final DialectFeatureCheck dialectFeatureCheck = effectiveRequiresDialectFeature.feature()
|
||||
.newInstance();
|
||||
if ( !dialectFeatureCheck.apply( dialect ) ) {
|
||||
final Class<? extends DialectFeatureCheck> featureClass = effectiveRequiresDialectFeature.feature();
|
||||
final DialectFeatureCheck featureCheck = featureClass.getConstructor().newInstance();
|
||||
boolean testResult = featureCheck.apply( dialect );
|
||||
if ( effectiveRequiresDialectFeature.reverse() ) {
|
||||
testResult = !testResult;
|
||||
}
|
||||
if ( !testResult ) {
|
||||
return ConditionEvaluationResult.disabled(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"Failed @RequiresDialectFeature [%s]",
|
||||
effectiveRequiresDialectFeature.feature()
|
||||
) );
|
||||
featureClass ) );
|
||||
}
|
||||
}
|
||||
catch (InstantiationException | IllegalAccessException e) {
|
||||
catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException( "Unable to instantiate DialectFeatureCheck class", e );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue