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

TestCaseWithFactories.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseWithFactories.cpp 00005 // 00006 // Version 1.0 00007 // Date 13.04.03 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "TestCaseWithFactories.h" 00011 #include "TestCase.h" 00012 #include "../GeneralInclude/CompilerSwitches.h" 00013 #include "../GeneralInclude/TestConstants.h" 00014 #include "../GeneralInclude/Constants.h" 00015 #include "../Base/CC_RootObject.h" 00016 #include "../Data/DC_DummyDataPool.h" 00017 #include "../Event/DC_EventRepository.h" 00018 #include "../Data/DC_DummyDatabase.h" 00019 #include "../Manoeuvre/DC_DummyManoeuvre.h" 00020 #include "../Manoeuvre/DC_DummyConfigurableManoeuvre.h" 00021 #include "../Manoeuvre/CC_ManoeuvreFactory.h" 00022 #include "../Telemetry/PUSTelemetryPacket.h" 00023 #include "../Telemetry/CC_TelemetryPacketFactory.h" 00024 #include "../Telemetry/DC_PUSTcVerificationPacket.h" 00025 #include "../Telemetry/DC_PUSDataReportingPacket.h" 00026 #include "../Telemetry/DC_DummyPUSTelemetryPacket.h" 00027 #include "../Telemetry/DC_PUSMemoryDumpOffset.h" 00028 #include "../Telemetry/DC_PUSMemoryDumpAbsolute.h" 00029 #include "../Telecommand/DC_PUSMemoryLoadOffset.h" 00030 #include "../Telecommand/DC_PUSMemoryLoadAbsolute.h" 00031 #include "../Telecommand/DC_PUSDumpMemoryOffset.h" 00032 #include "../Telecommand/DC_PUSDumpMemoryAbsolute.h" 00033 #include "../Telecommand/CC_TelecommandFactory.h" 00034 #include "../Telecommand/DC_DummyTelecommand.h" 00035 #include "../Telecommand/DC_DummyPUSTelecommand.h" 00036 #include "../Telecommand/PUSTelecommand.h" 00037 00038 bool TestCaseWithFactories::firstActivation = true; 00039 00040 DC_DummyPUSTelemetryPacket* TestCaseWithFactories::pTmDum1 = pNULL; 00041 DC_DummyPUSTelemetryPacket* TestCaseWithFactories::pTmDum2 = pNULL; 00042 DC_PUSTcVerificationPacket* TestCaseWithFactories::pTmTVP1 = pNULL; 00043 DC_PUSDataReportingPacket* TestCaseWithFactories::pTmDRP1 = pNULL; 00044 DC_PUSDataReportingPacket* TestCaseWithFactories::pTmDRP2 = pNULL; 00045 DC_PUSMemoryDumpOffset* TestCaseWithFactories::pTmMDO = pNULL; 00046 DC_PUSMemoryDumpAbsolute* TestCaseWithFactories::pTmMDA = pNULL; 00047 00048 DC_DummyConfigurableManoeuvre* TestCaseWithFactories::pManCD = pNULL; 00049 DC_TestPUSConfigurableManoeuvre* TestCaseWithFactories::pManTP = pNULL; 00050 DC_DummyManoeuvre* TestCaseWithFactories::pManDum = pNULL; 00051 00052 DC_DummyPUSTelecommand* TestCaseWithFactories::pTcPDum = pNULL; 00053 DC_DummyTelecommand* TestCaseWithFactories::pTcDum1 = pNULL; 00054 DC_DummyTelecommand* TestCaseWithFactories::pTcDum2 = pNULL; 00055 DC_PUSControlDataReporting* TestCaseWithFactories::pTcCDR = pNULL; 00056 DC_PUSDefineDataReporting* TestCaseWithFactories::pTcDDR = pNULL; 00057 DC_TestPUSTelecommand* TestCaseWithFactories::pTcTPT1 = pNULL; 00058 DC_TestPUSTelecommand* TestCaseWithFactories::pTcTPT2 = pNULL; 00059 DC_TestPUSTelecommand* TestCaseWithFactories::pTcTPT3 = pNULL; 00060 DC_PUSDumpMemoryOffset* TestCaseWithFactories::pTcDMO = pNULL; 00061 DC_PUSDumpMemoryAbsolute* TestCaseWithFactories::pTcDMA = pNULL; 00062 DC_PUSMemoryLoadOffset* TestCaseWithFactories::pTcMLO = pNULL; 00063 DC_PUSMemoryLoadAbsolute* TestCaseWithFactories::pTcMLA1 = pNULL; 00064 DC_PUSMemoryLoadAbsolute* TestCaseWithFactories::pTcMLA2 = pNULL; 00065 00066 00067 TestCaseWithFactories::TestCaseWithFactories(int testId, char* testName): 00068 TestCaseWithEvtCheck(testId,testName) { 00069 return; 00070 } 00071 00072 bool TestCaseWithFactories::setUpTestCase(void) { 00073 00074 if (!TestCaseWithEvtCheck::setUpTestCase()) 00075 return INITIALIZATION_FAILURE; 00076 00077 if (firstActivation) { 00078 00079 // Instantiate the items to go into the factories 00080 pTmDum1 = new DC_DummyPUSTelemetryPacket(); 00081 pTmDum2 = new DC_DummyPUSTelemetryPacket(); 00082 pTmTVP1 = new DC_PUSTcVerificationPacket(); 00083 pTmDRP1 = new DC_PUSDataReportingPacket(); 00084 pTmDRP2 = new DC_PUSDataReportingPacket(); 00085 pTmMDO = new DC_PUSMemoryDumpOffset(); 00086 pTmMDA = new DC_PUSMemoryDumpAbsolute(); 00087 00088 pManCD = new DC_DummyConfigurableManoeuvre(); 00089 pManTP = new DC_TestPUSConfigurableManoeuvre(); 00090 pManDum = new DC_DummyManoeuvre(); 00091 00092 pTcPDum = new DC_DummyPUSTelecommand(); 00093 pTcDum1 = new DC_DummyTelecommand(); 00094 pTcDum2 = new DC_DummyTelecommand(); 00095 pTcCDR = new DC_PUSControlDataReporting(); 00096 pTcDDR = new DC_PUSDefineDataReporting(); 00097 pTcTPT1 = new DC_TestPUSTelecommand(); 00098 pTcTPT2 = new DC_TestPUSTelecommand(); 00099 pTcTPT3 = new DC_TestPUSTelecommand(); 00100 pTcDMO = new DC_PUSDumpMemoryOffset(); 00101 pTcDMA = new DC_PUSDumpMemoryAbsolute(); 00102 pTcMLO = new DC_PUSMemoryLoadOffset(); 00103 pTcMLA1 = new DC_PUSMemoryLoadAbsolute(); 00104 pTcMLA2 = new DC_PUSMemoryLoadAbsolute(); 00105 00106 // Load the telemetry packet factory 00107 CC_TelemetryPacketFactory* pTmFct = CC_TelemetryPacketFactory::getInstance(); 00108 pTmFct->setTelemetryPacket(0, pTmDum1); 00109 pTmFct->setTelemetryPacket(1, pTmDum2); 00110 pTmFct->setTelemetryPacket(0, pTmTVP1); 00111 00112 pTmDRP1->setMaxNumberFA(0); 00113 pTmDRP1->setDefinitionBufferSize(PUS_DRP_DEF_BUF_SIZE_SMALL); 00114 pTmDRP1->setValueBufferSize(PUS_DRP_VAL_BUF_SIZE_SMALL); 00115 pTmFct->setTelemetryPacket(0, pTmDRP1); 00116 00117 pTmDRP2->setMaxNumberFA(PUS_DRP_MAX_FA); 00118 pTmDRP2->setDefinitionBufferSize(PUS_DRP_DEF_BUF_SIZE_LARGE); 00119 pTmDRP2->setValueBufferSize(PUS_DRP_VAL_BUF_SIZE_LARGE); 00120 pTmFct->setTelemetryPacket(1, pTmDRP2); 00121 00122 pTmMDO->setDumpBufferSize(PUS_MEM_BUFFER_LENGTH); 00123 pTmMDO->setMaxNumberBlocks(PUS_NUMBER_MEM_BLOCKS); 00124 pTmFct->setTelemetryPacket(0, pTmMDO); 00125 00126 pTmMDA->setDumpBufferSize(PUS_MEM_BUFFER_LENGTH); 00127 pTmMDA->setMaxNumberBlocks(PUS_NUMBER_MEM_BLOCKS); 00128 pTmFct->setTelemetryPacket(0, pTmMDA); 00129 00130 // Load the manoeuvre factory 00131 CC_ManoeuvreFactory* pManFct = CC_ManoeuvreFactory::getInstance(); 00132 pManFct->setManoeuvre(0, pManCD); 00133 pManFct->setManoeuvre(0, pManTP); 00134 pManFct->setManoeuvre(0, pManDum); 00135 00136 // Load the telecommand factory 00137 CC_TelecommandFactory* pTcFct = CC_TelecommandFactory::getInstance(); 00138 pTcFct->setTelecommand(0, pTcDum1); 00139 pTcFct->setTelecommand(1, pTcDum2); 00140 pTcFct->setTelecommand(0, pTcPDum); 00141 pTcFct->setTelecommand(0, pTcCDR); 00142 pTcFct->setTelecommand(0, pTcDDR); 00143 pTcFct->setTelecommand(0, pTcTPT1); 00144 pTcFct->setTelecommand(1, pTcTPT2); 00145 pTcFct->setTelecommand(2, pTcTPT3); 00146 00147 pTcDMO->setNumberOfRawData(PUS_MEM_BUFFER_LENGTH); 00148 pTcFct->setTelecommand(0, pTcDMO); 00149 00150 pTcDMA->setNumberOfRawData(PUS_MEM_BUFFER_LENGTH); 00151 pTcFct->setTelecommand(0, pTcDMA); 00152 00153 pTcMLA1->setMaxNumberBlocks(PUS_NUMBER_MEM_BLOCKS); 00154 pTcMLA1->setMaxNumberData(PUS_MEM_BUFFER_LENGTH); 00155 pTcFct->setTelecommand(0, pTcMLA1); 00156 00157 pTcMLA2->setMaxNumberBlocks(PUS_NUMBER_MEM_BLOCKS); 00158 pTcMLA2->setMaxNumberData(PUS_MEM_BUFFER_LENGTH); 00159 pTcFct->setTelecommand(1, pTcMLA2); 00160 00161 pTcMLO->setMaxNumberBlocks(PUS_NUMBER_MEM_BLOCKS); 00162 pTcMLO->setMaxNumberData(PUS_MEM_BUFFER_LENGTH); 00163 pTcFct->setTelecommand(0, pTcMLO); 00164 00165 // Check factory configuration 00166 if ( !pTmFct->isObjectConfigured() ) { 00167 setTestResult(false,"TM Factory is not configured"); 00168 return INITIALIZATION_FAILURE; 00169 } 00170 if ( !pManFct->isObjectConfigured() ) { 00171 setTestResult(false,"Manoeuvre Factory is not configured"); 00172 return INITIALIZATION_FAILURE; 00173 } 00174 if ( !pTcFct->isObjectConfigured() ) { 00175 setTestResult(false,"TC Factory is not configured"); 00176 return INITIALIZATION_FAILURE; 00177 } 00178 00179 firstActivation = false; 00180 } 00181 00182 return INITIALIZATION_SUCCESS; 00183 } 00184 00185 bool TestCaseWithFactories::shutDownTestCase(void) { 00186 00187 // Mark all items loaded in the factories as "not in use" 00188 pTmDum1->setInUse(NOT_IN_USE); 00189 pTmDum2->setInUse(NOT_IN_USE); 00190 pTmTVP1->setInUse(NOT_IN_USE); 00191 pTmDRP1->setInUse(NOT_IN_USE); 00192 pTmDRP2->setInUse(NOT_IN_USE); 00193 pTmMDO->setInUse(NOT_IN_USE); 00194 pTmMDA->setInUse(NOT_IN_USE); 00195 00196 pManCD->setInUse(NOT_IN_USE); 00197 pManDum->setInUse(NOT_IN_USE); 00198 pManTP->setInUse(NOT_IN_USE); 00199 00200 pTcDum1->setInUse(NOT_IN_USE); 00201 pTcDum2->setInUse(NOT_IN_USE); 00202 pTcPDum->setInUse(NOT_IN_USE); 00203 pTcCDR->setInUse(NOT_IN_USE); 00204 pTcDDR->setInUse(NOT_IN_USE); 00205 pTcTPT1->setInUse(NOT_IN_USE); 00206 pTcTPT2->setInUse(NOT_IN_USE); 00207 pTcTPT3->setInUse(NOT_IN_USE); 00208 pTcDMO->setInUse(NOT_IN_USE); 00209 pTcDMA->setInUse(NOT_IN_USE); 00210 pTcMLA1->setInUse(NOT_IN_USE); 00211 pTcMLA2->setInUse(NOT_IN_USE); 00212 pTcMLO->setInUse(NOT_IN_USE); 00213 00214 if (!TestCaseWithEvtCheck::shutDownTestCase()) 00215 return SHUTDOWN_FAILURE; 00216 else 00217 return SHUTDOWN_SUCCESS; 00218 }
Copyright 2003 P&P Software GmbH - All Rights Reserved