예제 #1
0
        public void VerifyCustomerRelationshipServiceDeleteResponse()
        {
            WaitForKafkaResponseAfterDelete();

            Assert.AreEqual(DeleteCustomerRelationshipModel.ParentCustomerUID, deleteCustomerRelationshipResponse.DeleteCustomerRelationshipEvent.ParentCustomerUID);

            Assert.AreEqual(DeleteCustomerRelationshipModel.ChildCustomerUID, deleteCustomerRelationshipResponse.DeleteCustomerRelationshipEvent.ChildCustomerUID);

            Assert.AreEqual(DeleteCustomerRelationshipModel.ActionUTC.ToString("yyyyMMddHHmmss"), deleteCustomerRelationshipResponse.DeleteCustomerRelationshipEvent.ActionUTC.ToString("yyyyMMddHHmmss"));

            deleteCustomerRelationshipResponse = null; // Reassigning the response back to null
        }
예제 #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 (CreateCustomerRelationshipModel != null && CreateCustomerRelationshipModel.ActionUTC != null)
                {
                    if (CreateCustomerRelationshipModel.ActionUTC.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) &&
                        message.Value.Contains(CreateCustomerRelationshipModel.ReceivedUTC.ToString()) &&
                        CreateCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ParentCustomerUID.ToString()) &&
                        CreateCustomerRelationshipModel.ChildCustomerUID.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ChildCustomerUID.ToString()))
                    {
                        createCustomerRelationshipResponse = JsonConvert.DeserializeObject <CreateCustomerRelationshipModel>(message.Value);
                    }

                    LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));

                    if (DeleteCustomerRelationshipModel != null && DeleteCustomerRelationshipModel.ActionUTC != null && DeleteCustomerRelationshipModel.ParentCustomerUID != Guid.Empty)
                    {
                        if (DeleteCustomerRelationshipModel.ActionUTC.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(DeleteCustomerRelationshipModel.ReceivedUTC.ToString()) &&
                            DeleteCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ParentCustomerUID.ToString()) &&
                            DeleteCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ParentCustomerUID.ToString()))
                        {
                            deleteCustomerRelationshipResponse = JsonConvert.DeserializeObject <DeleteCustomerRelationshipModel>(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");
            }
        }