Commit 02043815 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

correct wrong tests for the migration, since it was assumed that minStepLength...

correct wrong tests for the migration, since it was assumed that minStepLength should be set to stepLengthIntercept which is not the case.
parent 8b4bd96d
Pipeline #86717 canceled with stages
...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; ...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import org.vadere.annotation.factories.migrationassistant.MigrationTransformation; import org.vadere.annotation.factories.migrationassistant.MigrationTransformation;
import org.vadere.simulator.entrypoints.Version; import org.vadere.simulator.entrypoints.Version;
import org.vadere.simulator.projects.migration.MigrationException; import org.vadere.simulator.projects.migration.MigrationException;
import org.vadere.state.attributes.models.AttributesOSM;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -27,15 +28,16 @@ public class JoltTransformV6toV7 extends JoltTransformation{ ...@@ -27,15 +28,16 @@ public class JoltTransformV6toV7 extends JoltTransformation{
// postHookStep // postHookStep
private JsonNode setDefaultValues(JsonNode scenarioFile) throws MigrationException{ private JsonNode setDefaultValues(JsonNode scenarioFile) throws MigrationException{
JsonNode osmAttr = path(scenarioFile, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM"); JsonNode osmAttr = path(scenarioFile, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM");
AttributesOSM attributesOSM = new AttributesOSM();
if (!osmAttr.isMissingNode()){ if (!osmAttr.isMissingNode()){
double stepLengthIntercept = pathMustExist(osmAttr, "stepLengthIntercept").doubleValue(); double stepLengthIntercept = pathMustExist(osmAttr, "stepLengthIntercept").doubleValue();
if(!osmAttr.has("minStepLength")){ if(!osmAttr.has("minStepLength")){
addToObjectNode(osmAttr, "minStepLength", Double.toString(stepLengthIntercept)); addToObjectNode(osmAttr, "minStepLength", Double.toString(attributesOSM.getMinStepLength()));
} }
if(!osmAttr.has("maxStepDuration")){ if(!osmAttr.has("maxStepDuration")){
addToObjectNode(osmAttr, "maxStepDuration", Double.toString(Double.MAX_VALUE)); addToObjectNode(osmAttr, "maxStepDuration", Double.toString(attributesOSM.getMaxStepDuration()));
} }
} }
......
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
"stepLengthIntercept" : 0.999, "stepLengthIntercept" : 0.999,
"stepLengthSlopeSpeed" : 0.2345, "stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036, "stepLengthSD" : 0.036,
"minStepLength" : 0.999,
"movementThreshold" : 0.0, "movementThreshold" : 0.0,
"optimizationType" : "DISCRETE", "optimizationType" : "DISCRETE",
"movementType" : "ARBITRARY", "movementType" : "ARBITRARY",
"dynamicStepLength" : false, "dynamicStepLength" : false,
......
...@@ -22,8 +22,8 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{ ...@@ -22,8 +22,8 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{
return getPathFromResources("/migration/v06_to_v07"); return getPathFromResources("/migration/v06_to_v07");
} }
// "minStepLength" : 0.4625, // "minStepLength" : 0.10,
// "maxStepDuration" : 1.7976931348623157E308, // "maxStepDuration" : 1.7976931348623157E308,
@Test @Test
public void testDefaultOSMAttriubteValues(){ public void testDefaultOSMAttriubteValues(){
...@@ -44,13 +44,13 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{ ...@@ -44,13 +44,13 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{
double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble(); double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble();
double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble(); double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble();
assertEquals(minStepLength, attr.getMinStepLength(), 0.001); assertEquals(attr.getMinStepLength(), minStepLength, 0.001);
assertEquals(maxStepDuration, attr.getMaxStepDuration(), Double.MAX_VALUE); assertEquals(attr.getMaxStepDuration(), maxStepDuration, 0.001);
} }
@Test @Test
public void useStepLengthInterceptAsDefault(){ public void testMinStepLengthExists(){
String group_OSM_1Source2Places = getTestFileAsString("group_OSM_1Source2Places_B"); String group_OSM_1Source2Places = getTestFileAsString("group_OSM_1Source2Places_B");
assertThat(group_OSM_1Source2Places, versionMatcher(Version.V0_6)); assertThat(group_OSM_1Source2Places, versionMatcher(Version.V0_6));
JsonNode group_OSM_1Source2PlacesJson = getJsonFromString(group_OSM_1Source2Places); JsonNode group_OSM_1Source2PlacesJson = getJsonFromString(group_OSM_1Source2Places);
...@@ -68,12 +68,12 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{ ...@@ -68,12 +68,12 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{
double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble(); double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble();
double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble(); double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble();
assertEquals(minStepLength, 0.999, 0.001); assertEquals(0.999, minStepLength, 0.001);
assertEquals(maxStepDuration, attr.getMaxStepDuration(), Double.MAX_VALUE); assertEquals(attr.getMaxStepDuration(), maxStepDuration, 0.001);
} }
@Test @Test
public void PedestrianDensityGaussianProcessor(){ public void testPedestrianDensityGaussianProcessor(){
String group_OSM_1Source2Places = getTestFileAsString("group_OSM_1Source1Place"); String group_OSM_1Source2Places = getTestFileAsString("group_OSM_1Source1Place");
assertThat(group_OSM_1Source2Places, versionMatcher(Version.V0_6)); assertThat(group_OSM_1Source2Places, versionMatcher(Version.V0_6));
JsonNode group_OSM_1Source2PlacesJson = getJsonFromString(group_OSM_1Source2Places); JsonNode group_OSM_1Source2PlacesJson = getJsonFromString(group_OSM_1Source2Places);
...@@ -91,8 +91,8 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{ ...@@ -91,8 +91,8 @@ public class JoltTransformV6toV7Test extends JoltTransformationTest{
double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble(); double minStepLength = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/minStepLength").asDouble();
double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble(); double maxStepDuration = pathMustExist(v7, "scenario/attributesModel/org.vadere.state.attributes.models.AttributesOSM/maxStepDuration").asDouble();
assertEquals(minStepLength, attr.getMinStepLength(), 0.001); assertEquals(0.4625, minStepLength, 0.001);
assertEquals(maxStepDuration, attr.getMaxStepDuration(), Double.MAX_VALUE); assertEquals(attr.getMaxStepDuration(), maxStepDuration, 0.001);
ArrayList<JsonNode> pedestrianDensityGaussianProcessorAttrs = ArrayList<JsonNode> pedestrianDensityGaussianProcessorAttrs =
getProcessorsByType(v7, "org.vadere.simulator.projects.dataprocessing.processor.PedestrianDensityGaussianProcessor"); getProcessorsByType(v7, "org.vadere.simulator.projects.dataprocessing.processor.PedestrianDensityGaussianProcessor");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment