aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-01-28 17:49:25 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-01-29 17:57:26 +0100
commitc4536e50f0135c92a4093b45931178c50e9ff2f9 (patch)
tree9b5508b9c44cd2fee124d105ee50ec4284c3c94c /container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java
parent527035ccb63501f3e0b3f23157c2cd902eef551a (diff)
Remove usage of org.json:json
Remove most usage of org.json:json Maven artifact. This library does not have a compatible license. Some usage is still left as it's part of our container-search public API. We'll need a major release to fix that. See https://github.com/vespa-engine/vespa/issues/14762 for more details.
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java')
-rw-r--r--container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java b/container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java
index d025b9662d2..12852c9d54c 100644
--- a/container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java
+++ b/container-core/src/test/java/com/yahoo/container/jdisc/state/HostLifeGathererTest.java
@@ -1,8 +1,7 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.state;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Test;
import java.nio.file.Path;
@@ -16,15 +15,15 @@ import static org.junit.Assert.assertEquals;
public class HostLifeGathererTest {
@Test
- public void host_is_alive() throws JSONException {
- JSONObject packet = HostLifeGatherer.getHostLifePacket(new MockFileWrapper());
- JSONObject metrics = packet.getJSONObject("metrics");
- assertEquals("host_life", packet.getString("application"));
- assertEquals(0, packet.getInt("status_code"));
- assertEquals("OK", packet.getString("status_msg"));
-
- assertEquals(123l, metrics.getLong("uptime"));
- assertEquals(1, metrics.getInt("alive"));
+ public void host_is_alive() {
+ JsonNode packet = HostLifeGatherer.getHostLifePacket(new MockFileWrapper());
+ JsonNode metrics = packet.get("metrics");
+ assertEquals("host_life", packet.get("application").textValue());
+ assertEquals(0, packet.get("status_code").intValue());
+ assertEquals("OK", packet.get("status_msg").textValue());
+
+ assertEquals(123L, metrics.get("uptime").longValue());
+ assertEquals(1, metrics.get("alive").intValue());
}