Commit 5ffca5a3 authored by hm-schuhba1's avatar hm-schuhba1

Merge branch 'develop' into prepair_v0.5

parents 6f8badd0 e291f156
Pipeline #67926 failed with stages
in 56 minutes and 11 seconds
......@@ -15,24 +15,27 @@ import shutil
import subprocess
import time
def find_scenario_files(path="VadereModelTests"):
scenario_search_pattern = "*.scenario"
# exclude output and legacy to make sure that if used locally, .scenario files in these directories are not used
def find_scenario_files(path="VadereModelTests", scenario_search_pattern = "*.scenario", exclude_patterns = ["TESTOVM","output","legacy"]):
scenario_files = []
exclude_patterns = ["TESTOVM"]
for root, dirnames, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, scenario_search_pattern):
scenario_path = os.path.join(root, filename)
bool_exclude = False
for exclude_pattern in exclude_patterns:
regex_pattern = re.compile(exclude_pattern)
match = regex_pattern.search(scenario_path)
if match:
bool_exclude = True
if match is None:
scenario_files.append(scenario_path)
if not(bool_exclude):
scenario_files.append(scenario_path)
print("Total scenario files: {}".format(len(scenario_files)))
print("Exclude patterns: {}".format(exclude_patterns))
# Surpress this output since only failed scenarios are shown
# print("Total scenario files: {}".format(len(scenario_files)))
# print("Exclude patterns: {}".format(exclude_patterns))
return sorted(scenario_files)
......@@ -49,11 +52,13 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
for i, scenario_file in enumerate(scenario_files):
try:
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Surpress this output to see the files that failed in the email
# print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
wall_time_start = time.time()
# Use timout feature, check return value and capture stdout/stderr to a PIPE (use completed_process.stdout to get it).
completed_process = subprocess.run(args=["java", "-enableassertions", "-jar", vadere_console, "scenario-run", "-f", scenario_file, "-o", output_dir],
timeout=scenario_timeout_in_sec,
......@@ -64,26 +69,51 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
wall_time_end = time.time()
wall_time_delta = wall_time_end - wall_time_start
print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
# Surpress this output to see the files that failed in the email
# print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
passed_scenarios.append(scenario_file)
except subprocess.TimeoutExpired as exception:
print("Scenario file failed: {}".format(scenario_file))
print("-> Reason: timeout after {} s ({})".format(exception.timeout, exception.cmd))
prefix = ""
if "TestOSM" in scenario_file:
prefix = " * OSM * "
print(prefix +"Scenario file failed: {}".format(scenario_file))
print("-> Reason: timeout after {} s".format(exception.timeout))
failed_scenarios_with_exception.append((scenario_file, exception))
except subprocess.CalledProcessError as exception:
print("Scenario file failed: {}".format(scenario_file))
print("-> Reason: non-zero return value {} ({})".format(exception.returncode, exception.cmd))
prefix = ""
if "TestOSM" in scenario_file:
prefix = " * OSM * "
print(prefix + "Scenario file failed: {}".format(scenario_file))
print("-> Reason: non-zero return value {}".format(exception.returncode))
failed_scenarios_with_exception.append((scenario_file, exception))
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
return {"passed": passed_scenarios, "failed": failed_scenarios_with_exception}
if __name__ == "__main__":
scenario_files = find_scenario_files()
passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files)
print(" * Output is only shown for scenarios that fail * ")
passed_and_failed_scenarios = {"passed": [], "failed" : []}
scenarios_long = ["rimea_09", "rimea_11", "queueing"]
scenario_do_not_test = ["TESTOVM","output","legacy"]
scenario_do_not_test.extend(scenarios_long)
scenario_files_regular_length = find_scenario_files(exclude_patterns=scenario_do_not_test)
passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files_regular_length)
for scenario in scenarios_long:
search_pattern = "*" + scenario + "*.scenario"
scenario_files_long = find_scenario_files(scenario_search_pattern=search_pattern)
tmp_passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files_long, scenario_timeout_in_sec=240)
passed_and_failed_scenarios["passed"].extend(tmp_passed_and_failed_scenarios["passed"])
passed_and_failed_scenarios["failed"].extend(tmp_passed_and_failed_scenarios["failed"])
if len(passed_and_failed_scenarios["failed"]) > 0:
exit(1)
......
......@@ -134,7 +134,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -58,7 +58,7 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 1,
"simulationSeed" : null
"simulationSeed" : 0
},
"topography" : {
"attributes" : {
......@@ -134,11 +134,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -148,8 +149,7 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
"attributesCar" : null
}
}
}
\ No newline at end of file
......@@ -143,7 +143,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -116,7 +116,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -116,7 +116,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -116,7 +116,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -116,7 +116,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -116,7 +116,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -107,7 +107,7 @@
"startTime" : 0.0,
"endTime" : 1200.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -106,8 +106,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -106,8 +106,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -106,8 +106,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -106,8 +106,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -106,8 +106,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 120.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -124,8 +124,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -125,7 +125,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -107,7 +107,7 @@
"startTime" : 0.0,
"endTime" : 1000.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -208,8 +208,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -190,8 +190,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -511,7 +511,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -531,7 +531,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -551,7 +551,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -571,7 +571,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -591,7 +591,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -611,7 +611,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -631,7 +631,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -651,7 +651,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -671,7 +671,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -691,7 +691,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -711,7 +711,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......@@ -726,12 +726,12 @@
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 2,
"spawnNumber" : 1,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -178,8 +178,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -143,7 +143,7 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 110.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -138,8 +138,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -51,7 +51,7 @@
"attributesSimulation" : {
"finishTime" : 100.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
......@@ -188,8 +188,8 @@
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -67,7 +67,7 @@
}
},
"attributesSimulation" : {
"finishTime" : 450.0,
"finishTime" : 350.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
......@@ -141,9 +141,9 @@
"spawnNumber" : 3,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 40.0,
"endTime" : 25.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
......
......@@ -10,9 +10,8 @@ import org.vadere.simulator.projects.io.TrajectoryReader;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.scenario.Agent;
import org.vadere.state.simulation.Step;
import org.vadere.tests.util.reflection.TestResourceHandler;
import org.vadere.util.io.IOUtils;
import org.vadere.util.reflection.VadereClassNotFoundException;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
......@@ -23,27 +22,29 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class TestTrajectoryReader {
public class TestTrajectoryReader implements TestResourceHandler {
private Scenario test;
private VadereProject project;
private String folderName;
@Override
public Path getTestDir() {
return getPathFromResources("/data/VTestMultiRun");
}
@Before
public void setUp() throws URISyntaxException {
resetTestStructure();
folderName = "Test1_2015-03-11_17-42-08.826";
AttributesAgent attributes = new AttributesAgent();
try {
project = IOVadere.readProjectJson(getClass().getResource("/data/VTestMultiRun/vadere.project").getPath().replaceFirst("^/(.:/)", "$1"));
project = IOVadere.readProjectJson(getRelativeTestPath("vadere.project").toString());
test = project.getScenarios().stream().filter(t -> t.getName().equals("Test1")).findFirst().get();
} catch (IOException e) {
......@@ -52,9 +53,9 @@ public class TestTrajectoryReader {
}
private void resetTestStructure() throws URISyntaxException {
String source = getClass().getResource("/data/VTestMultiRun").toURI().getPath();
String dest = getClass().getResource("/data/VTestMultiRun.bak").toURI().getPath();
TestUtils.copyDirTo(source, dest);
String dest = getPathFromResources("/data/VTestMultiRun").toString();
String backup = getPathFromResources("/data/VTestMultiRun.bak").toString();
TestUtils.copyDirTo(dest, backup);
}
......
......@@ -2,19 +2,15 @@ package org.vadere.simulator.entrypoints;
import com.fasterxml.jackson.databind.JsonNode;
import org.hamcrest.core.StringContains;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.vadere.simulator.projects.migration.MigrationAssistant;
import org.vadere.tests.util.reflection.JsonNodeTester;
import org.vadere.tests.util.reflection.TestResourceHandler;
import org.vadere.util.io.IOUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
......@@ -34,7 +30,7 @@ public class MigrationSubCommandTest implements JsonNodeTester, TestResourceHand
@Override
public Path getTestDir() {
return getDirFromResources("/migration/VadererConsole");
return getPathFromResources("/migration/VadererConsole");
}
@Before
......
......@@ -7,22 +7,29 @@ import org.junit.Test;
import org.vadere.simulator.entrypoints.Version;
import org.vadere.simulator.projects.io.TestUtils;
import org.vadere.state.util.StateJsonConverter;
import org.vadere.tests.util.reflection.TestResourceHandler;
import org.vadere.util.io.IOUtils;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;