Beispiel #1
0
        public void VerifyCustomerAssetAssociateServiceResponse()
        {
            WaitForKafkaResponseAfterAssociate();

            if (AssociateCustomerAssetModel.CustomerUID != null)
            {
                Assert.AreEqual(AssociateCustomerAssetModel.CustomerUID, associateCustomerAssetResponse.AssociateCustomerAssetEvent.CustomerUID);
            }
            if (AssociateCustomerAssetModel.AssetUID != null)
            {
                Assert.AreEqual(AssociateCustomerAssetModel.AssetUID, associateCustomerAssetResponse.AssociateCustomerAssetEvent.AssetUID);
            }
            if (AssociateCustomerAssetModel.RelationType != null)
            {
                Assert.AreEqual(AssociateCustomerAssetModel.RelationType, associateCustomerAssetResponse.AssociateCustomerAssetEvent.RelationType);
            }
            if (AssociateCustomerAssetModel.ActionUTC != null)
            {
                Assert.AreEqual(AssociateCustomerAssetModel.ActionUTC.ToString("yyyyMMddHHmmss"), associateCustomerAssetResponse.AssociateCustomerAssetEvent.ActionUTC.ToString("yyyyMMddHHmmss"));
            }

            associateCustomerAssetResponse = null;//reassigning the response back to null
        }
Beispiel #2
0
        public void Handle(PayloadMessage message)
        {
            try
            {
                if (message.Value == null || message.Value == "null")
                {
                    LogResult.Report(Log, "log_ForInfo", "Kafka Message is Null");
                    return;
                }

                if (AssociateCustomerAssetModel != null && AssociateCustomerAssetModel.ActionUTC != null)
                {
                    if (AssociateCustomerAssetModel.ActionUTC.ToString() != null && message.Value.Contains(AssociateCustomerAssetModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(AssociateCustomerAssetModel.ReceivedUTC.ToString()) &&
                        AssociateCustomerAssetModel.CustomerUID.ToString() != null && message.Value.Contains(AssociateCustomerAssetModel.CustomerUID.ToString()))
                    {
                        associateCustomerAssetResponse = JsonConvert.DeserializeObject <AssociateCustomerAssetModel>(message.Value);
                    }
                    LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));

                    if (DissociateCustomerAssetModel != null && DissociateCustomerAssetModel.ActionUTC != null && DissociateCustomerAssetModel.CustomerUID != Guid.Empty)
                    {
                        if (DissociateCustomerAssetModel.ActionUTC.ToString() != null && message.Value.Contains(DissociateCustomerAssetModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(DissociateCustomerAssetModel.ReceivedUTC.ToString()) &&
                            DissociateCustomerAssetModel.CustomerUID.ToString() != null && message.Value.Contains(DissociateCustomerAssetModel.CustomerUID.ToString()))
                        {
                            dissociateCustomerAssetResponse = JsonConvert.DeserializeObject <DissociateCustomerAssetModel>(message.Value);
                        }
                        LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));
                    }
                }
            }
            catch (Exception e)
            {
                LogResult.Report(Log, "log_ForError", "Got Error While Handling Response", e);
                throw new Exception(e + "Got Error While Handling Response");
            }
        }