00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "../GeneralInclude/CompilerSwitches.h"
00013
#include "../GeneralInclude/ClassId.h"
00014
#include "../GeneralInclude/Constants.h"
00015
#include "../System/DC_DummyObsClock.h"
00016
#include "../FDIR/DC_OutOfRangeProfile.h"
00017
#include "../FDIR/DC_NullRecoveryAction.h"
00018
#include "../Data/DC_SampleFullDataPool.h"
00019
#include "../Data/DC_DataPoolMonitor.h"
00020
#include "TestCaseDataPoolMonitor_1.h"
00021
00022 TestCaseDataPoolMonitor_1::TestCaseDataPoolMonitor_1(
void) :
00023
TestCaseWithEvtCheck(ID_DATAPOOLMONITOR*10+1,"
TestCaseDataPoolMonitor_1") {
00024
return;
00025 }
00026
00027 void TestCaseDataPoolMonitor_1::runTestCase(
void) {
00028
const unsigned int nEvt=
getNumberOfEvents();
00029
00030
00031
TD_DataPoolId id;
00032
RecoveryAction *pAction=
new DC_NullRecoveryAction;
00033
DC_SampleFullDataPool *pDP =
new DC_SampleFullDataPool;
00034
00035 pDP->
setObsClock(
new DC_DummyObsClock);
00036
00037
for (
id=pDP->
firstIdentifier();!pDP->
isLastIdentifier();
id=pDP->
nextIdentifier()) {
00038
DC_OutOfRangeProfile *pProfile=
new DC_OutOfRangeProfile;
00039
00040 pProfile->
setLowerBound((
TD_Float)0.0);
00041 pProfile->
setUpperBound((
TD_Float)2.0);
00042 pDP->
setMonitoringProfile(
id,pProfile);
00043
00044 pDP->
setRecoveryAction(
id,pAction);
00045
00046
if (pDP->
isFloat(
id))
00047 pDP->
setValue(
id,(
TD_Float)1.0);
00048
else
00049 pDP->
setValue(
id,(
TD_Integer)1);
00050 }
00051
00052
00053 CC_RootObject::setDataPool(pDP);
00054
00055
00056
DC_DataPoolMonitor *pDPM=
new DC_DataPoolMonitor;
00057
00058
00059
if (pDPM->
getClassId()!=ID_DATAPOOLMONITOR) {
00060 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00061
return;
00062 }
00063
00064
00065 pDPM->
execute();
00066
for (
id=pDP->
firstIdentifier();!pDP->
isLastIdentifier();
id=pDP->
nextIdentifier()) {
00067
if (!pDP->
isValid(
id)) {
00068 setTestResult(
TEST_FAILURE,
"Wrong validity status");
00069
return;
00070 }
00071 }
00072
00073
00074
if (
getNumberOfEvents()!=nEvt+1) {
00075 setTestResult(
TEST_FAILURE,
"Wrong number of events");
00076
return;
00077 }
00078
00079
00080
00081
00082
unsigned int evtOffset=2;
00083
00084
for (
id=pDP->
firstIdentifier();!pDP->
isLastIdentifier();
id=pDP->
nextIdentifier()) {
00085
if (pDP->
isFloat(
id))
00086 pDP->
setValue(
id,(
TD_Float)3.0);
00087
else
00088 pDP->
setValue(
id,(
TD_Integer)3);
00089 }
00090
00091 pDPM->
execute();
00092
00093
00094
00095
00096
for (
id=pDP->
firstIdentifier();!pDP->
isLastIdentifier();
id=pDP->
nextIdentifier()) {
00097
if (pDP->
isValid(
id)) {
00098 setTestResult(
TEST_FAILURE,
"Failed to change the validity status");
00099
return;
00100 }
00101
00102
00103
if ((
getNumberOfEvents()-(nEvt+evtOffset))>=
getEventRepositorySize())
00104
break;
00105
00106
if (verifySpecificEvent(nEvt+evtOffset,EVT_PUNCTUAL_ACTION_EXEC)) {
00107 setTestResult(
TEST_FAILURE,
"Recovery action not executed");
00108
return;
00109 }
00110
00111 evtOffset+=2;
00112 }
00113
00114 setTestResult(
TEST_SUCCESS,
"Test Successful");
00115
return;
00116 }