changeset 1125:4c188c94dff0

TestMetric
author Devel 2
date Fri, 05 Jun 2020 09:47:19 +0200
parents 83c771436e55
children ea20a5ad6d38
files stress-tester/src/test/java/com/passus/st/metric/TestMetric.java
diffstat 1 files changed, 66 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/test/java/com/passus/st/metric/TestMetric.java	Fri Jun 05 09:47:19 2020 +0200
@@ -0,0 +1,66 @@
+package com.passus.st.metric;
+
+import com.passus.commons.metric.GenericMetric;
+import com.passus.commons.metric.Metric;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+class TestMetric extends GenericMetric {
+
+    public TestMetric() {
+        addAttribute("int", Integer.class);
+        addAttribute("string", String.class);
+        addAttribute("map", Map.class);
+    }
+
+    @Override
+    public String getName() {
+        return "test";
+    }
+
+    @Override
+    public boolean isActive() {
+        return true;
+    }
+
+    @Override
+    public void activate() {
+
+    }
+
+    @Override
+    public void deactivate() {
+
+    }
+
+    @Override
+    public Serializable getAttributeValue(String name) {
+        switch (name) {
+            case "int":
+                return 1;
+            case "string":
+                return "testString";
+            case "map":
+                HashMap<String, Object> hashMap = new HashMap<>();
+                hashMap.put("key1", 1);
+                hashMap.put("key2", "value1");
+                hashMap.put("key3", null);
+                return hashMap;
+            default:
+                return null;
+        }
+    }
+
+    @Override
+    public void update(Metric metric) {
+
+    }
+
+    @Override
+    public void reset() {
+
+    }
+
+}