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_NullRecoveryAction.h"
00015
#include "../FDIR/DC_DummyRecoveryAction.h"
00016
#include "TestCaseRecoveryAction_1.h"
00017
00018 TestCaseRecoveryAction_1::TestCaseRecoveryAction_1(
void) :
00019
TestCaseGenericSetUp(ID_DUMMYRECOVERYACTION*10+1,"
TestCaseRecoveryAction_1") {
00020
return;
00021 }
00022
00023 void TestCaseRecoveryAction_1::runTestCase(
void) {
00024
DC_NullRecoveryAction *pNRA=
new DC_NullRecoveryAction;
00025
DC_DummyRecoveryAction *pDRA=
new DC_DummyRecoveryAction;
00026
00027
00028
if (pNRA->
getClassId()!=ID_NULLRECOVERYACTION) {
00029 setTestResult(
TEST_FAILURE,
"Wrong class id");
00030
return;
00031 }
00032
00033
if (pDRA->
getClassId()!=ID_DUMMYRECOVERYACTION) {
00034 setTestResult(
TEST_FAILURE,
"Wrong class id");
00035
return;
00036 }
00037
00038
00039
if (pDRA->
getNextRecoveryAction()) {
00040 setTestResult(
TEST_FAILURE,
"Initialization failure");
00041
return;
00042 }
00043
00044
00045
00046
if (pDRA->
execute()!=ACTION_SUCCESS) {
00047 setTestResult(
TEST_FAILURE,
"Execution flag wrongly set");
00048
return;
00049 }
00050
00051
00052
00053 pDRA->
setExecutionFlag(
false);
00054
if (pDRA->
execute()!=ACTION_CANNOT_EXECUTE) {
00055 setTestResult(
TEST_FAILURE,
"setExecutionFlag() failed");
00056
return;
00057 }
00058
00059
00060
if (pNRA->
execute()!=ACTION_SUCCESS) {
00061 setTestResult(
TEST_FAILURE,
"Execution flag wrongly set");
00062
return;
00063 }
00064
00065
00066
00067 pNRA->
setNextRecoveryAction(pDRA);
00068
if (pNRA->
getNextRecoveryAction()!=pDRA) {
00069 setTestResult(
TEST_FAILURE,
"setNextRecoveryAction() failed");
00070
return;
00071 }
00072
00073
00074
00075 pDRA->
setActionOutcome(ACTION_FAILURE);
00076 pDRA->
setExecutionFlag(
true);
00077
00078
00079
00080
if (pNRA->
execute()!=ACTION_FAILURE) {
00081 setTestResult(
TEST_FAILURE,
"Wrong outcome");
00082
return;
00083 }
00084
00085 setTestResult(
TEST_SUCCESS,
"Test Successful");
00086
return;
00087 }