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
67190677
Commit
67190677
authored
4 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
allow multiple retries to check single-packet receipt
parent
fa835083
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build.all.out.txt
+83
-1160
83 additions, 1160 deletions
build.all.out.txt
test/edu/nps/moves/dis7/PduTest.java
+36
-4
36 additions, 4 deletions
test/edu/nps/moves/dis7/PduTest.java
with
119 additions
and
1164 deletions
build.all.out.txt
+
83
−
1160
View file @
67190677
This diff is collapsed.
Click to expand it.
test/edu/nps/moves/dis7/PduTest.java
+
36
−
4
View file @
67190677
...
@@ -52,6 +52,7 @@ abstract public class PduTest
...
@@ -52,6 +52,7 @@ 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
l
;
// i.e. 100, type long
private
long
threadSleepInterval
=
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
;
private
long
threadSleepInterval
=
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
;
private
int
maximumRetryAttempts
=
10
;
@BeforeAll
@BeforeAll
public
static
void
setUpClass
()
public
static
void
setUpClass
()
...
@@ -99,12 +100,26 @@ abstract public class PduTest
...
@@ -99,12 +100,26 @@ abstract public class PduTest
* for unmarshalling (deserialization) further unit testing.
* for unmarshalling (deserialization) further unit testing.
* @param createdPdu new PDU of interest
* @param createdPdu new PDU of interest
*/
*/
@SuppressWarnings
(
"SleepWhileInLoop"
)
protected
void
sendIeeeStandardPdu
(
Pdu
createdPdu
)
protected
void
sendIeeeStandardPdu
(
Pdu
createdPdu
)
{
{
try
disNetworkInterface
.
send
(
createdPdu
);
try
// check to see if the sent PDU came back
{
{
disNetworkInterface
.
send
(
createdPdu
);
int
numberOfReadTests
=
0
;
Thread
.
sleep
(
getThreadSleepInterval
());
// TODO better way to wait?
do
// check at least once, perhaps multiple times for receipt before returning
{
Thread
.
sleep
(
getThreadSleepInterval
());
if
(
receivedPdu
!=
null
)
return
;
numberOfReadTests
++;
System
.
out
.
flush
();
System
.
err
.
println
(
"*** PduTest.sendIeeeStandardPdu("
+
createdPdu
.
getPduType
().
name
()
+
")"
+
" receipt reattempt #"
+
numberOfReadTests
+
", "
+
(
numberOfReadTests
*
getThreadSleepInterval
())
+
" msec total"
);
}
while
(
numberOfReadTests
<
getMaximumRetryAttempts
());
System
.
err
.
println
(
"*** PduTest.sendIeeeStandardPdu("
+
createdPdu
.
getPduType
().
name
()
+
") did not succeed"
);
}
}
catch
(
InterruptedException
ex
)
catch
(
InterruptedException
ex
)
{
{
...
@@ -144,7 +159,8 @@ abstract public class PduTest
...
@@ -144,7 +159,8 @@ abstract public class PduTest
String
TEST_SUITE_WARNING
=
" (TODO note that test works standalone but mysteriously fails as part of project test suite)"
;
String
TEST_SUITE_WARNING
=
" (TODO note that test works standalone but mysteriously fails as part of project test suite)"
;
sendIeeeStandardPdu
(
createdPdu
);
// send to self, then wait a while, then return receivedPdu
sendIeeeStandardPdu
(
createdPdu
);
// send to self, then wait a while, then return receivedPdu
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive after "
+
getThreadSleepInterval
()
+
" msec"
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive after "
+
Math
.
max
(
getMaximumRetryAttempts
(),
1
)
+
" retry attempts at "
+
getThreadSleepInterval
()
+
" msec intervals"
+
TEST_SUITE_WARNING
);
+
TEST_SUITE_WARNING
);
assertTrue
((
createdPdu
!=
receivedPdu
),
"Exact match found between createdPdu and receivedPdu object references indicates improper test configuration"
);
assertTrue
((
createdPdu
!=
receivedPdu
),
"Exact match found between createdPdu and receivedPdu object references indicates improper test configuration"
);
...
@@ -222,5 +238,21 @@ abstract public class PduTest
...
@@ -222,5 +238,21 @@ abstract public class PduTest
{
{
this
.
threadSleepInterval
=
threadSleepInterval
;
this
.
threadSleepInterval
=
threadSleepInterval
;
}
}
/**
* @return the maximumRetryAttempts value
*/
public
int
getMaximumRetryAttempts
()
{
return
maximumRetryAttempts
;
}
/**
* @param maximumRetryAttempts the maximumRetryAttempts value to set
*/
public
void
setMaximumRetryAttempts
(
int
maximumRetryAttempts
)
{
this
.
maximumRetryAttempts
=
maximumRetryAttempts
;
}
}
}
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