From 9bc115652aa72af2c8bb19f4f6b1db8eee310d51 Mon Sep 17 00:00:00 2001
From: petruki <31597636+petruki@users.noreply.github.com>
Date: Sun, 5 Oct 2025 15:39:30 -0700
Subject: [PATCH] feat: removed data attribute from snapshot
---
pom.xml | 10 +-
snapshots/default.json | 66 +-
snapshots/dev1.json | 48 +-
.../client/model/criteria/Data.java | 19 -
.../client/model/criteria/Snapshot.java | 12 +-
.../client/remote/ClientWSImpl.java | 2 +-
.../remote/dto/SnapshotDataResponse.java | 16 +
.../switcher-client/reflect-config.json | 26 +-
.../SwitcherSnapshotAutoUpdateTest.java | 5 +-
.../switcherapi/client/model/ModelTest.java | 8 -
.../client/utils/SnapshotTest.java | 21 +-
.../fixture/MockWebServerHelper.java | 11 +-
src/test/resources/default.json | 66 +-
src/test/resources/defect_default.json | 11 +-
src/test/resources/snapshot/fixture1.json | 1354 ++++++++---------
src/test/resources/snapshot/fixture2.json | 52 +-
src/test/resources/snapshot/fixture3.json | 378 +++--
.../snapshot/playground/default.json | 66 +-
src/test/resources/snapshot_watcher.json | 40 +-
src/test/resources/test.json | 34 +-
src/test/resources/update/default.json | 42 +-
.../resources/update/default_outdated.json | 42 +-
22 files changed, 1142 insertions(+), 1187 deletions(-)
delete mode 100644 src/main/java/com/switcherapi/client/model/criteria/Data.java
create mode 100644 src/main/java/com/switcherapi/client/remote/dto/SnapshotDataResponse.java
diff --git a/pom.xml b/pom.xml
index 301b2f0a..7bd6a0e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
com.switcherapi
switcher-client
jar
- 2.4.2-SNAPSHOT
+ 2.5.0-SNAPSHOT
Switcher Client
Switcher Client SDK for working with Switcher API
@@ -59,19 +59,19 @@
5.1.0
- 5.13.4
+ 5.14.0
2.3.0
- 1.13.4
+ 1.14.0
- 3.14.0
+ 3.14.1
3.3.1
3.12.0
3.5.4
3.2.8
5.2.0.4988
0.8.13
- 0.8.0
+ 0.9.0
jacoco
diff --git a/snapshots/default.json b/snapshots/default.json
index 913e2048..205dab5d 100644
--- a/snapshots/default.json
+++ b/snapshots/default.json
@@ -1,37 +1,35 @@
{
- "data": {
- "domain": {
- "name": "Playground",
- "version": 1613542022439,
- "group": [
- {
- "name": "Release 1",
- "config": [
- {
- "key": "MY_SWITCHER",
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "operation": "EXIST",
- "values": [
- "user_1"
- ],
- "activated": false
- }
- ],
- "components": [
- "switcher-playground"
- ],
- "description": "My first switcher",
- "activated": false
- }
- ],
- "description": "",
- "activated": true
- }
- ],
- "description": "My playground",
- "activated": true
- }
+ "domain": {
+ "name": "Playground",
+ "version": 1613542022439,
+ "group": [
+ {
+ "name": "Release 1",
+ "config": [
+ {
+ "key": "MY_SWITCHER",
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "operation": "EXIST",
+ "values": [
+ "user_1"
+ ],
+ "activated": false
+ }
+ ],
+ "components": [
+ "switcher-playground"
+ ],
+ "description": "My first switcher",
+ "activated": false
+ }
+ ],
+ "description": "",
+ "activated": true
+ }
+ ],
+ "description": "My playground",
+ "activated": true
}
}
\ No newline at end of file
diff --git a/snapshots/dev1.json b/snapshots/dev1.json
index 63349813..063108db 100644
--- a/snapshots/dev1.json
+++ b/snapshots/dev1.json
@@ -1,28 +1,26 @@
{
- "data": {
- "domain": {
- "name": "Playground",
- "version": 1613542022439,
- "group": [
- {
- "name": "Release 1",
- "config": [
- {
- "key": "MY_SWITCHER",
- "strategies": [],
- "components": [
- "switcher-playground"
- ],
- "description": "My first switcher",
- "activated": true
- }
- ],
- "description": "",
- "activated": true
- }
- ],
- "description": "My playground",
- "activated": true
- }
+ "domain": {
+ "name": "Playground",
+ "version": 1613542022439,
+ "group": [
+ {
+ "name": "Release 1",
+ "config": [
+ {
+ "key": "MY_SWITCHER",
+ "strategies": [],
+ "components": [
+ "switcher-playground"
+ ],
+ "description": "My first switcher",
+ "activated": true
+ }
+ ],
+ "description": "",
+ "activated": true
+ }
+ ],
+ "description": "My playground",
+ "activated": true
}
}
\ No newline at end of file
diff --git a/src/main/java/com/switcherapi/client/model/criteria/Data.java b/src/main/java/com/switcherapi/client/model/criteria/Data.java
deleted file mode 100644
index 3058ac64..00000000
--- a/src/main/java/com/switcherapi/client/model/criteria/Data.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.switcherapi.client.model.criteria;
-
-/**
- * @author Roger Floriano (petruki)
- * @since 2019-12-24
- */
-public class Data {
-
- private Domain domain;
-
- public Domain getDomain() {
- return domain;
- }
-
- public void setDomain(Domain domain) {
- this.domain = domain;
- }
-
-}
diff --git a/src/main/java/com/switcherapi/client/model/criteria/Snapshot.java b/src/main/java/com/switcherapi/client/model/criteria/Snapshot.java
index 59422708..646dea06 100644
--- a/src/main/java/com/switcherapi/client/model/criteria/Snapshot.java
+++ b/src/main/java/com/switcherapi/client/model/criteria/Snapshot.java
@@ -7,18 +7,14 @@
*/
public class Snapshot {
- private Data data;
+ private Domain domain;
public Domain getDomain() {
- return data != null ? data.getDomain() : new Domain();
+ return domain != null ? domain : new Domain();
}
- public Data getData() {
- return data;
- }
-
- public void setData(Data data) {
- this.data = data;
+ public void setDomain(Domain domain) {
+ this.domain = domain;
}
}
diff --git a/src/main/java/com/switcherapi/client/remote/ClientWSImpl.java b/src/main/java/com/switcherapi/client/remote/ClientWSImpl.java
index 0b0745ab..943308a4 100644
--- a/src/main/java/com/switcherapi/client/remote/ClientWSImpl.java
+++ b/src/main/java/com/switcherapi/client/remote/ClientWSImpl.java
@@ -126,7 +126,7 @@ public Snapshot resolveSnapshot(final String token) {
throw new SwitcherRemoteException(url, response.statusCode());
}
- return gson.fromJson(response.body(), Snapshot.class);
+ return gson.fromJson(response.body(), SnapshotDataResponse.class).getData();
} catch (Exception e) {
return exceptionHandler(e, url);
}
diff --git a/src/main/java/com/switcherapi/client/remote/dto/SnapshotDataResponse.java b/src/main/java/com/switcherapi/client/remote/dto/SnapshotDataResponse.java
new file mode 100644
index 00000000..eefac50f
--- /dev/null
+++ b/src/main/java/com/switcherapi/client/remote/dto/SnapshotDataResponse.java
@@ -0,0 +1,16 @@
+package com.switcherapi.client.remote.dto;
+
+import com.switcherapi.client.model.criteria.Snapshot;
+
+public class SnapshotDataResponse {
+
+ private Snapshot data;
+
+ public Snapshot getData() {
+ return data;
+ }
+
+ public void setData(Snapshot data) {
+ this.data = data;
+ }
+}
diff --git a/src/main/resources/META-INF/native-image/com.switcherapi/switcher-client/reflect-config.json b/src/main/resources/META-INF/native-image/com.switcherapi/switcher-client/reflect-config.json
index a66c8382..a64f4c27 100644
--- a/src/main/resources/META-INF/native-image/com.switcherapi/switcher-client/reflect-config.json
+++ b/src/main/resources/META-INF/native-image/com.switcherapi/switcher-client/reflect-config.json
@@ -50,19 +50,6 @@
}
]
},
- {
- "name": "com.switcherapi.client.model.criteria.Data",
- "condition": {
- "typeReachable": "com.switcherapi.client.model.criteria.Snapshot"
- },
- "allDeclaredFields": true,
- "methods": [
- {
- "name": "",
- "parameterTypes": []
- }
- ]
- },
{
"name": "com.switcherapi.client.model.criteria.Domain",
"condition": {
@@ -210,5 +197,18 @@
"parameterTypes": []
}
]
+ },
+ {
+ "name": "com.switcherapi.client.remote.dto.SnapshotDataResponse",
+ "condition": {
+ "typeReachable": "com.switcherapi.client.remote.ClientWSImpl"
+ },
+ "allDeclaredFields": true,
+ "methods": [
+ {
+ "name": "",
+ "parameterTypes": []
+ }
+ ]
}
]
\ No newline at end of file
diff --git a/src/test/java/com/switcherapi/client/SwitcherSnapshotAutoUpdateTest.java b/src/test/java/com/switcherapi/client/SwitcherSnapshotAutoUpdateTest.java
index 991a7da3..1423a2f8 100644
--- a/src/test/java/com/switcherapi/client/SwitcherSnapshotAutoUpdateTest.java
+++ b/src/test/java/com/switcherapi/client/SwitcherSnapshotAutoUpdateTest.java
@@ -1,7 +1,6 @@
package com.switcherapi.client;
import com.switcherapi.Switchers;
-import com.switcherapi.client.model.criteria.Data;
import com.switcherapi.client.model.criteria.Domain;
import com.switcherapi.client.model.criteria.Snapshot;
import com.switcherapi.client.utils.SnapshotLoader;
@@ -60,9 +59,7 @@ void restoreStubs() {
static void generateFixture(String environment) {
final Snapshot mockedSnapshot = new Snapshot();
- final Data data = new Data();
- data.setDomain(DOMAIN_OUTDATED);
- mockedSnapshot.setData(data);
+ mockedSnapshot.setDomain(DOMAIN_OUTDATED);
SnapshotLoader.saveSnapshot(mockedSnapshot, SNAPSHOTS_LOCAL, environment);
}
diff --git a/src/test/java/com/switcherapi/client/model/ModelTest.java b/src/test/java/com/switcherapi/client/model/ModelTest.java
index 01ac7de6..122a09a7 100644
--- a/src/test/java/com/switcherapi/client/model/ModelTest.java
+++ b/src/test/java/com/switcherapi/client/model/ModelTest.java
@@ -75,14 +75,6 @@ void testCriteriaPackage() {
assertSame("Name", domain.getName());
assertEquals(10000000000L, domain.getVersion());
assertSame(groups, domain.getGroup());
-
- final Data data = new Data();
- data.setDomain(domain);
-
- final Snapshot snapshot = new Snapshot();
- snapshot.setData(data);
-
- assertSame(data, snapshot.getData());
}
}
diff --git a/src/test/java/com/switcherapi/client/utils/SnapshotTest.java b/src/test/java/com/switcherapi/client/utils/SnapshotTest.java
index 8ef99d0b..a032571a 100644
--- a/src/test/java/com/switcherapi/client/utils/SnapshotTest.java
+++ b/src/test/java/com/switcherapi/client/utils/SnapshotTest.java
@@ -1,7 +1,6 @@
package com.switcherapi.client.utils;
import com.switcherapi.SwitchersBase;
-import com.switcherapi.client.model.criteria.Data;
import com.switcherapi.client.model.criteria.Domain;
import com.switcherapi.client.model.criteria.Snapshot;
import com.switcherapi.client.service.WorkerName;
@@ -33,25 +32,21 @@ protected static void removeGeneratedFiles() throws IOException {
protected static void generateFixture() {
final Snapshot mockedSnapshot = new Snapshot();
- final Data data = new Data();
- data.setDomain(SnapshotLoader.loadSnapshot(SNAPSHOTS_LOCAL + "/snapshot_watcher.json"));
- mockedSnapshot.setData(data);
+ mockedSnapshot.setDomain(SnapshotLoader.loadSnapshot(SNAPSHOTS_LOCAL + "/snapshot_watcher.json"));
SnapshotLoader.saveSnapshot(mockedSnapshot, SNAPSHOTS_LOCAL, "generated_watcher_default");
}
protected void changeFixture() {
final Snapshot mockedSnapshot = new Snapshot();
- final Data data = new Data();
- data.setDomain(SnapshotLoader.loadSnapshot(SNAPSHOTS_LOCAL + "/snapshot_watcher.json"));
- mockedSnapshot.setData(data);
+ mockedSnapshot.setDomain(SnapshotLoader.loadSnapshot(SNAPSHOTS_LOCAL + "/snapshot_watcher.json"));
- data.setDomain(new Domain(
- data.getDomain().getName(),
- data.getDomain().getDescription(),
- !data.getDomain().isActivated(),
- data.getDomain().getVersion(),
- data.getDomain().getGroup()));
+ mockedSnapshot.setDomain(new Domain(
+ mockedSnapshot.getDomain().getName(),
+ mockedSnapshot.getDomain().getDescription(),
+ !mockedSnapshot.getDomain().isActivated(),
+ mockedSnapshot.getDomain().getVersion(),
+ mockedSnapshot.getDomain().getGroup()));
final Gson gson = new GsonBuilder().setPrettyPrinting().create();
writeFixture(gson.toJson(mockedSnapshot));
diff --git a/src/test/java/com/switcherapi/fixture/MockWebServerHelper.java b/src/test/java/com/switcherapi/fixture/MockWebServerHelper.java
index 745696d1..78ac9cab 100644
--- a/src/test/java/com/switcherapi/fixture/MockWebServerHelper.java
+++ b/src/test/java/com/switcherapi/fixture/MockWebServerHelper.java
@@ -1,9 +1,9 @@
package com.switcherapi.fixture;
-import com.switcherapi.client.model.criteria.Data;
import com.switcherapi.client.model.criteria.Snapshot;
import com.switcherapi.client.remote.ClientWSImpl;
import com.switcherapi.client.remote.dto.CriteriaRequest;
+import com.switcherapi.client.remote.dto.SnapshotDataResponse;
import com.switcherapi.client.utils.SnapshotLoader;
import com.switcherapi.client.utils.SwitcherUtils;
import com.google.gson.Gson;
@@ -71,13 +71,14 @@ protected MockResponse generateSnapshotResponse(String resourcesPath) {
*/
protected MockResponse generateSnapshotResponse(String snapshotFile, String resourcesPath) {
final Snapshot mockedSnapshot = new Snapshot();
- final Data data = new Data();
- data.setDomain(SnapshotLoader.loadSnapshot(resourcesPath + "/" + snapshotFile));
- mockedSnapshot.setData(data);
+ mockedSnapshot.setDomain(SnapshotLoader.loadSnapshot(resourcesPath + "/" + snapshotFile));
+
+ final SnapshotDataResponse data = new SnapshotDataResponse();
+ data.setData(mockedSnapshot);
Gson gson = new Gson();
MockResponse.Builder builder = new MockResponse.Builder();
- builder.body(gson.toJson(mockedSnapshot));
+ builder.body(gson.toJson(data));
builder.addHeader("Content-Type", "application/json");
return builder.build();
}
diff --git a/src/test/resources/default.json b/src/test/resources/default.json
index 4d4bcba6..a2fef320 100644
--- a/src/test/resources/default.json
+++ b/src/test/resources/default.json
@@ -1,37 +1,35 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "description": "Description of the domain",
- "activated": true,
- "version": 1588557288037,
- "group": [
- {
- "name": "Group 1",
- "description": "Description of the group",
- "activated": true,
- "config": [
- {
- "key": "USECASE11",
- "description": "Simple test - Domain disabled",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "operation": "EQUAL",
- "activated": false,
- "values": [
- "Value1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "description": "Description of the domain",
+ "activated": true,
+ "version": 1588557288037,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "Description of the group",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE11",
+ "description": "Simple test - Domain disabled",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "operation": "EQUAL",
+ "activated": false,
+ "values": [
+ "Value1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/defect_default.json b/src/test/resources/defect_default.json
index 40bdb62f..620cc449 100644
--- a/src/test/resources/defect_default.json
+++ b/src/test/resources/defect_default.json
@@ -1,7 +1,6 @@
{
- data: {
- domain: {
- name: "switcher-domain",
- description: "Fixture #1",
- activated: true,
- group: [
\ No newline at end of file
+ domain: {
+ name: "switcher-domain",
+ description: "Fixture #1",
+ activated: true,
+ group: [
\ No newline at end of file
diff --git a/src/test/resources/snapshot/fixture1.json b/src/test/resources/snapshot/fixture1.json
index a74bdcc5..7212a523 100644
--- a/src/test/resources/snapshot/fixture1.json
+++ b/src/test/resources/snapshot/fixture1.json
@@ -1,683 +1,681 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "version": 1588557288037,
- "description": "Fixture #1",
- "activated": true,
- "group": [
- {
- "name": "Group 1",
- "description": "Simple test",
- "activated": true,
- "config": [
- {
- "key": "USECASE11",
- "description": "Simple test - Config enabled",
- "activated": true,
- "components": [
- "switcher-client"
- ]
+ "domain": {
+ "name": "switcher-domain",
+ "version": 1588557288037,
+ "description": "Fixture #1",
+ "activated": true,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "Simple test",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE11",
+ "description": "Simple test - Config enabled",
+ "activated": true,
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE12",
+ "description": "Simple test - Config disabled",
+ "activated": false,
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 2",
+ "description": "Simple test - Group disabled",
+ "activated": false,
+ "config": [
+ {
+ "key": "USECASE21",
+ "description": "Simple test - Config enabled",
+ "activated": true,
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 3",
+ "description": "Date Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE31",
+ "description": "Config with Date Validation [GREATER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "DATE_VALIDATION",
+ "activated": true,
+ "operation": "GREATER",
+ "values": [
+ "2019-12-10"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE32",
+ "description": "Config with Date Validation [LOWER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "DATE_VALIDATION",
+ "activated": true,
+ "operation": "LOWER",
+ "values": [
+ "2019-12-10"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE33",
+ "description": "Config with Date Validation [BETWEEN]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "DATE_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "2019-12-10",
+ "2019-12-12"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 4",
+ "description": "Value Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE41",
+ "description": "Config with Value Validation [EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "Value1",
+ "Value2",
+ "Value3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE42",
+ "description": "Config with Value Validation [NOT_EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EXIST",
+ "values": [
+ "Value1",
+ "Value2",
+ "Value3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE43",
+ "description": "Config with Value Validation [EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": true,
+ "operation": "EQUAL",
+ "values": [
+ "Value1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE44",
+ "description": "Config with Value Validation [NOT_EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EQUAL",
+ "values": [
+ "Value1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 5",
+ "description": "Time Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE51",
+ "description": "Config with Time Validation [GREATER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "TIME_VALIDATION",
+ "activated": true,
+ "operation": "GREATER",
+ "values": [
+ "10:00"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE52",
+ "description": "Config with Time Validation [LOWER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "TIME_VALIDATION",
+ "activated": true,
+ "operation": "LOWER",
+ "values": [
+ "10:00"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE53",
+ "description": "Config with Time Validation [BETWEEN]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "TIME_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "10:00",
+ "16:00"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 6",
+ "description": "Network Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE61",
+ "description": "Config with Network Validation [EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NETWORK_VALIDATION",
+ "description": "From 10.0.0.0 to 10.0.0.7",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "10.0.0.0/29"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE62",
+ "description": "Config with Network Validation [NOT_EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NETWORK_VALIDATION",
+ "description": "From 10.0.0.0 to 10.0.0.7",
+ "activated": true,
+ "operation": "NOT_EXIST",
+ "values": [
+ "10.0.0.0/29"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE63",
+ "description": "Config with Network Validation [EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NETWORK_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "10.0.0.1",
+ "10.0.0.2",
+ "10.0.0.3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 7",
+ "description": "Simple test - Strategy disabled",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE71",
+ "description": "Simple test - Config enabled",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": false,
+ "operation": "EQUAL",
+ "values": [
+ "Value1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 8",
+ "description": "Numeric Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE81",
+ "description": "Config with Numeric Validation [EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "1",
+ "2",
+ "3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE82",
+ "description": "Config with Numeric Validation [NOT_EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EXIST",
+ "values": [
+ "1",
+ "2",
+ "3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE83",
+ "description": "Config with Numeric Validation [EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "EQUAL",
+ "values": [
+ "1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE84",
+ "description": "Config with Numeric Validation [NOT_EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EQUAL",
+ "values": [
+ "1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE85",
+ "description": "Config with Numeric Validation [LOWER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "LOWER",
+ "values": [
+ "1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE86",
+ "description": "Config with Numeric Validation [GREATER]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "GREATER",
+ "values": [
+ "1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE87",
+ "description": "Config with Numeric Validation [BETWEEN]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "1",
+ "3"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 9",
+ "description": "Regex Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE91",
+ "description": "Config with Regex Validation [EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "\\bUSER_[0-9]{1,2}\\b",
+ "\\buser-[0-9]{1,2}\\b"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE92",
+ "description": "Config with Regex Validation [NOT_EXIST]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EXIST",
+ "values": [
+ "\\bUSER_[0-9]{1,2}\\b",
+ "\\buser-[0-9]{1,2}\\b"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE93",
+ "description": "Config with Regex Validation [EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "EQUAL",
+ "values": [
+ "USER_[0-9]{1,2}"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE94",
+ "description": "Config with Regex Validation [NOT_EQUAL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "NOT_EQUAL",
+ "values": [
+ "USER_[0-9]{1,2}"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE95",
+ "description": "Config with Regex Validation [EXIST] - ReDoS attempt",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "^(([a-z])+.)+[A-Z]([a-z])+$"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 10",
+ "description": "Payload Validation",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE100",
+ "description": "Config with Payload Validation [HAS_ONE]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "PAYLOAD_VALIDATION",
+ "activated": true,
+ "operation": "HAS_ONE",
+ "values": [
+ "order.tracking.status",
+ "order.tracking.date"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE101",
+ "description": "Config with Payload Validation [HAS_ONE]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "PAYLOAD_VALIDATION",
+ "activated": true,
+ "operation": "HAS_ONE",
+ "values": [
+ "product"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE102",
+ "description": "Config with Payload Validation [HAS_ALL]",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "PAYLOAD_VALIDATION",
+ "activated": true,
+ "operation": "HAS_ALL",
+ "values": [
+ "name",
+ "categories",
+ "order",
+ "order.qty",
+ "order.tracking",
+ "order.tracking.status",
+ "order.tracking.comments"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "Group 11",
+ "description": "Relay group",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE103",
+ "description": "Relay enabled",
+ "activated": true,
+ "relay": {
+ "type": "VALIDATOR",
+ "activated": true
},
- {
- "key": "USECASE12",
- "description": "Simple test - Config disabled",
- "activated": false,
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 2",
- "description": "Simple test - Group disabled",
- "activated": false,
- "config": [
- {
- "key": "USECASE21",
- "description": "Simple test - Config enabled",
- "activated": true,
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 3",
- "description": "Date Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE31",
- "description": "Config with Date Validation [GREATER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "DATE_VALIDATION",
- "activated": true,
- "operation": "GREATER",
- "values": [
- "2019-12-10"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
+ "components": [
+ "switcher-client"
+ ]
+ },
+ {
+ "key": "USECASE104",
+ "description": "Relay disabled",
+ "relay": {
+ "type": "VALIDATOR",
+ "activated": false
},
- {
- "key": "USECASE32",
- "description": "Config with Date Validation [LOWER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "DATE_VALIDATION",
- "activated": true,
- "operation": "LOWER",
- "values": [
- "2019-12-10"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE33",
- "description": "Config with Date Validation [BETWEEN]",
- "activated": true,
- "strategies": [
- {
- "strategy": "DATE_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "2019-12-10",
- "2019-12-12"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 4",
- "description": "Value Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE41",
- "description": "Config with Value Validation [EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "Value1",
- "Value2",
- "Value3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE42",
- "description": "Config with Value Validation [NOT_EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": true,
- "operation": "NOT_EXIST",
- "values": [
- "Value1",
- "Value2",
- "Value3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE43",
- "description": "Config with Value Validation [EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": true,
- "operation": "EQUAL",
- "values": [
- "Value1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE44",
- "description": "Config with Value Validation [NOT_EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": true,
- "operation": "NOT_EQUAL",
- "values": [
- "Value1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 5",
- "description": "Time Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE51",
- "description": "Config with Time Validation [GREATER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "TIME_VALIDATION",
- "activated": true,
- "operation": "GREATER",
- "values": [
- "10:00"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE52",
- "description": "Config with Time Validation [LOWER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "TIME_VALIDATION",
- "activated": true,
- "operation": "LOWER",
- "values": [
- "10:00"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE53",
- "description": "Config with Time Validation [BETWEEN]",
- "activated": true,
- "strategies": [
- {
- "strategy": "TIME_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "10:00",
- "16:00"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 6",
- "description": "Network Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE61",
- "description": "Config with Network Validation [EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NETWORK_VALIDATION",
- "description": "From 10.0.0.0 to 10.0.0.7",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "10.0.0.0/29"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE62",
- "description": "Config with Network Validation [NOT_EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NETWORK_VALIDATION",
- "description": "From 10.0.0.0 to 10.0.0.7",
- "activated": true,
- "operation": "NOT_EXIST",
- "values": [
- "10.0.0.0/29"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE63",
- "description": "Config with Network Validation [EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NETWORK_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "10.0.0.1",
- "10.0.0.2",
- "10.0.0.3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 7",
- "description": "Simple test - Strategy disabled",
- "activated": true,
- "config": [
- {
- "key": "USECASE71",
- "description": "Simple test - Config enabled",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": false,
- "operation": "EQUAL",
- "values": [
- "Value1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 8",
- "description": "Numeric Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE81",
- "description": "Config with Numeric Validation [EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "1",
- "2",
- "3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE82",
- "description": "Config with Numeric Validation [NOT_EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "NOT_EXIST",
- "values": [
- "1",
- "2",
- "3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE83",
- "description": "Config with Numeric Validation [EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "EQUAL",
- "values": [
- "1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE84",
- "description": "Config with Numeric Validation [NOT_EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "NOT_EQUAL",
- "values": [
- "1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE85",
- "description": "Config with Numeric Validation [LOWER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "LOWER",
- "values": [
- "1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE86",
- "description": "Config with Numeric Validation [GREATER]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "GREATER",
- "values": [
- "1"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE87",
- "description": "Config with Numeric Validation [BETWEEN]",
- "activated": true,
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "1",
- "3"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 9",
- "description": "Regex Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE91",
- "description": "Config with Regex Validation [EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "\\bUSER_[0-9]{1,2}\\b",
- "\\buser-[0-9]{1,2}\\b"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE92",
- "description": "Config with Regex Validation [NOT_EXIST]",
- "activated": true,
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "NOT_EXIST",
- "values": [
- "\\bUSER_[0-9]{1,2}\\b",
- "\\buser-[0-9]{1,2}\\b"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE93",
- "description": "Config with Regex Validation [EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "EQUAL",
- "values": [
- "USER_[0-9]{1,2}"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE94",
- "description": "Config with Regex Validation [NOT_EQUAL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "NOT_EQUAL",
- "values": [
- "USER_[0-9]{1,2}"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE95",
- "description": "Config with Regex Validation [EXIST] - ReDoS attempt",
- "activated": true,
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "^(([a-z])+.)+[A-Z]([a-z])+$"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 10",
- "description": "Payload Validation",
- "activated": true,
- "config": [
- {
- "key": "USECASE100",
- "description": "Config with Payload Validation [HAS_ONE]",
- "activated": true,
- "strategies": [
- {
- "strategy": "PAYLOAD_VALIDATION",
- "activated": true,
- "operation": "HAS_ONE",
- "values": [
- "order.tracking.status",
- "order.tracking.date"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE101",
- "description": "Config with Payload Validation [HAS_ONE]",
- "activated": true,
- "strategies": [
- {
- "strategy": "PAYLOAD_VALIDATION",
- "activated": true,
- "operation": "HAS_ONE",
- "values": [
- "product"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE102",
- "description": "Config with Payload Validation [HAS_ALL]",
- "activated": true,
- "strategies": [
- {
- "strategy": "PAYLOAD_VALIDATION",
- "activated": true,
- "operation": "HAS_ALL",
- "values": [
- "name",
- "categories",
- "order",
- "order.qty",
- "order.tracking",
- "order.tracking.status",
- "order.tracking.comments"
- ]
- }
- ],
- "components": [
- "switcher-client"
- ]
- }
- ]
- },
- {
- "name": "Group 11",
- "description": "Relay group",
- "activated": true,
- "config": [
- {
- "key": "USECASE103",
- "description": "Relay enabled",
- "activated": true,
- "relay": {
- "type": "VALIDATOR",
- "activated": true
- },
- "components": [
- "switcher-client"
- ]
- },
- {
- "key": "USECASE104",
- "description": "Relay disabled",
- "relay": {
- "type": "VALIDATOR",
- "activated": false
- },
- "activated": true,
- "components": [
- "switcher-client"
- ]
- }
- ]
- }
- ]
- }
+ "activated": true,
+ "components": [
+ "switcher-client"
+ ]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/snapshot/fixture2.json b/src/test/resources/snapshot/fixture2.json
index 323c0fe5..31312cc2 100644
--- a/src/test/resources/snapshot/fixture2.json
+++ b/src/test/resources/snapshot/fixture2.json
@@ -1,30 +1,28 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "description": "Fixture #2 - Domain disabled",
- "activated": false,
- "group": [
- {
- "name": "Group 1",
- "description": "Simple test",
- "activated": true,
- "config": [
- {
- "key": "USECASE111",
- "description": "Simple test - Domain disabled",
- "activated": true,
- "components": ["switcher-client"]
- },
- {
- "key": "USECASE112",
- "description": "Simple test - Domain disabled",
- "activated": true,
- "components": ["switcher-client"]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "description": "Fixture #2 - Domain disabled",
+ "activated": false,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "Simple test",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE111",
+ "description": "Simple test - Domain disabled",
+ "activated": true,
+ "components": ["switcher-client"]
+ },
+ {
+ "key": "USECASE112",
+ "description": "Simple test - Domain disabled",
+ "activated": true,
+ "components": ["switcher-client"]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/snapshot/fixture3.json b/src/test/resources/snapshot/fixture3.json
index 438dd75c..74983ff1 100644
--- a/src/test/resources/snapshot/fixture3.json
+++ b/src/test/resources/snapshot/fixture3.json
@@ -1,193 +1,191 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "version": 1588557288037,
- "description": "Fixture #3 - Exceptions test",
- "activated": true,
- "group": [
- {
- "name": "Group 1",
- "description": "Simple test",
- "activated": true,
- "config": [
- {
- "key": "USECASE11",
- "description": "It contains an invalid strategy validation name",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "INVALID_NAME_FOR_VALIDATION",
- "activated": true,
- "operation": "EQUAL",
- "values": [
- "Value1"
- ]
- }
- ]
- },
- {
- "key": "USECASE12",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "NETWORK_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "10.0.0.1", "10.0.0.2"
- ]
- }
- ]
- },
- {
- "key": "USECASE13",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "Value1", "Value2"
- ]
- }
- ]
- },
- {
- "key": "USECASE14",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "DATE_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "2019-12-10", "2019-12-10"
- ]
- }
- ]
- },
- {
- "key": "USECASE15",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "TIME_VALIDATION",
- "activated": true,
- "operation": "EXIST",
- "values": [
- "12:00", "01:00"
- ]
- }
- ]
- },
- {
- "key": "USECASE16",
- "description": "It contains an invalid strategy operation values. Should have 2",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "DATE_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "2019-12-10"
- ]
- }
- ]
- },
- {
- "key": "USECASE17",
- "description": "It contains an invalid strategy operation values. Should have 2",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "TIME_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "12:00"
- ]
- }
- ]
- },
- {
- "key": "USECASE18",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "NOT_BETWEEN",
- "values": [
- "1", "3"
- ]
- }
- ]
- },
- {
- "key": "USECASE19",
- "description": "It contains an invalid number of values for the given operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "NUMERIC_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "1"
- ]
- }
- ]
- },
- {
- "key": "USECASE20",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "REGEX_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": [
- "[0-9]", "[a-Z]"
- ]
- }
- ]
- },
- {
- "key": "USECASE21",
- "description": "It contains an invalid strategy operation",
- "activated": true,
- "components": ["switcher-client"],
- "strategies": [
- {
- "strategy": "PAYLOAD_VALIDATION",
- "activated": true,
- "operation": "BETWEEN",
- "values": []
- }
- ]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "version": 1588557288037,
+ "description": "Fixture #3 - Exceptions test",
+ "activated": true,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "Simple test",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE11",
+ "description": "It contains an invalid strategy validation name",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "INVALID_NAME_FOR_VALIDATION",
+ "activated": true,
+ "operation": "EQUAL",
+ "values": [
+ "Value1"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE12",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "NETWORK_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "10.0.0.1", "10.0.0.2"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE13",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "Value1", "Value2"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE14",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "DATE_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "2019-12-10", "2019-12-10"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE15",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "TIME_VALIDATION",
+ "activated": true,
+ "operation": "EXIST",
+ "values": [
+ "12:00", "01:00"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE16",
+ "description": "It contains an invalid strategy operation values. Should have 2",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "DATE_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "2019-12-10"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE17",
+ "description": "It contains an invalid strategy operation values. Should have 2",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "TIME_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "12:00"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE18",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "NOT_BETWEEN",
+ "values": [
+ "1", "3"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE19",
+ "description": "It contains an invalid number of values for the given operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "NUMERIC_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "1"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE20",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "REGEX_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": [
+ "[0-9]", "[a-Z]"
+ ]
+ }
+ ]
+ },
+ {
+ "key": "USECASE21",
+ "description": "It contains an invalid strategy operation",
+ "activated": true,
+ "components": ["switcher-client"],
+ "strategies": [
+ {
+ "strategy": "PAYLOAD_VALIDATION",
+ "activated": true,
+ "operation": "BETWEEN",
+ "values": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/snapshot/playground/default.json b/src/test/resources/snapshot/playground/default.json
index 50874441..e3ae1793 100644
--- a/src/test/resources/snapshot/playground/default.json
+++ b/src/test/resources/snapshot/playground/default.json
@@ -1,37 +1,35 @@
{
- "data": {
- "domain": {
- "name": "Switcher API",
- "version": 0,
- "description": "Feature Flag - Toggle - Cloud-based",
- "activated": true,
- "group": [
- {
- "name": "Test Project",
- "description": "Test",
- "activated": true,
- "config": [
- {
- "key": "CLIENT_JAVA_FEATURE",
- "description": "Used for Integration test for the Switcher Client Java",
- "activated": true,
- "strategies": [
- {
- "strategy": "VALUE_VALIDATION",
- "operation": "EXIST",
- "activated": true,
- "values": [
- "user_1"
- ]
- }
- ],
- "components": [
- "switcher-client-java"
- ]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "Switcher API",
+ "version": 0,
+ "description": "Feature Flag - Toggle - Cloud-based",
+ "activated": true,
+ "group": [
+ {
+ "name": "Test Project",
+ "description": "Test",
+ "activated": true,
+ "config": [
+ {
+ "key": "CLIENT_JAVA_FEATURE",
+ "description": "Used for Integration test for the Switcher Client Java",
+ "activated": true,
+ "strategies": [
+ {
+ "strategy": "VALUE_VALIDATION",
+ "operation": "EXIST",
+ "activated": true,
+ "values": [
+ "user_1"
+ ]
+ }
+ ],
+ "components": [
+ "switcher-client-java"
+ ]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/snapshot_watcher.json b/src/test/resources/snapshot_watcher.json
index f4b13005..0356c5f3 100644
--- a/src/test/resources/snapshot_watcher.json
+++ b/src/test/resources/snapshot_watcher.json
@@ -1,24 +1,22 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "description": "Snapshot Watcher",
- "activated": true,
- "group": [
- {
- "name": "Group 1",
- "description": "Simple test",
- "activated": true,
- "config": [
- {
- "key": "USECASE11",
- "description": "Simple test - Domain disabled",
- "activated": true,
- "components": ["switcher-client"]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "description": "Snapshot Watcher",
+ "activated": true,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "Simple test",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE11",
+ "description": "Simple test - Domain disabled",
+ "activated": true,
+ "components": ["switcher-client"]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/test.json b/src/test/resources/test.json
index 52cd0c8e..3745eced 100644
--- a/src/test/resources/test.json
+++ b/src/test/resources/test.json
@@ -1,21 +1,19 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "activated": true,
- "group": [
- {
- "name": "Group 1",
- "activated": true,
- "config": [
- {
- "key": "USECASE11",
- "activated": true,
- "components": ["switcher-client"]
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "activated": true,
+ "group": [
+ {
+ "name": "Group 1",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE11",
+ "activated": true,
+ "components": ["switcher-client"]
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/update/default.json b/src/test/resources/update/default.json
index c675e416..7c76fc11 100644
--- a/src/test/resources/update/default.json
+++ b/src/test/resources/update/default.json
@@ -1,25 +1,23 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "version": 2,
- "description": "Snapshot Auto Update",
- "activated": true,
- "group": [
- {
- "name": "Group 1",
- "description": "",
- "activated": true,
- "config": [
- {
- "key": "USECASE_AUTO",
- "description": "",
- "activated": true,
- "components": []
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "version": 2,
+ "description": "Snapshot Auto Update",
+ "activated": true,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE_AUTO",
+ "description": "",
+ "activated": true,
+ "components": []
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/test/resources/update/default_outdated.json b/src/test/resources/update/default_outdated.json
index d832ddd7..58d4447c 100644
--- a/src/test/resources/update/default_outdated.json
+++ b/src/test/resources/update/default_outdated.json
@@ -1,25 +1,23 @@
{
- "data": {
- "domain": {
- "name": "switcher-domain",
- "version": 1,
- "description": "Snapshot Auto Update",
- "activated": false,
- "group": [
- {
- "name": "Group 1",
- "description": "",
- "activated": true,
- "config": [
- {
- "key": "USECASE_AUTO",
- "description": "",
- "activated": true,
- "components": []
- }
- ]
- }
- ]
- }
+ "domain": {
+ "name": "switcher-domain",
+ "version": 1,
+ "description": "Snapshot Auto Update",
+ "activated": false,
+ "group": [
+ {
+ "name": "Group 1",
+ "description": "",
+ "activated": true,
+ "config": [
+ {
+ "key": "USECASE_AUTO",
+ "description": "",
+ "activated": true,
+ "components": []
+ }
+ ]
+ }
+ ]
}
}
\ No newline at end of file