Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

TestCaseFdirCheck_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseFdirCheck_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 26.06.03 00008 // Author R. Totaro 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 // Verify the correctness of the class id 00029 if (pFDIR->getClassId()!=ID_FDIRCHECK) { 00030 setTestResult(TEST_FAILURE,"Wrong class id"); 00031 return; 00032 } 00033 00034 // A newly created FDIR check shall not be configured 00035 if (pFDIR->isObjectConfigured()) { 00036 setTestResult(TEST_FAILURE,"Newly created FDIR check is configured"); 00037 return; 00038 } 00039 00040 // Let's set the FDI, verify it is properly set and that the object 00041 // is not configured 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 // We now set the recovery action and verify that it is properly 00055 // set. The object shall now be configured. 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 // The FDI check return code is set to ACTION_CANNOT_EXECUTE. This is what 00069 // we shall get from a call to pFDIR->execute(). 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 // Now, the FDI check outcome is set to ACTION_FAILURE. The recovery action 00078 // shall be executed and its outcome (set to ACTION_CANNOT_EXECUTE) shall 00079 // be returned to the caller. 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 }
Copyright 2003 P&P Software GmbH - All Rights Reserved