mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-11428 - When multiple @RequiresDialect annotation is applied the test is ignored
This commit is contained in:
parent
b19d76f2cc
commit
e547ee0793
@ -261,11 +261,12 @@ SkipForDialect.class, SkipForDialects.class, frameworkMethod, getTestClass()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean foundMatch = false;
|
||||||
// @RequiresDialects & @RequiresDialect
|
// @RequiresDialects & @RequiresDialect
|
||||||
for ( RequiresDialect requiresDialectAnn : Helper.collectAnnotations(
|
final List<RequiresDialect> requiresDialects = Helper.collectAnnotations(
|
||||||
RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
||||||
) ) {
|
);
|
||||||
boolean foundMatch = false;
|
for ( RequiresDialect requiresDialectAnn : requiresDialects ) {
|
||||||
for ( Class<? extends Dialect> dialectClass : requiresDialectAnn.value() ) {
|
for ( Class<? extends Dialect> dialectClass : requiresDialectAnn.value() ) {
|
||||||
foundMatch = requiresDialectAnn.strictMatching()
|
foundMatch = requiresDialectAnn.strictMatching()
|
||||||
? dialectClass.equals( dialect.getClass() )
|
? dialectClass.equals( dialect.getClass() )
|
||||||
@ -274,10 +275,13 @@ RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !foundMatch ) {
|
if ( foundMatch ) {
|
||||||
return buildIgnore( requiresDialectAnn );
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( !foundMatch ) {
|
||||||
|
return buildIgnore( requiresDialects );
|
||||||
|
}
|
||||||
|
|
||||||
// @RequiresDialectFeature
|
// @RequiresDialectFeature
|
||||||
RequiresDialectFeature requiresDialectFeatureAnn = Helper.locateAnnotation(
|
RequiresDialectFeature requiresDialectFeatureAnn = Helper.locateAnnotation(
|
||||||
@ -287,10 +291,8 @@ RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
|||||||
);
|
);
|
||||||
if ( requiresDialectFeatureAnn != null ) {
|
if ( requiresDialectFeatureAnn != null ) {
|
||||||
try {
|
try {
|
||||||
boolean foundMatch = false;
|
|
||||||
for ( Class<? extends DialectCheck> checkClass : requiresDialectFeatureAnn.value() ) {
|
for ( Class<? extends DialectCheck> checkClass : requiresDialectFeatureAnn.value() ) {
|
||||||
foundMatch = checkClass.newInstance().isMatch( dialect );
|
if ( !checkClass.newInstance().isMatch( dialect ) ) {
|
||||||
if ( !foundMatch ) {
|
|
||||||
return buildIgnore( requiresDialectFeatureAnn );
|
return buildIgnore( requiresDialectFeatureAnn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,6 +317,10 @@ private Ignore buildIgnore(SkipForDialect skip) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Ignore buildIgnore(String reason, String comment, String jiraKey) {
|
private Ignore buildIgnore(String reason, String comment, String jiraKey) {
|
||||||
|
return new IgnoreImpl( getIgnoreMessage( reason, comment, jiraKey ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getIgnoreMessage(String reason, String comment, String jiraKey) {
|
||||||
StringBuilder buffer = new StringBuilder( reason );
|
StringBuilder buffer = new StringBuilder( reason );
|
||||||
if ( StringHelper.isNotEmpty( comment ) ) {
|
if ( StringHelper.isNotEmpty( comment ) ) {
|
||||||
buffer.append( "; " ).append( comment );
|
buffer.append( "; " ).append( comment );
|
||||||
@ -324,13 +330,26 @@ private Ignore buildIgnore(String reason, String comment, String jiraKey) {
|
|||||||
buffer.append( " (" ).append( jiraKey ).append( ')' );
|
buffer.append( " (" ).append( jiraKey ).append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new IgnoreImpl( buffer.toString() );
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ignore buildIgnore(RequiresDialect requiresDialect) {
|
private Ignore buildIgnore(RequiresDialect requiresDialect) {
|
||||||
return buildIgnore( "@RequiresDialect non-match", requiresDialect.comment(), requiresDialect.jiraKey() );
|
return buildIgnore( "@RequiresDialect non-match", requiresDialect.comment(), requiresDialect.jiraKey() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Ignore buildIgnore(List<RequiresDialect> requiresDialects) {
|
||||||
|
String ignoreMessage = "";
|
||||||
|
for ( RequiresDialect requiresDialect : requiresDialects ) {
|
||||||
|
ignoreMessage += getIgnoreMessage(
|
||||||
|
"@RequiresDialect non-match",
|
||||||
|
requiresDialect.comment(),
|
||||||
|
requiresDialect.jiraKey()
|
||||||
|
);
|
||||||
|
ignoreMessage += System.lineSeparator();
|
||||||
|
}
|
||||||
|
return new IgnoreImpl( ignoreMessage );
|
||||||
|
}
|
||||||
|
|
||||||
private Ignore buildIgnore(RequiresDialectFeature requiresDialectFeature) {
|
private Ignore buildIgnore(RequiresDialectFeature requiresDialectFeature) {
|
||||||
return buildIgnore(
|
return buildIgnore(
|
||||||
"@RequiresDialectFeature non-match",
|
"@RequiresDialectFeature non-match",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user