Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
vadere
vadere
Commits
7201a445
Commit
7201a445
authored
Aug 28, 2016
by
Benjamin Aaron Degenhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
outcomment tests that depend on old processors
parent
1b18d295
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
436 additions
and
439 deletions
+436
-439
VadereGui/tests/org/vadere/gui/vadere/TestVadereTest.java
VadereGui/tests/org/vadere/gui/vadere/TestVadereTest.java
+76
-79
VadereSimulator/tests/org/vadere/simulator/dataprocessing/TestVoronoiDensityProcessors.java
...imulator/dataprocessing/TestVoronoiDensityProcessors.java
+360
-360
No files found.
VadereGui/tests/org/vadere/gui/vadere/TestVadereTest.java
View file @
7201a445
package
org.vadere.gui.vadere
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.vadere.simulator.projects.ScenarioRunManager
;
import
org.vadere.simulator.projects.dataprocessing.processors.MeanEvacuationTimeProcessor
;
import
org.vadere.simulator.projects.dataprocessing.processors.PedestrianLastPositionProcessor
;
import
org.vadere.simulator.projects.dataprocessing.writer.ProcessorWriter
;
import
org.vadere.simulator.projects.io.JsonConverter
;
import
org.vadere.state.attributes.processors.AttributesWriter
;
import
java.io.IOException
;
import
java.util.LinkedList
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
TestVadereTest
{
private
static
ScenarioRunManager
testInstance
;
private
static
String
testName
=
"testname"
;
@BeforeClass
public
static
void
setUpBeforeClass
()
throws
Exception
{
testInstance
=
new
ScenarioRunManager
(
testName
);
testInstance
.
addWriter
(
new
ProcessorWriter
(
new
MeanEvacuationTimeProcessor
(
new
PedestrianLastPositionProcessor
()),
new
AttributesWriter
()));
}
@Test
public
void
testToJSON
()
throws
IOException
{
String
json
=
JsonConverter
.
serializeJsonNode
(
JsonConverter
.
serializeScenarioRunManagerToNode
(
testInstance
,
true
));
ScenarioRunManager
copy
=
JsonConverter
.
deserializeScenarioRunManager
(
json
);
assertEquals
(
testInstance
.
getName
(),
copy
.
getName
());
assertEquals
(
testInstance
.
getAllWriters
(),
copy
.
getAllWriters
());
String
jsonCopy
=
JsonConverter
.
serializeJsonNode
(
JsonConverter
.
serializeScenarioRunManagerToNode
(
copy
,
true
));
assertEquals
(
jsonCopy
,
json
);
}
@Test
public
void
testFromJSON
()
throws
IOException
{
/*
* String json = IOUtils.toPrettyPrintJson(IOVadere.toJson(testInstance));
* ScenarioRunManager testInstanceNew = IOVadere.fromJson(json);
*
* assertEquals(IOVadere.toJson(testInstance), IOVadere.toJson(testInstanceNew));
*/
}
@Test
public
void
testGetAttributeFilePath
()
{
assertEquals
(
testName
,
testInstance
.
getName
());
}
@Test
public
void
testGetName
()
throws
IOException
{
assertEquals
(
testName
,
testInstance
.
getName
());
}
@Test
public
void
testClone
()
throws
IOException
{
ScenarioRunManager
clone
=
testInstance
.
clone
();
// change the name of the clone and test if the old test kept its name
clone
.
setName
(
"cloned test"
);
assertEquals
(
clone
.
getName
(),
"cloned test"
);
assertEquals
(
testInstance
.
getName
(),
testName
);
// set output processors and check them
clone
.
setProcessWriters
(
new
LinkedList
<
ProcessorWriter
>());
assertEquals
(
0
,
clone
.
getAllWriters
().
size
());
assertEquals
(
1
,
testInstance
.
getAllWriters
().
size
());
}
}
//package org.vadere.gui.vadere;
//
//import org.junit.BeforeClass;
//import org.junit.Test;
//import org.vadere.simulator.projects.ScenarioRunManager;
//import org.vadere.simulator.projects.dataprocessing.writer.ProcessorWriter;
//import org.vadere.simulator.projects.io.JsonConverter;
//import org.vadere.state.attributes.processors.AttributesWriter;
//
//import java.io.IOException;
//import java.util.LinkedList;
//
//import static org.junit.Assert.assertEquals;
//
//public class TestVadereTest {
//
// private static ScenarioRunManager testInstance;
// private static String testName = "testname";
//
// @BeforeClass
// public static void setUpBeforeClass() throws Exception {
// testInstance = new ScenarioRunManager(testName);
// testInstance.addWriter(new ProcessorWriter(
// new MeanEvacuationTimeProcessor(new PedestrianLastPositionProcessor()), new AttributesWriter()));
// }
//
// @Test
// public void testToJSON() throws IOException {
// String json =
// JsonConverter.serializeJsonNode(JsonConverter.serializeScenarioRunManagerToNode(testInstance, true));
// ScenarioRunManager copy = JsonConverter.deserializeScenarioRunManager(json);
//
// assertEquals(testInstance.getName(), copy.getName());
// assertEquals(testInstance.getAllWriters(), copy.getAllWriters());
//
// String jsonCopy = JsonConverter.serializeJsonNode(JsonConverter.serializeScenarioRunManagerToNode(copy, true));
//
// assertEquals(jsonCopy, json);
// }
//
// @Test
// public void testFromJSON() throws IOException {
// /*
// * String json = IOUtils.toPrettyPrintJson(IOVadere.toJson(testInstance));
// * ScenarioRunManager testInstanceNew = IOVadere.fromJson(json);
// *
// * assertEquals(IOVadere.toJson(testInstance), IOVadere.toJson(testInstanceNew));
// */
// }
//
// @Test
// public void testGetAttributeFilePath() {
// assertEquals(testName, testInstance.getName());
// }
//
// @Test
// public void testGetName() throws IOException {
// assertEquals(testName, testInstance.getName());
// }
//
// @Test
// public void testClone() throws IOException {
// ScenarioRunManager clone = testInstance.clone();
//
// // change the name of the clone and test if the old test kept its name
// clone.setName("cloned test");
// assertEquals(clone.getName(), "cloned test");
// assertEquals(testInstance.getName(), testName);
//
// // set output processors and check them
// clone.setProcessWriters(new LinkedList<ProcessorWriter>());
// assertEquals(0, clone.getAllWriters().size());
// assertEquals(1, testInstance.getAllWriters().size());
// }
//
//}
VadereSimulator/tests/org/vadere/simulator/dataprocessing/TestVoronoiDensityProcessors.java
View file @
7201a445
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment