Beispiel #1
0
/******************************************************************************
Function Name  :  nParseTSFile
Input(s)       :  CString omstrTSFile
Output         :  INT
Functionality  :  Load the omStrTSFille
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
Codetag        : CS002
******************************************************************************/
INT CTestSetupEntity::nParseTSFile(CString omstrTSFile)
{
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    HRESULT hr = pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");

    if ( FAILED(hr) )
    {
        throw "Unable to create XML parser object";
    }

    if(PathFileExists(omstrTSFile) == FALSE)
    {
        return ERR_PATH_INCORRECT;
    }

    //Create A TestSetup DOM document
    CComVariant varFileName((LPCSTR)omstrTSFile);

    try
    {
        pIDOMDoc->load(varFileName);
        //GetTest Setup Title
        MSXML2::IXMLDOMNodePtr pIDOMTiltleNode;
        _bstr_t bstrNodeName = def_STR_TSNODE_NAME;
        CComVariant NodeValue;
        pIDOMTiltleNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
        pDOMTCAtrributes = pIDOMTiltleNode->Getattributes();
        MSXML2::IXMLDOMNodePtr pIDOMChildNode;
        //bstrNodeName = def_STR_TSATTRIB_TITLE;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSATTRIB_TITLE)));
        pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
        pIDOMChildNode->get_nodeTypedValue(&NodeValue);
        m_omstrTestSetupTitle = strCopyBSTRToCString(NodeValue);
        pIDOMChildNode.Release();
        //Get Description
        //bstrNodeName = def_STR_TSDESCRIPTION;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSDESCRIPTION)));
        MSXML2::IXMLDOMNodePtr pIDOMDescriptionNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        pIDOMDescriptionNode->get_nodeTypedValue(&NodeValue);
        m_omstrDescription = strCopyBSTRToCString(NodeValue);
        //Get Header Node
        //bstrNodeName = def_STR_TSHEADER;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSHEADER)));
        MSXML2::IXMLDOMNodePtr pIDOMHeaderNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        nLoadHeader(pIDOMHeaderNode);
        pIDOMHeaderNode.Release();
        //Get TestCases List
        //bstrNodeName = def_STR_TSTCLIST;
        bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSTCLIST)));
        MSXML2::IXMLDOMNodePtr pIDOMTSNode = pIDOMDoc->selectSingleNode(bstrNodeName);
        GetData(pIDOMTSNode);
    }
    catch(...)
    {
        return S_FALSE;
    }

    return S_OK;
}
Beispiel #2
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyResponse
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyResponse::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    CVerifyEntity::GetData(pIDomNode);
    _bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
    CComVariant NodeValue;
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;
    pDOMVerifyAtrributes = pIDomNode->Getattributes();
    //bstrNodeName = def_STR_ATTRIB_WAITFOR;
    bstrNodeName.Assign(SysAllocString(CT2W(def_STR_ATTRIB_WAITFOR)));
    pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
    CString strTemp;
    strTemp = strCopyBSTRToCString(NodeValue);
    //W4 Removal
    m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
    INT nCount = (INT)m_ouData.m_odVerify_MessageEntityList.GetCount();

    for(int i = 0; i < nCount; i++)
    {
        CVerify_MessageData ouVerifyData;
        POSITION pos = m_ouData.m_odVerify_MessageEntityList.FindIndex(i);
        CVerify_MessageEntity& ouVerifyEntity = m_ouData.m_odVerify_MessageEntityList.GetAt(pos);
        ouVerifyEntity.GetEntityData(VERIFY_MESSAGE, &ouVerifyData);
        m_ouVerifyMsgMap[ouVerifyData.m_dwMessageID] = ouVerifyData;
    }

    return S_OK;
}
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :   
Member of      :  CReplayEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CReplayEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    CComVariant NodeValue;
    pIDomNode->get_nodeTypedValue(&NodeValue);		
	m_omFilePath = strCopyBSTRToCString(NodeValue);
    m_omFilePath.Remove('\"');
    return S_OK;
}
Beispiel #4
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyEntity::GetCommonVerifyData(MSXML2::IXMLDOMNodePtr& pIDomNode, CVerifyData *verifyData)
{
	m_ouData = verifyData;
    _bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
    CComVariant NodeValue;
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    pDOMVerifyAtrributes = pIDomNode->Getattributes();
    //bstrNodeName = L"failure";
    bstrNodeName.Assign(SysAllocString(CT2W("failure")));
    pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
    CString strTemp;
    strTemp = strCopyBSTRToCString(NodeValue);

	//m_ouData = new CVerifyData();
    if(strTemp == "SUCCESS")
    {
        m_ouData->m_eAttributeError = SUCCESS;
    }
    else if(strTemp == "WARNING")
    {
        m_ouData->m_eAttributeError = WARNING;
    }
    else if(strTemp == "ERRORS")
    {
        m_ouData->m_eAttributeError = ERRORS;
    }
    else
    {
        m_ouData->m_eAttributeError = FATAL;
    }
    MSXML2::IXMLDOMNodeListPtr pIDOMSendList;

    LONG lCount;
    //bstrNodeName = def_STR_VERIFYMSG_NODE;
    bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VERIFYMSG_NODE)));
    pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
    pIDOMSendList->get_length(&lCount);

    for(int i = 0; i < lCount; i++)
    {
        CVerifySubEntity *odVerifySubEntity;
        MSXML2::IXMLDOMNodePtr pIXMLDOMVerifyMsgEntity;
        pIXMLDOMVerifyMsgEntity = pIDOMSendList->Getitem(i);
		//if(CVerifySubEntity::GetData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
		if(this->GetSubEntityData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
        {
            m_ouData->m_odVerifySubEntityList.push_back(odVerifySubEntity);
        }
    }
    return S_OK;
}
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :   
Member of      :  CWaitEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CWaitEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMWaitAtrributes;
    pDOMWaitAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"purpose";
	bstrNodeName.Assign(SysAllocString(CT2W("purpose")));
    pIDOMChildNode = pDOMWaitAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omPurpose = strCopyBSTRToCString(NodeValue);
    
    pIDomNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    //W4 Removal - Type Conversion No problem.
    m_ouData.m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
    pIDOMChildNode.Release();
    pDOMWaitAtrributes.Release();
    return S_OK;
}
/******************************************************************************
Function Name  :  nLoadHeader
Input(s)       :  MSXML2::IXMLDOMNodePtr& pHeaderDOMNode
Output         :  INT
Functionality  :  Retrives the Header info 
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  
******************************************************************************/
INT CTestSetupEntity::nLoadHeader(MSXML2::IXMLDOMNodePtr& pHeaderDOMNode)
{
   // CComPtr<IXMLDOMNode> pHeaderDOMNode;
    MSXML2::IXMLDOMNodeListPtr pXMLDOMInfoList;
    MSXML2::IXMLDOMNodePtr pInfoNode;
    MSXML2::IXMLDOMNodePtr pInfoCategoryNode;
    MSXML2::IXMLDOMNodePtr pInfoValueNode;
    _bstr_t bstrNodeName = "info";
    CComVariant NodeValue;		
    pXMLDOMInfoList = pHeaderDOMNode->selectNodes(bstrNodeName);

    LONG lCount = 0;
    pXMLDOMInfoList->get_length(&lCount);
    SInfo ouTempSInfo;
    for(int i = 0; i<lCount; i++)
    {
        pInfoNode = pXMLDOMInfoList->Getitem(i);

        //bstrNodeName = def_STR_CATEGORY_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_CATEGORY_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);		
				
		ouTempSInfo.m_omCategory = strCopyBSTRToCString(NodeValue);
		
        pInfoCategoryNode.Release();
        
        //bstrNodeName = def_STR_VALUE_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VALUE_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);			
		ouTempSInfo.m_omValue = strCopyBSTRToCString(NodeValue);
        pInfoCategoryNode.Release();
        
        pInfoNode.Release();


        if(ouTempSInfo.m_omCategory == def_STR_MODULENAME)
        {
            m_ouTestSetupHeader.m_sModuleName.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sModuleName.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINEERNAME)
        {
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINERROLE)
        {
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_VERSION)
        {
            m_ouTestSetupHeader.m_sVersion.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sVersion.m_omValue = ouTempSInfo.m_omValue;
        }
    }
//Taking Database
    
    //bstrNodeName = def_STR_LISTOFDB;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_LISTOFDB)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_omDatabasePath = strCopyBSTRToCString(NodeValue);
    //Set The Database Path
    SetDatabaseFile(m_ouTestSetupHeader.m_omDatabasePath);
    pInfoNode.Release();

    //bstrNodeName = def_STR_REPORT_FORMAT;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_FORMAT)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString omStrExt;	
	omStrExt = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();

    
    if(omStrExt == "HTM")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = HTM;
    }
    else
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = TXT;
    }

    //bstrNodeName = def_STR_REPORT_PATH;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_PATH)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_sReportFile.m_omPath = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();
    
    


    //bstrNodeName = def_STR_REPORT_TIMEMODE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_TIMEMODE)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    if(strTemp == "ABS")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = ABS;
    }
    else                    //Default
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = REL;
    }
    pInfoNode.Release();


    //bstrNodeName = def_STR_BUS_TYPE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_BUS_TYPE)));
    pInfoNode= pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	strTemp = strCopyBSTRToCString(NodeValue);

    if(strTemp == "CAN")
    {
        m_ouTestSetupHeader.m_eBus = CAN;
    }

    pInfoNode.Release();
    
    return 0;
}
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :  Fills the datastructure from the XML node 
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
//Getting Attributes
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
    pDOMTCAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"identifier";
	bstrNodeName.Assign(SysAllocString(CT2W("identifier")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omID = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    //bstrNodeName = L"title";
	bstrNodeName.Assign(SysAllocString(CT2W("title")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omTitle = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();

    //bstrNodeName = L"exp_handler";
	bstrNodeName.Assign(SysAllocString(CT2W("exp_handler")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    if(strTemp == "CONTINUE")
    {
        m_ouData.m_eExcpAction = CONTINUE;
    }
    else
    {
        m_ouData.m_eExcpAction = EXIT;
    }

//Getting Testcases
    MSXML2::IXMLDOMNodeListPtr pDOMChildList = pIDomNode->GetchildNodes();
    LONG lCount;
    pDOMChildList->get_length(&lCount);
    CComBSTR NodeName;
    for(int i = 0;i < lCount; i++)
    {
        pIDOMChildNode = pDOMChildList->Getitem(i);
        pIDOMChildNode->get_nodeName(&NodeName);        
		
        CBaseEntityTA *odpBaseEntity = NULL;
		if(NodeName == def_STR_SEND_NODE)
        {
            odpBaseEntity = new CSendEntity();
        }
        else if(NodeName == def_STR_VERIFY_NODE)
        {
            odpBaseEntity = new CVerifyEntity();
        }
        else if(NodeName == def_STR_WAIT_NODE)
        {
            odpBaseEntity = new CWaitEntity();
        }
        else if(NodeName == def_STR_REPLAY_NODE)
        {
            odpBaseEntity = new CReplayEntity();
        }
        else if(NodeName == def_STR_VERIFYRES_NODE)
        {
            odpBaseEntity = new CVerifyResponse();
        }
        if(odpBaseEntity == NULL)
        {
            //TODO::return a correct value
            return -1;
        }
        odpBaseEntity->GetData(pIDOMChildNode);
        m_ouData.m_odTAEntityList.AddTail(odpBaseEntity);
        //pIDOMChildNode->Release();
    }
    return S_OK;
}