aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java302
1 files changed, 151 insertions, 151 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
index dd69fb6c591..302fda9d3d7 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
@@ -3,10 +3,10 @@ package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.yolean.Exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -14,232 +14,232 @@ import static org.junit.Assert.fail;
public class RankingExpressionLoopDetectionTestCase {
@Test
- public void testSelfLoop() throws ParseException {
+ void testSelfLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: foo\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: foo is invalid: Invocation loop: foo -> foo",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testNestedLoop() throws ParseException {
+ void testNestedLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: arg(5)\n" +
- " }\n" +
- " function arg(a1) {\n" +
- " expression: foo + a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: arg(5)\n" +
+ " }\n" +
+ " function arg(a1) {\n" +
+ " expression: foo + a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: arg(5) is invalid: foo is invalid: arg(5) is invalid: Invocation loop: arg(5) -> foo -> arg(5)",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testSelfArgumentLoop() throws ParseException {
+ void testSelfArgumentLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: arg(foo)\n" +
- " }\n" +
- " function arg(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: arg(foo)\n" +
+ " }\n" +
+ " function arg(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: arg(foo) is invalid: a1 is invalid: foo is invalid: arg(foo) is invalid: Invocation loop: arg(foo) -> foo -> arg(foo)",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testNoLoopWithSameLocalArgument() throws ParseException {
+ void testNoLoopWithSameLocalArgument() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(3)\n" +
- " }\n" +
- " function foo(a1) {\n" +
- " expression: bar(3)\n" +
- " }\n" +
- " function bar(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(3)\n" +
+ " }\n" +
+ " function foo(a1) {\n" +
+ " expression: bar(3)\n" +
+ " }\n" +
+ " function bar(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithMultipleInvocations() throws ParseException {
+ void testNoLoopWithMultipleInvocations() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(3)\n" +
- " }\n" +
- " function foo(a1) {\n" +
- " expression: bar(3) + bar(a1)\n" +
- " }\n" +
- " function bar(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(3)\n" +
+ " }\n" +
+ " function foo(a1) {\n" +
+ " expression: bar(3) + bar(a1)\n" +
+ " }\n" +
+ " function bar(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithBoundIdentifiers() throws ParseException {
+ void testNoLoopWithBoundIdentifiers() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(bar(2))\n" +
- " }\n" +
- " function foo(x) {\n" +
- " expression: x * x\n" +
- " }\n" +
- " function bar(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(bar(2))\n" +
+ " }\n" +
+ " function foo(x) {\n" +
+ " expression: x * x\n" +
+ " }\n" +
+ " function bar(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException {
+ void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo()\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: bar(x)\n" +
- " }\n" +
- " function bar(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException {
+ void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo()\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: bar(x)\n" +
- " }\n" +
- " function bar(y) {\n" +
- " expression: baz(y)\n" +
- " }\n" +
- " function baz(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(y) {\n" +
+ " expression: baz(y)\n" +
+ " }\n" +
+ " function baz(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}