Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
feb6c12c
Commit
feb6c12c
authored
4 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
javadoc
parent
a432ffea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/edu/nps/moves/dis7/PduTest.java
+20
-6
20 additions, 6 deletions
test/edu/nps/moves/dis7/PduTest.java
with
20 additions
and
6 deletions
test/edu/nps/moves/dis7/PduTest.java
+
20
−
6
View file @
feb6c12c
...
@@ -39,7 +39,6 @@ import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface;
...
@@ -39,7 +39,6 @@ import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.jupiter.api.AfterEach
;
import
org.junit.jupiter.api.AfterEach
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
...
@@ -68,6 +67,7 @@ abstract public class PduTest
...
@@ -68,6 +67,7 @@ abstract public class PduTest
Pdu
receivedPdu
;
Pdu
receivedPdu
;
DisThreadedNetworkInterface
.
PduListener
pduListener
;
DisThreadedNetworkInterface
.
PduListener
pduListener
;
/** Ensure network connections, listener and handler are prepared */
@BeforeEach
@BeforeEach
public
void
setUp
()
public
void
setUp
()
{
{
...
@@ -83,6 +83,7 @@ abstract public class PduTest
...
@@ -83,6 +83,7 @@ abstract public class PduTest
disNetworkInterface
.
addListener
(
pduListener
);
disNetworkInterface
.
addListener
(
pduListener
);
}
}
/** Ensure network connections are removed */
@AfterEach
@AfterEach
public
void
tearDown
()
public
void
tearDown
()
{
{
...
@@ -91,15 +92,20 @@ abstract public class PduTest
...
@@ -91,15 +92,20 @@ abstract public class PduTest
disNetworkInterface
=
null
;
disNetworkInterface
=
null
;
}
}
protected
void
sendPdu
(
Pdu
pdu
)
/**
* Handler
* @param newPdu new PDU of interest
*/
protected
void
sendPdu
(
Pdu
newPdu
)
{
{
try
try
{
{
disNetworkInterface
.
send
(
p
du
);
disNetworkInterface
.
send
(
newP
du
);
Thread
.
sleep
(
getThreadSleepInterval
());
// TODO better way to wait?
Thread
.
sleep
(
getThreadSleepInterval
());
// TODO better way to wait?
}
catch
(
InterruptedException
ex
)
}
catch
(
InterruptedException
ex
)
{
{
System
.
err
.
println
(
"E
rror sending Multicast: "
+
ex
.
getLocalizedMessage
());
System
.
err
.
println
(
this
.
getClass
().
getName
()
+
".sendPdu(Pdu newPdu), e
rror sending Multicast: "
+
ex
.
getLocalizedMessage
());
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
}
}
...
@@ -116,6 +122,10 @@ abstract public class PduTest
...
@@ -116,6 +122,10 @@ abstract public class PduTest
return
result
;
return
result
;
}
}
/**
* Handler
* @param newPdu new PDU of interest
*/
protected
void
setUpReceiver
(
Pdu
newPdu
)
protected
void
setUpReceiver
(
Pdu
newPdu
)
{
{
receivedPdu
=
newPdu
;
receivedPdu
=
newPdu
;
...
@@ -138,7 +148,9 @@ abstract public class PduTest
...
@@ -138,7 +148,9 @@ abstract public class PduTest
assertEquals
(
newPdu
.
getTimestamp
(),
receivedPdu
.
getTimestamp
(),
"mismatched Timestamp"
);
assertEquals
(
newPdu
.
getTimestamp
(),
receivedPdu
.
getTimestamp
(),
"mismatched Timestamp"
);
}
}
/** Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization) */
/**
* Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization)
*/
public
abstract
void
testRoundTrip
();
public
abstract
void
testRoundTrip
();
/** Test single PDU for correctness according to all contained fields in this PDU type
/** Test single PDU for correctness according to all contained fields in this PDU type
...
@@ -147,6 +159,7 @@ abstract public class PduTest
...
@@ -147,6 +159,7 @@ abstract public class PduTest
protected
abstract
void
testOnePdu
(
Pdu
newPdu
);
protected
abstract
void
testOnePdu
(
Pdu
newPdu
);
/**
/**
* Threaded sleep may be necessary to ensure completion of sending/receiving PDU
* @return the threadSleepInterval
* @return the threadSleepInterval
*/
*/
public
long
getThreadSleepInterval
()
public
long
getThreadSleepInterval
()
...
@@ -155,6 +168,7 @@ abstract public class PduTest
...
@@ -155,6 +168,7 @@ abstract public class PduTest
}
}
/**
/**
* Threaded sleep may be necessary to ensure completion of sending/receiving PDU
* @param threadSleepInterval the threadSleepInterval to set
* @param threadSleepInterval the threadSleepInterval to set
*/
*/
public
void
setThreadSleepInterval
(
long
threadSleepInterval
)
public
void
setThreadSleepInterval
(
long
threadSleepInterval
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment