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
400a1427
Commit
400a1427
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
improved diagnostic outputs
parent
47a03974
No related branches found
Branches containing commit
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
+26
-8
26 additions, 8 deletions
test/edu/nps/moves/dis7/PduTest.java
with
26 additions
and
8 deletions
test/edu/nps/moves/dis7/PduTest.java
+
26
−
8
View file @
400a1427
...
...
@@ -50,9 +50,13 @@ import org.junit.jupiter.api.BeforeEach;
abstract
public
class
PduTest
{
protected
final
long
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
=
100
l
;
//
i.e
. 100, type long
protected
final
long
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
=
100
0
l
;
//
e.g
. 100
msec
, type long
private
long
threadSleepInterval
=
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
;
private
int
maximumRetryAttempts
=
10
;
Pdu
receivedPdu
;
DisThreadedNetworkInterface
disNetworkInterface
;
DisThreadedNetworkInterface
.
PduListener
pduListener
;
@BeforeAll
public
static
void
setUpClass
()
...
...
@@ -65,10 +69,6 @@ abstract public class PduTest
{
}
DisThreadedNetworkInterface
disNetworkInterface
;
Pdu
receivedPdu
;
DisThreadedNetworkInterface
.
PduListener
pduListener
;
/** Ensure network connections, listener and handler are prepared */
@BeforeEach
public
void
setUp
()
...
...
@@ -92,6 +92,16 @@ abstract public class PduTest
disNetworkInterface
.
removeListener
(
pduListener
);
disNetworkInterface
.
kill
();
disNetworkInterface
=
null
;
try
// additional sleep, allowing teardown to proceed
{
Thread
.
sleep
(
getThreadSleepInterval
());
}
catch
(
InterruptedException
ie
)
{
System
.
err
.
flush
();
System
.
err
.
println
(
"*** tearDown() failed to sleep"
);
ie
.
printStackTrace
();
}
}
/**
...
...
@@ -113,10 +123,18 @@ abstract public class PduTest
Thread
.
sleep
(
getThreadSleepInterval
());
if
(
receivedPdu
!=
null
)
return
;
// no receipt yet
numberOfReadTests
++;
System
.
out
.
flush
();
String
padding1
=
new
String
();
// count
String
padding2
=
new
String
();
// duration
if
(
numberOfReadTests
<
10
)
padding1
=
" "
;
if
((
numberOfReadTests
*
getThreadSleepInterval
())
<
1000
l
)
padding2
=
" "
;
System
.
err
.
println
(
"*** PduTest.sendIeeeStandardPdu("
+
createdPdu
.
getPduType
().
name
()
+
")"
+
" receipt reattempt #"
+
numberOfReadTests
+
", "
+
(
numberOfReadTests
*
getThreadSleepInterval
())
+
" msec total"
);
" receipt reattempt "
+
padding1
+
"#"
+
numberOfReadTests
+
", "
+
padding2
+
(
numberOfReadTests
*
getThreadSleepInterval
())
+
" msec total sleep"
);
System
.
err
.
flush
();
}
while
(
numberOfReadTests
<
getMaximumRetryAttempts
());
System
.
err
.
println
(
"*** PduTest.sendIeeeStandardPdu("
+
createdPdu
.
getPduType
().
name
()
+
") did not succeed"
);
...
...
@@ -156,7 +174,7 @@ abstract public class PduTest
*/
protected
void
testPduSendReceiveHeaderMatch
(
Pdu
createdPdu
)
{
String
TEST_SUITE_WARNING
=
" (TODO note that test work
s
standalone but mysteriously fail
s
as part of project test suite)"
;
String
TEST_SUITE_WARNING
=
" (TODO note that test
may
work standalone but mysteriously fail as part of project test suite)"
;
sendIeeeStandardPdu
(
createdPdu
);
// send to self, then wait a while, then return receivedPdu
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive after "
+
...
...
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