Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
6c859e21
Commit
6c859e21
authored
May 21, 2019
by
Daniel Lehmberg
Browse files
Adapted tests with the new column names
parent
740fea64
Pipeline
#115283
passed with stages
in 129 minutes and 55 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/OutputFile.java
View file @
6c859e21
...
...
@@ -178,18 +178,22 @@ public abstract class OutputFile<K extends DataKey<K>> {
return
String
.
join
(
DataProcessingJsonManager
.
DEFAULT_SEPARATOR
,
this
.
getIndices
());
}
public
static
String
addHeaderProcInfo
(
String
columnName
,
int
procId
){
return
columnName
+
headerNameAdd
.
replace
(
"?"
,
""
+
procId
);
}
private
List
<
String
>
uniqueHeaderNames
(){
// This function adds to every header "headerNameAdd", for ALL headers EVERY time
// (cmp. headersWithNameMangling)
LinkedList
<
String
>
headers
=
new
LinkedList
<>();
for
(
DataProcessor
l
:
dataProcessors
)
{
List
<
String
>
allProcHeaders
=
Arrays
.
asList
(
l
.
getHeaders
());
for
(
DataProcessor
dataProcessor
:
dataProcessors
)
{
List
<
String
>
allProcHeaders
=
Arrays
.
asList
(
dataProcessor
.
getHeaders
());
for
(
String
singleHeader:
allProcHeaders
)
{
// add the processor id to make header unique
headers
.
addLast
(
singleHeader
+
headerNameAdd
.
replace
(
"?"
,
""
+
l
.
getId
()));
String
adaptedColumnName
=
OutputFile
.
addHeaderProcInfo
(
singleHeader
,
dataProcessor
.
getId
());
headers
.
addLast
(
adaptedColumnName
);
}
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/io/IOOutput.java
View file @
6c859e21
...
...
@@ -76,7 +76,9 @@ public abstract class IOOutput {
private
static
boolean
testTrajectories
(
final
VadereProject
project
,
final
File
directory
)
{
try
{
TrajectoryReader
reader
=
new
TrajectoryReader
(
getPathToOutputFile
(
project
,
directory
.
getName
(),
IOUtils
.
TRAJECTORY_FILE_EXTENSION
));
return
reader
.
checkFile
();
reader
.
checkFile
();
return
true
;
}
catch
(
IOException
|
VadereClassNotFoundException
e
)
{
logger
.
error
(
"Error in output file "
+
directory
.
getName
());
return
false
;
...
...
VadereSimulator/tests/org/vadere/simulator/dataprocessing/TestOutputFile.java
View file @
6c859e21
...
...
@@ -7,6 +7,7 @@ import java.io.File;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.vadere.simulator.models.MainModel
;
import
org.vadere.simulator.models.MainModelBuilder
;
...
...
@@ -68,13 +69,13 @@ public class TestOutputFile {
List
<
String
>
header
=
testScenario
.
getDataProcessingJsonManager
().
getOutputFiles
().
get
(
0
).
getEntireHeader
();
//Note these fail if the name conflict is handled differently, for now hard coded.
assertTrue
(
header
.
contains
(
"timeStep"
));
assertTrue
(
header
.
contains
(
"pedestrianId"
));
assertTrue
(
header
.
contains
(
"x-Proc1"
));
assertTrue
(
header
.
contains
(
"y-Proc1"
));
assertTrue
(
header
.
contains
(
"x-Proc2"
));
assertTrue
(
header
.
contains
(
"y-Proc2"
));
assertTrue
(
header
.
contains
(
OutputFile
.
addHeaderProcInfo
(
"x"
,
1
)));
assertTrue
(
header
.
contains
(
OutputFile
.
addHeaderProcInfo
(
"y"
,
1
)));
assertTrue
(
header
.
contains
(
OutputFile
.
addHeaderProcInfo
(
"x"
,
2
)));
assertTrue
(
header
.
contains
(
OutputFile
.
addHeaderProcInfo
(
"y"
,
2
)));
}
...
...
VadereSimulator/tests/org/vadere/simulator/projects/dataprocessing/processor/PedestrianLastPositionProcessorTest.java
View file @
6c859e21
package
org.vadere.simulator.projects.dataprocessing.processor
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
public
class
PedestrianLastPositionProcessorTest
extends
ProcessorTest
{
...
...
VadereSimulator/tests/org/vadere/simulator/projects/dataprocessing/processor/ProcessorTest.java
View file @
6c859e21
...
...
@@ -8,7 +8,6 @@ import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile;
import
org.vadere.simulator.utils.reflection.ReflectionHelper
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* Base Test for all Processors.
...
...
@@ -51,10 +50,14 @@ public abstract class ProcessorTest {
}
int
l
=
processorTestEnv
.
getSimStates
().
size
();
p
.
postLoop
(
processorTestEnv
.
getSimStates
().
get
(
l
-
1
));
processorTestEnv
.
getOutputFile
().
write
();
OutputFile
outputFile
=
processorTestEnv
.
getOutputFile
();
outputFile
.
write
();
// NOTE: these are the column names that have the additional information of the data processor ID.
assertEquals
(
processorTestEnv
.
getHeader
(),
outputFile
.
getHeaderLine
());
String
header
=
String
.
join
(
processorTestEnv
.
getDelimiter
(),
p
.
getHeaders
());
assertTrue
(
processorTestEnv
.
getHeader
().
contains
(
header
));
if
(
header
.
equals
(
""
)){
assertEquals
(
processorTestEnv
.
getExpectedOutputAsList
(),
processorTestEnv
.
getOutput
(
0
));
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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