diff --git a/enterprise/cypher/acceptance-spec-suite/src/test/scala/cypher/features/BaseAcceptanceTest.scala b/enterprise/cypher/acceptance-spec-suite/src/test/scala/cypher/features/BaseAcceptanceTest.scala index 9fe01747d4179..92274cd8d8675 100644 --- a/enterprise/cypher/acceptance-spec-suite/src/test/scala/cypher/features/BaseAcceptanceTest.scala +++ b/enterprise/cypher/acceptance-spec-suite/src/test/scala/cypher/features/BaseAcceptanceTest.scala @@ -29,7 +29,7 @@ import org.junit.Assert.fail import org.junit.jupiter.api.Test import org.junit.platform.runner.JUnitPlatform import org.junit.runner.RunWith -import org.opencypher.tools.tck.api.Scenario +import org.opencypher.tools.tck.api.{CypherTCK, Scenario} @RunWith(classOf[JUnitPlatform]) abstract class BaseAcceptanceTest extends BaseFeatureTest { @@ -42,8 +42,7 @@ abstract class BaseAcceptanceTest extends BaseFeatureTest { val featuresURI: URI = getClass.getResource("/cypher/features").toURI val scenarios: Seq[Scenario] = { - val all = parseFilesystemFeatures(new File(featuresURI)).flatMap(_.scenarios) //TODO: Change this back to the following line when TCK M12 is released - //val all = CypherTCK.parseFilesystemFeatures(new File(featuresURI)).flatMap(_.scenarios) + val all = CypherTCK.parseFilesystemFeatures(new File(featuresURI)).flatMap(_.scenarios) filterScenarios(all, featureToRun, scenarioToRun) } diff --git a/enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ExpressionAcceptanceTest.scala b/enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ExpressionAcceptanceTest.scala index 5607a6ceb6fc0..acbef6296e03f 100644 --- a/enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ExpressionAcceptanceTest.scala +++ b/enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ExpressionAcceptanceTest.scala @@ -27,66 +27,6 @@ import org.neo4j.internal.cypher.acceptance.CypherComparisonSupport._ class ExpressionAcceptanceTest extends ExecutionEngineFunSuite with CypherComparisonSupport { - // TODO remove test once TCK dependency is upgraded to 1.0.0-M12 - test("property existence checks, on node") { - createNode("exists" -> 1) - val result = executeWith( - expectSucceed = Configs.Interpreted, - query = - "MATCH (n) " + - "RETURN n.missing IS NULL," + - " n.missing IS NOT NULL," + - " exists(n.missing)," + - " n.exists IS NULL," + - " n.exists IS NOT NULL," + - " exists(n.exists)") - result.toList should equal(List(Map( - "n.missing IS NULL" -> true, - "n.missing IS NOT NULL" -> false, - "exists(n.missing)" -> false, - "n.exists IS NULL" -> false, - "n.exists IS NOT NULL" -> true, - "exists(n.exists)" -> true))) - } - - // TODO remove test once TCK dependency is upgraded to 1.0.0-M12 - test("property existence checks, on optional non-null node") { - createNode("exists" -> 1) - val result = executeWith( - expectSucceed = Configs.Interpreted, - query = - "OPTIONAL MATCH (n) " + - "RETURN n.missing IS NULL," + - " n.missing IS NOT NULL," + - " exists(n.missing)," + - " n.exists IS NULL," + - " n.exists IS NOT NULL," + - " exists(n.exists)") - result.toList should equal(List(Map( - "n.missing IS NULL" -> true, - "n.missing IS NOT NULL" -> false, - "exists(n.missing)" -> false, - "n.exists IS NULL" -> false, - "n.exists IS NOT NULL" -> true, - "exists(n.exists)" -> true))) - } - - // TODO remove test once TCK dependency is upgraded to 1.0.0-M12 - test("property existence checks, on optional null node") { - val result = executeWith( - expectSucceed = Configs.Interpreted, - query = - "OPTIONAL MATCH (n) " + - "RETURN n.missing IS NULL," + - // " n.missing IS NOT NULL," + // Do not test. In 3.4 IS NOT NULL is incorrectly rewritten to Exists. Will be fixed in 3.5. - " exists(n.missing)", - expectedDifferentResults = Configs.Empty) - result.toList should equal(List(Map( - "n.missing IS NULL" -> true, - // "n.missing IS NOT NULL" -> false, // Do not test. In 3.4 IS NOT NULL is incorrectly rewritten to Exists. Will be fixed in 3.5. - "exists(n.missing)" -> null))) - } - test("should handle map projection with property selectors") { createNode("foo" -> 1, "bar" -> "apa") diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-23.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-23.txt index a3088d270ec75..e0f6bb880c795 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-23.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-23.txt @@ -161,6 +161,8 @@ Feature "ListOperations": Scenario "Use list lookup based on parameters when the Feature "ListOperations": Scenario "Use list lookup based on parameters when there is rhs type information" Feature "ListOperations": Scenario "Fail at runtime when attempting to index with a String into a List" Feature "ListOperations": Scenario "Fail at runtime when trying to index into a list with a list" +Feature "ListOperations": Scenario "List slice with parameterised range" +Feature "ListOperations": Scenario "List slice with parameterised invalid range" Feature "DeleteAcceptance": Scenario "Delete node from a list" Feature "DeleteAcceptance": Scenario "Delete relationship from a list" Feature "FunctionsAcceptance": Scenario "`properties()` on a node" @@ -245,3 +247,4 @@ Feature "TemporalParseAcceptance": Scenario "Should parse local date time from s Feature "TemporalParseAcceptance": Scenario "Should parse date time from string" Feature "TemporalParseAcceptance": Scenario "Should parse date time with named time zone from string" Feature "TemporalParseAcceptance": Scenario "Should parse duration from string" +Feature "NullOperator": Scenario "Property not null check on null node" diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-31.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-31.txt index e7d7eb042a9f8..a324c35c0d32a 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-31.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-31.txt @@ -50,3 +50,4 @@ Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure that tak Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure with explicit arguments that drops all result fields" Feature "ProcedureCallAcceptance": Scenario "Standalone call to procedure with argument of type INTEGER accepts value of type FLOAT" Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure with argument of type INTEGER accepts value of type FLOAT" +Feature "NullOperator": Scenario "Property not null check on null node" diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-33.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-33.txt index 65e1cee3935d1..03eba437e1abe 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-33.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/compatibility-33.txt @@ -1,6 +1,7 @@ Feature "MiscellaneousErrorAcceptance": Scenario "Failing on merging relationship with null property" Feature "MiscellaneousErrorAcceptance": Scenario "Failing on merging node with null property" Feature "MiscellaneousErrorAcceptance": Scenario "Failing when setting a list of maps as a property" +Feature "NullOperator": Scenario "Property not null check on null node" Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure that takes no arguments and yields no results" Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure with explicit arguments that drops all result fields" Feature "ProcedureCallAcceptance": Scenario "Standalone call to procedure with argument of type INTEGER accepts value of type FLOAT" diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-compiled.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-compiled.txt index 063f4b867a466..bb139b4fde08d 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-compiled.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-compiled.txt @@ -504,6 +504,17 @@ Feature "ListOperations": Scenario "Use list lookup based on parameters when the Feature "ListOperations": Scenario "Use list lookup based on parameters when there is rhs type information" Feature "ListOperations": Scenario "Fail at runtime when attempting to index with a String into a List" Feature "ListOperations": Scenario "Fail at runtime when trying to index into a list with a list" +Feature "ListOperations": Scenario "List slice" +Feature "ListOperations": Scenario "List slice with implicit end" +Feature "ListOperations": Scenario "List slice with implicit start" +Feature "ListOperations": Scenario "List slice with singleton range" +Feature "ListOperations": Scenario "List slice with empty range" +Feature "ListOperations": Scenario "List slice with negative range" +Feature "ListOperations": Scenario "List slice with invalid range" +Feature "ListOperations": Scenario "List slice with exceeding range" +Feature "ListOperations": Scenario "List slice with null range" +Feature "ListOperations": Scenario "List slice with parameterised range" +Feature "ListOperations": Scenario "List slice with parameterised invalid range" Feature "ListComprehension": Scenario "Returning a list comprehension" Feature "ListComprehension": Scenario "Using a list comprehension in a WITH" Feature "ListComprehension": Scenario "Using a list comprehension in a WHERE" @@ -641,6 +652,15 @@ Feature "NullAcceptance": Scenario "Ignore null when setting label" Feature "NullAcceptance": Scenario "Ignore null when removing label" Feature "NullAcceptance": Scenario "Ignore null when deleting node" Feature "NullAcceptance": Scenario "Ignore null when deleting relationship" +Feature "NullAcceptance": Scenario "Property existence check on non-null node" +Feature "NullAcceptance": Scenario "Property existence check on optional non-null node" +Feature "NullAcceptance": Scenario "Property existence check on null node" +Feature "NullOperator": Scenario "Property null check on non-null node" +Feature "NullOperator": Scenario "Property not null check on non-null node" +Feature "NullOperator": Scenario "Property null check on optional non-null node" +Feature "NullOperator": Scenario "Property not null check on optional non-null node" +Feature "NullOperator": Scenario "Property null check on null node" +Feature "NullOperator": Scenario "Property not null check on null node" Feature "Aggregation": Scenario "`max()` over strings" Feature "Aggregation": Scenario "`min()` over strings" Feature "Aggregation": Scenario "`max()` over integers" diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-interpreted.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-interpreted.txt index 65e1cee3935d1..03eba437e1abe 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-interpreted.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-interpreted.txt @@ -1,6 +1,7 @@ Feature "MiscellaneousErrorAcceptance": Scenario "Failing on merging relationship with null property" Feature "MiscellaneousErrorAcceptance": Scenario "Failing on merging node with null property" Feature "MiscellaneousErrorAcceptance": Scenario "Failing when setting a list of maps as a property" +Feature "NullOperator": Scenario "Property not null check on null node" Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure that takes no arguments and yields no results" Feature "ProcedureCallAcceptance": Scenario "In-query call to procedure with explicit arguments that drops all result fields" Feature "ProcedureCallAcceptance": Scenario "Standalone call to procedure with argument of type INTEGER accepts value of type FLOAT" diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-slotted.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-slotted.txt index 65fba0815a599..054acbdedac5d 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-slotted.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/cost-slotted.txt @@ -13,3 +13,6 @@ Feature "MiscellaneousErrorAcceptance": Scenario "Failing when setting a list of // To classify Feature "ProcedureCallAcceptance": Scenario "Standalone call to procedure should fail if implicit argument is missing" + +// Formalized and fixed in Neo4j 3.5 +Feature "NullOperator": Scenario "Property not null check on null node" \ No newline at end of file diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/default.txt b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/default.txt index 16b7a785596a8..9fa9b18c3ef30 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/default.txt +++ b/enterprise/cypher/compatibility-spec-suite/src/test/resources/blacklists/default.txt @@ -13,3 +13,6 @@ Feature "MiscellaneousErrorAcceptance": Scenario "Failing when setting a list of // Different error type in Neo4j Feature "ProcedureCallAcceptance": Scenario "Standalone call to procedure should fail if implicit argument is missing" + +// Formalized and fixed in Neo4j 3.5 +Feature "NullOperator": Scenario "Property not null check on null node" \ No newline at end of file diff --git a/enterprise/cypher/compatibility-spec-suite/src/test/scala/cypher/features/BaseTCKTests.scala b/enterprise/cypher/compatibility-spec-suite/src/test/scala/cypher/features/BaseTCKTests.scala index 9388b2248befd..f5df72c9c5f47 100644 --- a/enterprise/cypher/compatibility-spec-suite/src/test/scala/cypher/features/BaseTCKTests.scala +++ b/enterprise/cypher/compatibility-spec-suite/src/test/scala/cypher/features/BaseTCKTests.scala @@ -26,7 +26,7 @@ import org.junit.Assert.fail import org.junit.jupiter.api.Test import org.junit.platform.runner.JUnitPlatform import org.junit.runner.RunWith -import org.opencypher.tools.tck.api.Scenario +import org.opencypher.tools.tck.api.{CypherTCK, Scenario} @RunWith(classOf[JUnitPlatform]) abstract class BaseTCKTests extends BaseFeatureTest { @@ -35,8 +35,7 @@ abstract class BaseTCKTests extends BaseFeatureTest { val featureToRun = "" val scenarioToRun = "" - val scenarios: Seq[Scenario] = filterScenarios(allTckScenarios, featureToRun, scenarioToRun) //TODO: Change this back to the following line when TCK M12 is released - // filterScenarios(CypherTCK.allTckScenarios, featureToRun, scenarioToRun) + val scenarios: Seq[Scenario] = filterScenarios(CypherTCK.allTckScenarios, featureToRun, scenarioToRun) @Test def debugTokensNeedToBeEmpty(): Unit = { @@ -49,5 +48,3 @@ abstract class BaseTCKTests extends BaseFeatureTest { fail("featureToRun is only for debugging and should not be committed") } } - - diff --git a/enterprise/cypher/pom.xml b/enterprise/cypher/pom.xml index 0d56c8cbe506c..1b1c2aed6cab0 100644 --- a/enterprise/cypher/pom.xml +++ b/enterprise/cypher/pom.xml @@ -20,7 +20,7 @@ licensing/notice-agpl-prefix.txt headers/AGPL-3-header.txt - 1.0.0-M11 + 1.0.0-M12 1.1.0 5.1.0 diff --git a/enterprise/cypher/spec-suite-tools/src/test/scala/cypher/features/BaseFeatureTest.scala b/enterprise/cypher/spec-suite-tools/src/test/scala/cypher/features/BaseFeatureTest.scala index 3f4d3b1a57a47..3147e2cd0697f 100644 --- a/enterprise/cypher/spec-suite-tools/src/test/scala/cypher/features/BaseFeatureTest.scala +++ b/enterprise/cypher/spec-suite-tools/src/test/scala/cypher/features/BaseFeatureTest.scala @@ -22,53 +22,10 @@ */ package cypher.features -import java.io.File -import java.net.URL -import java.nio.file.{FileSystems, Files, Paths} -import java.util - -import org.opencypher.tools.tck.api.CypherTCK.{featureSuffix, featuresPath, parseFeature} -import org.opencypher.tools.tck.api.{Feature, Scenario} - -import scala.collection.JavaConverters._ -import scala.io.{Codec, Source} +import org.opencypher.tools.tck.api.Scenario abstract class BaseFeatureTest { - // ---- TCK methods - // TODO: Remove those when M12 is released - - def parseFilesystemFeatures(directory: File): Seq[Feature] = { - require(directory.isDirectory) - val featureFileNames = directory.listFiles.filter(_.getName.endsWith(featureSuffix)) - featureFileNames.map(parseFilesystemFeature) - } - - def parseFilesystemFeature(file: File): Feature = { - parseFeature(file.getAbsolutePath, Source.fromFile(file)(Codec.UTF8).mkString) - } - - def parseClasspathFeature(pathUrl: URL): Feature = { - parseFeature(pathUrl.toString, Source.fromURL(pathUrl)(Codec.UTF8).mkString) - } - - def allTckScenarios: Seq[Scenario] = parseClasspathFeatures(featuresPath).flatMap(_.scenarios) - - def parseClasspathFeatures(path: String): Seq[Feature] = { - val resource = getClass.getResource(path).toURI - val fs = FileSystems.newFileSystem(resource, new util.HashMap[String, String]) // Needed to support `Paths.get` below - try { - val directoryPath = Paths.get(resource) - val paths = Files.newDirectoryStream(directoryPath).asScala.toSeq - val featurePathStrings = paths.map(path => path.toString).filter(_.endsWith(featureSuffix)) - val featureUrls = featurePathStrings.map(getClass.getResource(_)) - featureUrls.map(parseClasspathFeature) - } finally { - fs.close() - } - } - // ---- TCK methods end - def filterScenarios(allScenarios: Seq[Scenario], featureToRun: String, scenarioToRun: String): Seq[Scenario] = { if (featureToRun.nonEmpty) { val filteredFeature = allScenarios.filter(s => s.featureName.contains(featureToRun))