CORDET Framework - C2 Implementation
CrFwOutStreamTestCases.c File Reference

Implementation of test cases for OutStream Component. More...

Go to the source code of this file.

Functions

CrFwBool_t CrFwOutStreamTestCase1 ()
 Test the initialization and packet queue (PQ) management of the OutStream. More...
 
CrFwBool_t CrFwOutStreamTestCase2 ()
 Test the OutStream with overridden initialization check and initialization action. More...
 
CrFwBool_t CrFwOutStreamTestCase3 ()
 Test the packet flushing functionality of an OutStream for a packet originating from the host application (as opposed to a re-routed packet). More...
 
CrFwBool_t CrFwOutStreamTestCase4 ()
 Test the registry functionality of an OutStream. More...
 
CrFwBool_t CrFwOutStreamTestCase5 ()
 Test the Shutdown Operation of an OutStream. More...
 
CrFwBool_t CrFwOutStreamTestCase6 ()
 Test the packet flushing functionality of an OutStream for a re-routed packet (as opposed to a packet originating from the host application). More...
 
CrFwBool_t CrFwOutStreamTestCase7 ()
 Test the management of the sequence counters for different groups. More...
 

Detailed Description

Implementation of test cases for OutStream Component.

Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the CORDET Framework.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file CrFwOutStreamTestCases.c.

Function Documentation

CrFwBool_t CrFwOutStreamTestCase1 ( )

Test the initialization and packet queue (PQ) management of the OutStream.

The following actions are performed in this test:

  • Attempt to instantiate an OutStream with an illegal identifier and check that the operation fails.
  • Instantiate one OutStream twice and check that the same instance is returned on both occasions.
  • Check that the OutStream is correctly configured.
  • Initialize and configure the OutStream and bring its state machine to state CONFIGURED-READY
  • Check that the OutStream sequence counters and PQ size are correct
  • Configure the Packet Hand-Over Operation to return "hand-over failed", send a packet to the OutStream and check that the PQ state is correctly updated and that the OutStream goes to state BUFFERING.
  • Send the same packet multiple times until the PQ is full and check that its state is as expected.
  • Send one more packet and check that an error report is generated. In all cases, the packet is configured to belong to the first group associated to the OutStream.
Verifies:

Error Report: crOutStreamPQFull

Application Error: crOutStreamIllId

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->FPS

OutStream SM Transition: IPS->READY

OutStream SM Transition: READY->BUFFERING

OutStream SM Transition: BUFFERING->BUFFERING

OutStream SM Transition: Enqueue Action with PQ Not Full

OutStream SM Transition: Enqueue Action with PQ Full

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Check Successful

Returns
true if the test was successful, false otherwise.

Definition at line 42 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase2 ( )

Test the OutStream with overridden initialization check and initialization action.

The following actions are performed in this test:

  • Verify that initialization of OutStream only succeeds when both the initialization check and the initialization action succeed.
  • Verify that configuration of OutStream only succeeds when both the configuration check and the configuration action succeed.
  • Verify that a reset of a configured OutStream fails if the configuration check fails.

After this test has run, the second OutStream component may no longer be usable.

Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->INITIALIZED

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Initialization Procedure: Initialization Action Failed

Initialization Procedure: Initialization Check Failed

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Action Failed

Reset Procedure: Configuration Check Successful

Reset Procedure: Configuration Check Failed

Returns
true if the test was successful, false otherwise.

Definition at line 188 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase3 ( )

Test the packet flushing functionality of an OutStream for a packet originating from the host application (as opposed to a re-routed packet).

The following actions are performed in this test:

  • The first OutStream is started and the Packet Hand-Over Operation is configured to return "hand-over successful".
  • It is checked that the destination assigned to the OutStream is correctly reported by the OutStream
  • A packet is sent to the OutStream and it is checked that it is successfully flushed.
  • The Packet Hand-Over Operation is configured to return "hand-over failed", two packets are sent to the OutStream, and it is checked that they are buffered.
  • The packet factory is configured to be empty and then a packet is sent to the OutStream and it is checked that error crOutStreamNoMorePckt is raised.
  • The ConnectionAvailable signal is sent to the OutStream and it is checked that the packet queue remains unchanged.
  • The Packet Hand-Over Operation is configured to return "hand-over successful", the ConnectionAvailable signal is sent again to the OutStream and it is checked that the packet queue is successfully flushed.
  • The Packet Hand-Over Operation is configured to return "hand-over failed", the packet factory is configured to be empty, and then a packet is sent to the OutStream and it is checked that error crOutStreamNoMorePckt is raised.
  • The OutStream is reset and it is checked that its state is correctly reset In all cases, the packets sent to an OutStream are configured to belong to the first group associated to the OutStream.
Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->CONFIGURED

OutStream SM Transition: IPS->READY

OutStream SM Transition: READY->BUFFERING

OutStream SM Transition: BUFFERING->READY

OutStream SM Transition: Enqueue Action with No More Packets Available

OutStream SM Transition: Enqueue Action with PQ Not Full

OutStream SM Transition: Flush Packet Queue Action with Middleware Accepting Packet

OutStream SM Transition: Flush Packet Queue Action with Middleware Rejecting Packet

OutStream SM Transition: Flush Packet Queue Action with Packet Originating in Application

OutStream SM Transition: Flush Packet Queue Action with Legal Packet Group

OutStream SM Transition: Send or Enqueue Action with No More Packets Available

OutStream SM Transition: Send or Enqueue Action with Middleware Accepting Packet

OutStream SM Transition: Send or Enqueue Action with Middleware Rejecting Packet

OutStream SM Transition: Send or Enqueue Action with Packet Originating in Application

OutStream SM Transition: Send or Enqueue Action with Legal Packet Group

OutStream SM Transition: Flush Packet Queue Action with Illegal Group Report

OutStream SM Transition: Send or Enqueue Action with Illegal Group Report

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Check Successful

Application Error: crOutStreamUndefDest

Returns
true if the test was successful, false otherwise.

Definition at line 263 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase4 ( )

Test the registry functionality of an OutStream.

The following actions are performed in this test:

  • The OutStreams are made by their factory function and associated to their destinations.
  • The same OutStreams are retrieved from their destinations.
  • An attempt is made to retrieve an OutStream from an illegal destination.
Verifies:
Application Error: crOutStreamUndefDest
Returns
true if the test was successful, false otherwise.

Definition at line 466 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase5 ( )

Test the Shutdown Operation of an OutStream.

The following actions are performed in this test:

  • Bring an OutStream to its CONFIGURED state
  • Shut down the OutStream and check that the new Shutdown Operation is executed.
Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->FPS

Returns
true if the test was successful, false otherwise.

Definition at line 499 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase6 ( )

Test the packet flushing functionality of an OutStream for a re-routed packet (as opposed to a packet originating from the host application).

The following actions are performed in this test:

  • The first OutStream is started and the Packet Hand-Over Operation is configured to return "hand-over successful".
  • A packet is sent to the OutStream and it is checked that it is successfully flushed and that its sequence counter is not modified.
  • The Packet Hand-Over Operation is configured to return "hand-over failed", two packets are sent to the OutStream, and it is checked that they are buffered.
  • The ConnectionAvailable signal is sent to the OutStream and it is checked that the packet queue is successfully flushed.
  • The OutStream is reset and it is checked that its state is correctly reset
Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->CONFIGURED

OutStream SM Transition: IPS->READY

OutStream SM Transition: READY->BUFFERING

OutStream SM Transition: BUFFERING->READY

OutStream SM Transition: Enqueue Action with PQ Not Full

OutStream SM Transition: Flush Packet Queue Action with Middleware Accepting Packet

OutStream SM Transition: Flush Packet Queue Action with Middleware Rejecting Packet

OutStream SM Transition: Flush Packet Queue Action with Packet not Originating in Application

OutStream SM Transition: Send or Enqueue Action with Packet not Originating in Application

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Check Successful

Returns
true if the test was successful, false otherwise.

Definition at line 535 of file CrFwOutStreamTestCases.c.

CrFwBool_t CrFwOutStreamTestCase7 ( )

Test the management of the sequence counters for different groups.

The following actions are performed in this test:

  • The second OutStream (which must be configured to have more than one destination/source group) is started and its Packet Hand-Over Operation is configured to return "hand-over successful".
  • It is checked that the number of groups assigned to the OutStream is greater than 1
  • Two packets belonging to, respectively, the first and second groups are sent to the OutStream and it is checked that they are successfully flushed and that their sequence counter is successfully incremented.
  • Two more packets belonging to, respectively, the first and second groups are sent to the OutStream and it is checked that they are successfully flushed and that their sequence counter is successfully incremented.
  • A packet belonging to a non-existent group is sent to the OutStream and it is checked that it is successfully flushed but that an error report is raised.
  • The Packet Hand-Over Operation is configured to return "hand-over failed", three packets belonging to, respectively, the first, second and a non-existent group are sent to the OutStream, and it is checked that they are buffered.
  • The ConnectionAvailable signal is sent to the OutStream and it is checked that the packet queue remains unchanged.
  • The Packet Hand-Over Operation is configured to return "hand-over successful", the ConnectionAvailable signal is sent again to the OutStream and it is checked that the packet queue is successfully flushed and that one error report for the illegal group is created.
  • The OutStream is reset and it is checked that its state is correctly reset
Verifies:

Base SM Transition: IPS->CREATED

Base SM Transition: CREATED->INITIALIZED

Base SM Transition: INITIALIZED->CONFIGURED

Base SM Transition: CONFIGURED->CONFIGURED

OutStream SM Transition: IPS->READY

OutStream SM Transition: READY->BUFFERING

OutStream SM Transition: BUFFERING->READY

OutStream SM Transition: Flush Packet Queue Action with Illegal Group Report

OutStream SM Transition: Send or Enqueue Action with Illegal Group Report

Initialization Procedure: Initialization Action Successful

Initialization Procedure: Initialization Check Successful

Reset Procedure: Configuration Action Successful

Reset Procedure: Configuration Check Successful

Error Report: crOutStreamIllGroup

Returns
true if the test was successful, false otherwise.

Definition at line 681 of file CrFwOutStreamTestCases.c.

P&P Software GmbH, Copyright 2012-2013, All Rights Reserved