コード例 #1
0
 public CompositeSubscriber()
 {
     SubscriberDpi = new CustomerAccountDto();
     SubscriberTriad = new SubscriberDto();
     DpiServices = new List<ServiceAccountDto>();
     SubscriberErrorMessages = string.Empty;
 }
コード例 #2
0
        public void CreateNotes_GetNotesFromTriad_Succeed_Test()
        {
            var loc = new LocationDto();
            var sub = new SubscriberDto();
            try
            {
                // new sub and loc data
                loc = DataHelper.NewLocationData();
                sub = DataHelper.NewSubscriberData();
                sub.Accounts.First().Location = loc;
                DataHelper.RestoreLocation1(loc, false);
                DataHelper.RestoreSubscriber1(sub, false);

                // set current subscriber
                CurrentSubscriber.SetInstance(sub);

                // create new note
                var newNote = new NoteDto
                {
                    NoteCode = "DEFAULT",
                    NoteText = "This new note is created from SIMPL integration test",
                    NoteType = NoteTypeDto.SubNote

                };
                var sh = new SubscriberHelper();
                sh.CreateSubNote(sub.ID, newNote);

                var criteria = new SearchServiceHistoryDto
                {
                    SubscriberId = sub.ID,
                    LocationId = loc.ID,
                    StartDate = DateTime.Now.AddDays(-1),
                    EndDate = DateTime.Now.AddDays(+1)
                };
                // call LoadLocation action method
                var result = NotesControllerForTests.LoadRosettianNotes(criteria);

                // validate response result is not null
                Assert.IsNotNull(result, "Notes object is null");
                Assert.IsTrue(result.Any(), "There are no notes in Triad system for the given search criteria");
                Assert.IsTrue(result.Any(x => x.Notes.Contains("This new note is created from SIMPL integration test")), "The newly created note doesn't exist");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is AssertFailedException, ex.ToString());
                throw;
            }
            finally
            {
                DataHelper.DeleteSubscriber(sub.ID);
                DataHelper.DeleteLocation(loc.ID);
            }
        }
コード例 #3
0
        /// <summary>
        /// Merges the specified subscriber triad.
        /// </summary>
        /// <param name="provisionedSubscriber">Subscriber object from provisioning</param>
        /// <param name="billedSubscriber">Subscriber object from billing.</param>
        /// <param name="provisionedSubscriberPhones">Phone object from provisioning.</param>
        /// <returns></returns>
        public static CompositeSubscriber Merge(SubscriberDto provisionedSubscriber, BillingandServiceAccountDto billedSubscriber, IEnumerable<PhoneDto> provisionedSubscriberPhones )
        {
            var compositeSubscriber = new CompositeSubscriber
            {
                SubscriberTriad = provisionedSubscriber ?? new SubscriberDto(),
                SubscriberDpi = (billedSubscriber != null && billedSubscriber.CustomerAccount != null)
                    ? billedSubscriber.CustomerAccount
                    : null
            };

            var billedServiceAccounts = (billedSubscriber != null && billedSubscriber.ServiceAccounts != null)
                                            ? billedSubscriber.ServiceAccounts : new List<ServiceAccountDto>();

            compositeSubscriber.DpiServices = MergePhonesAndServiceAccounts(billedServiceAccounts, provisionedSubscriberPhones.ToList(), compositeSubscriber.SubscriberTriad.ID);

            return compositeSubscriber;
        }
コード例 #4
0
        public void LoadPPV_VOD_Mgmt_WithPPVPrivilegeUnlimited()
        {
            var sub = new SubscriberDto();
            try
            {
                // new sub data
                sub = DataHelper.NewSubscriberData();
                sub.CustomFields = DataHelper.DefaultCustomFields_Sub();
                sub.Accounts[0].PPVPrivilege = SubscriberEnums.PPVPrivilegeEnum.Unlimited.ToString();
                sub.Accounts[0].PPVCap = "150.00";
                sub.Accounts[0].PPVResetDay = "10";
                sub.Accounts[0].PinRequired = true;
                sub.Accounts[0].PIN = "2345";
                DataHelper.RestoreSubscriber1(sub, false);

                // set current subscriber
                CurrentSubscriber.SetInstance(sub);

                // call LoadPPV_VOD_Mgmt action method
                var result = PpvVodController.LoadPPV_VOD_Mgmt(sub.ID) as PartialViewResult;

                // validate returned partial view and model
                Assert.IsNotNull(result, "PpvVodControllor PPV_VOD_Mgmt_Partial method returned null");
                Assert.AreEqual("PPV_VOD_Mgmt_Partial", result.ViewName);

                var actualModel = result.Model as PPV_VOD_MgmtModel;
                Assert.IsNotNull(actualModel, "Model is null");
                Assert.AreEqual(sub.Accounts[0].PPVPrivilege, actualModel.PPVPrivilege.ToString(), "PPVPrivilege does not match");
                Assert.AreEqual(sub.Accounts[0].PPVCap, actualModel.PPVCap, "PPVCape does not match");
                Assert.AreEqual(sub.Accounts[0].PPVResetDay, actualModel.PPVResetDay.ToString(CultureInfo.InvariantCulture), "PPVResetDay does not match");
                Assert.AreEqual(sub.Accounts[0].PinRequired, actualModel.PINRequired, "PinRequired does not match");
                Assert.AreEqual(sub.Accounts[0].PIN, actualModel.PIN, "PIN does not match");
            }
            catch (System.Exception ex)
            {
                Assert.IsTrue(ex is AssertFailedException, ex.ToString());
                throw;
            }
            finally
            {
                DataHelper.DeleteSubscriber(sub.ID);
            }
        }
コード例 #5
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
        public static SubscriberDto UVerseSub1WithActiveStb()
        {
            const string id = "S1001";
            var subId = string.Format("STBJULEISUB{0}", id);
            var locId = string.Format("STBJULEILOC{0}", id);
            var stbSerial = string.Format("STBJULEI{0}", id);

            var loc = DefaultAddress(locId);
            RestoreLocation(loc);
            Return2Headend(loc.ID);

            var equipmentDto = new EquipmentDto
            {
                SerialNumber = stbSerial,
                Type = new EquipmentTypeDto
                {
                    Model = "VIP2250",
                },
                UnitAddress = "53B2727219AE46EBA414DC425FDC9E47",
                Status = "ACTIVE",
                LocationId = locId
            };
            RestoreEquip(equipmentDto);

            var sub = new SubscriberDto
            {
                ID = subId,
                Name = subId,
                Accounts = new List<AccountDto>
                {
                    new AccountDto
                    {
                        Location = loc,
                        Equipment = new EquipmentCollectionDto{equipmentDto}
                    }
                },
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto{Label ="MAXSTB", Value = "5"},
                }
            };
            return RestoreSubscriber(sub);
        }
コード例 #6
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
        public static SubscriberDto RgTestSubWith1ActiveRg()
        {
            const string id = "90090001";
            var subId = string.Format("SRGTESTSUB{0}", id);
            var locId = string.Format("SRGTESTLOC{0}", id);
            var rgSerial = string.Format("PACE{0}", id);
            var equipCriteria = new EquipmentCriteriaDto
            {
                LocationId = locId,
                SerialNumber = rgSerial,
                Model = "ARRIS RG",
                Status = "ACTIVE",
                UnitAddress = "001E46"
            };

            var loc = DataHelper.DefaultAddress(locId);
            RestoreLocation1(loc, false);
            Return2Headend(locId);
            var rgEquip = RestoreEquip(equipCriteria);
            var sub = new SubscriberDto
            {
                ID = subId,
                Name = subId,
                Accounts = new List<AccountDto>
                {
                    new AccountDto
                    {
                        Location = loc,
                        Equipment = rgEquip,
                    }
                }
            };
            return RestoreSubscriber(sub);
        }
コード例 #7
0
ファイル: Validation.cs プロジェクト: borealwinter/simpl
        /// <summary>
        /// ValidateSubscriber method - takes SubscriberDto objects and loadAll
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        /// <param name="loadAll"></param>
        public static void ValidateSubscriber(SubscriberDto expected, SubscriberDto actual, bool loadAll)
        {
            if (expected == null)
            {
                return;
            }
            Console.WriteLine();
            Console.WriteLine("=== Validation: Subscriber ===\r\n");

            Validate(expected.ID, actual.ID, TestAttribute.SubscriberID);
            Validate(expected.Name, actual.Name, TestAttribute.SubscriberName);

            Console.WriteLine();

            if (expected.SubContactEmail != null)
            {
                Validate(expected.SubContactEmail, actual.SubContactEmail, TestAttribute.SubContactEmail);
            }
            if (expected.SubContactPhone != null)
            {
                Validate(expected.SubContactPhone, actual.SubContactPhone, TestAttribute.ContactPhone);
            }
            if (expected.Accounts != null && expected.Accounts.Count != 0)
            {
                Assert.AreEqual(1, expected.Accounts.Count);
                Assert.AreEqual(1, actual.Accounts.Count);
                ValidateAccount(expected.Accounts[0], actual.Accounts[0], loadAll);
            }
            if (expected.CustomFields != null && expected.CustomFields.Count != 0 && loadAll)
            {
                ValidateCustomFields(expected.CustomFields, actual.CustomFields);
            }
            Console.WriteLine();
        }
コード例 #8
0
 /// <summary>
 /// Deletes a subscriber but leaves the location
 /// Caller will be responsible for handling exceptions thrown
 /// </summary>
 /// <returns>A boolean that says whether the subscriber was successfully deleted</returns>
 public bool DeleteSubscriberLeaveLocation(SubscriberDto subscriber)
 {
     using (RosettianClient rc = new RosettianClient())
     {
         Thread.Sleep(200);
         rc.DeleteSubscriber(subscriber, CurrentUser.AsUserDto());
         return true;
     }
 }
コード例 #9
0
 /// <summary>
 /// This method takes the Subscriber account object "subscriber" and uses it to save a subscriber.
 /// It is split from the CreateSubscriber method so a user can make changes to the "subscriber" object 
 /// before saving it. It does NOT make another attempt if it fails
 /// Caller will be responsible for handling exceptions thrown
 /// </summary>
 /// <param name="subscriber">Holds the field information of the subscriber</param>
 /// <returns>A boolean that says whether the subscriber was successfully created</returns>
 public bool SaveSubscriberNoRetry(SubscriberDto subscriber)
 {
     bool result = false;
     using (var client = new RosettianClient())
     {
         //Save subscriber
         client.CreateSubscriber(subscriber, CurrentUser.AsUserDto());
         result = true;
     }
     return result;
 }
コード例 #10
0
        /// <summary>
        /// This method takes the Subscriber account object "subscriber" and uses it to save a subscriber.
        /// It is split from the CreateSubscriber method so a user can make changes to the "subscriber" object 
        /// before saving it.
        /// Caller will be responsible for handling exceptions thrown
        /// </summary>
        /// <param name="subscriber">Holds the field information of the subscriber</param>
        /// <returns>A boolean that says whether the subscriber was successfully created</returns>
        public bool SaveMinimalSubscriberWithLocation(SubscriberDto subscriber)
        {
            int iteration = 0;
            bool result = false;

            do
            {
                iteration++;
                try
                {
                    using (var client = new RosettianClient())
                    {
                        //Save subscriber
                        client.CreateSubscriber(subscriber, CurrentUser.AsUserDto());
                        result = true;
                        break;
                    }
                }
                catch (Exception ex)
                {
                    if (iteration == 4)
                    {
                        //throw;
                        string temp = ex.Message;
                    }

                    subscriber = CreateMinimalSubscriberWithLocation();
                }
            } while (iteration != 4);

            return result;
        }
コード例 #11
0
ファイル: BusinessFacade.cs プロジェクト: borealwinter/simpl
        /// <summary>
        /// Loads the composite subscriber.
        /// </summary>
        /// <param name="usi">The usi.</param>
        /// <param name="dpiRegion"></param>
        /// <param name="userDto">The user dto.</param>
        /// <returns></returns>
        public CompositeSubscriber LoadCompositeSubscriber(string usi, string dpiRegion, UserDto userDto)
        {
            var compositeSubscriber = new CompositeSubscriber();
            var rosettianResults = new SubscriberDto();
            var provisionedPhonesResults = new List<PhoneDto>();
            BillingandServiceAccountDto esbResults;
            var esbResultsEnterpriseServiceExceptionFound = false;
            var headerArgs = new HeaderArgs(dpiRegion, userDto.Name, String.Empty, userDto.Name, userDto.Email, userDto.Role);
            Task<SubscriberDto> rosettianResponse = null;
            Task<BillingandServiceAccountDto> esbGetAccountResponse = null;
            Task<List<PhoneDto>> provisioningSubPhonesReponse = null;

            try
            {
                rosettianResponse = Task.Factory.StartNew(() => _rosettianService.LoadSubscriber(usi, userDto));
                esbGetAccountResponse = Task.Factory.StartNew(() => _enterpriseService.GetBillingServiceAccounts(usi, headerArgs));
                provisioningSubPhonesReponse = Task.Factory.StartNew(() => _rosettianService.LoadSubscriberPhones(usi, userDto));
                Task.WaitAll(rosettianResponse, esbGetAccountResponse, provisioningSubPhonesReponse);

            }
            catch (AggregateException ae)
            {
                foreach (var e in ae.InnerExceptions)
                {
                    var handled = false;
                    var isFaultException = (e is FaultException<ValidationFaultDto>);
                    var isServiceError = (e is MessageSecurityException || e is ServerTooBusyException || e is CommunicationException || e is TimeoutException);

                    // Note: if you reverse the order below, VS2013 warns you that isFaultException is always false.
                    if ((isFaultException) || (isServiceError))
                    {
                        // Throw exception if LoadSubscriber and not LoadSubscriberPhones
                        if ((e.StackTrace.Contains("LoadSubscriber")) && (!(e.StackTrace.Contains("LoadSubscriberPhones"))))
                        {
                            var myException = new Exception("Error retrieving Provisioning information for subscriber from Triad, unable to proceed.", e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            throw myException;
                        }

                        // Do not throw exception if LoadSubscriberPhones
                        if (e.StackTrace.Contains("LoadSubscriberPhones"))
                        {
                            var myException = new Exception("Error retrieving Provisioning information for subscriber's phones from Triad, preceeding with loading the subscriber.", e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            handled = true;
                        }
                    }

                    if (!handled)
                    {
                        const string baseErrorMessage = "Error retrieving DPI information for subscriber";
                        if (e is EnterpriseServiceException)
                        {
                            esbResultsEnterpriseServiceExceptionFound = true;
                            var myException = new Exception(String.Format("{0}, as error is an EnterpriseServiceException we are going to proceed", baseErrorMessage));
                            _errorLoggingService.LogErrorNoContext(myException);
                            handled = true;
                        }
                        else if (!isFaultException)
                        {
                            var myException = new Exception(String.Format("{0}, unable to proceed.", baseErrorMessage), e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            throw myException;
                        }
                    }

                    if (!handled)
                    {
                        var myException = new Exception("Unknown error condition retrieving either Provisioning or DPI information for subscriber, unable to proceed.", e);
                        _errorLoggingService.LogErrorNoContext(myException);
                        throw myException;
                    }
                }
            }
            catch (Exception e)
            {
                var myException = new Exception("Unknown error condition retrieving either Provisioning or DPI information for subscriber, unable to proceed.", e);
                _errorLoggingService.LogErrorNoContext(myException);
                throw myException;
            }

            rosettianResults = ((rosettianResponse != null) && (!rosettianResponse.IsFaulted)) ? rosettianResponse.Result : null;
            provisionedPhonesResults = ((provisioningSubPhonesReponse != null) && (!provisioningSubPhonesReponse.IsFaulted)) ? provisioningSubPhonesReponse.Result : null;
            esbResults = ((esbGetAccountResponse != null) && (!esbGetAccountResponse.IsFaulted)) ? esbGetAccountResponse.Result : null;
            compositeSubscriber = FacadeExtensions.Merge(rosettianResults, esbResults, provisionedPhonesResults);
            compositeSubscriber.BillingRegion = dpiRegion;
            compositeSubscriber.ProvisionedUsi = usi;
            // User Story 11766 and Bug 11769 - Adding a new error message for the case where ESB errors out or times out and we don't get any response
            if ((esbResults == null) && (!esbResultsEnterpriseServiceExceptionFound))
            {
                compositeSubscriber.SubscriberErrorMessages = "DPI data request timed out";
            }

            return compositeSubscriber;
        }
コード例 #12
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 public static SubscriberDto GetSIMPLSubscriber03()
 {
     var loc = DefaultAddress("3001.0001");
     loc.CustomFields = DefaultCustomFields_Loc();
     RestoreLocation(loc);
     const string serial = "MRCC30010011";
     var equip = RestoreEquip(new EquipmentCriteriaDto { SerialNumber = serial, LocationId = loc.ID, Status = "ACTIVE", Model = "ONT1000M", UnitAddress = "EVRTWAXFOL2-18-4-10" });
     var svcs = DefaultServices_MOCA();
     var customFields = new List<CustomFieldDto>
     {
         new CustomFieldDto{Label ="Service_ID", Value=""},
         new CustomFieldDto{Label = "PCAN", Value=""},
         new CustomFieldDto{Label = "IP_TYPE", Value="DYNAMIC"},
         new CustomFieldDto{Label = "Sub_WTN", Value="3001000103"},
     };
     var phones = new List<PhoneDto>
     {
         new PhoneDto{ PhoneNumber = "3001000100", PhoneProvSpec = new PhoneProvSpecDto{ InterfaceGroup=1, CRV = 149, EquipmentId = serial+"P01"} } ,
         new PhoneDto{ PhoneNumber = "3001000101", PhoneProvSpec = new PhoneProvSpecDto{ InterfaceGroup=1, CRV = 149, EquipmentId = serial+"P02"} } ,
     };
     var vsp = new VoiceServiceProfileDto { PhoneLines = phones };
     var sub = new SubscriberDto
     {
         ID = "SIMPLTEST1",
         Name = "SIMPLTEST1",
         SubContactPhone = "3001000102",
         SubContactEmail = "*****@*****.**",
         CustomFields = customFields,
         Accounts = new List<AccountDto>
         {
             new AccountDto
             {
                 PPVCap = "75.00",
                 PPVResetDay = "5",
                 PPVPrivilege = "2",
                 PIN = "1234",
                 PinRequired = true,
                 ServiceEnabled = true,
                 Location = loc,
                 Services = svcs,
                 ServiceProfiles = new List<ServiceProfileDto>{vsp} } }
     };
     equip.ToList().ForEach(x => x.AssociatedSubscriberId = sub.ID);
     return RestoreSubscriber(sub);
 }
コード例 #13
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 public static SubscriberDto GetSIMPLSubscriber02NoLocation()
 {
     var sub = new SubscriberDto
     {
         ID = "SUBNOLOC",
         Name = "SUB HAS NO LOC",
         CustomFields = DefaultCustomFields_Sub(),
         Accounts = new List<AccountDto>()
     };
     return RestoreSubscriber(sub);
 }
コード例 #14
0
 private static void ValidatePpvSetting(PPV_VOD_SettingsModel expected, SubscriberDto actual)
 {
     Assert.IsTrue(actual.Accounts.Any(), "Subscriber should not be null!");
     var account = actual.Accounts[0];
     switch (account.PPVPrivilege)
     {
         case "2":
             account.PPVPrivilege = "Capped";
             break;
         case "1":
             account.PPVPrivilege = "Unlimited";
             break;
         case "0":
             account.PPVPrivilege = "None";
             break;
     }
     Assert.AreEqual(expected.PPVPrivilege.ToString(), actual.Accounts[0].PPVPrivilege, "PPVPrivilege does not match");
     Assert.AreEqual(expected.PPVCap, actual.Accounts[0].PPVCap, "PPVCape does not match");
     Assert.AreEqual(expected.PPVResetDay.ToString(CultureInfo.InvariantCulture), actual.Accounts[0].PPVResetDay, "PPVResetDay does not match");
     Assert.AreEqual(expected.PINRequired, actual.Accounts[0].PinRequired, "PinRequired does not match");
     Assert.AreEqual(expected.PIN, actual.Accounts[0].PIN, "PIN does not match");
 }
コード例 #15
0
        public void UpdatePPV_VOD_UpdatePPVPrivilegeFromCappedToUnlimited()
        {
            var sub = new SubscriberDto();
            try
            {
                // new sub data
                sub = DataHelper.NewSubscriberData();
                sub.CustomFields = DataHelper.DefaultCustomFields_Sub();
                sub.Accounts[0].PPVPrivilege = SubscriberEnums.PPVPrivilegeEnum.Capped.ToString();
                sub.Accounts[0].PPVCap = "150.00";
                sub.Accounts[0].PPVResetDay = "10";
                sub.Accounts[0].PinRequired = true;
                sub.Accounts[0].PIN = "2345";

                // create subscriber with PPVCap privilege
                DataHelper.RestoreSubscriber1(sub, false);

                // set current subscriber
                CurrentSubscriber.SetInstance(sub);

                // get current subscriber
                var currentSub = CurrentSubscriber.GetInstance();
                Assert.AreEqual(SubscriberEnums.PPVPrivilegeEnum.Capped, currentSub.PPVPrivilege);

                // model
                var ppvSettingsModel = new PPV_VOD_SettingsModel
                {
                    PPVPrivilege = currentSub.PPVPrivilege,
                    PPVCap = currentSub.PPVCap,
                    PPVResetDay = int.Parse(currentSub.PPVResetDay),
                    PINRequired = currentSub.PINRequired,
                    PIN = currentSub.PIN
                };

                // edit ppv settings
                ppvSettingsModel.PPVPrivilege = SubscriberEnums.PPVPrivilegeEnum.Unlimited;

                // call UpdatePPV_VOD action method
                var result = PpvVodController.UpdatePPV_VOD(ppvSettingsModel) as JsonResult;

                // validate return json result
                Assert.IsNotNull(result, "Json result is null");
                Assert.IsNotNull(result.Data, "Json result data is null");
                dynamic resultStatus = result.Data;
                Assert.AreEqual("valid", resultStatus.status as string, "Response status does not match!");

                // validate current subscriber in session updated with new ppvsetting as well.
                currentSub = CurrentSubscriber.GetInstance();
                Assert.IsNotNull(currentSub, "Model is null");
                ValidatePpvSetting(ppvSettingsModel, currentSub);

                // validate subscriber ppvsettings updated in db
                var actualSub = DataHelper.LoadSubscriber(sub.ID);
                Assert.IsNotNull(actualSub, "Subscriber should not be null!");
                ValidatePpvSetting(ppvSettingsModel, actualSub);
            }
            catch (System.Exception ex)
            {
                Assert.IsTrue(ex is AssertFailedException, ex.ToString());
                throw;
            }
            finally
            {
                DataHelper.DeleteSubscriber(sub.ID);
            }
        }
コード例 #16
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
        public static SubscriberDto UVerseSub2With1ActiveRgAnd1ActiveStb()
        {
            const string id = "S1002";
            var subId = string.Format("STBJULEISUB{0}", id);
            var locId = string.Format("STBJULEILOC{0}", id);
            var stbSerial = string.Format("STBJULEI{0}", id);
            var rgSerial = string.Format("PACEJULEI{0}", id);
            var equipCriteria = new EquipmentCriteriaDto
            {
                LocationId = locId,
                SerialNumber = rgSerial,
                Model = "ARRIS RG",
                Status = "ACTIVE",
                UnitAddress = "001E46"
            };

            // Restore location
            var loc = DefaultAddress(locId);
            RestoreLocation(loc);

            // Return unwanted equip to headend
            Return2Headend(loc.ID);

            // Restore RG
            var compositeEquipment = RestoreEquip(equipCriteria);
            var equipmentDto = new EquipmentDto
            {
                SerialNumber = stbSerial,
                Type = new EquipmentTypeDto
                {
                    Model = "VIP2250",
                },
                UnitAddress = "66A29F493EF843D69F8CB211D4181105",
                Status = "ACTIVE",
                LocationId = locId
            };
            compositeEquipment.Add(equipmentDto);

            // Restore STB
            RestoreEquip(equipmentDto);

            var sub = new SubscriberDto
            {
                ID = subId,
                Name = subId,
                Accounts = new List<AccountDto>
                {
                    new AccountDto
                    {
                        Location = loc,
                        Equipment = compositeEquipment
                    }
                },
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto{Label ="MAXSTB", Value = "5"},
                }
            };
            return RestoreSubscriber(sub);
        }
コード例 #17
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
        public static SubscriberDto GetSIMPLSubscriber01()
        {
            //Location
            var loc = new LocationDto
            {
                ID = "5829224.3544318",
                AddressLine1 = "8105 161ST AVE NE",
                CityName = "REDMOND",
                StateName = "WA",
                ZipCode = "98052",
                HeadendCode = "04",
                CustomFields = DefaultCustomFields_Loc()
            };

            //Equipment
            const string unitAddr = "RDMDWAXAOL4-18-3-3";
            var equip = new EquipmentCollectionDto
            {
                NewEquipment("MRCC00181AB9D01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Data Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9M01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M MoCA Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P01", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P02", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P03", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("MRCC00181AB9P04", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "ONT1000M Phone Port"), unitAddr, "ACTIVE"),
                NewEquipment("M90937ZA8275", EquipmentTypes().Single(x=>x.Manufacturer == "Motorola" && x.Model == "QIP2500"), "0000050810829002", "ACTIVE")
            };
            equip.ToList().ForEach(x => x.LocationId = loc.ID);

            //Services
            var svcs = new ServiceCollectionDto
            {
                new ServiceDto { ClassName = "DATA - FTTH SPEED", Name = "F35M35M", Description = "35M DOWN 35M UP" },
                new ServiceDto{ ClassName = ServiceClassType.ProvisionedOntDataPort.GetStringValue(), Name = "MOCA", Description = "MOCA PORT" },
                new ServiceDto { ClassName = "RF - BASICS", Name = "FIOS", Description = "FIOS VIDEO SERVICE" },
                new ServiceDto { ClassName = "VIDEO - BUNDLE/MISC", Name = "FIDS1", Description = "DOWNSTREAM PATH" },
                new ServiceDto { ClassName = "VIDEO - BUNDLE/MISC", Name = "FIVOD", Description = "VIDEO ON DEMAND SERV" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIES1", Description = "FIOS TV ESSENTIALS" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIHDS", Description = "HIGH DEFINITION -TRK" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIPR1", Description = "FIOS TV PREMIER" },
                new ServiceDto { ClassName = "VIDEO - TIERS", Name = "FIPR5", Description = "FIOS TV PREM ENH BIZ" },
                new ServiceDto { ClassName = "VOICE", Name = "VOICE", Description = "FTTH VOICE SERVICE" },
            };

            //ServiceProfiles
            var vsps = new List<ServiceProfileDto>
            {
                NewVoiceServiceProfile("4258818771", 1, 413, "MRCC00181AB9P01", null),
                NewVoiceServiceProfile("4258699232", 1, 414, "MRCC00181AB9P02", null)
            };

            //Account
            var acct = new AccountDto
            {
                AcctContactEmail = null,
                AcctContactName = null,
                AcctContactPhone = null,
                Email = null,
                Location = loc,
                ID = null,
                Name = null,
                PIN = null,
                PinRequired = false,
                PPVCap = "1.00",
                PPVEnabled = true,
                PPVPrivilege = "2",
                PPVResetDay = "15",
                ServiceEnabled = true,
                ServiceProfiles = vsps,
                Services = svcs
            };

            var sub = new SubscriberDto
            {
                ID = "370002312079",
                Name = "KIKUYA JAPANESE RESTAURAN",
                SubContactEmail = "*****@*****.**",
                SubContactPhone = "4258818771",
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto{Label ="Service_ID", Value=""},
                    new CustomFieldDto{Label = "PCAN", Value="F274112844"},
                    new CustomFieldDto{Label = "IP_TYPE", Value="DYNAMIC"},
                    new CustomFieldDto{Label = "Sub_WTN", Value=""},
                },
                Accounts = new List<AccountDto> { acct }
            };
            return sub;
        }
コード例 #18
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 public static SubscriberDto GetSIMPLSubscriber04CPE01()
 {
     var loc = DefaultAddress("4001.0001");
     RestoreLocation(loc);
     var equip = RestoreEquip(new EquipmentCriteriaDto { SerialNumber = "MRCC40010001", LocationId = loc.ID, Status = "ACTIVE", Model = "ONT1000GTI" });
     var svcs = DefaultServices_ENET();
     var customFields = DefaultCustomFields_Sub();
     var sub = new SubscriberDto
     {
         ID = "SIMPLCPE1",
         Name = "SIMPLCPE1",
         CustomFields = customFields,
         Accounts = new List<AccountDto>
         {
             new AccountDto
             {
                 Location = loc,
                 Equipment = equip,
                 Services = svcs,
                 PPVCap = "150.00",
                 PPVPrivilege = "Capped",
                 PPVResetDay = "28",
                 PinRequired = false
         }
         }
     };
     equip.ToList().ForEach(x => x.AssociatedSubscriberId = sub.ID);
     return RestoreSubscriber(sub);
 }
コード例 #19
0
ファイル: BusinessFacade.cs プロジェクト: borealwinter/simpl
        /// <summary>
        /// Maps subscriber DTO object to SubscriberSearchResult object.
        /// </summary>
        /// <param name="subscriber">SubscriberDto object</param>
        /// <returns>Equivalent SubscriberSearchResult object.</returns>
        private SubscriberSearchResult MapProvisioningResponseToSubscriberSearchResult(SubscriberDto subscriber)
        {
            if (subscriber == null || string.IsNullOrEmpty(subscriber.ID) || string.IsNullOrEmpty(subscriber.Name))
            {
                throw new NullReferenceException("Subscriber Object, ID or Name was null");
            }
            var result = new SubscriberSearchResult();

            result.ID = subscriber.ID;
            result.Name = subscriber.Name;
            if (subscriber.Accounts != null
                && subscriber.Accounts.Any()
                && subscriber.Accounts.FirstOrDefault() != null
                // ReSharper disable once PossibleNullReferenceException
                && subscriber.Accounts.FirstOrDefault().Location != null)
            {
                result.LocationID = subscriber.Accounts[0].Location.ID;
                result.AddressLine1 = subscriber.Accounts[0].Location.AddressLine1;
                result.AddressLine2 = subscriber.Accounts[0].Location.AddressLine2;
                result.CityName = subscriber.Accounts[0].Location.CityName;
                result.StateName = subscriber.Accounts[0].Location.StateName;
                result.ZipCode = subscriber.Accounts[0].Location.ZipCode;
                result.Phone = subscriber.SubContactPhone;
                result.ExistsInProvisioning = true;
            }

            result.DataSource = SubscriberEnums.SubscriberDataSource.Provisioning;
            result.Environment = String.Empty;

            return result;
        }
コード例 #20
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 public static SubscriberDto GetSIMPLSubscriber05CPE02()
 {
     var loc = DefaultAddress("4001.0002");
     RestoreLocation(loc);
     var equip = RestoreEquip(new EquipmentCriteriaDto { SerialNumber = "MRCC40010002", LocationId = loc.ID, Status = "ACTIVE", Model = "ONT1000GTI" });
     var svcs = DefaultServices_ENET();
     var customFields = DefaultCustomFields_Sub();
     var sub = new SubscriberDto
     {
         ID = "SIMPLCPE2",
         Name = "SIMPLCPE2",
         CustomFields = customFields,
         Accounts = new List<AccountDto>
         {
             new AccountDto { Location = loc, Services = svcs }
         }
     };
     equip.ToList().ForEach(x => x.AssociatedSubscriberId = sub.ID);
     return RestoreSubscriber(sub);
 }
コード例 #21
0
        /// <summary>
        /// This method takes the Subscriber account object "subscriber" and uses it to save a subscriber.
        /// It is split from the CreateSubscriber method so a user can make changes to the "subscriber" object 
        /// before saving it. It will make up to four attempts to succeed.
        /// Caller will be responsible for handling exceptions thrown
        /// </summary>
        /// <param name="subscriber">Holds the field information of the subscriber</param>
        /// <returns>A boolean that says whether the subscriber was successfully created</returns>
        public bool SaveSubscriber(SubscriberDto subscriber)
        {
            int iteration = 0; //Used to keep track of how many attempts were made
            bool result = false;

            do
            {
                iteration++;
                try
                {
                    using (var client = new RosettianClient())
                    {
                        //Save subscriber
                        client.CreateSubscriber(subscriber, CurrentUser.AsUserDto());
                        result = true;
                        break;
                    }
                }
                catch (Exception ex)
                {
                    //Try four times before throwing an error
                    if (iteration == 4)
                    {
                        //throw;
                        string temp = ex.Message;
                    }

                    subscriber = CreateSubscriber();
                }
            } while (iteration != 4);

            return result;
        }
コード例 #22
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 public static SubscriberDto GetSIMPLSubscriberwithCvoipPhones()
 {
     var loc = DefaultAddress("9999.9182");
     RestoreLocation(loc);
     var svcs = DefaultServices_Cvoip();
     var customFields = DefaultCustomFields_Sub();
     var sub = new SubscriberDto
     {
         ID = "SIMPLCVOIP9182",
         Name = "SIMPLCVOIP9182",
         CustomFields = customFields,
         Accounts = new List<AccountDto>
         {
             new AccountDto
             {
                 Location = loc,
                 Services = svcs,
                 PPVCap = "150.00",
                 PPVPrivilege = "Capped",
                 PPVResetDay = "28",
                 PinRequired = false
             }
         }
     };
     var subDto = RestoreSubscriber(sub);
     return subDto;
 }
コード例 #23
0
        /// <summary>
        /// Generate a Subscriber object from the auto-generated field values
        /// </summary>
        /// <returns></returns>
        public SubscriberDto CreateSubscriberObjectFromGeneratedFields()
        {
            SubscriberDto subscriber = new SubscriberDto()
            {
                //These fields are access directly through the Subscriber Object
                ID = SubscriberID,
                Name = SubscriberName,
                SubContactPhone = SubscriberContactPhone,
                SubContactEmail = SubscriberContactEmail,
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto {Label = "Sub_WTN", Value = SubscriberContactPhone}
                },

                //The following fields are accessed through Subscriber.Accounts object
                Accounts = new List<AccountDto>
                {
                    new AccountDto
                    {
                        PPVPrivilege = SubscriberPPVPrivilege.ToString(),
                        PPVCap = SubscriberPPVCap,
                        PPVCapUsed = "0.00",
                        PPVResetDay = GenerateSubscriberPPVResetDay,
                        PinRequired = SubscriberPinRequired,
                        PIN = SubscriberPIN,
                        ServiceEnabled = ServiceEnabled,
                        Services = new ServiceCollectionDto(),
                        IpType = this.IpType
                    }
                }
            };

            //Add subscribers and equipment
            subscriber.Accounts[0].Location = GenerateLocationForLocalObject();
               // subscriber.Accounts[0].Equipment = GenerateEquipmentCollectionDto(subscriber.Accounts[0].Location.ID);

            return subscriber;
        }
コード例 #24
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
 /// <summary>
 /// Load subscriber specified by USI subID and convert to model instance.
 /// Load is performed twice as an easy means for creating a reference clone
 /// to use in comparing or restoring original state.
 /// Assumption: subscriber being loaded is reserved for a specific test.
 /// </summary>
 /// <param name="subID">USI for subscriber to load</param>
 /// <param name="referenceSub">deep clone of subscriber</param>
 /// <returns>subscriber identified by subID as MVC model</returns>
 public static SubscriberModel GetTestSubModel(string subID, out SubscriberDto referenceSub)
 {
     referenceSub = null;
     try
     {
         using (var client = new RosettianClient())
         {
             var user = CurrentUser.AsUserDto();
             referenceSub = client.LoadSubscriber(subID, user);
             Assert.IsNotNull(referenceSub, "GetTestSubModel() - USI {0} not found.", subID);
             // Create deep copy "clone" (with unique instances) by loading again.
             var rozSub = client.LoadSubscriber(subID, user);
             return rozSub.MapToSubscriberModel();
         }
     }
     catch (Exception)
     {
         return new SubscriberModel();
     }
 }
コード例 #25
0
ファイル: Data.cs プロジェクト: borealwinter/simpl
        public static SubscriberDto RgTestSub2With1ActiveRg()
        {
            const string subId = "999000795551";
            const string locId = "REN";
            const string rgSerial = "PACE99999991";
            var equipCriteria = new EquipmentCriteriaDto
            {
                LocationId = locId,
                SerialNumber = rgSerial,
                Model = "ARRIS RG",
                Status = "ACTIVE",
                UnitAddress = "001E46"
            };

            var loc = new LocationDto { ID = locId, AddressLine1 = "19999 19TH AVE", CityName = "RENTON", StateName = "WA", ZipCode = "98999" };
            RestoreLocation1(loc, false);
            Return2Headend(locId);
            var rgEquip = RestoreEquip(equipCriteria);

            var rgDataPort = rgEquip.FirstOrDefault(x => x.SerialNumber.Substring(x.SerialNumber.Length - 3, 3) == "D01");
            Assert.IsNotNull(rgDataPort);
            rgDataPort.CustomFields = new List<CustomFieldDto>
            {
                new CustomFieldDto()
                {
                    Label = "ENET_MAC_ADDR",
                    Value = "A0:B1:C2:D3:E4:F5"
                }
            };
            RestoreEquip(rgDataPort);

            var sub = new SubscriberDto
            {
                ID = subId,
                Name = "Cathy Copper",
                Accounts = new List<AccountDto>
                {
                    new AccountDto
                    {
                        Location = loc,
                        Equipment = rgEquip,
                    }
                },
                CustomFields = new List<CustomFieldDto>
                {
                    new CustomFieldDto
                    {
                        Label = "WAN_IP_ADDR",
                        Value = "10.129.96.213"
                    }
                }
            };
            return RestoreSubscriber(sub);
        }
コード例 #26
0
ファイル: Validation.cs プロジェクト: borealwinter/simpl
 /// <summary>
 /// ValidateSubscriber method - takes SubscriberDto objects
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 public static void ValidateSubscriber(SubscriberDto expected, SubscriberDto actual)
 {
     ValidateSubscriber(expected, actual, false);
 }