00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#include "../GeneralInclude/CompilerSwitches.h"
00011
#include "../GeneralInclude/ClassId.h"
00012
#include "../GeneralInclude/Constants.h"
00013
#include "../GeneralInclude/TestConstants.h"
00014
#include "../FDIR/DC_FdirCheck.h"
00015
#include "../FDIR/DC_DummyRecoveryAction.h"
00016
#include "TestCaseFdirCheck_1.h"
00017
00018 TestCaseFdirCheck_1::TestCaseFdirCheck_1(
void) :
00019
TestCaseGenericSetUp(ID_FDIRCHECK*10+1,"
TestCaseFdirCheck_1") {
00020
return;
00021 }
00022
00023 void TestCaseFdirCheck_1::runTestCase(
void) {
00024
DC_FdirCheck *pFDIR=
new DC_FdirCheck;
00025
DC_DummyRecoveryAction *pFDI =
new DC_DummyRecoveryAction;
00026 DC_DummyRecoveryAction *pDRA =
new DC_DummyRecoveryAction;
00027
00028
00029
if (pFDIR->
getClassId()!=ID_FDIRCHECK) {
00030 setTestResult(
TEST_FAILURE,
"Wrong class id");
00031
return;
00032 }
00033
00034
00035
if (pFDIR->
isObjectConfigured()) {
00036 setTestResult(
TEST_FAILURE,
"Newly created FDIR check is configured");
00037
return;
00038 }
00039
00040
00041
00042 pFDIR->
setFdiCheck(pFDI);
00043
00044
if (pFDIR->
getFdiCheck()!=pFDI) {
00045 setTestResult(
TEST_FAILURE,
"setFdiCheck() failed");
00046
return;
00047 }
00048
00049
if (pFDIR->
isObjectConfigured()) {
00050 setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00051
return;
00052 }
00053
00054
00055
00056 pFDIR->
setRecoveryAction(pDRA);
00057
00058
if (pFDIR->
getRecoveryAction()!=pDRA) {
00059 setTestResult(
TEST_FAILURE,
"setRecoveryAction() failed");
00060
return;
00061 }
00062
00063
if (!pFDIR->
isObjectConfigured()) {
00064 setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00065
return;
00066 }
00067
00068
00069
00070 pFDI->
setActionOutcome(ACTION_CANNOT_EXECUTE);
00071
00072
if (pFDIR->
execute()!=ACTION_CANNOT_EXECUTE) {
00073 setTestResult(
TEST_FAILURE,
"Wrong FDI check outcome");
00074
return;
00075 }
00076
00077
00078
00079
00080 pFDI->
setActionOutcome(ACTION_FAILURE);
00081 pDRA->
setActionOutcome(ACTION_CANNOT_EXECUTE);
00082
00083
if (pFDIR->
execute()!=ACTION_CANNOT_EXECUTE) {
00084 setTestResult(
TEST_FAILURE,
"Wrong recovery action outcome");
00085
return;
00086 }
00087
00088 setTestResult(
TEST_SUCCESS,
"Test Successful");
00089
return;
00090 }