Skip to content

Commit

Permalink
Dependency updates; use Datafker instead of JavaFaker for !Fake symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
tcnh committed Dec 3, 2023
1 parent ac3e4e5 commit cf5eb40
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 29 deletions.
76 changes: 76 additions & 0 deletions toolchain-fitnesse-plugin/.github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: release

on:
push:
branches:
- 'master'

jobs:
maven-release:
runs-on: ubuntu-20.04
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Unsnapshot version
run: mvn versions:set -DremoveSnapshot
- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
server_id: staging
maven_profiles: release
gpg_private_key: ${{ secrets.gpg_private_key }}
gpg_passphrase: ${{ secrets.gpg_passphrase }}
nexus_username: ${{ secrets.MAVEN_USERNAME }}
nexus_password: ${{ secrets.MAVEN_PASSWORD }}
github-release:
needs: [ maven-release ]
runs-on: ubuntu-20.04
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- name: Unsnapshot version
run: mvn versions:set -DremoveSnapshot
- id: get-version
uses: JActions/[email protected]
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
release_name: "Toolchain FitNesse Fixtures ${{ steps.get-version.outputs.version }}"
body:
draft: false
prerelease: false
update-version:
needs: [maven-release, github-release]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Praegus"
- name: Update version
run: |
mvn -B release:update-versions -DautoVersionSubmodules=true
git add pom.xml
git commit -m "Update version"
git push origin master
41 changes: 16 additions & 25 deletions toolchain-fitnesse-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,28 @@
<!-- needed to be able to update version.properties -->
<toolchain-plugin.version>${project.version}</toolchain-plugin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.fitnesse</groupId>
<artifactId>fitnesse</artifactId>
<version>20221219</version>
<version>20231203</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>nl.praegus</groupId>
<artifactId>fitnesse-bootstrap-plus-theme</artifactId>
<version>2.0.15</version>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>nl.praegus</groupId>
Expand All @@ -48,17 +44,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.8.3</version>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<version>3.9.5</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>1.9.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -94,10 +85,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>8</source>
<target>8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -159,7 +150,7 @@
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
Expand Down Expand Up @@ -273,7 +264,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<version>1.2.1</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package nl.praegus.fitnesse.symbols;

import com.github.javafaker.Faker;
import fitnesse.wikitext.parser.Matcher;
import fitnesse.wikitext.parser.Maybe;
import fitnesse.wikitext.parser.Parser;
Expand All @@ -9,6 +8,7 @@
import fitnesse.wikitext.parser.SymbolType;
import fitnesse.wikitext.parser.Translation;
import fitnesse.wikitext.parser.Translator;
import net.datafaker.Faker;

import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -44,18 +44,19 @@ public String toTarget(Translator translator, Symbol symbol) {
Faker faker = new Faker(new Locale(symbol.findProperty(LOCALE, "en")));
String result;
try {
Object category = Faker.class.getDeclaredMethod(symbol.findProperty(CATEGORY, "")).invoke(faker);
Object category = Faker.class.getMethod(symbol.findProperty(CATEGORY, "")).invoke(faker);
result = category.getClass().getDeclaredMethod(symbol.findProperty(ITEM, "")).invoke(category).toString();
} catch (Exception e) {
result = "ERROR_FAKING_DATA";
e.printStackTrace();
}
return result;
}

protected Maybe<Symbol> storeParenthesisContent(Symbol current, Parser parser, String key) {
Maybe<Symbol> result = new Maybe<>(current);
List<Symbol> lookAhead = parser.peek(new SymbolType[]{SymbolType.Whitespace, SymbolType.OpenParenthesis});
if (lookAhead.size() != 0) {
if (!lookAhead.isEmpty()) {
parser.moveNext(2);
Maybe<String> format = parser.parseToAsString(SymbolType.CloseParenthesis);
if (format.isNothing()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void check_If_Html_Contains_FitNesse_Information() throws FileNotFoundExc

String expectedValue = "<tr><td>fitnesse</td>" + System.lineSeparator() +
"<td>20200404</td>" + System.lineSeparator() +
"<td>20230503</td>" + System.lineSeparator() +
"<td>20231203</td>" + System.lineSeparator() +
"<td class=\"Outdated\">Outdated</td>";

String expectedValue2 = "<a href=\"http://fitnesse.org/FitNesse.ReleaseNotes\" target=\"_blank\">fitnesse</a>";
Expand Down

0 comments on commit cf5eb40

Please sign in to comment.