/*
 * This test will first send an instance of InteractionRoot.X with a region that overlaps with the
 * region that listener federate has subscribed to. It will then send another interaction with a
 * region that doesn't overlap with the listener (and validate that the interaction isnt' recevied)
 */
void SendInteractionWithRegionTest::testSendTSOInteractionWithRegion()
{
	try
	{
		RTIfedTime theTime = 10.0;
		defaultFederate->rtiamb->sendInteractionWithRegion(
		                             xHandle, *phvps, theTime, "NA", *senderRegion );
	}
	catch( RTI::Exception &e )
	{
		failTest( "Unexpected exception while sending TSO interaction: %s", e._reason );
	}
	
	// shouldn't receive the interaction until we advance enough
	listenerFederate->fedamb->waitForTSOInteractionTimeout( xHandle );
	defaultFederate->quickAdvanceAndWait( 10.0 );
	listenerFederate->quickAdvanceAndWait( 10.0 );
	validateReceivedTSO();

	try
	{
		RTIfedTime theTime = 20.0;
		defaultFederate->rtiamb->sendInteractionWithRegion(
		                             xHandle, *phvps, theTime, "NA", *senderRegionOOB );
	}
	catch( RTI::Exception &e )
	{
		failTest( "Unexpected exception while sending TSO interaction: %s", e._reason );
	}
	
	// shouldn't receive the interaction at all
	defaultFederate->quickAdvanceAndWait( 20.0 );
	listenerFederate->quickAdvanceAndWait( 20.0 );
	listenerFederate->fedamb->waitForTSOInteractionTimeout( xHandle );
}
Ejemplo n.º 2
0
////////////////////////////////////////////
// TEST: (valid) testSendTSOInteraction() //
////////////////////////////////////////////
void SendInteractionTest::testSendTSOInteraction()
{
	try
	{
		RTIfedTime theTime = 10.0;
		defaultFederate->rtiamb->sendInteraction( yHandle, *phvps, theTime, "NA" );
	}
	catch( RTI::Exception &e )
	{
		failTest( "Unexpected exception while sending TSO interaction: %s", e._reason );
	}
	
	// shouldn't receive the reflection yet
	listenerFederate->fedamb->waitForTSOInteractionTimeout( yHandle );
	defaultFederate->quickAdvanceAndWait( 10.0 );
	listenerFederate->quickAdvanceAndWait( 10.0 );
	validateReceivedTSO();
}