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
6a42eaf3
Commit
6a42eaf3
authored
4 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
tuned naming and logic, works well
parent
01db3692
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/CommentPdusTest.java
+17
-17
17 additions, 17 deletions
test/edu/nps/moves/dis7/CommentPdusTest.java
with
17 additions
and
17 deletions
test/edu/nps/moves/dis7/CommentPdusTest.java
+
17
−
17
View file @
6a42eaf3
...
...
@@ -13,8 +13,8 @@ import static org.junit.jupiter.api.Assertions.*;
@DisplayName
(
"Comment Pdus Test"
)
public
class
CommentPdusTest
{
DisThreadedNetIF
disThreadedNetworkInterface
;
Pdu
receivedPdu
;
DisThreadedNetIF
disThreadedNetworkInterface
;
Pdu
receivedPdu
;
DisThreadedNetIF
.
PduListener
pduListener
;
@BeforeAll
...
...
@@ -52,32 +52,32 @@ public class CommentPdusTest
@Test
public
void
testRoundTrip
()
{
PduFactory
f
actory
=
new
PduFactory
();
PduFactory
pduF
actory
=
new
PduFactory
();
testOne
(
f
actory
.
makeCommentPdu
());
testOne
(
f
actory
.
makeCommentPdu
(
"123_test_string"
));
testOne
(
f
actory
.
makeCommentPdu
(
VariableRecordType
.
MODEL_TYPE
,
"456_test with type = modeltype"
));
testOne
(
f
actory
.
makeCommentPdu
(
"xyz first message"
,
"mno second message"
,
"jkl third message"
));
testOne
(
pduF
actory
.
makeCommentPdu
());
testOne
(
pduF
actory
.
makeCommentPdu
(
"123_test_string"
));
testOne
(
pduF
actory
.
makeCommentPdu
(
VariableRecordType
.
MODEL_TYPE
,
"456_test with type = modeltype"
));
testOne
(
pduF
actory
.
makeCommentPdu
(
"xyz first message"
,
"mno second message"
,
"jkl third message"
));
testOne
(
f
actory
.
makeCommentReliablePdu
());
testOne
(
f
actory
.
makeCommentReliablePdu
(
"789_test_string"
));
testOne
(
f
actory
.
makeCommentReliablePdu
(
VariableRecordType
.
ACLS_AIRCRAFT_REPORT
,
"abc_test with type = acls_aircraft_report"
));
testOne
(
f
actory
.
makeCommentReliablePdu
(
"xyz R first message"
,
"mno R second message"
,
"jkl R third message"
));
testOne
(
pduF
actory
.
makeCommentReliablePdu
());
testOne
(
pduF
actory
.
makeCommentReliablePdu
(
"789_test_string"
));
testOne
(
pduF
actory
.
makeCommentReliablePdu
(
VariableRecordType
.
ACLS_AIRCRAFT_REPORT
,
"abc_test with type = acls_aircraft_report"
));
testOne
(
pduF
actory
.
makeCommentReliablePdu
(
"xyz R first message"
,
"mno R second message"
,
"jkl R third message"
));
}
private
void
testOne
(
Pdu
p
du
)
private
void
testOne
(
Pdu
newP
du
)
{
sendPdu
(
p
du
);
// will wait a while
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive"
);
assertTrue
(
compare
(
p
du
,
receivedPdu
),
"Comparison failed"
);
receivedPdu
=
null
;
sendPdu
(
newP
du
);
// will wait a while
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive
r
"
);
assertTrue
(
compare
(
newP
du
,
receivedPdu
),
"Comparison failed"
);
receivedPdu
=
null
;
// ensure cleared prior to next test
}
private
void
sendPdu
(
Pdu
pdu
)
{
try
{
disThreadedNetworkInterface
.
send
(
pdu
);
Thread
.
sleep
(
100
l
);
Thread
.
sleep
(
100
);
// TODO consider refactoring the wait logic and moving externally
}
catch
(
InterruptedException
ex
)
{
System
.
err
.
println
(
"Error sending Multicast: "
+
ex
.
getLocalizedMessage
());
...
...
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