From d4db4d882ba4646b196f907ebbfdaab348f9f7b7 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 13:41:18 +0100 Subject: [PATCH 1/9] Reformat code, organize imports, fix spelling --- .../main/java/bisq/monitor/Configurable.java | 8 ++--- .../src/main/java/bisq/monitor/Metric.java | 4 +-- .../src/main/java/bisq/monitor/Monitor.java | 32 +++++++++++-------- .../src/main/java/bisq/monitor/Reporter.java | 11 ++++--- .../main/java/bisq/monitor/metric/Dummy.java | 7 ++-- .../metric/TorHiddenServiceStartupTime.java | 19 +++++------ .../bisq/monitor/metric/TorRoundtripTime.java | 29 +++++++++-------- .../bisq/monitor/metric/TorStartupTime.java | 15 +++++---- .../monitor/reporter/ConsoleReporter.java | 6 ++-- .../monitor/reporter/GraphiteReporter.java | 14 ++++---- 10 files changed, 79 insertions(+), 66 deletions(-) diff --git a/monitor/src/main/java/bisq/monitor/Configurable.java b/monitor/src/main/java/bisq/monitor/Configurable.java index 9746a3833d..43212c0d68 100644 --- a/monitor/src/main/java/bisq/monitor/Configurable.java +++ b/monitor/src/main/java/bisq/monitor/Configurable.java @@ -20,8 +20,8 @@ package bisq.monitor; import java.util.Properties; /** - * Does some precomputation for a configurable class. - * + * Does some pre-computation for a configurable class. + * * @author Florian Reimair */ public abstract class Configurable { @@ -42,7 +42,7 @@ public abstract class Configurable { * example, a property MyName.answer=42 is made available as * configuration.getProperty("answer") resulting in * 42. - * + * * @param properties a set of configuration properties */ public void configure(final Properties properties) { @@ -65,7 +65,7 @@ public abstract class Configurable { /** * Set the name used to filter through configuration properties. See * {@link Configurable#configure(Properties)}. - * + * * @param name */ protected void setName(String name) { diff --git a/monitor/src/main/java/bisq/monitor/Metric.java b/monitor/src/main/java/bisq/monitor/Metric.java index b255f59201..ed537e7784 100644 --- a/monitor/src/main/java/bisq/monitor/Metric.java +++ b/monitor/src/main/java/bisq/monitor/Metric.java @@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j; * it down gracefully. Furthermore, configuration updates and execution are done * in a thread-save manner. Implementing classes only have to implement the * {@link Metric#execute()} method. - * + * * @author Florian Reimair */ @Slf4j @@ -102,7 +102,7 @@ public abstract class Metric extends Configurable implements Runnable { else if (!configuration.containsKey(INTERVAL)) log.error("{} is missing mandatory '" + INTERVAL + "' property. Will not run.", getName()); else - log.error("{} is misconfigured. Will not run.", getName()); + log.error("{} is mis-configured. Will not run.", getName()); } else if (!enabled() && configuration.getProperty("enabled", "false").equals("true")) { // check if this Metric got activated after being disabled. // if so, resume execution diff --git a/monitor/src/main/java/bisq/monitor/Monitor.java b/monitor/src/main/java/bisq/monitor/Monitor.java index acc720ed75..491a784c07 100644 --- a/monitor/src/main/java/bisq/monitor/Monitor.java +++ b/monitor/src/main/java/bisq/monitor/Monitor.java @@ -17,26 +17,30 @@ package bisq.monitor; -import java.io.File; -import java.io.FileInputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; +import bisq.monitor.metric.TorHiddenServiceStartupTime; +import bisq.monitor.metric.TorRoundtripTime; +import bisq.monitor.metric.TorStartupTime; +import bisq.monitor.reporter.GraphiteReporter; import org.berndpruenster.netlayer.tor.NativeTor; import org.berndpruenster.netlayer.tor.Tor; -import bisq.monitor.metric.TorStartupTime; -import bisq.monitor.reporter.ConsoleReporter; -import bisq.monitor.reporter.GraphiteReporter; -import bisq.monitor.metric.TorRoundtripTime; -import bisq.monitor.metric.TorHiddenServiceStartupTime; +import java.io.File; +import java.io.FileInputStream; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + import lombok.extern.slf4j.Slf4j; + + + import sun.misc.Signal; /** * Monitor executable for the Bisq network. - * + * * @author Florian Reimair */ @Slf4j @@ -56,7 +60,7 @@ public class Monitor { /** * Starts up all configured Metrics. - * + * * @throws Exception */ private void start() throws Throwable { @@ -132,7 +136,7 @@ public class Monitor { /** * Overloads a default set of properties with a file if given - * + * * @return a set of properties * @throws Exception */ @@ -142,7 +146,7 @@ public class Monitor { Properties result = new Properties(defaults); - if(args.length > 0) + if (args.length > 0) result.load(new FileInputStream(args[0])); return result; diff --git a/monitor/src/main/java/bisq/monitor/Reporter.java b/monitor/src/main/java/bisq/monitor/Reporter.java index 641fed9972..8538d93c03 100644 --- a/monitor/src/main/java/bisq/monitor/Reporter.java +++ b/monitor/src/main/java/bisq/monitor/Reporter.java @@ -22,7 +22,7 @@ import java.util.Map; /** * Reports findings to a specific service/file/place using the proper means to * do so. - * + * * @author Florian Reimair */ public abstract class Reporter extends Configurable { @@ -30,16 +30,17 @@ public abstract class Reporter extends Configurable { public Reporter() { setName(this.getClass().getSimpleName()); } + /** * Report our findings. - * + * * @param value */ public abstract void report(long value); /** * Report our findings - * + * * @param l * @param prefix */ @@ -47,14 +48,14 @@ public abstract class Reporter extends Configurable { /** * Report our findings. - * + * * @param values Map */ public abstract void report(Map values); /** * Report our findings. - * + * * @param values Map * @param prefix for example "bisq.torStartupTime" */ diff --git a/monitor/src/main/java/bisq/monitor/metric/Dummy.java b/monitor/src/main/java/bisq/monitor/metric/Dummy.java index 35e625ce6c..6cbaa50e60 100644 --- a/monitor/src/main/java/bisq/monitor/metric/Dummy.java +++ b/monitor/src/main/java/bisq/monitor/metric/Dummy.java @@ -17,15 +17,16 @@ package bisq.monitor.metric; -import java.util.Properties; - import bisq.monitor.Metric; import bisq.monitor.Reporter; + +import java.util.Properties; + import lombok.extern.slf4j.Slf4j; /** * A dummy metric for development purposes. - * + * * @author Florian Reimair */ @Slf4j diff --git a/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java b/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java index 7f3d4a39b3..a42805c339 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java @@ -17,19 +17,20 @@ package bisq.monitor.metric; -import java.io.File; -import java.io.IOException; +import bisq.monitor.Metric; +import bisq.monitor.Reporter; import org.berndpruenster.netlayer.tor.HiddenServiceSocket; -import bisq.monitor.Metric; -import bisq.monitor.Reporter; +import java.io.File; +import java.io.IOException; + import lombok.extern.slf4j.Slf4j; /** * A Metric to measure the startup time of a Tor Hidden Service on a already * running Tor. - * + * * @author Florian Reimair */ @Slf4j @@ -66,12 +67,12 @@ public class TorHiddenServiceStartupTime extends Metric { @Override protected void execute() { - // prepare settings. Fetch them everytime we run the Metric so we do not have to + // prepare settings. Fetch them every time we run the Metric so we do not have to // restart on a config update int localPort = Integer.parseInt(configuration.getProperty(LOCAL_PORT, "9998")); int servicePort = Integer.parseInt(configuration.getProperty(SERVICE_PORT, "9999")); - // clear directory so we get a new onion address everytime + // clear directory so we get a new onion address every time new File(hiddenServiceDirectory).delete(); log.debug("creating the hidden service"); @@ -90,8 +91,8 @@ public class TorHiddenServiceStartupTime extends Metric { }); await(); - log.debug("going to unpublish the hidden service..."); + log.debug("going to revoke the hidden service..."); hiddenServiceSocket.close(); - log.debug("[going to unpublish the hidden service...] done"); + log.debug("[going to revoke the hidden service...] done"); } } diff --git a/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java b/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java index 03dca0d8af..23b999f641 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java @@ -17,8 +17,19 @@ package bisq.monitor.metric; -import java.io.IOException; +import bisq.monitor.Metric; +import bisq.monitor.Reporter; + +import org.berndpruenster.netlayer.tor.Tor; +import org.berndpruenster.netlayer.tor.TorCtlException; + +import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy; +import com.runjva.sourceforge.jsocks.protocol.SocksSocket; + import java.net.URL; + +import java.io.IOException; + import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -26,17 +37,9 @@ import java.util.List; import java.util.LongSummaryStatistics; import java.util.Map; -import org.berndpruenster.netlayer.tor.Tor; -import org.berndpruenster.netlayer.tor.TorCtlException; -import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy; -import com.runjva.sourceforge.jsocks.protocol.SocksSocket; - -import bisq.monitor.Metric; -import bisq.monitor.Reporter; - /** * A Metric to measure the round-trip time to the Bisq seednodes via plain tor. - * + * * @author Florian Reimair */ public class TorRoundtripTime extends Metric { @@ -80,7 +83,7 @@ public class TorRoundtripTime extends Metric { // aftermath Collections.sort(samples); - // - average, max, min , samplesize + // - average, max, min , sample size LongSummaryStatistics statistics = samples.stream().mapToLong(val -> val).summaryStatistics(); Map results = new HashMap<>(); @@ -91,7 +94,7 @@ public class TorRoundtripTime extends Metric { // - p25, median, p75 Integer[] percentiles = new Integer[]{25, 50, 75}; - for(Integer percentile : percentiles) { + for (Integer percentile : percentiles) { double rank = statistics.getCount() * percentile / 100; Long percentileValue; if (samples.size() <= rank + 1) @@ -101,7 +104,7 @@ public class TorRoundtripTime extends Metric { else percentileValue = Math.round(samples.get((int) Math.floor(rank)) + (samples.get((int) (Math.floor(rank) + 1)) - samples.get((int) Math.floor(rank))) - / (rank - Math.floor(rank))); + / (rank - Math.floor(rank))); results.put("p" + percentile, String.valueOf(percentileValue)); } diff --git a/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java b/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java index b343676477..cc7cee58be 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java @@ -17,23 +17,24 @@ package bisq.monitor.metric; -import java.io.File; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Properties; +import bisq.monitor.Metric; +import bisq.monitor.Reporter; import org.berndpruenster.netlayer.tor.NativeTor; import org.berndpruenster.netlayer.tor.Tor; import org.berndpruenster.netlayer.tor.TorCtlException; import org.berndpruenster.netlayer.tor.Torrc; -import bisq.monitor.Metric; -import bisq.monitor.Reporter; +import java.io.File; +import java.io.IOException; + +import java.util.LinkedHashMap; +import java.util.Properties; /** * A Metric to measure the deployment and startup time of the packaged Tor * binaries. - * + * * @author Florian Reimair */ public class TorStartupTime extends Metric { diff --git a/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java b/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java index 2a93d7a88a..e7ba9f2024 100644 --- a/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java +++ b/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java @@ -17,14 +17,14 @@ package bisq.monitor.reporter; +import bisq.monitor.Reporter; + import java.util.HashMap; import java.util.Map; -import bisq.monitor.Reporter; - /** * A simple console reporter. - * + * * @author Florian Reimair */ public class ConsoleReporter extends Reporter { diff --git a/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java b/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java index a1a85778ef..2afbecb4b4 100644 --- a/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java +++ b/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java @@ -17,18 +17,20 @@ package bisq.monitor.reporter; -import java.io.IOException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; +import bisq.monitor.Reporter; import org.berndpruenster.netlayer.tor.TorSocket; -import bisq.monitor.Reporter; +import java.net.URL; + +import java.io.IOException; + +import java.util.HashMap; +import java.util.Map; /** * Reports our findings to a graphite service. - * + * * @author Florian Reimair */ public class GraphiteReporter extends Reporter { From 2762d74c8f8228f7b41ae5aa9f510974ffcbfe75 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 13:44:57 +0100 Subject: [PATCH 2/9] Rename TorRoundtripTime to TorRoundTripTime --- monitor/src/main/java/bisq/monitor/Monitor.java | 4 ++-- .../src/main/java/bisq/monitor/metric/TorRoundtripTime.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor/src/main/java/bisq/monitor/Monitor.java b/monitor/src/main/java/bisq/monitor/Monitor.java index 491a784c07..c06d21a5d3 100644 --- a/monitor/src/main/java/bisq/monitor/Monitor.java +++ b/monitor/src/main/java/bisq/monitor/Monitor.java @@ -18,7 +18,7 @@ package bisq.monitor; import bisq.monitor.metric.TorHiddenServiceStartupTime; -import bisq.monitor.metric.TorRoundtripTime; +import bisq.monitor.metric.TorRoundTripTime; import bisq.monitor.metric.TorStartupTime; import bisq.monitor.reporter.GraphiteReporter; @@ -74,7 +74,7 @@ public class Monitor { // - add available metrics with their reporters metrics.add(new TorStartupTime(graphiteReporter)); - metrics.add(new TorRoundtripTime(graphiteReporter)); + metrics.add(new TorRoundTripTime(graphiteReporter)); metrics.add(new TorHiddenServiceStartupTime(graphiteReporter)); // prepare configuration reload diff --git a/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java b/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java index 23b999f641..b08810a404 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java @@ -38,16 +38,16 @@ import java.util.LongSummaryStatistics; import java.util.Map; /** - * A Metric to measure the round-trip time to the Bisq seednodes via plain tor. + * A Metric to measure the round-trip time to the Bisq seed nodes via plain tor. * * @author Florian Reimair */ -public class TorRoundtripTime extends Metric { +public class TorRoundTripTime extends Metric { private static final String SAMPLE_SIZE = "run.sampleSize"; private static final String HOSTS = "run.hosts"; - public TorRoundtripTime(Reporter reporter) { + public TorRoundTripTime(Reporter reporter) { super(reporter); } From 2d8ca8c0f990da1407ca3298b7f0e5f7e70de235 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 13:53:30 +0100 Subject: [PATCH 3/9] Add monitor directory as parent for test directories - Apply reorg imports and reformat to test classes --- .../src/main/java/bisq/monitor/Monitor.java | 2 +- ...undtripTime.java => TorRoundTripTime.java} | 0 .../TorHiddenServiceStartupTimeTests.java | 14 +++++++------ ...eTests.java => TorRoundTripTimeTests.java} | 20 ++++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) rename monitor/src/main/java/bisq/monitor/metric/{TorRoundtripTime.java => TorRoundTripTime.java} (100%) rename monitor/src/test/java/bisq/monitor/{TorRoundtripTimeTests.java => TorRoundTripTimeTests.java} (95%) diff --git a/monitor/src/main/java/bisq/monitor/Monitor.java b/monitor/src/main/java/bisq/monitor/Monitor.java index c06d21a5d3..ab448aac90 100644 --- a/monitor/src/main/java/bisq/monitor/Monitor.java +++ b/monitor/src/main/java/bisq/monitor/Monitor.java @@ -65,7 +65,7 @@ public class Monitor { */ private void start() throws Throwable { // start Tor - Tor.setDefault(new NativeTor(new File("monitor-tor"), null, null, false)); + Tor.setDefault(new NativeTor(new File("monitor/monitor-tor"), null, null, false)); // assemble Metrics // - create reporters diff --git a/monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java b/monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java similarity index 100% rename from monitor/src/main/java/bisq/monitor/metric/TorRoundtripTime.java rename to monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java diff --git a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java index cd246eecfd..cbf6defc5d 100644 --- a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java @@ -17,23 +17,25 @@ package bisq.monitor; -import java.io.File; -import java.util.Map; -import java.util.Properties; +import bisq.monitor.metric.TorHiddenServiceStartupTime; import org.berndpruenster.netlayer.tor.NativeTor; import org.berndpruenster.netlayer.tor.Tor; import org.berndpruenster.netlayer.tor.TorCtlException; + +import java.io.File; + +import java.util.Map; +import java.util.Properties; + import org.junit.Assert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import bisq.monitor.metric.TorHiddenServiceStartupTime; - public class TorHiddenServiceStartupTimeTests { - private final static File torWorkingDirectory = new File(TorHiddenServiceStartupTimeTests.class.getSimpleName()); + private final static File torWorkingDirectory = new File("monitor/" + TorHiddenServiceStartupTimeTests.class.getSimpleName()); /** * A dummy Reporter for development purposes. diff --git a/monitor/src/test/java/bisq/monitor/TorRoundtripTimeTests.java b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java similarity index 95% rename from monitor/src/test/java/bisq/monitor/TorRoundtripTimeTests.java rename to monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java index 9f14e99ffc..970bf19fa0 100644 --- a/monitor/src/test/java/bisq/monitor/TorRoundtripTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java @@ -17,27 +17,29 @@ package bisq.monitor; -import java.io.File; -import java.util.Map; -import java.util.Properties; +import bisq.monitor.metric.TorRoundTripTime; import org.berndpruenster.netlayer.tor.NativeTor; import org.berndpruenster.netlayer.tor.Tor; import org.berndpruenster.netlayer.tor.TorCtlException; + +import java.io.File; + +import java.util.Map; +import java.util.Properties; + import org.junit.Assert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import bisq.monitor.metric.TorRoundtripTime; - /** * Test the roundtrip time metric against the hidden service of torproject.org. - * + * * @author Florian Reimair */ -public class TorRoundtripTimeTests { +public class TorRoundTripTimeTests { /** * A dummy Reporter for development purposes. @@ -71,7 +73,7 @@ public class TorRoundtripTimeTests { } } - private static File workingDirectory = new File(TorRoundtripTimeTests.class.getSimpleName()); + private static File workingDirectory = new File(TorRoundTripTimeTests.class.getSimpleName()); @BeforeAll public static void setup() throws TorCtlException { @@ -93,7 +95,7 @@ public class TorRoundtripTimeTests { // torproject.org hidden service configuration.put("TorRoundtripTime.run.hosts", "http://expyuzz4wqqyqhjn.onion:80"); - Metric DUT = new TorRoundtripTime(reporter); + Metric DUT = new TorRoundTripTime(reporter); // start DUT.configure(configuration); From cb533f4364506cacc43717461d837e695f6126fd Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 13:54:08 +0100 Subject: [PATCH 4/9] Update gitignore - Add /monitor/TorHiddenServiceStartupTimeTests/* and /monitor/monitor-tor/* --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0b3cd7ebdc..544eb84dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ desktop.ini *.class deploy */releases/* +/monitor/TorHiddenServiceStartupTimeTests/* +/monitor/monitor-tor/* From 1c58d894653bb911b20b26538084dbaab398a057 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 14:13:26 +0100 Subject: [PATCH 5/9] Apply code inspection - Fix spelling - Remove exception throw clause which was never thrown - Add not null preconditions - Remove unneeded types in diamonds - Add final - Fix java doc - Make Reporter constructor protected (abstract) --- monitor/README.md | 12 +++++------ .../src/main/java/bisq/monitor/Monitor.java | 8 ++++++-- .../src/main/java/bisq/monitor/Reporter.java | 4 ++-- .../metric/TorHiddenServiceStartupTime.java | 3 +-- .../bisq/monitor/metric/TorRoundTripTime.java | 8 ++++++-- .../bisq/monitor/metric/TorStartupTime.java | 2 +- .../monitor/reporter/ConsoleReporter.java | 4 ++-- .../monitor/reporter/GraphiteReporter.java | 2 +- monitor/src/main/resources/metrics.properties | 10 +++++----- .../monitor/MonitorInfrastructureTests.java | 8 ++++---- .../TorHiddenServiceStartupTimeTests.java | 6 +++++- .../bisq/monitor/TorRoundTripTimeTests.java | 20 +++++++++++-------- 12 files changed, 51 insertions(+), 36 deletions(-) diff --git a/monitor/README.md b/monitor/README.md index 296b502056..9e170823d3 100644 --- a/monitor/README.md +++ b/monitor/README.md @@ -36,11 +36,11 @@ TorStartupTime.enabled=true TorStartupTime.run.interval=100 TorStartupTime.run.socksPort=90500 # so that there is no interference with a system Tor -#TorRoundtripTime Metric -TorRoundtripTime.enabled=true -TorRoundtripTime.run.interval=100 -TorRoundtripTime.run.sampleSize=5 -TorRoundtripTime.run.hosts=http://expyuzz4wqqyqhjn.onion:80 # torproject.org hidden service +#TorRoundTripTime Metric +TorRoundTripTime.enabled=true +TorRoundTripTime.run.interval=100 +TorRoundTripTime.run.sampleSize=5 +TorRoundTripTime.run.hosts=http://expyuzz4wqqyqhjn.onion:80 # torproject.org hidden service #TorHiddenServiceStartupTime Metric TorHiddenServiceStartupTime.enabled=true @@ -54,4 +54,4 @@ TorHiddenServiceStartupTime.run.servicePort=90511 # so that there is no interfer #GraphiteReporter GraphiteReporter.serviceUrl=http://yourHiddenService.onion:2003 -``` \ No newline at end of file +``` diff --git a/monitor/src/main/java/bisq/monitor/Monitor.java b/monitor/src/main/java/bisq/monitor/Monitor.java index ab448aac90..f69bfd9739 100644 --- a/monitor/src/main/java/bisq/monitor/Monitor.java +++ b/monitor/src/main/java/bisq/monitor/Monitor.java @@ -34,6 +34,8 @@ import java.util.Properties; import lombok.extern.slf4j.Slf4j; +import static com.google.common.base.Preconditions.checkNotNull; + import sun.misc.Signal; @@ -56,7 +58,7 @@ public class Monitor { /** * A list of all active {@link Metric}s */ - private List metrics = new ArrayList<>(); + private final List metrics = new ArrayList<>(); /** * Starts up all configured Metrics. @@ -108,7 +110,9 @@ public class Monitor { } log.info("shutting down tor"); - Tor.getDefault().shutdown(); + Tor tor = Tor.getDefault(); + checkNotNull(tor, "tor must not be null"); + tor.shutdown(); log.info("system halt"); } diff --git a/monitor/src/main/java/bisq/monitor/Reporter.java b/monitor/src/main/java/bisq/monitor/Reporter.java index 8538d93c03..b38042353b 100644 --- a/monitor/src/main/java/bisq/monitor/Reporter.java +++ b/monitor/src/main/java/bisq/monitor/Reporter.java @@ -27,7 +27,7 @@ import java.util.Map; */ public abstract class Reporter extends Configurable { - public Reporter() { + protected Reporter() { setName(this.getClass().getSimpleName()); } @@ -41,7 +41,7 @@ public abstract class Reporter extends Configurable { /** * Report our findings * - * @param l + * @param value * @param prefix */ public abstract void report(long value, String prefix); diff --git a/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java b/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java index a42805c339..39ba8bd75f 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorHiddenServiceStartupTime.java @@ -23,7 +23,6 @@ import bisq.monitor.Reporter; import org.berndpruenster.netlayer.tor.HiddenServiceSocket; import java.io.File; -import java.io.IOException; import lombok.extern.slf4j.Slf4j; @@ -40,7 +39,7 @@ public class TorHiddenServiceStartupTime extends Metric { private static final String LOCAL_PORT = "run.localPort"; private final String hiddenServiceDirectory = "metric_" + getName(); - public TorHiddenServiceStartupTime(Reporter reporter) throws IOException { + public TorHiddenServiceStartupTime(Reporter reporter) { super(reporter); } diff --git a/monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java b/monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java index b08810a404..ab5f6da546 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorRoundTripTime.java @@ -37,6 +37,8 @@ import java.util.List; import java.util.LongSummaryStatistics; import java.util.Map; +import static com.google.common.base.Preconditions.checkNotNull; + /** * A Metric to measure the round-trip time to the Bisq seed nodes via plain tor. * @@ -53,10 +55,12 @@ public class TorRoundTripTime extends Metric { @Override protected void execute() { - SocksSocket socket = null; + SocksSocket socket; try { // fetch proxy - Socks5Proxy proxy = Tor.getDefault().getProxy(); + Tor tor = Tor.getDefault(); + checkNotNull(tor, "tor must not be null"); + Socks5Proxy proxy = tor.getProxy(); // for each configured host for (String current : configuration.getProperty(HOSTS, "").split(",")) { diff --git a/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java b/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java index cc7cee58be..a4336caa42 100644 --- a/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java +++ b/monitor/src/main/java/bisq/monitor/metric/TorStartupTime.java @@ -52,7 +52,7 @@ public class TorStartupTime extends Metric { super.configure(properties); synchronized (this) { - LinkedHashMap overrides = new LinkedHashMap(); + LinkedHashMap overrides = new LinkedHashMap<>(); overrides.put("SOCKSPort", configuration.getProperty(SOCKS_PORT, "90500")); try { diff --git a/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java b/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java index e7ba9f2024..0b2050a5cb 100644 --- a/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java +++ b/monitor/src/main/java/bisq/monitor/reporter/ConsoleReporter.java @@ -31,7 +31,7 @@ public class ConsoleReporter extends Reporter { @Override public void report(long value, String prefix) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); result.put("", String.valueOf(value)); report(result, "bisq"); @@ -39,7 +39,7 @@ public class ConsoleReporter extends Reporter { @Override public void report(long value) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); result.put("", String.valueOf(value)); report(result); } diff --git a/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java b/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java index 2afbecb4b4..fd18f3af9c 100644 --- a/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java +++ b/monitor/src/main/java/bisq/monitor/reporter/GraphiteReporter.java @@ -37,7 +37,7 @@ public class GraphiteReporter extends Reporter { @Override public void report(long value, String prefix) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); result.put("", String.valueOf(value)); report(result, prefix); diff --git a/monitor/src/main/resources/metrics.properties b/monitor/src/main/resources/metrics.properties index 5c1989910f..482796cd94 100644 --- a/monitor/src/main/resources/metrics.properties +++ b/monitor/src/main/resources/metrics.properties @@ -12,11 +12,11 @@ TorStartupTime.enabled=true TorStartupTime.run.interval=100 TorStartupTime.run.socksPort=90500 -TorRoundtripTime.enabled=true -TorRoundtripTime.run.interval=100 -TorRoundtripTime.run.sampleSize=3 +TorRoundTripTime.enabled=true +TorRoundTripTime.run.interval=100 +TorRoundTripTime.run.sampleSize=3 # torproject.org hidden service -TorRoundtripTime.run.hosts=http://expyuzz4wqqyqhjn.onion:80 +TorRoundTripTime.run.hosts=http://expyuzz4wqqyqhjn.onion:80 #TorHiddenServiceStartupTime Metric TorHiddenServiceStartupTime.enabled=true @@ -32,4 +32,4 @@ Another.run.interval=5 ## In contrast to Metrics, Reporters do not have a minimal set of properties. #GraphiteReporter -GraphiteReporter.serviceUrl=http://k6evlhg44acpchtc.onion:2003 \ No newline at end of file +GraphiteReporter.serviceUrl=http://k6evlhg44acpchtc.onion:2003 diff --git a/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java b/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java index 26ae79b10e..4363b87f78 100644 --- a/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java +++ b/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java @@ -17,6 +17,8 @@ package bisq.monitor; +import bisq.monitor.reporter.ConsoleReporter; + import java.util.HashMap; import java.util.Properties; @@ -25,8 +27,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import bisq.monitor.reporter.ConsoleReporter; - public class MonitorInfrastructureTests { /** @@ -50,7 +50,7 @@ public class MonitorInfrastructureTests { @ParameterizedTest @ValueSource(strings = { "empty", "no interval", "typo" }) - public void basicConfigurationError(String configuration) throws Exception { + public void basicConfigurationError(String configuration) { HashMap lut = new HashMap<>(); lut.put("empty", new Properties()); Properties noInterval = new Properties(); @@ -58,7 +58,7 @@ public class MonitorInfrastructureTests { lut.put("no interval", noInterval); Properties typo = new Properties(); typo.put("Dummy.enabled", "true"); - typo.put("Dummy.run.inteval", "1"); + typo.put("Dummy.run.interval", "1"); lut.put("typo", typo); Dummy DUT = new Dummy(); diff --git a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java index cbf6defc5d..05e019678b 100644 --- a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java @@ -33,6 +33,8 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import static com.google.common.base.Preconditions.checkNotNull; + public class TorHiddenServiceStartupTimeTests { private final static File torWorkingDirectory = new File("monitor/" + TorHiddenServiceStartupTimeTests.class.getSimpleName()); @@ -98,7 +100,9 @@ public class TorHiddenServiceStartupTimeTests { @AfterAll public static void cleanup() { - Tor.getDefault().shutdown(); + Tor tor = Tor.getDefault(); + checkNotNull(tor, "tor must not be null"); + tor.shutdown(); torWorkingDirectory.delete(); } } diff --git a/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java index 970bf19fa0..0364befd2c 100644 --- a/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java @@ -34,8 +34,10 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static com.google.common.base.Preconditions.checkNotNull; + /** - * Test the roundtrip time metric against the hidden service of torproject.org. + * Test the round trip time metric against the hidden service of tor project.org. * * @author Florian Reimair */ @@ -73,7 +75,7 @@ public class TorRoundTripTimeTests { } } - private static File workingDirectory = new File(TorRoundTripTimeTests.class.getSimpleName()); + private static final File workingDirectory = new File(TorRoundTripTimeTests.class.getSimpleName()); @BeforeAll public static void setup() throws TorCtlException { @@ -82,18 +84,18 @@ public class TorRoundTripTimeTests { } @ParameterizedTest - @ValueSource(strings = { "default", "3", "4", "10" }) + @ValueSource(strings = {"default", "3", "4", "10"}) public void run(String sampleSize) throws Exception { DummyReporter reporter = new DummyReporter(); // configure Properties configuration = new Properties(); - configuration.put("TorRoundtripTime.enabled", "true"); - configuration.put("TorRoundtripTime.run.interval", "2"); + configuration.put("TorRoundTripTime.enabled", "true"); + configuration.put("TorRoundTripTime.run.interval", "2"); if (!"default".equals(sampleSize)) - configuration.put("TorRoundtripTime.run.sampleSize", sampleSize); + configuration.put("TorRoundTripTime.run.sampleSize", sampleSize); // torproject.org hidden service - configuration.put("TorRoundtripTime.run.hosts", "http://expyuzz4wqqyqhjn.onion:80"); + configuration.put("TorRoundTripTime.run.hosts", "http://expyuzz4wqqyqhjn.onion:80"); Metric DUT = new TorRoundTripTime(reporter); // start @@ -126,7 +128,9 @@ public class TorRoundTripTimeTests { @AfterAll public static void cleanup() { - Tor.getDefault().shutdown(); + Tor tor = Tor.getDefault(); + checkNotNull(tor, "tor must not be null"); + tor.shutdown(); workingDirectory.delete(); } } From 69b168eaee4f1c0687bb2febf920ce22610019d2 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 14:16:10 +0100 Subject: [PATCH 6/9] Add guava --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 9cd4f5ece0..a6f1ee90f4 100644 --- a/build.gradle +++ b/build.gradle @@ -323,6 +323,8 @@ configure(project(':monitor')) { } dependencies { + compile 'com.google.guava:guava:20.0' + compile 'org.slf4j:slf4j-api:$slf4jVersion' compile 'ch.qos.logback:logback-core:$logbackVersion' compile 'ch.qos.logback:logback-classic:$logbackVersion' From 579d1f101d896774173c489f5b1069ebbdf6f33d Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 14:18:37 +0100 Subject: [PATCH 7/9] Use 1.1.10 instead of $logbackVersion $logbackVersion causes build errors. --- build.gradle | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index a6f1ee90f4..82b96b1dfa 100644 --- a/build.gradle +++ b/build.gradle @@ -163,8 +163,10 @@ configure(project(':common')) { } compile "org.springframework:spring-core:$springVersion" compile 'org.slf4j:slf4j-api:$slf4jVersion' - compile 'ch.qos.logback:logback-core:$logbackVersion' - compile 'ch.qos.logback:logback-classic:$logbackVersion' + compile 'ch.qos.logback:logback-core:1.1.10' + compile 'ch.qos.logback:logback-classic:1.1.10' + // compile 'ch.qos.logback:logback-core:$logbackVersion' + // compile 'ch.qos.logback:logback-classic:$logbackVersion' compile 'com.google.code.findbugs:jsr305:3.0.2' compile 'com.google.guava:guava:20.0' compile('com.google.inject:guice:4.1.0') { @@ -326,8 +328,10 @@ configure(project(':monitor')) { compile 'com.google.guava:guava:20.0' compile 'org.slf4j:slf4j-api:$slf4jVersion' - compile 'ch.qos.logback:logback-core:$logbackVersion' - compile 'ch.qos.logback:logback-classic:$logbackVersion' + compile 'ch.qos.logback:logback-core:1.1.10' + compile 'ch.qos.logback:logback-classic:1.1.10' + // compile 'ch.qos.logback:logback-core:$logbackVersion' + // compile 'ch.qos.logback:logback-classic:$logbackVersion' compileOnly "org.projectlombok:lombok:$lombokVersion" annotationProcessor "org.projectlombok:lombok:$lombokVersion" From e39f91aab56fc34ffd433982f48121cfe82b2f59 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 14:44:18 +0100 Subject: [PATCH 8/9] Update hashes --- gradle/witness/gradle-witness.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle/witness/gradle-witness.gradle b/gradle/witness/gradle-witness.gradle index b994c7c744..167a6aee14 100644 --- a/gradle/witness/gradle-witness.gradle +++ b/gradle/witness/gradle-witness.gradle @@ -55,10 +55,10 @@ dependencyVerification { 'org.bouncycastle:bcprov-jdk15on:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349', 'com.google.zxing:javase:0ec23e2ec12664ddd6347c8920ad647bb3b9da290f897a88516014b56cc77eb9', 'com.nativelibs4java:bridj:101bcd9b6637e6bc16e56deb3daefba62b1f5e8e9e37e1b3e56e3b5860d659cf', - 'com.cedricwalter:tor-binary-macos:64dc92c6ff5c6d006583850346ffee67cff0013a8cd34a95376c1918355ee710', - 'com.cedricwalter:tor-binary-linux32:8573a18f531e013c7162209eca81404aaf7d1d3b3ab6baeac15c7fae927edd20', - 'com.cedricwalter:tor-binary-linux64:b61d5f9ffb2a62b20923ebed9f7558648f23eab2a1c7a805eb3cf32bc30de8d8', - 'com.cedricwalter:tor-binary-windows:04f7a5c794c291da6335cf5b8324bf9d8ecebaaf56fbb728fa28e661fe6184fc', + 'com.cedricwalter:tor-binary-macos:94f95e127c3409f870ee5c9fc642540c3ba865338cfaf3bb66d1e7e18c7fcee0', + 'com.cedricwalter:tor-binary-linux32:af92b0b1ed40e3ff6c0f7b575ce44f19dfd666dfc6709e26cfb0f0bddca752eb', + 'com.cedricwalter:tor-binary-linux64:f1fd937ef964e62abb13f62ddd53cd012316ecd09fecf1205e2db9f3333659c1', + 'com.cedricwalter:tor-binary-windows:af7d67bc8f74b5c50f68b1aa5aa3e833470964f71882ee06ca40a32cd3dbc940', 'com.github.ravn:jsocks:3c71600af027b2b6d4244e4ad14d98ff2352a379410daebefff5d8cd48d742a4', 'org.apache.httpcomponents:httpcore:d7f853dee87680b07293d30855b39b9eb56c1297bd16ff1cd6f19ddb8fa745fb', 'commons-codec:commons-codec:ad19d2601c3abf0b946b5c3a4113e226a8c1e3305e395b90013b78dd94a723ce', @@ -67,7 +67,7 @@ dependencyVerification { 'aopalliance:aopalliance:0addec670fedcd3f113c5c8091d783280d23f75e3acb841b61a9cdb079376a08', 'com.lambdaworks:scrypt:9a82d218099fb14c10c0e86e7eefeebd8c104de920acdc47b8b4b7a686fb73b4', 'com.google.zxing:core:11aae8fd974ab25faa8208be50468eb12349cd239e93e7c797377fa13e381729', - 'com.cedricwalter:tor-binary-geoip:514042e5db788d9313554b61adb5994d7f5b283f0de0871d17eaf401bd78b593', + 'com.cedricwalter:tor-binary-geoip:fbd7656a262607e5a73016e048d5270cbabcd4639a1795b4b4e762df8877429d', 'com.github.JesusMcCloud:jtorctl:ba71601cbe50474ccc39a17bc6f7880c1412d8d19b94d37aee69ea2917f72046', 'org.apache.commons:commons-compress:5f2df1e467825e4cac5996d44890c4201c000b43c0b23cffc0782d28a0beb9b0', 'org.tukaani:xz:a594643d73cc01928cf6ca5ce100e094ea9d73af760a5d4fb6b75fa673ecec96', From b18c0b0ecdf10d0954b66942c39e3c137fd05eac Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sat, 29 Dec 2018 14:46:06 +0100 Subject: [PATCH 9/9] Ignore tests - Revert spelling error as misspelling was used for test - Add TODO for failing test (timing issue, seems to fail just sometimes) - Set @Disable to test classes which take longer as Tor is started --- .../test/java/bisq/monitor/MonitorInfrastructureTests.java | 3 ++- .../bisq/monitor/TorHiddenServiceStartupTimeTests.java | 2 ++ .../src/test/java/bisq/monitor/TorRoundTripTimeTests.java | 2 ++ .../src/test/java/bisq/monitor/TorStartupTimeTests.java | 7 +++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java b/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java index 4363b87f78..9843779566 100644 --- a/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java +++ b/monitor/src/test/java/bisq/monitor/MonitorInfrastructureTests.java @@ -58,7 +58,8 @@ public class MonitorInfrastructureTests { lut.put("no interval", noInterval); Properties typo = new Properties(); typo.put("Dummy.enabled", "true"); - typo.put("Dummy.run.interval", "1"); + //noinspection SpellCheckingInspection + typo.put("Dummy.run.inteval", "1"); lut.put("typo", typo); Dummy DUT = new Dummy(); diff --git a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java index 05e019678b..6081830d62 100644 --- a/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorHiddenServiceStartupTimeTests.java @@ -31,10 +31,12 @@ import java.util.Properties; import org.junit.Assert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static com.google.common.base.Preconditions.checkNotNull; +@Disabled // Ignore for normal test runs as the tests take lots of time public class TorHiddenServiceStartupTimeTests { private final static File torWorkingDirectory = new File("monitor/" + TorHiddenServiceStartupTimeTests.class.getSimpleName()); diff --git a/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java index 0364befd2c..bc59ce4b3d 100644 --- a/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorRoundTripTimeTests.java @@ -31,6 +31,7 @@ import java.util.Properties; import org.junit.Assert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -41,6 +42,7 @@ import static com.google.common.base.Preconditions.checkNotNull; * * @author Florian Reimair */ +@Disabled // Ignore for normal test runs as the tests take lots of time public class TorRoundTripTimeTests { /** diff --git a/monitor/src/test/java/bisq/monitor/TorStartupTimeTests.java b/monitor/src/test/java/bisq/monitor/TorStartupTimeTests.java index d4cfa78e24..5e3a594ccc 100644 --- a/monitor/src/test/java/bisq/monitor/TorStartupTimeTests.java +++ b/monitor/src/test/java/bisq/monitor/TorStartupTimeTests.java @@ -17,14 +17,16 @@ package bisq.monitor; +import bisq.monitor.metric.TorStartupTime; + import java.util.Map; import java.util.Properties; import org.junit.Assert; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import bisq.monitor.metric.TorStartupTime; - +@Disabled // Ignore for normal test runs as the tests take lots of time public class TorStartupTimeTests { /** @@ -78,6 +80,7 @@ public class TorStartupTimeTests { Thread.sleep(15 * 1000); DUT.shutdown(); + // TODO Test fails due timing issue // observe results Assert.assertTrue(reporter.results() > 0); }