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

TestCaseSimpleChangeProfile_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseSimpleChangeProfile_1.cpp 00005 // 00006 // Version 1.2 00007 // Date 13.04.03 (Version 1.1) 00008 // 01.10.03 (Version 1.2) 00009 // Author A. Pasetti (P&P Software), R. Totaro 00010 // 00011 // Change Record: 00012 // Version 1.2: replaced double and int with TD_Float and TD_Integer 00013 00014 #include "../GeneralInclude/CompilerSwitches.h" 00015 #include "../GeneralInclude/ClassId.h" 00016 #include "../GeneralInclude/TestConstants.h" 00017 #include "../GeneralInclude/Constants.h" 00018 #include "../Base/CC_RootObject.h" 00019 #include "../FDIR/MonitoringProfile.h" 00020 #include "../FDIR/DC_SimpleChangeProfile.h" 00021 #include "../Event/DC_EventRepository.h" 00022 #include "TestCaseSimpleChangeProfile_1.h" 00023 00024 TestCaseSimpleChangeProfile_1::TestCaseSimpleChangeProfile_1(void) : 00025 TestCaseGenericSetUp(ID_SIMPLECHANGEPROFILE*10+1,"TestCaseSimpleChangeProfile_1") { 00026 return; 00027 } 00028 00029 void TestCaseSimpleChangeProfile_1::runTestCase(void) { 00030 00031 DC_SimpleChangeProfile* mp = new DC_SimpleChangeProfile(); 00032 00033 // Check the value of the class identifier 00034 if ( mp->getClassId() != ID_SIMPLECHANGEPROFILE ) 00035 { setTestResult(TEST_FAILURE, "Wrong class identifier"); 00036 return; 00037 } 00038 00039 // Check that monitoring check is enabled 00040 if ( !mp->isEnabled() ) 00041 { setTestResult(TEST_FAILURE, "Wrong enable status"); 00042 return; 00043 } 00044 00045 // Set the reference value 00046 TD_Integer rv = 10; 00047 mp->setReferenceValue(rv); 00048 if ( mp->getReferenceValue() != rv ) 00049 { setTestResult(TEST_FAILURE, "Wrong reference value"); 00050 return; 00051 } 00052 00053 // Check monitoring check for a case with "no deviation from profile" 00054 if ( mp->deviatesFromProfile(rv) ) 00055 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00056 return; 00057 } 00058 00059 // Check monitoring check for real-valued argument 00060 if (isNonNominalCheckAllowed()) { 00061 if ( !mp->deviatesFromProfile((TD_Float)1.0) ) 00062 { setTestResult(TEST_FAILURE, "Wrong monitoring check result for real-valued argument"); 00063 return; 00064 } 00065 } 00066 00067 // Check monitoring check for a case with "deviation from profile" 00068 DC_EventRepository* rep = CC_RootObject::getEventRepository(); 00069 unsigned int nEvt = rep->getCounter(); 00070 if ( !mp->deviatesFromProfile((TD_Integer)(rv+1)) ) 00071 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00072 return; 00073 } 00074 00075 // Check generation of event reporting detection of deviation from profile 00076 if ( rep->getCounter() != (nEvt+1) ) 00077 { setTestResult(TEST_FAILURE, "Wrong number of events"); 00078 return; 00079 } 00080 rep->latest(); 00081 if ( rep->getEventType() != EVT_MON_PROFILE_VIOLATION ) 00082 { setTestResult(TEST_FAILURE, "Wrong event type"); 00083 return; 00084 } 00085 00086 // Disable monitoring profile and check new enable status 00087 mp->setEnabled(DISABLED); 00088 if ( mp->isEnabled() != DISABLED ) 00089 { setTestResult(TEST_FAILURE, "Wrong enable status"); 00090 return; 00091 } 00092 00093 // Check monitoring check for a case with "deviation from profile" 00094 // NB: the monitoring profile component is now disabled 00095 if ( mp->deviatesFromProfile((TD_Integer)(rv+1)) ) 00096 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00097 return; 00098 } 00099 00100 // Check that no events were generated 00101 if ( rep->getCounter() != (nEvt+1) ) 00102 { setTestResult(TEST_FAILURE, "Wrong number of events"); 00103 return; 00104 } 00105 00106 setTestResult(TEST_SUCCESS,"Test Successful"); 00107 return; 00108 00109 }
Copyright 2003 P&P Software GmbH - All Rights Reserved