aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2018-01-28 18:32:51 +0100
committerHåkon Hallingstad <hakon@oath.com>2018-01-28 18:32:51 +0100
commitbcd260cd95241cab4ac024abd2b6de49965e34ff (patch)
tree70b86b6468aeca74d5d1e4b8602f7f460c79ff68 /node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider
parent354b7c36e0f18a63b4b6ca8e4143bf278cba2925 (diff)
Implement debug handler
Diffstat (limited to 'node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider')
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
new file mode 100644
index 00000000000..723b9f0df8a
--- /dev/null
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
@@ -0,0 +1,35 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+package com.yahoo.vespa.hosted.node.admin.provider;
+
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+public class DebugHandlerHelperTest {
+ @Test
+ public void trivial() {
+ DebugHandlerHelper helper = new DebugHandlerHelper();
+ helper.addConstant("constant-key", "constant-value");
+
+ NodeAdminDebugHandler handler = new NodeAdminDebugHandler() {
+ @Override
+ public Map<String, Object> getDebugPage() {
+ return Collections.singletonMap("handler-value-key", "handler-value-value");
+ }
+ };
+ helper.addHandler("handler-key", handler);
+
+ helper.addThreadSafeSupplier("supplier-key", () -> "supplier-value");
+
+ assertEquals("{" +
+ "supplier-key=supplier-value, " +
+ "handler-key={handler-value-key=handler-value-value}, " +
+ "constant-key=constant-value" +
+ "}",
+ helper.getDebugPage().toString());
+ }
+} \ No newline at end of file