Skip to content

Commit

Permalink
Bump cucumber
Browse files Browse the repository at this point in the history
  • Loading branch information
loveleif committed Dec 19, 2024
1 parent 370fe27 commit 0f59f36
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 121 deletions.
20 changes: 15 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
<dep.antlr4.version>4.7.2</dep.antlr4.version>
<dep.batik.version>1.13</dep.batik.version>
<dep.scalatags.version>0.10.0</dep.scalatags.version>
<dep.cucumber.version>5.7.0</dep.cucumber.version>
<dep.cucumber.version>7.20.1</dep.cucumber.version>
<dep.cucumber-scala.version>8.25.1</dep.cucumber-scala.version>
<dep.fastparse.version>2.3.3</dep.fastparse.version>
<dep.hamcrest.version>2.2</dep.hamcrest.version>
<dep.junit.platform.version>1.7.0</dep.junit.platform.version>
<dep.junit.version>5.7.0</dep.junit.version>
<dep.json-unit-asserth.version>2.37.0</dep.json-unit-asserth.version>
<dep.maven.compiler.plugin.version>3.8.1</dep.maven.compiler.plugin.version>
<dep.maven.javadoc.plugin.version>3.2.0</dep.maven.javadoc.plugin.version>
<dep.maven.source.plugin.version>3.2.1</dep.maven.source.plugin.version>
Expand All @@ -48,6 +50,7 @@
<dep.commons-cli.version>1.4</dep.commons-cli.version>
<dep.freemarker.version>2.3.30</dep.freemarker.version>
<dep.jackson-dataformat-xml.version>2.11.3</dep.jackson-dataformat-xml.version>
<dep.jackson-databind.version>2.18.2</dep.jackson-databind.version>
<license.header>${project.rootdir}/ASL-2-header.txt</license.header>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
Expand Down Expand Up @@ -122,14 +125,15 @@
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>${dep.cucumber.version}</version>
<groupId>net.javacrumbs.json-unit</groupId>
<artifactId>json-unit-assertj</artifactId>
<version>${dep.json-unit-asserth.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-gherkin-vintage</artifactId>
<artifactId>cucumber-core</artifactId>
<version>${dep.cucumber.version}</version>
</dependency>

Expand Down Expand Up @@ -185,6 +189,12 @@
<version>${dep.jackson-dataformat-xml.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${dep.jackson-databind.version}</version>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions tools/grammar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@
<version>2.17.0</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-gherkin-vintage</artifactId>
<optional>true</optional>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ package org.opencypher.tools.tck.api

import io.cucumber.core.gherkin
import io.cucumber.core.gherkin.DataTableArgument
import io.cucumber.core.gherkin.DocStringArgument
import io.cucumber.core.gherkin.vintage.GherkinVintageFeatureParser
import io.cucumber.plugin.event.DocStringArgument
import io.cucumber.core.gherkin.messages.GherkinMessagesFeatureParser
import org.opencypher.tools.tck.SideEffectOps.Diff
import org.opencypher.tools.tck._
import org.opencypher.tools.tck.api.events.TCKEvents
Expand All @@ -46,6 +46,7 @@ import java.net.URI
import java.nio.charset.StandardCharsets
import java.nio.file._
import java.util
import java.util.UUID
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
import scala.jdk.CollectionConverters._
Expand All @@ -58,7 +59,7 @@ object CypherTCK {
val featuresPath = "/features"
val featureSuffix = ".feature"

private lazy val parser = new GherkinVintageFeatureParser()
private lazy val parser = new GherkinMessagesFeatureParser()

/**
* Provides all the scenarios in the openCypher TCK.
Expand Down Expand Up @@ -142,7 +143,7 @@ object CypherTCK {
def apply(pickle: NameExtractedPickle): PickleGroupingKey = PickleGroupingKey(pickle.pickle.getKeyword, pickle.nameAndNumber)
}

Try(parser.parse(featureFile.toUri, featureString, null)) match {
Try(parser.parse(featureFile.toUri, featureString, () => UUID.randomUUID)) match {
case Success(featureOption) =>
if(featureOption.isPresent) {
val feature = featureOption.get()
Expand All @@ -156,7 +157,7 @@ object CypherTCK {
case (_, included) => included.sortBy(_.pickle.getLocation.getLine)
}

val featureName = feature.getName
val featureName = feature.getName.orElse("N/A")
val scenarios = includedGroupedAndSorted.flatMap {
case (PickleGroupingKey("Scenario Outline", _), pickles) =>
pickles.zipWithIndex.map {
Expand All @@ -171,7 +172,7 @@ object CypherTCK {
}
else Feature(Seq[Scenario]())
case Failure(error) =>
throw InvalidFeatureFormatException(s"Could not parse feature from ${featureFile.toAbsolutePath.toString}: ${error.getMessage}")
throw InvalidFeatureFormatException(s"Could not parse feature from ${featureFile.toAbsolutePath.toString}: ${error.getMessage}", error)
}
}

Expand Down Expand Up @@ -470,7 +471,7 @@ case class ExpectError(errorType: String, phase: String, detail: String, source:
}
}

case class InvalidFeatureFormatException(message: String) extends RuntimeException(message)
case class InvalidFeatureFormatException(message: String, cause: Throwable = null) extends RuntimeException(message, cause)

sealed trait QueryType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ case object PickleStep {
case class PickleLocation(line: Int, column: Int)

case object PickleLocation {
def apply(location: io.cucumber.core.gherkin.Location): PickleLocation = {
def apply(location: io.cucumber.plugin.event.Location): PickleLocation = {
PickleLocation(location.getLine, location.getColumn)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
*/
package org.opencypher.tools.tck.api

import io.cucumber.plugin.event.Location

import java.net.URI
import java.util

import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

Expand All @@ -39,12 +40,8 @@ class ScenarioTest extends AnyFunSuite with Matchers {
val noPickleSteps = new util.ArrayList[io.cucumber.core.gherkin.Step]()
val noPickleTags = new util.ArrayList[String]()

def location(line: Int, column: Int): io.cucumber.core.gherkin.Location = {
new io.cucumber.core.gherkin.Location() {
override def getLine: Int = line

override def getColumn: Int = column
}
def location(line: Int, column: Int): io.cucumber.plugin.event.Location = {
new io.cucumber.plugin.event.Location(line, column)
}

def stringArgument(text: String, line: Int): io.cucumber.core.gherkin.DocStringArgument = {
Expand All @@ -54,6 +51,8 @@ class ScenarioTest extends AnyFunSuite with Matchers {
override def getContentType: String = ""

override def getLine: Int = line

override def getMediaType: String = ""
}
}

Expand All @@ -63,15 +62,17 @@ class ScenarioTest extends AnyFunSuite with Matchers {

override def getArgument: io.cucumber.core.gherkin.Argument = argument

override def getKeyWord: String = keyWord
override def getKeyword: String = keyWord

override def getType: io.cucumber.core.gherkin.StepType = stepType

override def getPreviousGivenWhenThenKeyWord: String = ""
override def getPreviousGivenWhenThenKeyword: String = ""

override def getText: String = text

override def getId: String = id

override def getLocation: Location = new Location(0, 0)
}
}

Expand All @@ -94,9 +95,9 @@ class ScenarioTest extends AnyFunSuite with Matchers {

override def getName: String = name

override def getLocation: io.cucumber.core.gherkin.Location = loc
override def getLocation: io.cucumber.plugin.event.Location = loc

override def getScenarioLocation: io.cucumber.core.gherkin.Location = loc
override def getScenarioLocation: io.cucumber.plugin.event.Location = loc

override def getSteps: util.List[io.cucumber.core.gherkin.Step] = steps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
*/
package org.opencypher.tools.tck.api.groups

import io.cucumber.core.gherkin.DocStringArgument

import java.net.URI
import java.util

import io.cucumber.core.gherkin.Pickle
import io.cucumber.plugin.event.Location
import org.opencypher.tools.tck.api.Dummy
import org.opencypher.tools.tck.api.Measure
import org.opencypher.tools.tck.api.Scenario
Expand All @@ -46,17 +48,9 @@ trait GroupTest extends Matchers {

override val getName: String = "name"

override val getLocation: io.cucumber.core.gherkin.Location = new io.cucumber.core.gherkin.Location() {
override val getLine: Int = 1

override val getColumn: Int = 1
}

override val getScenarioLocation: io.cucumber.core.gherkin.Location = new io.cucumber.core.gherkin.Location() {
override val getLine: Int = 1
override val getLocation: io.cucumber.plugin.event.Location = new io.cucumber.plugin.event.Location(1,1)

override val getColumn: Int = 1
}
override val getScenarioLocation: io.cucumber.plugin.event.Location = new io.cucumber.plugin.event.Location(1,1)

override val getSteps: util.List[io.cucumber.core.gherkin.Step] = new util.ArrayList[io.cucumber.core.gherkin.Step]()

Expand All @@ -70,23 +64,27 @@ trait GroupTest extends Matchers {
val dummyPickleStep: io.cucumber.core.gherkin.Step = new io.cucumber.core.gherkin.Step() {
override val getLine: Int = 1

override val getArgument: io.cucumber.core.gherkin.Argument = new io.cucumber.core.gherkin.DocStringArgument() {
override val getContent: String = "text"
override val getArgument: io.cucumber.core.gherkin.Argument = new DocStringArgument {
override def getContent: String = "text"

override val getContentType: String = ""
override def getContentType: String = ""

override val getLine: Int = 1
override def getMediaType: String = ""

override def getLine: Int = 1
}

override val getKeyWord: String = "keyWord"
override val getKeyword: String = "keyWord"

override val getType: io.cucumber.core.gherkin.StepType = io.cucumber.core.gherkin.StepType.GIVEN

override val getPreviousGivenWhenThenKeyWord: String = ""
override val getPreviousGivenWhenThenKeyword: String = ""

override val getText: String = "xyz"

override val getId: String = "id"

override def getLocation: Location = new Location(1, 1)
}

val dummySteps: List[Step] = List[Step](Dummy(dummyPickleStep), Measure(dummyPickleStep))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
*/
package org.opencypher.tools.tck.inspection.browser.cli

import io.cucumber.plugin.event.Location

import java.net.URI
import java.util

import org.opencypher.tools.tck.api.CypherTCK
import org.opencypher.tools.tck.api.Dummy
import org.opencypher.tools.tck.api.Measure
Expand All @@ -48,17 +49,9 @@ class CountScenariosTest extends AnyFunSuite with Matchers {

override def getName: String = "name"

override def getLocation: io.cucumber.core.gherkin.Location = new io.cucumber.core.gherkin.Location() {
override def getLine: Int = 1

override def getColumn: Int = 1
}

override def getScenarioLocation: io.cucumber.core.gherkin.Location = new io.cucumber.core.gherkin.Location() {
override def getLine: Int = 1
override def getLocation: io.cucumber.plugin.event.Location = new io.cucumber.plugin.event.Location(1,1)

override def getColumn: Int = 1
}
override def getScenarioLocation: io.cucumber.plugin.event.Location = new io.cucumber.plugin.event.Location(1,1)

override def getSteps: util.List[io.cucumber.core.gherkin.Step] = new util.ArrayList[io.cucumber.core.gherkin.Step]()

Expand All @@ -72,23 +65,27 @@ class CountScenariosTest extends AnyFunSuite with Matchers {
private def namedDummyPickleStep(name: String): io.cucumber.core.gherkin.Step = new io.cucumber.core.gherkin.Step() {
override def getLine: Int = 1

override def getArgument: io.cucumber.core.gherkin.Argument = new io.cucumber.core.gherkin.DocStringArgument() {
override def getArgument: io.cucumber.core.gherkin.Argument = new io.cucumber.core.gherkin.DocStringArgument {
override def getContent: String = "text"

override def getContentType: String = ""

override def getLine: Int = 1

override def getMediaType: String = ""
}

override def getKeyWord: String = "keyWord"
override def getKeyword: String = "keyWord"

override def getType: io.cucumber.core.gherkin.StepType = io.cucumber.core.gherkin.StepType.GIVEN

override def getPreviousGivenWhenThenKeyWord: String = ""
override def getPreviousGivenWhenThenKeyword: String = ""

override def getText: String = name

override def getId: String = "id"

override def getLocation: Location = new Location(1,1)
}

private val dummyPickleStep = namedDummyPickleStep("")
Expand Down
Loading

0 comments on commit 0f59f36

Please sign in to comment.