public void Test_StagedDBRecor_ValidCLII()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(2));
            //  Assert.IsTrue(objOrderAddressProcessor.Load(5));
            //  Assert.IsTrue(objOrderAddressProcessor.Load(54));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process());
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);


            // FAILING GLM SERVICE LOCATION CREATION:
            // Assert.IsTrue(objOrderAddressProcessor.Load(1));
            // Assert.IsTrue(objOrderAddressProcessor.Load(2));

            // FAILING GLM SERVICE LOCATION CREATION... BUT --->  GOOD EXAMPLE OF BAD DATA ENTRY IN ORDER SYSTEM (will create DUP Site Location b/c of SL info)
            Assert.IsTrue(objOrderAddressProcessor.Load(5));  // Unit Test 5: http://glmenv1.twtelecom.com/GLMSWeb/Location/Details/PL0009599612

            // WHY IS this coming through in our QUERY?
            // Untouched, exists as it should --> Assert.IsTrue(objOrderAddressProcessor.Load(3)); // Unit Test 3: http://glmenv1.level3.com/GLMSWeb/Location/Details/PL0000994407 PROD: http://glm.level3.com/GLMSWeb/Location/Details/PL0000994407
            // Untouched in GLM, exists as it should but wasn't in SAP --> Assert.IsTrue(objOrderAddressProcessor.Load(4)); // Unit Test 4: http://glmenv1.level3.com/GLMSWeb/Location/Details/PL0002212806 PROD: http://glm.level3.com/GLMSWeb/Location/Details/PL0002212806

            // SITE LOCATION
            //Assert.IsTrue(objOrderAddressProcessor.Load(54));
        }
        public void Test_7062_SAP_NotFoundComparison()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(7062));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process(true, "BJM Unit Test"));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
        public void Test_OneOffTester_99xx()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(9990));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process());
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
        public void Test_StagedDBRecor_BrendansApt_1290()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(1290));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process());
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
예제 #5
0
        public void OrderAddressID_20_StrangeGLMError_RegressionTester()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(20));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process(true, @"level3\muir.brendan"));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
예제 #6
0
        public void OrderAddressID_7_StrangeGLMError_RegressionTester()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(7));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process());
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
예제 #7
0
        public void OrderAddressID_6_NewServiceLocation_GLMBug_DesignatorsImproperlyStripped_RegressionTester()
        {
            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(6));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process());
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
        public void Test_7174_SCodeCreation_Failure()
        {
            // http://addressmanagementtest.corp.global.level3.com/OrderAddressDetail?orderAddressId=6595&referringUrl=aHR0cDovL2FkZHJlc3NtYW5hZ2VtZW50dGVzdC5jb3JwLmdsb2JhbC5sZXZlbDMuY29tL0lzc3Vlcz9wYWdlTnVtPTAmcGFnZVNpemU9MTAw

            OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();

            Assert.IsTrue(objOrderAddressProcessor.Load(7174));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
            Assert.IsTrue(objOrderAddressProcessor.Process(true, "BJM Unit Test"));
            Assert.IsTrue(objOrderAddressProcessor.ErrorMessages.Count == 0);
        }
        public bool Process()
        {
            try
            {
                // Instantiate a stopwatch to write runtimes to a log file
                Stopwatch objStopWatch = new Stopwatch();
                objStopWatch.Start();

                // Iterate over the order addresses that require processing
                Parallel.For(0, _lstOrderAddressRecords_ToProcess.Count, new ParallelOptions {
                    MaxDegreeOfParallelism = _intNumberOfThreads
                }, i =>
                {
                    // Declare a base logging string
                    string strBaseLoggingString = OrderAddressUtil.CalcUniqueRecordIdentifierLoggingString(_lstOrderAddressRecords_ToProcess[i]);

                    try
                    {
                        // Instantiate an OrderAddressProcessor for the order
                        OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();
                        if (objOrderAddressProcessor.Load(_lstOrderAddressRecords_ToProcess[i].OrderAddressID.Value) == false)
                        {
                            throw new Exception(String.Format("The OrderAddressProcessor could not be loaded from the address record, and so processing of this single transaction will be aborted and skipped. Error Messages = [{0}]", String.Join(" | ", objOrderAddressProcessor.ErrorMessages.ToArray())));
                        }

                        if (objOrderAddressProcessor.Process() == false)
                        {
                            throw new Exception(String.Format("The OrderAddressProcessor experienced an issue. Error Messages = [{0}]", String.Join(" | ", objOrderAddressProcessor.ErrorMessages.ToArray())));
                        }
                    }
                    catch (Exception ex)
                    {
                        string strErrorMessage = String.Format("There was an error while processing one of the order address records that needs processing into GLM and SAP.  This error is contained to a single Order Address record, which will now be skipped.  Other records contained in the result set will continue to process.  Error Message = [{0}].  {1}", ex.Message, strBaseLoggingString);

                        // Log a warning to the log file
                        _objLogger.Warn(strErrorMessage);

                        // Continue to the next record, so that one bad record cannot hault the processing of subsequent records that are next in the list
                        return;
                    }
                });

                // This is the code, without MULTI-THREADING, if ever needed.
                //// Iterate over the order addresses that require processing
                //for (int i = 0; i < _lstOrderAddressRecords_ToProcess.Count; i++)
                //{
                //    // Declare a base logging string
                //    string strBaseLoggingString = OrderAddressUtil.CalcUniqueRecordIdentifierLoggingString(_lstOrderAddressRecords_ToProcess[i]);

                //    try
                //    {
                //        // Instantiate an OrderAddressProcessor for the order
                //        OrderAddressProcessor objOrderAddressProcessor = new OrderAddressProcessor();
                //        if (objOrderAddressProcessor.Load(_lstOrderAddressRecords_ToProcess[i].OrderAddressID.Value) == false)
                //        {
                //            throw new Exception(String.Format("The OrderAddressProcessor could not be loaded from the address record, and so processing of this single transaction will be aborted and skipped. Error Messages = [{0}]", String.Join(" | ", objOrderAddressProcessor.ErrorMessages.ToArray())));
                //        }

                //        if (objOrderAddressProcessor.Process() == false)
                //        {
                //            throw new Exception(String.Format("The OrderAddressProcessor experienced an issue. Error Messages = [{0}]", String.Join(" | ", objOrderAddressProcessor.ErrorMessages.ToArray())));
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        string strErrorMessage = String.Format("There was an error while processing one of the order address records that needs processing into GLM and SAP.  This error is contained to a single Order Address record, which will now be skipped.  Other records contained in the result set will continue to process.  Error Message = [{0}].  {1}", ex.Message, strBaseLoggingString);

                //        // Log a warning to the log file
                //        _objLogger.Warn(strErrorMessage);

                //        // Continue to the next record, so that one bad record cannot hault the processing of subsequent records that are next in the list
                //        continue;
                //    }
                //}


                // Log the time to retrieve the date
                string strTimeElapsed = StopwatchUtil.GetHumanReadableTimeElapsedString(objStopWatch);
                _objLogger.Info(String.Concat("Time elapsed while processing the Order Address records included in this batch.  Batch Type [", _enmBatchType, "] was [", strTimeElapsed, "] to retrieve [", _lstOrderAddressRecords_ToProcess.Count, "] records."));
            }
            catch (Exception ex)
            {
                // Create the error message
                string strErrorMessage = String.Format("A global error was caught while trying to process the order addresses loaded into memory and that were to be included as part of this batch.  This failure occured outside the try/catch/continue meaning that subsequent records will NOT be processed.  Please investigate the issue and run the process again to process any records that had not yet been processed when things errored.  Error Message = [{0}]", ex.Message);

                // Log a warning to the log file
                _objLogger.Warn(strErrorMessage);

                // Add the error message to the error list so that the caller can access it
                _lstErrorMessages.Add(strErrorMessage);
            }

            _blnIsLoaded = (_lstErrorMessages.Count == 0);

            return(_blnIsLoaded);
        }