public void Test_UpdateEQI_ValidUrl()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
            esynReq.CustomerId = "010203040";
            esynReq.macAddress = "00002986685810000000000000000551";
            esynReq.offeringId = new List<string>("1234567".Split('/'));
            esynReq.smartCardId = "";
            CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
            ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
            String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.UpdateEQI(), "UpdateEQI");

            Assert.AreEqual("0000000", expRes, "Should be able to update Customer Equipment ");
        }
Пример #2
0
        /// <summary>
        /// Process ICOMS EQI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface.
        /// </summary>
        /// <param name="strICOMS_EQI_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processEQIMessage(string strICOMS_EQI_Msg, ServiceListenerMembers templistenerMembers)
        {
            Dictionary<string, string> dictObj4c = new Dictionary<string, string>();
             SyncRequest objSyncReq;
             EquipmentSyncRequest objCusEqi;
             ServiceTranslationManager trsMgr;
             ServiceBusinessRulesManager busMgr;
             string retMsg2ICOM = "0000901";
             string strResMainFormat = string.Empty;
             string strErrCode = string.Empty;
             trsMgr = new ServiceTranslationManager();

             try
             {
             logger.Info("ServiceRunTimeManager::processEQIMessage() called");
             busMgr = new ServiceBusinessRulesManager();

             // Create dictionary object with all required tokens(key-value) for EQI
             dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_EQI_Msg, ServiceConstantsManager.CONST_EQI, templistenerMembers);
             logger.Info(string.Format("Required tokens are extracted from EQI message...  {0}", trsMgr.GetLine(dictObj4c)));

             // Validation for missing tokens
             strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_EQI);
             if (strErrCode != string.Empty)
             {
                 logger.Error(string.Format("Please verify all required tokens are present in the EQI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 return strErrCode;
             }

             // Validation for token length
             strErrCode = busMgr.checkRequiredLengthOfTokens(dictObj4c, templistenerMembers);
             if (strErrCode != string.Empty)
             {
                 logger.Error(string.Format("Length is not matching for one of tokens present in the EQI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 return strErrCode;
             }

             // update Customerid(AN=AN+SI) based on flag value in config value
             dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers);

             // Get Native format device id from ICOMS "EA" token based config value of "DeviceIdFormat" & "NativeFormat4cFlag"
             dictObj4c = busMgr.getNativeFormat4cAddress(dictObj4c, templistenerMembers);

             objCusEqi = new EquipmentSyncRequest();
             objCusEqi.CustomerId = dictObj4c["AN:"];
             objCusEqi.macAddress = dictObj4c["EA:"];
             // Create new list for product Ids
             objCusEqi.offeringId = busMgr.getProductIdList(dictObj4c);
             objSyncReq = new SyncRequest();
             objSyncReq.CustomerId = dictObj4c["AN:"];
             objSyncReq.CustomerStatus = string.Empty;
             objSyncReq.ICOMSMsgFormat = "EQI";

             CustomerEquipmentRequest objCusEQIReq = new CustomerEquipmentRequest(objCusEqi, objSyncReq);

             switch (dictObj4c["AC:"])
             {
                 // Add EQI
                 case "A":
                     logger.Info("ADD EQI action called");
                     retMsg2ICOM = objCusEQIReq.AddEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddEQI");
                     break;
                 // Update EQI
                 case "U":
                     logger.Info("Update EQI action called");
                     retMsg2ICOM = objCusEQIReq.UpdateEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "UpdateEQI");
                     break;
                 // Delete EQI
                 case "R":
                     logger.Info("Delete EQI action called");
                     retMsg2ICOM = objCusEQIReq.DeleteEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "DeleteEQI");
                     break;
                 default:
                     logger.Warn(string.Format("Invalid token value received from EQI message for AC operation : {0}", dictObj4c["AC:"]));
                     break;
             }
             logger.Info(string.Format("ServiceRunTimeManager::processEQIMessage() returning value {0}", retMsg2ICOM));
             return retMsg2ICOM;
             }
             catch (Exception ex)
             {
             logger.Error(string.Format("processEQIMessage(): Exception: {0}", ex.Message));
             logger.Error("ServiceRunTimeManager::processEQIMessage() returning error");
             return retMsg2ICOM;
             }
        }
        public void Test_UpdateEQI()
        {
            SyncRequest synReq = new SyncRequest();
            synReq.CustomerId = "010203040";
            synReq.CustomerStatus = "A";
            EquipmentSyncRequest esynReq = new EquipmentSyncRequest();
            esynReq.CustomerId = "010203040";
            esynReq.macAddress = "00002986685810000000000000000001";
            esynReq.offeringId = new List<string>("0005432".Split('/'));
            esynReq.smartCardId = "";
            CustomerEquipmentRequest ceReq = new CustomerEquipmentRequest(esynReq, synReq);
            ServiceRunTimeManager srvRunMgr = new ServiceRunTimeManager();
            String expRes = srvRunMgr.transalteResCode2ICOM4m4C(ceReq.UpdateEQI(), "UpdateEQI");

            Assert.AreEqual("0000901", expRes, "Should not able to update customer Equipment as product id is not in correct format");
        }