protected void Application_Start()
        {
            // This is a *partial* fix for some of the issues discovered when disabling TLS 1.0 as part of the following story: https://projects.sitkatech.com/projects/gemini/cards/4197
            // Allow multiple protocols so that we can connect to more than one endpoint, over time we may need to add Tls13 etc
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("ProjectFirma.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectPerson/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                    "~/Views/Shared/FileResourceControls/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }
Exemple #2
0
        public void AllExistingProjectModelReportTemplatesAreValid()
        {
            SitkaLogger.RegisterLogger(new FirmaLogger());

            List <ReportTemplateTestFailedReportTemplate> failedReportTemplates = new List <ReportTemplateTestFailedReportTemplate>();
            //var reportTemplates = HttpRequestStorageForTest.DatabaseEntities.AllReportTemplates.ToList();
            var reportTemplatesGroupedByTenantID = HttpRequestStorageForTest.DatabaseEntities.AllReportTemplates.GroupBy(x => x.TenantID, (key, rt) => new { TenantID = key, ReportTemplates = rt.ToList() }).ToList();

            foreach (var reportTemplatesForTenant in reportTemplatesGroupedByTenantID)
            {
                var sampleProjectIDs = HttpRequestStorageForTest.DatabaseEntities.AllProjects
                                       .Where(p => p.TenantID == reportTemplatesForTenant.TenantID).Select(p => p.ProjectID).Take(10).ToList();

                foreach (var reportTemplate in reportTemplatesForTenant.ReportTemplates)
                {
                    ReportTemplateGenerator.ValidateReportTemplateForSelectedModelIDs(reportTemplate, sampleProjectIDs, out var reportIsValid, out var errorMessage, out var sourceCode);
                    if (!reportIsValid)
                    {
                        failedReportTemplates.Add(new ReportTemplateTestFailedReportTemplate(reportTemplate, errorMessage, sourceCode));
                    }
                }
            }

            Assert.That(failedReportTemplates, Is.Empty, $"The following report templates (count: {failedReportTemplates.Count}) have failed to compile: {string.Join(", ", failedReportTemplates.Select(x => x.ErrorMessageForTest()))}. Was there any changes recently to the Docx ReportTemplating or associated models?");
        }
Exemple #3
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             $"ProjectFirma.Web{(!string.IsNullOrWhiteSpace(keyValuePair.Key) ? $".Areas.{keyValuePair.Key}" : string.Empty)}.Controllers",
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectContact/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/ProjectAttachment/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();

            //FederatedAuthentication.ServiceConfigurationCreated += FederatedAuthentication_ServiceConfigurationCreated;
        }
Exemple #4
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new NeptuneLogger());
            CookiePrefixToExcludeFromEmailLogging = $"{NeptuneWebConfiguration.KeystoneOpenIDClientId}_";

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("Neptune.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/JurisdictionControls/{0}.cshtml",
                    "~/Views/Shared/ProjectWatershedControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/EditAttributes/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/Location/{0}.cshtml",
                    "~/Views/Shared/UserJurisdictions/{0}.cshtml",
                    "~/Views/Shared/HRUCharacteristics/{0}.cshtml",
                    "~/Views/Shared/ModeledPerformance/{0}.cshtml",
                    "~/Views/FieldVisit/ObservationTypePreview/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "Neptune"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(NeptuneBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }
    public void RunBeforeAnyTests()
    {
        SitkaLogger.RegisterLogger();
        log4net.Config.XmlConfigurator.Configure();

        // This is a *partial* fix for some of the issues discovered when disabling TLS 1.0 as part of the following story: https://projects.sitkatech.com/projects/gemini/cards/4197
        // Allow multiple protocols so that we can connect to more than one endpoint, over time we may need to add Tls13 etc
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
    }
Exemple #6
0
 public void RunBeforeAnyTests()
 {
     SitkaLogger.RegisterLogger();
     log4net.Config.XmlConfigurator.Configure();
 }