Example #1
0
        public void MyTestInitialize()
        {
            // Kör tester mot produktionsmiljö
            //Configuration.Debug = false;
            //Configuration.InstallationType = InstallationType.Production;

            // Set used datasources
            CoreData.CountryManager            = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager             = new LocaleManagerMultiThreadCache();
            CoreData.TaxonManager              = new TaxonManagerMultiThreadCache();
            CoreData.UserManager               = new UserManagerMultiThreadCache();
            CoreData.RegionManager             = new RegionManagerMultiThreadCache(new CoordinateSystem());
            CoreData.ReferenceManager          = new ReferenceManagerMultiThreadCache();
            CoreData.SpeciesObservationManager = new SpeciesObservationManagerMultiThreadCache();
            CoreData.MetadataManager           = new MetadataManagerMultiThreadCache();
            CoreData.AnalysisManager           = new AnalysisManager();
            CoreData.SpeciesFactManager        = new SpeciesFactManagerMultiThreadCache();
            CoreData.FactorManager             = new FactorManagerMultiThreadCache();

            UserDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();

            // Finally login application user
            //LoginApplicationUser(null, null);
        }
        public void TestInitialize()
        {
            CoreData.ApplicationManager  = new ApplicationManager();
            CoreData.CountryManager      = new CountryManagerSingleThreadCache();
            CoreData.LocaleManager       = new LocaleManagerSingleThreadCache();
            CoreData.OrganizationManager = new OrganizationManager();
            CoreData.TaxonManager        = new TaxonManagerSingleThreadCache();
            CoreData.UserManager         = new UserManagerSingleThreadCache();
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();

            try
            {
                _userContext = CoreData.UserManager.Login(Settings.Default.TestUserName,
                                                          Settings.Default.TestPassword,
                                                          ApplicationIdentifier.Dyntaxa.ToString());
            }
            catch (TimeoutException)
            {
                // Try Once more if service is turned off...
                Thread.Sleep(20000);
                _userContext = CoreData.UserManager.Login(Settings.Default.TestUserName,
                                                          Settings.Default.TestPassword,
                                                          ApplicationIdentifier.Dyntaxa.ToString());
            }
        }
        public void TestInitialize()
        {
            UserManager.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, _applicationName, false);

            // Set used datasources
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();

            bool loginSuccess = false;

            // Added try catch due to problems with Moneses-Dev loosing connection.
            try
            {
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }
            catch (TimeoutException)
            {
                Thread.Sleep(20000);
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }

            if (!loginSuccess)
            {
                throw new ArgumentException("UserManager login failed.");
            }
        }
Example #4
0
        protected void Application_Start()
        {
#if DEBUG
            DyntaxaLogger.WriteMessage("Web application started");
#endif
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);

            RegisterRoutes(RouteTable.Routes);
            // MK 2015-10-12 County map isn't used?
            //String path = Server.MapPath("~/Images/Maps/Sverigekarta med län.shp");
            //CountyOccurrenceMap.InitializeMap(path);

            Configuration.SetInstallationType();
            CoreData.CountryManager     = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager      = new LocaleManagerMultiThreadCache();
            CoreData.ReferenceManager   = new ReferenceManagerMultiThreadCache();
            CoreData.TaxonManager       = new TaxonManagerMultiThreadCache();
            CoreData.UserManager        = new UserManagerMultiThreadCache();
            CoreData.SpeciesFactManager = new SpeciesFactManagerMultiThreadCache();

            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            PesiNameDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();

            CoreData.UserManager.LoginApplicationUser();
            CoreData.UserManager.LoginApplicationTransactionUser();
            ScheduledTasksManager.AddTasks();
        }
        public void MyTestInitialize()
        {
            //Set session helper for handling HttpContext data.
            sessionHelper = new DictionarySessionHelper();
            SessionHandler.SetSessionHelper(sessionHelper);

            // this.StubDataSourceData();

            CoreData.CountryManager            = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager             = new LocaleManagerMultiThreadCache();
            CoreData.TaxonManager              = new TaxonManagerMultiThreadCache();
            CoreData.UserManager               = new UserManagerMultiThreadCache();
            CoreData.RegionManager             = new RegionManagerMultiThreadCache(new CoordinateSystem());
            CoreData.ReferenceManager          = new ReferenceManagerMultiThreadCache();
            CoreData.SpeciesObservationManager = new SpeciesObservationManagerMultiThreadCache();
            CoreData.MetadataManager           = new MetadataManagerMultiThreadCache();
            CoreData.AnalysisManager           = new AnalysisManager();

            UserDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();

            //Finally login application user
            try
            {
                CoreData.UserManager.LoginApplicationUser();
            }
            catch (Exception)
            {
                // Try Once more...
                Thread.Sleep(20000);
                CoreData.UserManager.LoginApplicationUser();
            }
            IUserContext user = CacheHandler.GetApplicationUserContext("ApplicationContext:");

            SessionHelper.SetInSession("userContext", user);
            SessionHelper.SetInSession("ApplicationContext:en-GB", user);
            SessionHelper.SetInSession("ApplicationContext:", user);
            SessionHelper.SetInSession("mySettings", new MySettings());
            SessionHelper.SetInSession("results", new CalculatedDataItemCollection());
            user.User              = new User(user);
            user.User.UserName     = AnalysisPortalTestSettings.Default.TestUserName + "Appuser";
            userContext            = user;
            applicationUserContext = user;

            //SessionHelper.SetInSession("userContext", userContext);
            //SessionHelper.SetInSession("ApplicationContext:en-GB", applicationUserContext);
            //SessionHelper.SetInSession("ApplicationContext:", applicationUserContext);
            // CacheHandler.SetApplicationUserContext("ApplicationContext:", applicationUserContext);
        }
Example #6
0
        public DyntaxaService(string userName, string password, string appId)
        {
            // Configure data sources in the Onion architecture.
            // User service must be first because the other services depends on UserService.
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();

            setUserContext(userName, password, appId);
        }
Example #7
0
        public void TestInitialize()
        {
            Configuration.SetInstallationType();
            //Configuration.InstallationType = InstallationType.Production;

            CoreData.CountryManager            = new CountryManagerSingleThreadCache();
            CoreData.LocaleManager             = new LocaleManagerSingleThreadCache();
            CoreData.UserManager               = new UserManagerSingleThreadCache();
            CoreData.OrganizationManager       = new OrganizationManager();
            CoreData.ApplicationManager        = new ApplicationManager();
            CoreData.ReferenceManager          = new ReferenceManagerSingleThreadCache();
            CoreData.RegionManager             = new RegionManager(GetCoordinateSystem());
            CoreData.TaxonManager              = new TaxonManagerSingleThreadCache();
            CoreData.SpeciesObservationManager = new SpeciesObservationManagerSingleThreadCache();
            CoreData.AnalysisManager           = new AnalysisManager();

            UserDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            PictureDataSource.SetDataSource();

            bool loginSuccess;

            // Added try catch due to problems with Moneses-Dev loosing connection.
            try
            {
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }
            catch (TimeoutException)
            {
                Thread.Sleep(20000);
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }

            if (!loginSuccess)
            {
                throw new ArgumentException("UserManager login failed.");
            }
        }
Example #8
0
        protected void Application_Start()
        {
#if DEBUG
            Logger.WriteMessage("Web application started");
#endif
            Configuration.SetInstallationType();
            ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            ModelBinders.Binders.Add(typeof(double), new DoubleModelBinder());
            SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            String path = Server.MapPath("~/App_Data/Map/Sverigekarta med län.geojson");
            ArtDatabanken.WebApplication.AnalysisPortal.IO.MapImage.InitializeMap(path);
            SpeciesObservationPointMap.InitializeMap(path);

            IFilterProvider[] providers = FilterProviders.Providers.ToArray();
            FilterProviders.Providers.Clear();
            FilterProviders.Providers.Add(new ExcludeFilterProvider(providers));

            CoreData.CountryManager  = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager   = new LocaleManagerMultiThreadCache();
            CoreData.TaxonManager    = new TaxonManagerMultiThreadCache();
            CoreData.UserManager     = new UserManagerMultiThreadCache();
            CoreData.RegionManager   = new RegionManagerMultiThreadCache(new CoordinateSystem());
            CoreData.MetadataManager = new MetadataManagerMultiThreadCache();

            // Get species observation information from Elasticsearch.
            //WebServiceProxy.AnalysisService.WebServiceAddress = @"silurus2-1.artdata.slu.se/AnalysisService/AnalysisService.svc";
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceAddress = @"silurus2-1.artdata.slu.se/SwedishSpeciesObservationService/SwedishSpeciesObservationService.svc";

            // Set datasources
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            WebServiceProxy.SwedishSpeciesObservationService.MaxBufferPoolSize = Resources.AppSettings.Default.MaxBufferPoolSize;
            // Local test.
            //WebServiceProxy.SwedishSpeciesObservationService.InternetProtocol = InternetProtocol.Http;
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceAddress = @"localhost:1667/SwedishSpeciesObservationService.svc";
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceProtocol = WebServiceProtocol.SOAP11;

            // Login application user
            try
            {
                CoreData.UserManager.LoginApplicationUser();
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to login application user", ex);
            }

            // Initialize Red list cache
            try
            {
                CoreData.AnalysisManager.InitAnalysisCache(CoreData.UserManager.GetApplicationContext());
                //TaxonListInformationManager.Instance.InitCache();
                IUserContext cacheUserContext = CoreData.UserManager.GetApplicationContext();
                cacheUserContext.Locale = CoreData.LocaleManager.GetLocale(cacheUserContext, LocaleId.sv_SE);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to initialize cache", ex);
            }

            ScheduledTasksManager.AddTasks();
        }