Commit 5ffca5a3 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

Merge branch 'develop' into prepair_v0.5

parents 6f8badd0 e291f156
Pipeline #67926 failed with stages
in 56 minutes and 11 seconds
......@@ -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;
import joptsimple.internal.Strings;
import static org.junit.Assert.assertEquals;
public class JoltMigrationAssistantTest {
public class JoltMigrationAssistantTest implements TestResourceHandler {
@Override
public Path getTestDir() {
return getPathFromResources("/migration");
}
// clean up after test
@After
public void resetTestStructure() throws URISyntaxException {
String dest = getClass().getResource("/migration/testProject_v0.1").toURI().getPath();
String backup = getClass().getResource("/migration/testProject_v0.1.bak").toURI().getPath();
Path dest = getRelativeTestPath("testProject_v0.1");
Path backup = getRelativeTestPath("testProject_v0.1.bak");
TestUtils.copyDirTo(dest, backup);
}
......@@ -47,11 +54,11 @@ public class JoltMigrationAssistantTest {
// Test project transformation
@Test
public void TestTransformProject() throws URISyntaxException, IOException {
String projectPath = getClass().getResource("/migration/testProject_v0.1").toURI().getPath();
Path projectPath = getRelativeTestPath("testProject_v0.1");
JoltMigrationAssistant joltMigrationAssistant = new JoltMigrationAssistant();
MigrationResult res = joltMigrationAssistant.analyzeProject(projectPath);
MigrationResult res = joltMigrationAssistant.analyzeProject(projectPath.toString());
assertEquals("", new MigrationResult(12, 0, 11, 1), res);
System.out.println(Strings.repeat('#', 80));
}
......
......@@ -29,7 +29,7 @@ public class JoltTransformV3toV4Test extends JoltTransformationTest {
@Override
public Path getTestDir() {
return getDirFromResources("/migration/v03_to_v04");
return getPathFromResources("/migration/v03_to_v04");
}
@Before
......
......@@ -18,7 +18,7 @@ public class JoltTransformV4toV5Test extends JoltTransformationTest {
@Override
public Path getTestDir() {
return getDirFromResources("/migration/v04_to_v05");
return getPathFromResources("/migration/v04_to_v05");
}
private JsonNode test001() {
......
......@@ -36,8 +36,11 @@ public interface TestResourceHandler {
return testDir.getParent().resolve(testDir.getFileName() + ".bak");
}
default Path getDirFromResources(String resource) {
default Path getPathFromResources(String resource) {
URL resource1 = getClass().getResource(resource);
if (resource1 == null){
fail("Resource not found: " + resource);
}
File f = new File(resource1.getFile());
return Paths.get(f.toString());
}
......
Markdown is supported
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