Esempio n. 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());
            }
        }
Esempio n. 3
0
        public void MyTestInitialize()
        {
            //Set session helper for handling HttpContext data.
            sessionHelper = new DictionarySessionHelper();
            SessionHandler.SetSessionHelper(sessionHelper);

            //Set applicatiobn start parameters that will be set in Global.asax.cs-Application_Start())
            CoreData.ApplicationManager  = new ApplicationManager();
            CoreData.CountryManager      = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager       = new LocaleManagerMultiThreadCache();
            CoreData.OrganizationManager = new OrganizationManager();
            CoreData.TaxonManager        = new TaxonManagerMultiThreadCache();
            CoreData.UserManager         = new UserManagerMultiThreadCache();
            CoreData.RegionManager       = new RegionManagerMultiThreadCache(new CoordinateSystem());
            CoreData.AnalysisManager     = new AnalysisManager();

            //Create datasources
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();

            //Set Session start parameters that will be set in Global.asax.cs-Session_Start(object sender, EventArgs e)
            SessionHelper.SetInSession("language", "en-GB");
            SessionHelper.SetInSession("mySettings", new AnalysisPortal.MySettings.MySettings());
            SessionHelper.SetInSession("results", new CalculatedDataItemCollection());
            // Set language that will be set in Global.asax.cs-Application_BeginRequest(object sender, EventArgs e)
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(SessionHelper.GetFromSession <string>("language"));
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(SessionHelper.GetFromSession <string>("language"));

            LoginApplicationUser(); // to remove this call, you must implement SpeciesObservationDataSourceTestRepository.GetSpeciesObservationFieldDescriptions
        }
        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.");
            }
        }
Esempio n. 5
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public void TestInitialize()
        {
            WebServiceData.ApplicationManager   = new ApplicationManager();
            WebServiceData.AuthorizationManager = new AuthorizationManager();
            WebServiceData.RegionManager        = new ArtDatabankenService.Data.RegionManager();
            WebServiceData.UserManager          = new UserManager();
            WebServiceData.TaxonManager         = new ArtDatabankenService.Data.TaxonManager();
            WebServiceData.WebServiceManager    = new WebServiceManager();
            CoreData.TaxonManager = new TaxonManagerSingleThreadCache();
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
//            _context = new WebServiceContextCached(new WebClientToken(TEST_USER_NAME, ApplicationIdentifier).Token);
            //_context = new WebServiceContext(new WebClientToken(TEST_USER_NAME, ApplicationIdentifier).Token);
            _context = new WebServiceContext(new WebClientToken(TEST_USER_NAME, ApplicationIdentifier, WebServiceData.WebServiceManager.Key).Token);
            if (_useTransaction)
            {
                _context.StartTransaction(_transactionTimeout);
            }
        }
Esempio n. 9
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.");
            }
        }
Esempio n. 10
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();
        }