(cherry picked from commit c1e43e694f02edf3e197abbab7c21008c022b516)
This commit is contained in:
parent
49f41d127b
commit
69383acecf
|
@ -24,6 +24,8 @@ import org.elasticsearch.xpack.ql.expression.gen.pipeline.Pipe;
|
||||||
import org.elasticsearch.xpack.ql.expression.gen.processor.ConstantProcessor;
|
import org.elasticsearch.xpack.ql.expression.gen.processor.ConstantProcessor;
|
||||||
import org.elasticsearch.xpack.ql.expression.gen.processor.Processor;
|
import org.elasticsearch.xpack.ql.expression.gen.processor.Processor;
|
||||||
import org.elasticsearch.xpack.ql.expression.predicate.fulltext.FullTextPredicate;
|
import org.elasticsearch.xpack.ql.expression.predicate.fulltext.FullTextPredicate;
|
||||||
|
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.In;
|
||||||
|
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.InPipe;
|
||||||
import org.elasticsearch.xpack.ql.expression.predicate.regex.Like;
|
import org.elasticsearch.xpack.ql.expression.predicate.regex.Like;
|
||||||
import org.elasticsearch.xpack.ql.expression.predicate.regex.LikePattern;
|
import org.elasticsearch.xpack.ql.expression.predicate.regex.LikePattern;
|
||||||
import org.elasticsearch.xpack.ql.tree.NodeTests.ChildrenAreAProperty;
|
import org.elasticsearch.xpack.ql.tree.NodeTests.ChildrenAreAProperty;
|
||||||
|
@ -56,6 +58,7 @@ import java.util.function.Supplier;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarInputStream;
|
import java.util.jar.JarInputStream;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
@ -86,6 +89,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*/
|
*/
|
||||||
public class NodeSubclassTests<T extends B, B extends Node<B>> extends ESTestCase {
|
public class NodeSubclassTests<T extends B, B extends Node<B>> extends ESTestCase {
|
||||||
|
|
||||||
|
private static final List<Class<?>> CLASSES_WITH_MIN_TWO_CHILDREN = asList(In.class, InPipe.class);
|
||||||
|
|
||||||
private final Class<T> subclass;
|
private final Class<T> subclass;
|
||||||
|
|
||||||
public NodeSubclassTests(Class<T> subclass) {
|
public NodeSubclassTests(Class<T> subclass) {
|
||||||
|
@ -153,7 +158,6 @@ public class NodeSubclassTests<T extends B, B extends Node<B>> extends ESTestCas
|
||||||
/**
|
/**
|
||||||
* Test {@link Node#replaceChildren} implementation on {@link #subclass}.
|
* Test {@link Node#replaceChildren} implementation on {@link #subclass}.
|
||||||
*/
|
*/
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/52951")
|
|
||||||
public void testReplaceChildren() throws Exception {
|
public void testReplaceChildren() throws Exception {
|
||||||
Constructor<T> ctor = longestCtor(subclass);
|
Constructor<T> ctor = longestCtor(subclass);
|
||||||
Object[] nodeCtorArgs = ctorArgs(ctor);
|
Object[] nodeCtorArgs = ctorArgs(ctor);
|
||||||
|
@ -564,7 +568,7 @@ public class NodeSubclassTests<T extends B, B extends Node<B>> extends ESTestCas
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasAtLeastTwoChildren(Class<? extends Node<?>> toBuildClass) {
|
protected boolean hasAtLeastTwoChildren(Class<? extends Node<?>> toBuildClass) {
|
||||||
return false;
|
return CLASSES_WITH_MIN_TWO_CHILDREN.stream().anyMatch(toBuildClass::equals);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> makeListOfSameSizeOtherThan(Type listType, List<?> original) throws Exception {
|
private List<?> makeListOfSameSizeOtherThan(Type listType, List<?> original) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue