每一个测试项目,均需要一个Factory,充当运行的客户端或者服务端的入口
-
#pragma once
-
-
namespace IMIX
-
{
-
class IMIXApplication;
-
}
-
-
class CCaseIMIXFactory
-
{
-
public:
-
static CCaseIMIXFactory* GetInstance();
-
-
void RunTest(int type, IMIX::IMIXApplication *pApp, CApiOp *pApiOp);
-
};
-
#include "UTILITY/Mutex.h"
-
-
#include "IMIX/IMIXAPI/Listener.h"
-
#include "IMIX/IMIXAPI/IMIXApplication.h"
-
-
#include "Common.h"
-
#include "ConfigGen.h"
-
#include "TerminalConfig.h"
-
-
#include "CommonListenerImpl.h"
-
-
#include "TestObject.h"
-
#include "ProtocolInc.h"
-
#include "IMIXTestCaseObject.h"
-
#include "ImixInc.h"
-
-
using namespace IMIX;
-
-
CCaseIMIXFactory* CCaseIMIXFactory::GetInstance()
-
{
-
static CCaseIMIXFactory s_caseImixFactory;
-
-
return &s_caseImixFactory;
-
}
-
-
void CCaseIMIXFactory::RunTest(int type, IMIXApplication *pApp, CApiOp *pApiOp)
-
{
-
int ty = type & TYPE_CASETYPE;
-
-
CIMIXTestCaseObject *ptestcase = NULL;
-
-
switch(ty)
-
{
-
case TYPE_APPINIT:
-
ptestcase = (CIMIXTestCaseObject*)CAppInit::GetInstance();
-
break;
-
case TYPE_HEARTBTINT:
-
ptestcase = (CIMIXTestCaseObject*)CHeartBtIntCase::GetInstance();
-
break;
-
case TYPE_IMIXTIMER:
-
ptestcase = (CIMIXTestCaseObject*)CIMIXTimerCase::GetInstance();
-
break;
-
case TYPE_RECONNECT:
-
ptestcase = (CIMIXTestCaseObject*)CReConnectCase::GetInstance();
-
break;
-
case TYPE_SESSIONCASE:
-
ptestcase = (CIMIXTestCaseObject*)CSessionCase::GetInstance();
-
break;
-
case TYPE_ERRORNO:
-
ptestcase = (CIMIXTestCaseObject *)CErrorNoCase::GetInstance();
-
break;
-
case TYPE_CSCASE:
-
ptestcase = (CIMIXTestCaseObject *)CCSCase::GetInstance();
-
break;
-
case TYPE_PERFORMANCECASE:
-
ptestcase = (CIMIXTestCaseObject *)CIMIXPerformanceCase::GetInstance();
-
break;
-
case TYPE_IMIXSEQCASE:
-
ptestcase = (CIMIXTestCaseObject *)CIMIXSeqCase::GetInstance();
-
break;
-
case TYPE_ATESTCASE:
-
ptestcase = (CIMIXTestCaseObject *)CATest::GetInstance();
-
break;
-
case TYPE_IMIXAPPLICATIONCASE:
-
ptestcase = (CIMIXTestCaseObject *)CIMIXApplicationCase::GetInstance();
-
break;
-
case TYPE_IMIXCONFIGFUNC:
-
ptestcase = (CIMIXTestCaseObject *)CIMIXConfigFunc::GetInstance();
-
break;
-
}
-
-
if (ptestcase != NULL)
-
ptestcase->RunTest(type, pApp, pApiOp);
-
}
阅读(4453) | 评论(0) | 转发(0) |