Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
3e13f68c
Commit
3e13f68c
authored
May 21, 2015
by
duminil
Browse files
Some comments about Novafactory Export Job.
parent
80d2a209
Changes
1
Show whitespace changes
Inline
Side-by-side
test/eu/simstadt/nf4j/async/test/SuccessfulExportJob.java
View file @
3e13f68c
package
eu.simstadt.nf4j.async.test
;
package
eu.simstadt.nf4j.async.test
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.File
;
import
java.io.File
;
import
org.junit.Test
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
eu.simstadt.nf4j.FailedTransmissionException
;
import
eu.simstadt.nf4j.FailedTransmissionException
;
import
eu.simstadt.nf4j.InvalidJobDescriptorException
;
import
eu.simstadt.nf4j.InvalidJobDescriptorException
;
import
eu.simstadt.nf4j.JobStatus
;
import
eu.simstadt.nf4j.JobStatus
;
...
@@ -16,29 +14,82 @@
...
@@ -16,29 +14,82 @@
import
eu.simstadt.nf4j.async.Layer
;
import
eu.simstadt.nf4j.async.Layer
;
import
eu.simstadt.nf4j.async.Unit
;
import
eu.simstadt.nf4j.async.Unit
;
/**
/**
* This class contains client oriented export job tests. It will send an export job and listens to
* This class contains client oriented export job tests. It will send an export job and listens to
status updates. Every
*
status updates. Every
of the subsequent status' LOCAL, SENT, PENDING, RUNNING, FINISHED and DOWNLOAD
* of the subsequent status' LOCAL, SENT, PENDING, RUNNING, FINISHED and DOWNLOAD
have to be signaled to this test
*
have to be signaled to this test
class.
* class.
*
*
* @author Marcel Bruse
* @author Marcel Bruse
*/
*/
public
class
SuccessfulExportJob
implements
JobStatusListener
{
public
class
SuccessfulExportJob
implements
JobStatusListener
{
public
AsyncExportJob
job
;
public
AsyncExportJob
job
;
@Test
@Test
public
void
processJob
()
throws
InterruptedException
{
public
void
processJob
()
throws
InterruptedException
{
ExportJobDescription
description
=
ExportJobDescription
.
getDefaultDescriptor
();
ExportJobDescription
description
=
ExportJobDescription
.
getDefaultDescriptor
();
description
.
setInitiator
(
"2758"
);
description
.
setInitiator
(
"2758"
);
description
.
setAccount
(
"Bruse"
);
description
.
setAccount
(
"Bruse"
);
description
.
setProduct
(
"WU3"
);
description
.
setProduct
(
"WU3"
);
description
.
setJobnumber
(
"Bruse_0815"
);
description
.
setJobnumber
(
"Bruse_0815"
);
//FIXME: Zipped GMLs coming from nF don't have any defined srsName
//NOTE: Unit is a predefined Map Region.
// Some of those units are empty. 821 (Finsterrot) and 824 (Neulautern) are available on HFT nF Server.
// <designation>
// 820
// </designation><name>
// Wuestenrot
// </name></mapsheet><mapsheet nr="127"><designation>
// 821
// </designation><name>
// Finsterrot
// </name></mapsheet><mapsheet nr="128"><designation>
// 822
// </designation><name>
// Maienfels
// </name></mapsheet><mapsheet nr="129"><designation>
// 823
// </designation><name>
// Neuhütten
// </name></mapsheet><mapsheet nr="130"><designation>
// 824
// </designation><name>
// Neulautern
// </name></mapsheet><mapsheet nr="131"><designation>
// 824-1
// </designation><name>
// Neulautern (1)
// </name>
Unit
unit
=
Unit
.
getDefaultUnit
();
Unit
unit
=
Unit
.
getDefaultUnit
();
unit
.
setValue
(
"82
1
"
);
unit
.
setValue
(
"82
4
"
);
description
.
addUnit
(
unit
);
description
.
addUnit
(
unit
);
//NOTE: Polygon selection. This would be for a small part of Neulautern
//TODO: Check if orientation is important
//TODO: Check if polygon needs to be closed (lastPoint == firstPoint)
// ArrayList<Coord> regionPolygon = new ArrayList<>();
// regionPolygon.add(new Coord(49.06020829807264, 9.432239985562616));
// regionPolygon.add(new Coord(49.05989193639516, 9.432497477628047));
// regionPolygon.add(new Coord(49.05968102749148, 9.432883715726192));
// regionPolygon.add(new Coord(49.05935060174289, 9.433001732922845));
// regionPolygon.add(new Coord(49.058422585764504, 9.433066105939206));
// regionPolygon.add(new Coord(49.05806402949591, 9.433248496152215));
// regionPolygon.add(new Coord(49.05748752183746, 9.434353566266353));
// regionPolygon.add(new Coord(49.05788826567445, 9.435544467068967));
// regionPolygon.add(new Coord(49.06072150273306, 9.435233330823237));
// regionPolygon.add(new Coord(49.06133312328379, 9.43515822897082));
// regionPolygon.add(new Coord(49.06143154427858, 9.43440721044665));
// regionPolygon.add(new Coord(49.06020829807264, 9.432239985562616));
//
// description.setRegionPolygon(regionPolygon);
Layer
layer
=
Layer
.
getDefaultLayer
();
Layer
layer
=
Layer
.
getDefaultLayer
();
layer
.
setProduct
(
"WU3"
);
layer
.
setProduct
(
"WU3"
);
layer
.
setName
(
"GML"
);
layer
.
setName
(
"GML"
);
...
@@ -61,11 +112,13 @@ public void processJob() throws InterruptedException {
...
@@ -61,11 +112,13 @@ public void processJob() throws InterruptedException {
while
(!
job
.
hasFinished
()
&&
!
job
.
hasFailed
()
&&
timeout
>
0
)
{
while
(!
job
.
hasFinished
()
&&
!
job
.
hasFailed
()
&&
timeout
>
0
)
{
Thread
.
sleep
(
interval
);
Thread
.
sleep
(
interval
);
timeout
-=
interval
;
timeout
-=
interval
;
System
.
out
.
println
(
"+"
);
}
}
}
}
@Override
@Override
public
void
jobStatusChanged
(
JobStatusEvent
event
)
{
public
void
jobStatusChanged
(
JobStatusEvent
event
)
{
System
.
out
.
println
(
"BOOM BOOM"
);
JobStatus
status
=
(
JobStatus
)
event
.
getSource
();
JobStatus
status
=
(
JobStatus
)
event
.
getSource
();
System
.
out
.
println
(
status
);
System
.
out
.
println
(
status
);
if
(
status
==
JobStatus
.
LOCAL
)
{
if
(
status
==
JobStatus
.
LOCAL
)
{
...
...
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