Skip to content

Commit 8578707

Browse files
authored
Fixes #360 - updated reflect-config.json reachability metadata (#362)
* Fixes #360 - updated reflect-config.json reachability metadata (#361) * test: increased shouldStartAndKillWorker delay * test: increased shouldStartAndKillWorker delay * test-ci: update maven cache * test-ci: add coverage phase for matrix * test-ci: updated matrix to use ubuntu-22.04 * test-ci: updated all matrices to use ubuntu-22.04 * test-ci: updated release to use ubuntu-22.04
1 parent ef662c6 commit 8578707

15 files changed

Lines changed: 141 additions & 48 deletions

File tree

.github/workflows/master-2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build-scan:
1111
name: SonarCloud Scan
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- uses: actions/checkout@v4
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
java: ['11', '17', '21']
38-
os: [ubuntu-latest, windows-latest]
38+
os: [ubuntu-22.04, windows-latest]
3939
runs-on: ${{ matrix.os }}
4040

4141
steps:

.github/workflows/master.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build-scan:
1111
name: SonarCloud Scan
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- uses: actions/checkout@v4
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
java: ['8', '11', '17', '21']
38-
os: [ubuntu-latest, windows-latest]
38+
os: [ubuntu-22.04, windows-latest]
3939
runs-on: ${{ matrix.os }}
4040

4141
steps:

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
java: ['8', '11', '17', '21']
15-
os: [ubuntu-latest, windows-latest]
15+
os: [ubuntu-22.04, windows-latest]
1616
runs-on: ${{ matrix.os }}
1717

1818
steps:
@@ -40,7 +40,7 @@ jobs:
4040
publish:
4141
name: Publish Release
4242
needs: [build-test]
43-
runs-on: ubuntu-latest
43+
runs-on: ubuntu-22.04
4444

4545
steps:
4646
- uses: actions/checkout@v4

.github/workflows/sonar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
sonar-analysis:
1313
name: SonarCloud Analysis for PR
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-22.04
1515

1616
steps:
1717
- name: Get PR details

.github/workflows/staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
required: true
1010
default: '17'
1111
os:
12-
description: 'Operating System (ubuntu-20.04, ubuntu-latest, windows-latest)'
12+
description: 'Operating System (ubuntu-22.04, ubuntu-latest, windows-latest)'
1313
required: true
1414
default: 'ubuntu-latest'
1515

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ Loading information into the switcher can be made by using *prepareEntry*, in ca
171171

172172
```java
173173
List<Entry> entries = new ArrayList<>();
174-
entries.add(Entry.build(StrategyValidator.DATE, "2019-12-10"));
175-
entries.add(Entry.build(StrategyValidator.DATE, "2020-12-10"));
174+
entries.add(Entry.of(StrategyValidator.DATE, "2019-12-10"));
175+
entries.add(Entry.of(StrategyValidator.DATE, "2020-12-10"));
176176

177177
switcher.prepareEntry(entries);
178178
switcher.isItOn();

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.switcherapi</groupId>
99
<artifactId>switcher-client</artifactId>
1010
<packaging>jar</packaging>
11-
<version>1.8.0</version>
11+
<version>1.8.1-SNAPSHOT</version>
1212

1313
<name>Switcher Client</name>
1414
<description>Switcher Client SDK for working with Switcher API</description>
@@ -73,7 +73,7 @@
7373
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
7474
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
7575
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
76-
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
76+
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
7777
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
7878
<sonar-maven-plugin.version>3.11.0.3922</sonar-maven-plugin.version>
7979
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
@@ -228,7 +228,6 @@
228228
<plugin>
229229
<groupId>org.sonarsource.scanner.maven</groupId>
230230
<artifactId>sonar-maven-plugin</artifactId>
231-
<version>${sonar-maven-plugin.version}</version>
232231
<executions>
233232
<execution>
234233
<phase>verify</phase>

src/main/java/com/switcherapi/client/model/Entry.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,29 @@ public class Entry {
1111
private final String strategy;
1212

1313
private final String input;
14-
15-
private Entry(final String strategy, final String input) {
14+
15+
public Entry(String strategy, String input) {
1616
this.strategy = strategy;
1717
this.input = input;
1818
}
19-
20-
private Entry(final StrategyValidator strategy, final String input) {
19+
20+
public Entry(StrategyValidator strategy, String input) {
2121
this(strategy.toString(), input);
2222
}
2323

2424
/**
25+
* Creates a new Entry with the given strategy and input.
26+
*
2527
* @param strategy Validator used to evaluate the Switcher
2628
* @param input follow the required format documented into each strategy type
2729
* @return new Entry
2830
* @see StrategyValidator
2931
*/
30-
public static Entry build(final StrategyValidator strategy, final String input) {
32+
public static Entry of(StrategyValidator strategy, String input) {
3133
return new Entry(strategy, input);
3234
}
33-
34-
public static Entry build(final String strategy, final String input) {
35+
36+
public static Entry of(String strategy, String input) {
3537
return new Entry(strategy, input);
3638
}
3739

src/main/java/com/switcherapi/client/model/SwitcherBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public SwitcherBuilder restrictRelay(boolean restrictRelay) {
9595
*/
9696
public SwitcherBuilder check(StrategyValidator strategy, String input) {
9797
if (StringUtils.isNotBlank(input)) {
98-
entry.add(Entry.build(strategy, input));
98+
entry.add(Entry.of(strategy, input));
9999
}
100100

101101
return this;

src/main/resources/META-INF/native-image/com.switcherapi/switcher-client/reflect-config.json

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"methods": [
99
{
1010
"name": "<init>",
11-
"parameterTypes": []
11+
"parameterTypes": [
12+
"java.lang.String",
13+
"java.lang.String"
14+
]
1215
}
1316
]
1417
},
@@ -21,7 +24,9 @@
2124
"methods": [
2225
{
2326
"name": "<init>",
24-
"parameterTypes": []
27+
"parameterTypes": [
28+
"com.switcherapi.client.model.Entry[]"
29+
]
2530
}
2631
]
2732
},
@@ -34,7 +39,14 @@
3439
"methods": [
3540
{
3641
"name": "<init>",
37-
"parameterTypes": []
42+
"parameterTypes": [
43+
"java.lang.String",
44+
"java.lang.String",
45+
"boolean",
46+
"com.switcherapi.client.model.criteria.StrategyConfig[]",
47+
"java.lang.String[]",
48+
"com.switcherapi.client.model.criteria.Relay"
49+
]
3850
}
3951
]
4052
},
@@ -73,7 +85,12 @@
7385
"methods": [
7486
{
7587
"name": "<init>",
76-
"parameterTypes": []
88+
"parameterTypes": [
89+
"java.lang.String",
90+
"java.lang.String",
91+
"boolean",
92+
"com.switcherapi.client.model.criteria.Config[]"
93+
]
7794
}
7895
]
7996
},
@@ -99,7 +116,29 @@
99116
"methods": [
100117
{
101118
"name": "<init>",
102-
"parameterTypes": []
119+
"parameterTypes": [
120+
"java.lang.String",
121+
"java.lang.String",
122+
"java.lang.String",
123+
"boolean",
124+
"java.lang.String[]"
125+
]
126+
}
127+
]
128+
},
129+
{
130+
"name": "com.switcherapi.client.model.criteria.Relay",
131+
"condition": {
132+
"typeReachable": "com.switcherapi.client.model.criteria.Snapshot"
133+
},
134+
"allDeclaredFields": true,
135+
"methods": [
136+
{
137+
"name": "<init>",
138+
"parameterTypes": [
139+
"java.lang.String",
140+
"boolean"
141+
]
103142
}
104143
]
105144
},

0 commit comments

Comments
 (0)