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
cc87bc82
Commit
cc87bc82
authored
3 years ago
by
Fisher, Alexander (Alex) (Capt)
Browse files
Options
Downloads
Patches
Plain Diff
Delete CommentPDUFisherTest.java
parent
3b81bb10
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
assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/CommentPDUFisherTest.java
+0
-131
0 additions, 131 deletions
...21JulySeptember/projects/Fisher/CommentPDUFisherTest.java
with
0 additions
and
131 deletions
assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/CommentPDUFisherTest.java
deleted
100644 → 0
+
0
−
131
View file @
3b81bb10
package
MV3500Cohort2021JulySeptember.projects.Fisher
;
import
edu.nps.moves.dis7.enumerations.VariableRecordType
;
import
edu.nps.moves.dis7.pdus.Pdu
;
import
edu.nps.moves.dis7.utilities.PduFactory
;
/**
*
* @author adfis
*/
public
class
CommentPDUFisherTest
{
//BeforeAll
public
static
void
setUpClass
()
{
System
.
out
.
println
(
"CommentPdusTest"
);
}
//AfterAll
public
static
void
tearDownClass
()
{
}
//BeforeEach
public
void
setUp
()
{
}
//AfterEach
public
void
tearDown
()
{
}
private
Pdu
receivedPdu
;
//Test
public
void
testRoundTrip
()
{
PduFactory
factory
=
new
PduFactory
();
setUpReceiver
();
testOne
(
factory
.
makeCommentPdu
());
testOne
(
factory
.
makeCommentPdu
(
"123_test_string"
));
testOne
(
factory
.
makeCommentPdu
(
VariableRecordType
.
MODEL_TYPE
,
"456_test with type = modeltype"
));
testOne
(
factory
.
makeCommentPdu
(
"xyz first message"
,
"mno second message"
,
"jkl third message"
));
testOne
(
factory
.
makeCommentReliablePdu
());
testOne
(
factory
.
makeCommentReliablePdu
(
"789_test_string"
));
testOne
(
factory
.
makeCommentReliablePdu
(
VariableRecordType
.
ACLS_AIRCRAFT_REPORT
,
"abc_test with type = acls_aircraft_report"
));
testOne
(
factory
.
makeCommentReliablePdu
(
"xyz R first message"
,
"mno R second message"
,
"jkl R third message"
));
}
private
void
testOne
(
Pdu
pdu
)
{
sendPdu
(
pdu
);
// will wait a while
assertTrue
(
receivedPdu
!=
null
,
"No response from network receive"
);
assertTrue
(
compare
(
pdu
,
receivedPdu
),
"Comparison failed"
);
receivedPdu
=
null
;
}
private
void
sendPdu
(
Pdu
pdu
)
{
try
{
Thread
.
sleep
(
250
l
);
// make sure receiver is listening
DisNetworking
disnet
=
new
DisNetworking
();
disnet
.
sendPdu
(
pdu
);
Thread
.
sleep
(
1000
l
);
}
catch
(
InterruptedException
ex
)
{
System
.
err
.
println
(
"Error sending Multicast: "
+
ex
.
getLocalizedMessage
());
System
.
exit
(
1
);
}
}
private
boolean
compare
(
Pdu
pdu1
,
Pdu
pdu2
)
{
return
pdu1
.
equals
(
pdu2
);
}
private
void
setUpReceiver
()
{
Thread
rcvThread
=
new
Thread
(()
->
{
while
(
true
)
{
receivedPdu
=
new
DisNetworking
().
receivePdu
();
// blocks
}
});
rcvThread
.
setPriority
(
Thread
.
NORM_PRIORITY
);
rcvThread
.
setDaemon
(
true
);
rcvThread
.
start
();
}
/**
*
* @param args
*/
public
static
void
main
(
String
[]
args
)
{
//new CommentPdusTest().testRoundTrip();
}
private
void
assertTrue
(
boolean
b
,
String
no_response_from_network_receive
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
private
static
class
CommentPdusTest
{
public
CommentPdusTest
()
{
}
//private void testRoundTrip() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
// }
}
private
static
class
DisNetworking
{
public
DisNetworking
()
{
}
private
Pdu
receivePdu
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
private
void
sendPdu
(
Pdu
pdu
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
}
}
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