Skip to content

Commit

Permalink
Fix test failures after version change of Cypher compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Nov 4, 2016
1 parent 88a534a commit 2107cd3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 31 deletions.
Expand Up @@ -111,17 +111,17 @@ public static class Compatibility23
@RunWith( Cucumber.class )
@CucumberOptions(
plugin = {
DB_CONFIG + "compatibility-30.json",
HTML_REPORT + SUITE_NAME + "/compatibility-30",
JSON_REPORT + SUITE_NAME + "/compatibility-30",
BLACKLIST_PLUGIN + "compatibility-30.txt"
DB_CONFIG + "compatibility-31.json",
HTML_REPORT + SUITE_NAME + "/compatibility-31",
JSON_REPORT + SUITE_NAME + "/compatibility-31",
BLACKLIST_PLUGIN + "compatibility-31.txt"
},
glue = { GLUE_PATH },
features = { FEATURE_PATH + FEATURE_TO_RUN },
tags = { "~@pending" },
strict = true
)
public static class Compatibility30
public static class Compatibility31
{
}

Expand Down

This file was deleted.

@@ -0,0 +1,2 @@


This file was deleted.

@@ -0,0 +1,3 @@
{
"language": "3.1"
}
Expand Up @@ -21,9 +21,8 @@ package org.neo4j.internal.cypher.acceptance

import org.neo4j.cypher.ExecutionEngineFunSuite
import org.neo4j.cypher.internal.ExecutionResult
import org.neo4j.cypher.internal.compatibility.CompatibilityPlanDescriptionFor3_1
import org.neo4j.cypher.internal.compatibility.CompatibilityPlanDescriptionFor3_2
import org.neo4j.cypher.internal.compiler.v3_2._
import org.neo4j.kernel.impl.query.TransactionalContext
import org.scalatest.matchers.{MatchResult, Matcher}

class PreParsingAcceptanceTest extends ExecutionEngineFunSuite {
Expand Down Expand Up @@ -87,17 +86,18 @@ class PreParsingAcceptanceTest extends ExecutionEngineFunSuite {
// exhaust the iterator so we can collect the plan description
result.length
result.executionPlanDescription() match {
case CompatibilityPlanDescriptionFor3_1(_, _, actual, _) =>
case CompatibilityPlanDescriptionFor3_2(_, _, actual, _) =>
MatchResult(
matches = actual == expected,
rawFailureMessage = s"PlannerName should be $expected, but was $actual",
rawNegatedFailureMessage = s"PlannerName should not be $actual"
)
case planDesc =>
val s: String = s"Plan description should be of type ${classOf[CompatibilityPlanDescriptionFor3_2].getSimpleName}, but was ${planDesc.getClass.getSimpleName}"
MatchResult(
matches = false,
rawFailureMessage = s"Plan description should be of type CompatibilityPlanDescriptionFor2_3, but was ${planDesc.getClass.getSimpleName}",
rawNegatedFailureMessage = s"Plan description should be of type CompatibilityPlanDescriptionFor2_3, but was ${planDesc.getClass.getSimpleName}"
rawFailureMessage = s,
rawNegatedFailureMessage = s
)
}
}
Expand Down
Expand Up @@ -28,14 +28,12 @@ import org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService
import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor}
import org.neo4j.graphdb.factory.GraphDatabaseSettings
import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.proc._
import org.neo4j.kernel.api.{proc, Statement}
import org.neo4j.kernel.api.exceptions.ProcedureException
import Context.KERNEL_TRANSACTION
import org.neo4j.kernel.api.proc.Context.KERNEL_TRANSACTION
import org.neo4j.kernel.api.proc._
import org.neo4j.kernel.api.{Statement, proc}
import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge
import org.neo4j.kernel.impl.proc.Procedures
import org.neo4j.kernel.impl.query.TransactionalContext
import org.neo4j.test.TestGraphDatabaseFactory

import scala.collection.immutable.Map
Expand All @@ -60,11 +58,11 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan2.getArguments.get("planner-impl") should equal(CostBasedPlannerName.default.name)
}

test("by default when using cypher 3.0 some queries should default to COST") {
test("by default when using cypher 3.1 some queries should default to COST") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.0").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand All @@ -78,11 +76,11 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan2.getArguments.get("planner-impl") should equal(CostBasedPlannerName.default.name)
}

test("by default when using cypher 3.1 some queries should default to COST") {
test("by default when using cypher 3.2 some queries should default to COST") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.2").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand Down Expand Up @@ -112,12 +110,12 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan.getArguments.get("planner-impl") should equal("RULE")
}

test("should be able to set RULE as default when using cypher 3.0") {
test("should be able to set RULE as default when using cypher 3.1") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_planner, "RULE")
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.0").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand All @@ -128,12 +126,12 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan.getArguments.get("planner-impl") should equal("RULE")
}

test("should be able to set RULE as default when using cypher 3.1") {
test("should be able to set RULE as default when using cypher 3.2") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_planner, "RULE")
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.2").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand All @@ -160,12 +158,12 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan.getArguments.get("planner-impl") should equal("IDP")
}

test("should be able to force COST as default when using cypher 3.0") {
test("should be able to force COST as default when using cypher 3.1") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_planner, "COST")
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.0").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand All @@ -176,12 +174,12 @@ class ExecutionEngineIT extends CypherFunSuite with GraphIcing {
plan.getArguments.get("planner-impl") should equal("IDP")
}

test("should be able to force COST as default when using cypher 3.1") {
test("should be able to force COST as default when using cypher 3.2") {
//given
val db = new TestGraphDatabaseFactory()
.newImpermanentDatabaseBuilder()
.setConfig(GraphDatabaseSettings.cypher_planner, "COST")
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.1").newGraphDatabase()
.setConfig(GraphDatabaseSettings.cypher_parser_version, "3.2").newGraphDatabase()
val service = new GraphDatabaseCypherService(db)

//when
Expand Down

0 comments on commit 2107cd3

Please sign in to comment.