private RedisConnectionWrapper GetRedisConnectionWrapperWithUniqueSession(ProviderConfiguration pc)
 {
     string id = Guid.NewGuid().ToString();
     uniqueSessionNumber++;
     // Initial connection with redis
     RedisConnectionWrapper.sharedConnection = null;
     RedisConnectionWrapper redisConn = new RedisConnectionWrapper(pc, id);
     return redisConn;
 }
Example #2
0
        public static void Main()
        {
            var servConfig = new ProviderConfiguration();
            servConfig.ApiDomain = "api.aaa.com";
            var clientConfig = new ConsumerConfiguration();

            var registry = new GenericRegistry(null,null);
            SeifApplication.Initialize(registry, servConfig,clientConfig, null);

            SeifApplication.ExposeService<IMockService, MockService>(new ServiceConfiguration());
        }
Example #3
0
        public async Task SendAndReceiveFromSQS()
        {
            var properties = new Dictionary <string, string>
            {
                { SQSAdapterFactory.DataConnectionStringPropertyName, AWSTestConstants.DefaultSQSConnectionString },
                { SQSAdapterFactory.DeploymentIdPropertyName, deploymentId }
            };
            var config = new ProviderConfiguration(properties, "type", "name");

            var adapterFactory = new SQSAdapterFactory();

            adapterFactory.Init(config, SQS_STREAM_PROVIDER_NAME, new LoggerWrapper <SQSAdapter>(NullLoggerFactory.Instance), this.fixture.Services);
            await SendAndReceiveFromQueueAdapter(adapterFactory, config);
        }
        public ArrayList GetUpgradeLogList()
        {
            var objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("data");
            var strProviderPath          = DataProvider.Instance().GetProviderPath();
            var arrScriptFiles           = new ArrayList();
            var arrFiles = Directory.GetFiles(strProviderPath, "*." + objProviderConfiguration.DefaultProvider);

            foreach (var strFile in arrFiles)
            {
                arrScriptFiles.Add(Path.GetFileNameWithoutExtension(strFile));
            }
            arrScriptFiles.Sort();
            return(arrScriptFiles);
        }
Example #5
0
        public async Task SendAndReceiveFromAzureQueue()
        {
            var properties = new Dictionary <string, string>
            {
                { AzureQueueAdapterFactory.DataConnectionStringPropertyName, TestDefaultConfiguration.DataConnectionString },
                { AzureQueueAdapterFactory.DeploymentIdPropertyName, deploymentId }
            };
            var config = new ProviderConfiguration(properties, "type", "name");

            var adapterFactory = new AzureQueueAdapterFactory();

            adapterFactory.Init(config, AZURE_QUEUE_STREAM_PROVIDER_NAME, LogManager.GetLogger("AzureQueueAdapter", LoggerType.Application), null);
            await SendAndReceiveFromQueueAdapter(adapterFactory, config);
        }
Example #6
0
        public static string GetDbObjectQualifier()
        {
            ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration("data");
            Provider provider = (Provider)providerConfiguration.Providers[providerConfiguration.DefaultProvider];

            string objectQualifier = provider.Attributes["objectQualifier"];

            if (!string.IsNullOrEmpty(objectQualifier) && !objectQualifier.EndsWith("_"))
            {
                objectQualifier += "_";
            }

            return(objectQualifier);
        }
        private async Task <ShardedStorageProvider> ConfigureShardedStorageProvider(string name, StorageProviderManager storageProviderMgr)
        {
            var composite = new ShardedStorageProvider();
            var provider1 = (IStorageProvider)storageProviderMgr.GetProvider("Store1");
            var provider2 = (IStorageProvider)storageProviderMgr.GetProvider("Store2");
            List <IProvider> providers = new List <IProvider>();

            providers.Add(provider1);
            providers.Add(provider2);
            var cfg = new ProviderConfiguration(providerCfgProps, providers);
            await composite.Init(name, storageProviderMgr, cfg);

            return(composite);
        }
Example #8
0
        public async Task SendAndReceiveFromSQS()
        {
            var properties = new Dictionary <string, string>
            {
                { SQSAdapterFactory.DataConnectionStringPropertyName, AWSTestConstants.DefaultSQSConnectionString },
                { SQSAdapterFactory.DeploymentIdPropertyName, deploymentId }
            };
            var config = new ProviderConfiguration(properties, "type", "name");

            var adapterFactory = new SQSAdapterFactory();

            adapterFactory.Init(config, SQS_STREAM_PROVIDER_NAME, LogManager.GetLogger("SQSAdapter", LoggerType.Application), null);
            await SendAndReceiveFromQueueAdapter(adapterFactory, config);
        }
        public async Task SendAndReceiveFromAzureQueue()
        {
            var properties = new Dictionary <string, string>
            {
                { AzureQueueAdapterFactory.DATA_CONNECTION_STRING, StorageTestConstants.DataConnectionString },
                { AzureQueueAdapterFactory.DEPLOYMENT_ID, deploymentId }
            };
            var config = new ProviderConfiguration(properties, "type", "name");

            var adapterFactory = new AzureQueueAdapterFactory();

            adapterFactory.Init(config, AZURE_QUEUE_STREAM_PROVIDER_NAME, TraceLogger.GetLogger("AzureQueueAdapter", TraceLogger.LoggerType.Application), new DefaultServiceProvider());
            await SendAndReceiveFromQueueAdapter(adapterFactory, config);
        }
        public void TryUpdateIfLockIdMatch_WithOnlyUpdateAndNoDelete()
        {
            ProviderConfiguration pc = Utility.GetDefaultConfigUtility();

            using (RedisServer redisServer = new RedisServer())
            {
                RedisConnectionWrapper redisConn = GetRedisConnectionWrapperWithUniqueSession();

                // Inserting data into redis server
                ChangeTrackingSessionStateItemCollection data = new ChangeTrackingSessionStateItemCollection(new RedisUtility(pc));
                data["key1"] = "value1";
                data["key2"] = "value2";
                data["key3"] = "value3";
                redisConn.Set(data, 900);

                int      lockTimeout = 900;
                DateTime lockTime    = DateTime.Now;
                object   lockId;
                ISessionStateItemCollection dataFromRedis;
                int sessionTimeout;
                Assert.True(redisConn.TryTakeWriteLockAndGetData(lockTime, lockTimeout, out lockId, out dataFromRedis, out sessionTimeout));
                Assert.Equal(lockTime.Ticks.ToString(), lockId.ToString());
                Assert.Equal(3, dataFromRedis.Count);
                Assert.Equal("value1", dataFromRedis["key1"]);
                Assert.Equal("value2", dataFromRedis["key2"]);
                Assert.Equal("value3", dataFromRedis["key3"]);

                dataFromRedis["key2"] = "value2-updated";
                redisConn.TryUpdateAndReleaseLockIfLockIdMatch(lockId, dataFromRedis, 900);

                // Get actual connection and get data from redis
                IDatabase   actualConnection     = GetRealRedisConnection(redisConn);
                HashEntry[] sessionDataFromRedis = actualConnection.HashGetAll(redisConn.Keys.DataKey);
                Assert.Equal(3, sessionDataFromRedis.Length);
                ChangeTrackingSessionStateItemCollection sessionDataFromRedisAsCollection = new ChangeTrackingSessionStateItemCollection(new RedisUtility(pc));
                foreach (HashEntry entry in sessionDataFromRedis)
                {
                    sessionDataFromRedisAsCollection[entry.Name] = RedisUtility.GetObjectFromBytes(entry.Value).ToString();
                }
                Assert.Equal("value1", sessionDataFromRedisAsCollection["key1"]);
                Assert.Equal("value2-updated", sessionDataFromRedisAsCollection["key2"]);
                Assert.Equal("value3", sessionDataFromRedisAsCollection["key3"]);

                // check lock removed and remove data from redis
                actualConnection.KeyDelete(redisConn.Keys.DataKey);
                Assert.False(actualConnection.KeyExists(redisConn.Keys.LockKey));
                DisposeRedisConnectionWrapper(redisConn);
            }
        }
        private void BindUpgradeLogs()
        {
            ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("data");
            string strProviderPath = DataProvider.Instance().GetProviderPath();
            var    arrScriptFiles  = new ArrayList();

            string[] arrFiles = Directory.GetFiles(strProviderPath, "*." + objProviderConfiguration.DefaultProvider);
            foreach (string strFile in arrFiles)
            {
                arrScriptFiles.Add(Path.GetFileNameWithoutExtension(strFile));
            }
            arrScriptFiles.Sort();
            cboVersion.DataSource = arrScriptFiles;
            cboVersion.DataBind();
        }
Example #12
0
        public void Constructor_DatabaseIdFromConfigurationProperty()
        {
            using (RedisServer redisServer = new RedisServer())
            {
                int databaseId = 7;
                ProviderConfiguration configuration = Utility.GetDefaultConfigUtility();
                configuration.DatabaseId = databaseId;

                StackExchangeClientConnection connection = new StackExchangeClientConnection(configuration);

                Assert.Equal(databaseId, connection.RealConnection.Database);

                connection.Close();
            }
        }
Example #13
0
        public DynamoDBStorageProviderTests()
        {
            DefaultProviderRuntime = new StorageProviderManager(new GrainFactory(), null);
            ((StorageProviderManager)DefaultProviderRuntime).LoadEmptyStorageProviders(new ClientProviderRuntime(new GrainFactory(), null)).WaitWithThrow(TestConstants.InitTimeout);
            SerializationManager.InitializeForTesting();

            var properties = new Dictionary <string, string>();

            properties["DataConnectionString"] = $"Service={AWSTestConstants.Service}";
            var config   = new ProviderConfiguration(properties, null);
            var provider = new DynamoDBStorageProvider();

            provider.Init("DynamoDBStorageProviderTests", DefaultProviderRuntime, config).Wait();
            PersistenceStorageTests = new CommonStorageTests(provider);
        }
        public async Task SendAndReceiveFromAzureQueue()
        {
            var properties = new Dictionary <string, string>
            {
                { AzureQueueAdapterConstants.DataConnectionStringPropertyName, TestDefaultConfiguration.DataConnectionString },
                { AzureQueueAdapterConstants.DeploymentIdPropertyName, deploymentId },
                { AzureQueueAdapterConstants.MessageVisibilityTimeoutPropertyName, "00:00:30" }
            };
            var config = new ProviderConfiguration(properties, "type", "name");

            var adapterFactory = new AzureQueueAdapterFactory <AzureQueueDataAdapterV2>();

            adapterFactory.Init(config, AZURE_QUEUE_STREAM_PROVIDER_NAME, this.fixture.Services);
            await SendAndReceiveFromQueueAdapter(adapterFactory, config);
        }
Example #15
0
        public void Constructor_DatabaseIdFromConnectionString()
        {
            using (RedisServer redisServer = new RedisServer())
            {
                int databaseId = 3;
                ProviderConfiguration configuration = Utility.GetDefaultConfigUtility();
                configuration.ConnectionString = string.Format("localhost, defaultDatabase={0}", databaseId);

                StackExchangeClientConnection connection = new StackExchangeClientConnection(configuration);

                Assert.Equal(databaseId, connection.RealConnection.Database);

                connection.Close();
            }
        }
        public static SchedulingProvider Instance()
        {
            string strCacheKey = ProviderType + "provider";

            // --------------------------------------------------------------
            //  Use the cache because the reflection used later is expensive
            // --------------------------------------------------------------
            ConstructorInfo objConstructor = (ConstructorInfo)DataCache.GetCache(strCacheKey);

            if (objConstructor == null)
            {
                // --------------------------------------------------------------
                //  Get the name of the provider
                // --------------------------------------------------------------
                ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);

                // --------------------------------------------------------------
                //  The assembly should be in \bin or GAC, so we simply need to
                //  get an instance of the type
                // --------------------------------------------------------------
                try
                {
                    // --------------------------------------------------------------
                    //  Get the typename of the LoggingProvider from web.config
                    // --------------------------------------------------------------
                    string strTypeName = ((Provider)objProviderConfiguration.Providers[objProviderConfiguration.DefaultProvider]).Type;

                    // --------------------------------------------------------------
                    //  Use reflection to store the constructor of the class that implements LoggingProvider
                    // --------------------------------------------------------------
                    Type t = Type.GetType(strTypeName, true);
                    objConstructor = t.GetConstructor(System.Type.EmptyTypes);

                    // --------------------------------------------------------------
                    //  Insert the type into the cache
                    // --------------------------------------------------------------
                    //DataCache.SetCache(strCacheKey, objConstructor);
                }
                catch
                {
                    // --------------------------------------------------------------
                    //  Could not load the provider - this is likely due to binary compatibility issues
                    // --------------------------------------------------------------
                }
            }

            return((SchedulingProvider)objConstructor.Invoke(null));
        }
Example #17
0
        public void InstallComponents(IContainer container)
        {
            ProviderConfiguration config = ProviderConfiguration.GetProviderConfiguration(_ProviderType);

            if (config != null)
            {
                InstallProvider(container, (Provider)config.Providers[config.DefaultProvider]);
                foreach (Provider provider in config.Providers.Values)
                {
                    if (!config.DefaultProvider.Equals(provider.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        InstallProvider(container, provider);
                    }
                }
            }
        }
Example #18
0
        private static ConfigurationOptions GetConfigurationOptions(ProviderConfiguration configuration)
        {
            if (string.IsNullOrEmpty(configuration.ConnectionString))
            {
                throw new ArgumentException("Connection string cannot be null or empty", nameof(configuration));
            }

            var configOption = ConfigurationOptions.Parse(configuration.ConnectionString);

            // Setting explicitly 'abortconnect' to false. It will overwrite customer provided value for 'abortconnect'
            // As it doesn't make sense to allow to customer to set it to true as we don't give them access to ConnectionMultiplexer
            // in case of failure customer can not create ConnectionMultiplexer so right choice is to automatically create it by providing AbortOnConnectFail = false
            configOption.AbortOnConnectFail = false;

            return(configOption);
        }
Example #19
0
        public void Config_StorageProvider_Azure1()
        {
            const string filename      = "Config_StorageProvider_Azure1.xml";
            const int    numProviders  = 1;
            var          orleansConfig = new ClusterConfiguration();

            orleansConfig.LoadFromFile(filename);
            var providerConfigs = orleansConfig.Globals.ProviderConfigurations["Storage"];

            ValidateProviderConfigs(providerConfigs, numProviders);

            ProviderConfiguration pCfg = (ProviderConfiguration)providerConfigs.Providers.Values.ToList()[0];

            Assert.Equal("orleanstest1", pCfg.Name); // Provider name #1
            Assert.Equal("AzureTable", pCfg.Type);   // Provider type #1
        }
        private static void SetupCustomConfigProviders(
            IDictionary <string, IAuthenticationProvider> authenticationProviders,
            IList <Type> discoveredProviders,
            ProviderConfiguration providerConfig)
        {
            authenticationProviders.ThrowIfNull("authenticationProviders");
            discoveredProviders.ThrowIfNull("discoveredProviders");
            providerConfig.ThrowIfNull("providerConfig");
            providerConfig.Providers.ThrowIfNull("providerConfig.Providers");

            foreach (ProviderKey provider in providerConfig.Providers)
            {
                var discoveredProvider = DiscoverProvider(discoveredProviders, provider);

                AddProviderToDictionary(authenticationProviders, discoveredProvider, false);
            }
        }
        /// <summary>
        /// Reads the associated configuration for the database instance and sets it up if
        /// it is a localdb instance requiring initialization.
        /// </summary>
        public void InitialiseDatabaseServer()
        {
            ProviderConfiguration config =
                (ProviderConfiguration)ConfigurationManager.GetSection("dbTestMonkey/" + ConfigurationSectionName);

            if (config.IsLocalDbInstance)
            {
                SetupLocalDbInstance(config);
            }
            else
            {
                // SQL Server instance must already be set up.
                LogAction("Configured SQL Server instance is not LocalDB. Assuming user has already created and started the instance.");

                return;
            }
        }
 internal static ProviderConfiguration GetDefaultConfigUtility()
 {
     ProviderConfiguration configuration = new ProviderConfiguration();
     configuration.SessionTimeout = new TimeSpan(0, 15, 0); //15 min
     configuration.RequestTimeout = new TimeSpan(0, 1, 30); //1.5 min
     configuration.Host = "127.0.0.1";
     configuration.Port = 0;
     configuration.AccessKey = null;
     configuration.UseSsl = false;
     configuration.DatabaseId = 0;
     configuration.ApplicationName = null;
     configuration.ConnectionTimeoutInMilliSec = 5000;
     configuration.OperationTimeoutInMilliSec = 1000;
     configuration.RetryTimeout = TimeSpan.Zero;
     configuration.ThrowOnError = true;
     return configuration;
 }
Example #23
0
        /// <summary>
        /// Recupera os dados das colunas da tabela.
        /// </summary>
        /// <param name="map">Tabela</param>
        private void GetColumnData(TableMap map)
        {
            IDbConnection conn = ProviderConfiguration.CreateConnection();
            IDbCommand    cmd  = conn.CreateCommand();

            cmd.Connection = conn;
            string sql = String.Format(@"SELECT Column_Name AS Field, Column_Type AS Type, 
                                                Is_Nullable, Column_Key, Column_Default, Extra, Column_Comment 
                                                FROM Information_Schema.Columns 
                                                WHERE Table_Schema='{0}' AND Table_Name='{1}';", conn.Database, map.TableName);

            cmd.CommandText = sql;
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            try
            {
                IDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    string   columnName = dr["Field"].ToString();
                    FieldMap fm         = map.GetFieldMapFromColumn(columnName);
                    if (fm == null)
                    {
                        fm = new FieldMap(map, columnName);
                        map.Fields.Add(fm);
                    }
                    string typeinfo = dr["Type"].ToString();
                    bool   isUnsigned;
                    fm.SetDbType(ExtractType(typeinfo, out isUnsigned), isUnsigned);
                    fm.Size         = ExtractSize(typeinfo);
                    fm.IsNullable   = (dr["Is_Nullable"].ToString() == "YES");
                    fm.IsPrimaryKey = (dr["Column_Key"].ToString() == "PRI");
                    if (fm.IsPrimaryKey)
                    {
                        fm.IsAutoGenerated = (dr["Extra"].ToString() == "auto_increment");
                    }
                    fm.Comment = dr.GetString(dr.GetOrdinal("Column_Comment"));
                }
            }
            finally
            {
                conn.Close();
            }
        }
Example #24
0
        public static IDbConnection GetConnection()
        {
            const string          providerType          = "data";
            ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration(providerType);

            var    objProvider = ((Provider)providerConfiguration.Providers[providerConfiguration.DefaultProvider]);
            string connectionString;

            connectionString = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;

            IDbConnection newConnection = new System.Data.SqlClient.SqlConnection {
                ConnectionString = connectionString
            };

            newConnection.Open();
            return(newConnection);
        }
        private string GetFullyQualifiedName(string name)
        {
            ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);
            Provider objProvider = (Provider)providerConfiguration.Providers[providerConfiguration.DefaultProvider];

            objectQualifier = objProvider.Attributes["objectQualifier"];
            if (!String.IsNullOrEmpty(objectQualifier) && objectQualifier.EndsWith("_") == false)
            {
                objectQualifier += "_";
            }
            databaseOwner = objProvider.Attributes["databaseOwner"];
            if (!String.IsNullOrEmpty(databaseOwner) && databaseOwner.EndsWith(".") == false)
            {
                databaseOwner += ".";
            }
            return(databaseOwner + objectQualifier + name);
        }
        /// <summary>
        /// Instances this instance.
        /// </summary>
        /// <returns></returns>
        public static LogProvider Instance()
        {
            // Use the cache because the reflection used later is expensive
            Cache  cache = HttpRuntime.Cache;
            string cacheKey;

            // Get the names of providers
            ProviderConfiguration config;

            config = ProviderConfiguration.GetProviderConfiguration(providerType);

            //If config not found (missing web.config)
            if (config == null)
            {
                //Try to provide a default anyway
                XmlDocument defaultNode = new XmlDocument();
                defaultNode.LoadXml(
                    "<log defaultProvider=\"Log4NetLog\"><providers><clear /><add name=\"Log4NetLog\" type=\"Rainbow.Framework.Logging.Log4NetLogProvider, Rainbow.Provider.Implementation\" /></providers></log>");

                // Get the names of providers
                config = new ProviderConfiguration();
                config.LoadValuesFromConfigurationXml(defaultNode.DocumentElement);
            }

            // Read specific configuration information for this provider
            ProviderSettings providerSettings = (ProviderSettings)config.Providers[config.DefaultProvider];

            // In the cache?
            cacheKey = "Rainbow::Configuration::Log::" + config.DefaultProvider;
            if (cache[cacheKey] == null)
            {
                // The assembly should be in \bin or GAC, so we simply need
                // to get an instance of the type
                try
                {
                    cache.Insert(cacheKey, ProviderHelper.InstantiateProvider(providerSettings, typeof(LogProvider)));
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to load provider", e);
                }
            }

            return((LogProvider)cache[cacheKey]);
        }
Example #27
0
 /// <summary>
 /// Recupera as informações sobre a chave identidade da tabela.
 /// </summary>
 /// <param name="map"></param>
 protected void GetIdentityInformation(TableMap map)
 {
     if (map != null)
     {
         IDbConnection conn = ProviderConfiguration.CreateConnection();
         GDAConnectionManager.NotifyConnectionCreated(conn);
         IDbCommand cmd = conn.CreateCommand();
         cmd.Connection = conn;
         if (conn.State != ConnectionState.Open)
         {
             conn.Open();
             GDAConnectionManager.NotifyConnectionOpened(conn);
         }
         try
         {
             foreach (FieldMap fm in map.Fields)
             {
                 if (fm.IsPrimaryKey)
                 {
                     if (!map.IsView)
                     {
                         cmd.CommandText = String.Format("select COLUMNPROPERTY(OBJECT_ID('{0}'), '{1}', 'IsIdentity') as IsIdentity ", map.TableName, fm.ColumnName);
                         using (IDataReader reader = cmd.ExecuteReader())
                         {
                             if (reader.Read())
                             {
                                 fm.IsAutoGenerated = (reader["IsIdentity"].ToString() == "1");
                             }
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             GDAOperations.CallDebugTrace(this, String.Format("Unable to determine whether PK column of table {0} is an identity column.", map.TableName));
             GDAOperations.CallDebugTrace(this, ex.Message);
         }
         finally
         {
             conn.Close();
             conn.Dispose();
         }
     }
 }
        public DynamoDBStorageProviderTests(TestEnvironmentFixture fixture)
        {
            if (!AWSTestConstants.IsDynamoDbAvailable)
            {
                throw new SkipException("Unable to connect to DynamoDB simulator");
            }

            DefaultProviderRuntime = new ClientProviderRuntime(fixture.InternalGrainFactory, fixture.Services, NullLoggerFactory.Instance);

            var properties = new Dictionary <string, string>();

            properties["DataConnectionString"] = $"Service={AWSTestConstants.Service}";
            var config   = new ProviderConfiguration(properties);
            var provider = new DynamoDBStorageProvider();

            provider.Init("DynamoDBStorageProviderTests", DefaultProviderRuntime, config).Wait();
            PersistenceStorageTests = new CommonStorageTests(fixture.InternalGrainFactory, provider);
        }
Example #29
0
        internal static ProviderConfiguration GetDefaultConfigUtility()
        {
            ProviderConfiguration configuration = new ProviderConfiguration();

            configuration.SessionTimeout              = new TimeSpan(0, 15, 0); //15 min
            configuration.RequestTimeout              = new TimeSpan(0, 1, 30); //1.5 min
            configuration.Host                        = "127.0.0.1";
            configuration.Port                        = 0;
            configuration.AccessKey                   = null;
            configuration.UseSsl                      = false;
            configuration.DatabaseId                  = 0;
            configuration.ApplicationName             = null;
            configuration.ConnectionTimeoutInMilliSec = 5000;
            configuration.OperationTimeoutInMilliSec  = 1000;
            configuration.RetryTimeout                = TimeSpan.Zero;
            configuration.ThrowOnError                = true;
            return(configuration);
        }
        private static CollectorCSPConfiguration CollectorInternalToMessage(EventTracingDataContract.CollectorInner collector)
        {
            Logger.Log("Reading collector CSP desired configuration...", LoggingLevel.Information);

            CollectorCSPConfiguration cspConfiguration = new CollectorCSPConfiguration();

            cspConfiguration.LogFileFolder      = collector.logFileFolder;
            cspConfiguration.LogFileName        = collector.logFileName;
            cspConfiguration.LogFileSizeLimitMB = collector.logFileSizeLimitMB;
            cspConfiguration.TraceLogFileMode   = EventTracingDataContract.TraceModeToJsonString(collector.traceMode);
            cspConfiguration.Started            = collector.started;
            foreach (EventTracingDataContract.Provider provider in collector.providers)
            {
                ProviderConfiguration msgProvider = ProviderToMessage(provider);
                cspConfiguration.Providers.Add(msgProvider);
            }
            return(cspConfiguration);
        }
Example #31
0
        /// <summary>
        /// 获取平台配置
        /// </summary>
        /// <param name="configKey">配置名</param>
        /// <returns></returns>
        public static ProviderConfiguration Configuration(string configKey)
        {
            var path = AppDataPath(String.Format("WebADNuke\\{0}.config", configKey));

            if (System.IO.File.Exists(path))
            {
                return(ProviderConfiguration.GetProvider(path));
            }
            else
            {
                path = AppDataPath(String.Format("WebADNuke\\{0}.xml", configKey));
                if (System.IO.File.Exists(path))
                {
                    return(ProviderConfiguration.GetProvider(path));
                }
            }
            return(null);
        }
Example #32
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// BindData fetches the data from the database and updates the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindConfiguration()
        {
            lblProduct.Text = DotNetNukeContext.Current.Application.Description;
            lblVersion.Text = Globals.FormatVersion(DotNetNukeContext.Current.Application.Version, true);

            betaRow.Visible       = (DotNetNukeContext.Current.Application.Status != ReleaseMode.Stable);
            chkBetaNotice.Checked = Entities.Host.Host.DisplayBetaNotice;

            chkUpgrade.Checked  = Entities.Host.Host.CheckUpgrade;
            hypUpgrade.ImageUrl = Upgrade.UpgradeIndicator(DotNetNukeContext.Current.Application.Version, Request.IsLocal, Request.IsSecureConnection);
            if (String.IsNullOrEmpty(hypUpgrade.ImageUrl))
            {
                hypUpgrade.Visible = false;
            }
            else
            {
                hypUpgrade.NavigateUrl = Upgrade.UpgradeRedirect();
            }
            lblDataProvider.Text = ProviderConfiguration.GetProviderConfiguration("data").DefaultProvider;
            lblFramework.Text    = Globals.NETFrameworkVersion.ToString(2);

            if (!Upgrade.IsNETFrameworkCurrent("3.5"))
            {
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("FrameworkDownLevel", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
            }
            if (WindowsIdentity.GetCurrent() != null)
            {
                // ReSharper disable PossibleNullReferenceException
                lblIdentity.Text = WindowsIdentity.GetCurrent().Name;
                // ReSharper restore PossibleNullReferenceException
            }
            lblHostName.Text    = Dns.GetHostName();
            lblIPAddress.Text   = Dns.GetHostEntry(lblHostName.Text).AddressList[0].ToString();
            lblPermissions.Text = SecurityPolicy.Permissions;
            if (string.IsNullOrEmpty(lblPermissions.Text))
            {
                lblPermissions.Text = Localization.GetString("None", LocalResourceFile);
            }
            lblApplicationPath.Text    = string.IsNullOrEmpty(Globals.ApplicationPath) ? "/" : Globals.ApplicationPath;
            lblApplicationMapPath.Text = Globals.ApplicationMapPath;
            lblServerTime.Text         = DateTime.Now.ToString();
            lblGUID.Text       = Entities.Host.Host.GUID;
            chkWebFarm.Checked = CachingProvider.Instance().IsWebFarm();
        }
Example #33
0
        public void ClientConfig_SqlServer_StatsProvider()
        {
            const string filename = "DevTestClientConfiguration.xml";

            ClientConfiguration config = ClientConfiguration.LoadFromFile(filename);

            output.WriteLine(config);

            Assert.Equal(1, config.ProviderConfigurations.Count);                   // Number of Providers Types
            Assert.Equal("Statistics", config.ProviderConfigurations.Keys.First()); // Client Stats Providers
            ProviderCategoryConfiguration statsProviders = config.ProviderConfigurations["Statistics"];

            Assert.Equal(1, statsProviders.Providers.Count);            // Number of Stats Providers
            Assert.Equal("SQL", statsProviders.Providers.Keys.First()); // Stats provider name
            ProviderConfiguration providerConfig = (ProviderConfiguration)statsProviders.Providers["SQL"];

            // Note: Use string here instead of typeof(SqlStatisticsPublisher).FullName to prevent cascade load of this type
            Assert.Equal("Orleans.Providers.SqlServer.SqlStatisticsPublisher", providerConfig.Type); // Stats provider class name
        }