Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Agriterix
simulator
Commits
a2cd465f
Commit
a2cd465f
authored
Jul 21, 2021
by
Loris Croce
Browse files
patches.db test edit
parent
1f4ec9fb
Pipeline
#37909
passed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/inrae/agriterix/simulator/GeoArea.java
View file @
a2cd465f
package
fr.inrae.agriterix.simulator
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
java.util.*
;
public
class
GeoArea
{
...
...
src/main/java/fr/inrae/agriterix/simulator/Simulator.java
View file @
a2cd465f
...
...
@@ -204,15 +204,10 @@ public class Simulator {
ArrayBuilder
arrayBuilder
;
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
CborEncoder
cborEncoder
=
new
CborEncoder
(
baos
);
File
file
;
FileOutputStream
fos
;
OutputStream
os
;
file
=
new
File
(
"db"
,
"data/out/"
+
timestamp
+
"/patches.cbor"
);
arrayBuilder
=
cborBuilder
.
addArray
();
fos
=
new
FileOutputStream
(
file
);
os
=
Files
.
newOutputStream
(
Paths
.
get
(
"data/out/"
+
timestamp
+
"/patches.cbor"
));
for
(
Farmer
farmer
:
this
.
getFarmers
())
{
for
(
Patch
patch
:
farmer
.
getFarm
().
getPatches
())
{
...
...
@@ -234,8 +229,8 @@ public class Simulator {
cborEncoder
.
encode
(
cborBuilder
.
build
());
data
=
baos
.
toByteArray
();
f
os
.
write
(
data
);
f
os
.
close
();
os
.
write
(
data
);
os
.
close
();
}
...
...
src/test/java/fr/inrae/agriterix/simulator/SimulatorTest.java
View file @
a2cd465f
...
...
@@ -189,16 +189,9 @@ public class SimulatorTest {
return
flows
;
}
//
@Test
@Test
public
void
toDB
()
throws
FileNotFoundException
{
Simulator
simulator
=
Simulator
.
loadSimulator
(
new
FileInputStream
(
directory
+
"simulator.xml"
));
int
patchesNB
=
0
;
for
(
GeoArea
geoArea
:
simulator
.
geoAreas
())
{
for
(
Patch
patch
:
geoArea
.
getPatches
())
{
patchesNB
++;
}
}
//System.out.println(patchesNB);
try
{
simulator
.
patchesCBOR
();
}
catch
(
IOException
e
)
{
...
...
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