summaryrefslogtreecommitdiffstats
path: root/configserver-flags
diff options
context:
space:
mode:
authorrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>2023-08-29 17:02:12 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-29 23:37:31 +0200
commit9ad528fdbc466133b67d55baadf1c01181cefea3 (patch)
treebf7b540188f9a64d99ac8b9f4cb6ff579c25dab1 /configserver-flags
parent306dce28ed3cfa0d2f4679fd2519db3d1ac780c7 (diff)
- Update dependency org.jvnet.mimepull:mimepull to v1.10.0
- Update dependency org.apache.opennlp:opennlp-tools to v1.9.4 - Use dependency-versions - Bring jimfs up to date. - Bring some more libraries up-2-date. - Reduce usage of assertj
Diffstat (limited to 'configserver-flags')
-rw-r--r--configserver-flags/pom.xml5
-rw-r--r--configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java101
2 files changed, 52 insertions, 54 deletions
diff --git a/configserver-flags/pom.xml b/configserver-flags/pom.xml
index 63525805669..02824f2e6e3 100644
--- a/configserver-flags/pom.xml
+++ b/configserver-flags/pom.xml
@@ -110,11 +110,6 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
<plugins>
diff --git a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java
index 2700ab114e9..3c4c99e0337 100644
--- a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java
+++ b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java
@@ -23,8 +23,8 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author hakonhall
@@ -36,8 +36,6 @@ public class FlagsHandlerTest {
"id2", true, List.of("joe"), "2010-01-01", "2030-01-01", "desc2", "mod2",
FetchVector.Dimension.HOSTNAME, FetchVector.Dimension.APPLICATION_ID);
- private static final String FLAGS_V1_URL = "https://foo.com:4443/flags/v1";
-
private final FlagsDb flagsDb = new FlagsDbImpl(new MockCurator());
private final FlagsHandler handler = new FlagsHandler(FlagsHandler.testContext(), flagsDb);
@@ -71,14 +69,15 @@ public class FlagsHandlerTest {
void testData() {
// PUT flag with ID id1
verifySuccessfulRequest(Method.PUT, "/data/" + FLAG1.id(),
- "{\n" +
- " \"id\": \"id1\",\n" +
- " \"rules\": [\n" +
- " {\n" +
- " \"value\": true\n" +
- " }\n" +
- " ]\n" +
- "}",
+ """
+ {
+ "id": "id1",
+ "rules": [
+ {
+ "value": true
+ }
+ ]
+ }""",
"");
// GET on ID id1 should return the same as the put.
@@ -99,29 +98,31 @@ public class FlagsHandlerTest {
// PUT id2
verifySuccessfulRequest(Method.PUT, "/data/" + FLAG2.id(),
- "{\n" +
- " \"id\": \"id2\",\n" +
- " \"rules\": [\n" +
- " {\n" +
- " \"conditions\": [\n" +
- " {\n" +
- " \"type\": \"whitelist\",\n" +
- " \"dimension\": \"hostname\",\n" +
- " \"values\": [ \"host1\", \"host2\" ]\n" +
- " },\n" +
- " {\n" +
- " \"type\": \"blacklist\",\n" +
- " \"dimension\": \"application\",\n" +
- " \"values\": [ \"app1\", \"app2\" ]\n" +
- " }\n" +
- " ],\n" +
- " \"value\": true\n" +
- " }\n" +
- " ],\n" +
- " \"attributes\": {\n" +
- " \"zone\": \"zone1\"\n" +
- " }\n" +
- "}\n",
+ """
+ {
+ "id": "id2",
+ "rules": [
+ {
+ "conditions": [
+ {
+ "type": "whitelist",
+ "dimension": "hostname",
+ "values": [ "host1", "host2" ]
+ },
+ {
+ "type": "blacklist",
+ "dimension": "application",
+ "values": [ "app1", "app2" ]
+ }
+ ],
+ "value": true
+ }
+ ],
+ "attributes": {
+ "zone": "zone1"
+ }
+ }
+ """,
"");
// GET on id2 should now return what was put
@@ -135,14 +136,16 @@ public class FlagsHandlerTest {
// Putting (overriding) id1 should work silently
verifySuccessfulRequest(Method.PUT, "/data/" + FLAG1.id(),
- "{\n" +
- " \"id\": \"id1\",\n" +
- " \"rules\": [\n" +
- " {\n" +
- " \"value\": false\n" +
- " }\n" +
- " ]\n" +
- "}\n",
+ """
+ {
+ "id": "id1",
+ "rules": [
+ {
+ "value": false
+ }
+ ]
+ }
+ """,
"");
// Verify PUT
@@ -162,16 +165,16 @@ public class FlagsHandlerTest {
@Test
void testForcing() {
- assertThat(handle(Method.PUT, "/data/" + new FlagId("undef"), "", 400)).contains("There is no flag 'undef'");
+ assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef"), "", 400).contains("There is no flag 'undef'"));
- assertThat(handle(Method.PUT, "/data/" + new FlagId("undef") + "?force=true", "", 400)).
- contains("No content to map due to end-of-input");
+ assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef") + "?force=true", "", 400).
+ contains("No content to map due to end-of-input"));
- assertThat(handle(Method.PUT, "/data/" + FLAG1.id(), "{}", 400)).
- contains("Flag ID missing");
+ assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{}", 400).
+ contains("Flag ID missing"));
- assertThat(handle(Method.PUT, "/data/" + FLAG1.id(), "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 400)).
- contains("Wrong type of JsonNode: STRING");
+ assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 400).
+ contains("Wrong type of JsonNode: STRING"));
assertEquals(handle(Method.PUT, "/data/" + FLAG1.id() + "?force=true", "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 200),
"");