HHH-14738 Remove redundant function contribution
This commit is contained in:
parent
b88596df6a
commit
44babcb880
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@ExtendWith({ SessionFactoryExtension.class, RequireFunctionExtension.class })
|
||||
@ExtendWith({ SessionFactoryExtension.class, RequiresFunctionExtension.class })
|
||||
public @interface RequiresFunction {
|
||||
/**
|
||||
* The key for the function (as used in the SqmFunctionRegistry)
|
||||
|
|
|
@ -23,12 +23,12 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
|||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
public class RequireFunctionExtension implements ExecutionCondition {
|
||||
public class RequiresFunctionExtension implements ExecutionCondition {
|
||||
|
||||
private static final ConditionEvaluationResult ENABLED = ConditionEvaluationResult.enabled(
|
||||
"No applicable @RequireFunction annotation" );
|
||||
|
||||
private static final Logger log = Logger.getLogger( RequireFunctionExtension.class );
|
||||
private static final Logger log = Logger.getLogger( RequiresFunctionExtension.class );
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||
|
@ -38,8 +38,6 @@ public class RequireFunctionExtension implements ExecutionCondition {
|
|||
return ENABLED;
|
||||
}
|
||||
|
||||
final SqmFunctionRegistry functionRegistry = new SqmFunctionRegistry();
|
||||
|
||||
ExtensionContext.Store store = JUnitHelper.locateExtensionStore(
|
||||
SessionFactoryExtension.class,
|
||||
context,
|
||||
|
@ -59,11 +57,9 @@ public class RequireFunctionExtension implements ExecutionCondition {
|
|||
|
||||
if ( requiresFunctions.isPresent() ) {
|
||||
String functionKey = requiresFunctions.get().key();
|
||||
SpatialFunctionContributor contributor = new SpatialFunctionContributor();
|
||||
contributor.contributeFunctions(
|
||||
functionRegistry,
|
||||
existing.getSessionFactory().getServiceRegistry()
|
||||
);
|
||||
SqmFunctionRegistry functionRegistry = existing.getSessionFactory()
|
||||
.getQueryEngine()
|
||||
.getSqmFunctionRegistry();
|
||||
if ( functionRegistry.findFunctionDescriptor( functionKey ) == null ) {
|
||||
return ConditionEvaluationResult.disabled( String.format(
|
||||
Locale.ROOT,
|
Loading…
Reference in New Issue