Skip to content
Snippets Groups Projects
Commit dcbf9b75 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

test web results

parent c952e8ca
No related branches found
No related tags found
1 merge request!793Test Web Service
...@@ -16,6 +16,7 @@ import java.util.Map; ...@@ -16,6 +16,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -37,6 +38,7 @@ import gov.usgs.earthquake.nshmp.calc.Site; ...@@ -37,6 +38,7 @@ import gov.usgs.earthquake.nshmp.calc.Site;
import gov.usgs.earthquake.nshmp.data.XySequence; import gov.usgs.earthquake.nshmp.data.XySequence;
import gov.usgs.earthquake.nshmp.geo.Location; import gov.usgs.earthquake.nshmp.geo.Location;
import gov.usgs.earthquake.nshmp.gmm.Imt; import gov.usgs.earthquake.nshmp.gmm.Imt;
import gov.usgs.earthquake.nshmp.www.hazard.HazardServiceUtils;
import io.swagger.v3.core.util.Yaml; import io.swagger.v3.core.util.Yaml;
...@@ -83,8 +85,11 @@ class NshmTestUtils { ...@@ -83,8 +85,11 @@ class NshmTestUtils {
* Test a NSHM. * Test a NSHM.
* *
* @param nshm The NSHM to test * @param nshm The NSHM to test
* @throws ExecutionException
* @throws InterruptedException
*/ */
static void testNshm(Nshm nshm, Optional<Path> dataPath) { static void testNshm(Nshm nshm, Optional<Path> dataPath)
throws InterruptedException, ExecutionException {
NshmModel nshmModel = loadModel(nshm); NshmModel nshmModel = loadModel(nshm);
for (NamedLocation location : nshm.locations()) { for (NamedLocation location : nshm.locations()) {
...@@ -138,13 +143,16 @@ class NshmTestUtils { ...@@ -138,13 +143,16 @@ class NshmTestUtils {
} }
private static void compareCurves(NshmModel nshmModel, NamedLocation location, private static void compareCurves(NshmModel nshmModel, NamedLocation location,
Optional<Path> dataPath) { Optional<Path> dataPath) throws InterruptedException, ExecutionException {
Map<String, XySequence> actual = dataPath.isPresent() Map<String, XySequence> actual = dataPath.isPresent()
? readExpected(nshmModel, location, dataPath) : generateActual(nshmModel, location); ? readExpected(nshmModel, location, dataPath) : generateActual(nshmModel, location);
Map<String, XySequence> webActual =
HazardServiceUtils.generateActual(location, nshmModel.nshm.imts());
Map<String, XySequence> expected = readExpected(nshmModel, location, Optional.empty()); Map<String, XySequence> expected = readExpected(nshmModel, location, Optional.empty());
for (String key : actual.keySet()) { for (String key : actual.keySet()) {
assertCurveEquals(expected.get(key), actual.get(key), TOLERANCE); assertCurveEquals(expected.get(key), actual.get(key), TOLERANCE);
assertCurveEquals(expected.get(key), webActual.get(key), TOLERANCE);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment