Skip to content

Commit a05e179

Browse files
authored
Update protos and tidy test code (#848)
* Consolidate on junit-jupiter and tidy POM Signed-off-by: Chad Wilson <[email protected]> * Update protos and regenerate Signed-off-by: Chad Wilson <[email protected]> * Remove unnecessary commons-io dependency Signed-off-by: Chad Wilson <[email protected]> * Bump go to 1.23 Signed-off-by: Chad Wilson <[email protected]> * Use more modern Maven version on GHA Signed-off-by: Chad Wilson <[email protected]> --------- Signed-off-by: Chad Wilson <[email protected]>
1 parent a556d62 commit a05e179

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7041
-3277
lines changed

.github/workflows/release_on_pr.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
uses: actions/setup-java@v4
2121
with:
2222
distribution: 'temurin'
23-
java-version: '11'
23+
java-version: '17'
24+
25+
- name: Set up Maven
26+
uses: stCarolas/setup-maven@v5
27+
with:
28+
maven-version: 3.9.9
2429

2530
- name: Setup maven
2631
run: |

.github/workflows/tests.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest]
1717
java_version: ['11', '17']
18+
fail-fast: false
19+
1820
steps:
1921
- uses: actions/checkout@v4
2022

@@ -24,11 +26,13 @@ jobs:
2426
distribution: 'temurin'
2527
java-version: ${{ matrix.java_version }}
2628

29+
- name: Set up Maven
30+
uses: stCarolas/setup-maven@v5
31+
with:
32+
maven-version: 3.9.9
2733

2834
- name: Run test
29-
run: |
30-
java -version
31-
mvn -q clean test
35+
run: mvn -q clean test
3236

3337
functional_tests:
3438
name: FTs - java 17 ${{ matrix.os }}
@@ -37,6 +41,7 @@ jobs:
3741
strategy:
3842
matrix:
3943
os: [windows-latest, ubuntu-latest]
44+
fail-fast: false
4045

4146
steps:
4247
- uses: actions/checkout@v4
@@ -53,6 +58,11 @@ jobs:
5358
distribution: 'temurin'
5459
java-version: '17'
5560

61+
- name: Set up Maven
62+
uses: stCarolas/setup-maven@v5
63+
with:
64+
maven-version: 3.9.9
65+
5666
- uses: getgauge/setup-gauge@master
5767
with:
5868
gauge-version: master
@@ -94,6 +104,7 @@ jobs:
94104
strategy:
95105
matrix:
96106
os: [ubuntu-latest, windows-latest]
107+
fail-fast: false
97108

98109
steps:
99110
- uses: actions/checkout@v4
@@ -110,6 +121,11 @@ jobs:
110121
distribution: 'temurin'
111122
java-version: '17'
112123

124+
- name: Set up Maven
125+
uses: stCarolas/setup-maven@v5
126+
with:
127+
maven-version: 3.9.9
128+
113129
- uses: getgauge/setup-gauge@master
114130
with:
115131
gauge-version: master

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "gauge-proto"]
22
path = gauge-proto
3-
url = http://github.com/getgauge/gauge-proto
3+
url = https://github.com/getgauge/gauge-proto/

CONTRIBUTING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@ Ex:
4242
Ex:
4343

4444

45-
* Update the productVersion property in `pom.xml`.
45+
* Update the version in `pom.xml`.
4646

4747
Ex:
4848

4949
```diff
50-
<properties>
51-
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
52-
- <projectVersion>0.7.5</projectVersion>
53-
+ <projectVersion>0.7.6</projectVersion>
54-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
50+
<artifactId>gauge-java</artifactId>
51+
- <version>0.11.0</version>
52+
+ <version>0.11.1</version>
53+
<description>Java plugin for Gauge</description>
5554
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/getgauge/gauge-java
22

3-
go 1.22
3+
go 1.23

java.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "java",
3-
"version": "0.11.0",
3+
"version": "0.11.1",
44
"description": "Java support for gauge",
55
"install": {
66
"windows": [],

pom.xml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,29 @@
44
<name>gauge-java</name>
55
<groupId>com.thoughtworks.gauge</groupId>
66
<artifactId>gauge-java</artifactId>
7-
<version>${projectVersion}</version>
7+
<version>0.11.1</version>
88
<description>Java plugin for Gauge</description>
99
<url>http://github.com/getgauge/gauge-java</url>
1010
<dependencyManagement>
1111
<dependencies>
1212
<dependency>
1313
<groupId>io.grpc</groupId>
1414
<artifactId>grpc-bom</artifactId>
15-
<version>1.68.0</version>
15+
<version>${grpc.version}</version>
16+
<type>pom</type>
17+
<scope>import</scope>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.junit</groupId>
21+
<artifactId>junit-bom</artifactId>
22+
<version>5.11.0</version>
23+
<type>pom</type>
24+
<scope>import</scope>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.mockito</groupId>
28+
<artifactId>mockito-bom</artifactId>
29+
<version>5.13.0</version>
1630
<type>pom</type>
1731
<scope>import</scope>
1832
</dependency>
@@ -34,11 +48,6 @@
3448
<artifactId>javaparser-core</artifactId>
3549
<version>3.26.2</version>
3650
</dependency>
37-
<dependency>
38-
<groupId>commons-io</groupId>
39-
<artifactId>commons-io</artifactId>
40-
<version>2.17.0</version>
41-
</dependency>
4251
<dependency>
4352
<groupId>org.apache.commons</groupId>
4453
<artifactId>commons-lang3</artifactId>
@@ -52,7 +61,7 @@
5261
<dependency>
5362
<groupId>com.google.protobuf</groupId>
5463
<artifactId>protobuf-java</artifactId>
55-
<version>4.28.2</version>
64+
<version>${protobuf.version}</version>
5665
</dependency>
5766
<dependency>
5867
<groupId>com.google.guava</groupId>
@@ -75,33 +84,30 @@
7584
<groupId>io.grpc</groupId>
7685
<artifactId>grpc-stub</artifactId>
7786
</dependency>
78-
<dependency>
79-
<groupId>javax.annotation</groupId>
80-
<artifactId>javax.annotation-api</artifactId>
81-
<version>1.3.2</version>
82-
</dependency>
8387
<dependency>
8488
<groupId>org.junit.jupiter</groupId>
8589
<artifactId>junit-jupiter-api</artifactId>
86-
<version>5.11.0</version>
8790
<scope>test</scope>
8891
</dependency>
8992
<dependency>
90-
<groupId>junit</groupId>
91-
<artifactId>junit</artifactId>
92-
<version>4.13.2</version>
93+
<groupId>org.junit.jupiter</groupId>
94+
<artifactId>junit-jupiter-engine</artifactId>
9395
<scope>test</scope>
9496
</dependency>
9597
<dependency>
9698
<groupId>org.hamcrest</groupId>
97-
<artifactId>hamcrest-core</artifactId>
99+
<artifactId>hamcrest</artifactId>
98100
<version>3.0</version>
99101
<scope>test</scope>
100102
</dependency>
101103
<dependency>
102104
<groupId>org.mockito</groupId>
103105
<artifactId>mockito-core</artifactId>
104-
<version>5.13.0</version>
106+
<scope>test</scope>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.mockito</groupId>
110+
<artifactId>mockito-junit-jupiter</artifactId>
105111
<scope>test</scope>
106112
</dependency>
107113
<dependency>
@@ -126,12 +132,15 @@
126132
<version>0.6.1</version>
127133
<configuration>
128134
<protocArtifact>
129-
com.google.protobuf:protoc:4.27.1:exe:${os.detected.classifier}
135+
com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
130136
</protocArtifact>
131137
<pluginId>grpc-java</pluginId>
132138
<pluginArtifact>
133-
io.grpc:protoc-gen-grpc-java:1.64.0:exe:${os.detected.classifier}
139+
io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
134140
</pluginArtifact>
141+
<pluginParameter>
142+
@generated=omit
143+
</pluginParameter>
135144
<protoSourceRoot>gauge-proto</protoSourceRoot>
136145
</configuration>
137146
<executions>
@@ -239,6 +248,11 @@
239248
</execution>
240249
</executions>
241250
</plugin>
251+
<plugin>
252+
<groupId>org.apache.maven.plugins</groupId>
253+
<artifactId>maven-surefire-plugin</artifactId>
254+
<version>3.5.0</version>
255+
</plugin>
242256
<plugin>
243257
<groupId>org.apache.maven.plugins</groupId>
244258
<artifactId>maven-dependency-plugin</artifactId>
@@ -302,12 +316,14 @@
302316

303317
<properties>
304318
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
305-
<projectVersion>0.11.0</projectVersion>
306319
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
307320
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
308321
<java.version>11</java.version>
309322
<maven.compiler.source>${java.version}</maven.compiler.source>
310323
<maven.compiler.target>${java.version}</maven.compiler.target>
324+
325+
<protobuf.version>4.28.2</protobuf.version>
326+
<grpc.version>1.68.0</grpc.version>
311327
</properties>
312328

313329
</project>

src/main/java/com/thoughtworks/gauge/command/SetupCommand.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
package com.thoughtworks.gauge.command;
77

88
import com.thoughtworks.gauge.Logger;
9-
import org.apache.commons.io.FileUtils;
109

11-
import java.io.FileOutputStream;
1210
import java.io.IOException;
11+
import java.nio.file.Files;
1312
import java.nio.file.Path;
1413
import java.nio.file.Paths;
14+
import java.nio.file.StandardOpenOption;
1515

1616
public class SetupCommand implements GaugeJavaCommand {
1717

@@ -105,8 +105,7 @@ public void execute() throws IOException {
105105

106106
private void writeContent(Path templateFilePath, String content) throws IOException {
107107
Logger.info(String.format("create %s", templateFilePath.toString()));
108-
FileOutputStream fileOutputStream = FileUtils.openOutputStream(templateFilePath.toFile(), true);
109-
fileOutputStream.write(content.getBytes());
108+
Files.writeString(templateFilePath, content, StandardOpenOption.APPEND);
110109
}
111110

112111
}

src/main/java/com/thoughtworks/gauge/processor/CacheFileRequestProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*----------------------------------------------------------------*/
66
package com.thoughtworks.gauge.processor;
77

8-
import com.google.common.base.Charsets;
98
import com.thoughtworks.gauge.scan.StaticScanner;
109
import gauge.messages.Messages;
1110

1211
import java.io.File;
12+
import java.nio.charset.StandardCharsets;
1313

1414
public class CacheFileRequestProcessor implements IMessageProcessor {
1515
private StaticScanner staticScanner;
@@ -47,7 +47,7 @@ public Messages.Message process(Messages.Message request) {
4747

4848
private void loadFromDisk(String fileName) {
4949
if ((new File(fileName).exists())) {
50-
staticScanner.reloadSteps(fileName, staticScanner.readFile(fileName, Charsets.UTF_8));
50+
staticScanner.reloadSteps(fileName, staticScanner.readFile(fileName, StandardCharsets.UTF_8));
5151
}
5252
}
5353
}

0 commit comments

Comments
 (0)