-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e8f67e
commit bb95b6e
Showing
37 changed files
with
2,733 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release Maven | ||
|
||
on: | ||
push: | ||
branches: [release/*] | ||
|
||
jobs: | ||
publish-mvn: | ||
name: Publish Maven Package | ||
runs-on: ubuntu-latest | ||
environment: Release | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
cache: 'maven' | ||
- uses: cucumber/action-publish-mvn@v2.0.0 | ||
with: | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
nexus-username: cukebot | ||
nexus-password: ${{ secrets.SONATYPE_PASSWORD }} | ||
working-directory: java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: test-java | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- renovate/** | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_call: | ||
|
||
jobs: | ||
test-java: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
java: ["11", "17"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: ${{ matrix.java }} | ||
cache: "maven" | ||
|
||
- run: mvn verify | ||
working-directory: java | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: test-testdata | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-testdata: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'npm' | ||
cache-dependency-path: testdata/package-lock.json | ||
|
||
- run: npm ci | ||
working-directory: testdata | ||
|
||
- name: check repository is not dirty | ||
run: "[[ -z $(git status --porcelain) ]]" | ||
|
||
- name: show diff | ||
if: ${{ failure() }} | ||
run: git status --porcelain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-parent</artifactId> | ||
<version>4.2.0</version> | ||
</parent> | ||
|
||
<artifactId>query</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>Cucumber Query</name> | ||
<description>Query messages</description> | ||
<url>https://github.com/cucumber/query</url> | ||
|
||
<properties> | ||
<project.Automatic-Module-Name>io.cucumber.query</project.Automatic-Module-Name> | ||
<project.build.outputTimestamp>1711217894</project.build.outputTimestamp> | ||
</properties> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/cucumber/query.git</connection> | ||
<developerConnection>scm:git:git@github.com:cucumber/query.git</developerConnection> | ||
<url>git://github.com/cucumber/query.git</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit</groupId> | ||
<artifactId>junit-bom</artifactId> | ||
<version>5.10.2</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson</groupId> | ||
<artifactId>jackson-bom</artifactId> | ||
<version>2.17.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>messages</artifactId> | ||
<version>[24.0.0,25.0.0)</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jdk8</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.module</groupId> | ||
<artifactId>jackson-module-parameter-names</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>3.25.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
90 changes: 90 additions & 0 deletions
90
java/src/main/java/io/cucumber/query/GherkinDocumentElements.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package io.cucumber.query; | ||
|
||
import io.cucumber.messages.types.Examples; | ||
import io.cucumber.messages.types.Feature; | ||
import io.cucumber.messages.types.GherkinDocument; | ||
import io.cucumber.messages.types.Rule; | ||
import io.cucumber.messages.types.Scenario; | ||
import io.cucumber.messages.types.TableRow; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* A structure containing all ancestors of a given element. | ||
* <p> | ||
* This works without any ordering because Gherkins document | ||
* structure is simple enough to hard code. | ||
*/ | ||
class GherkinDocumentElements { | ||
private final GherkinDocument document; | ||
private final Feature feature; | ||
private final Rule rule; | ||
private final Scenario scenario; | ||
private final Examples examples; | ||
private final TableRow example; | ||
private final Integer examplesIndex; | ||
private final Integer exampleIndex; | ||
|
||
GherkinDocumentElements(GherkinDocument document, Feature feature, Rule rule, Scenario scenario) { | ||
this(document, feature, rule, scenario, null, null, null, null); | ||
} | ||
|
||
GherkinDocumentElements(GherkinDocument document, Feature feature, Rule rule, Scenario scenario, Integer examplesIndex, Examples examples, Integer exampleIndex, TableRow example) { | ||
this.document = requireNonNull(document); | ||
this.feature = feature; | ||
this.rule = rule; | ||
this.scenario = scenario; | ||
this.examplesIndex = examplesIndex; | ||
this.examples = examples; | ||
this.exampleIndex = exampleIndex; | ||
this.example = example; | ||
} | ||
|
||
GherkinDocument document() { | ||
return document; | ||
} | ||
|
||
Optional<Feature> feature() { | ||
return Optional.ofNullable(feature); | ||
} | ||
|
||
Optional<Rule> rule() { | ||
return Optional.ofNullable(rule); | ||
} | ||
|
||
Optional<Scenario> scenario() { | ||
return Optional.ofNullable(scenario); | ||
} | ||
|
||
Optional<Examples> examples() { | ||
return Optional.ofNullable(examples); | ||
} | ||
|
||
Optional<TableRow> example() { | ||
return Optional.ofNullable(example); | ||
} | ||
|
||
Optional<Integer> examplesIndex() { | ||
return Optional.ofNullable(examplesIndex); | ||
} | ||
|
||
Optional<Integer> exampleIndex() { | ||
return Optional.ofNullable(exampleIndex); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
GherkinDocumentElements that = (GherkinDocumentElements) o; | ||
return document.equals(that.document) && feature.equals(that.feature) && Objects.equals(rule, that.rule) && scenario.equals(that.scenario) && Objects.equals(examples, that.examples) && Objects.equals(example, that.example) && Objects.equals(examplesIndex, that.examplesIndex) && Objects.equals(exampleIndex, that.exampleIndex); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(document, feature, rule, scenario, examples, example, examplesIndex, exampleIndex); | ||
} | ||
} |
Oops, something went wrong.