Exemplo n.º 1
0
 public MessageProducer(IOptions <ConfigRabbitMQ> config, IConnectionHelper connectionFactory, ISerializationManager serialization)
 {
     _config        = config.Value;
     _connection    = connectionFactory.CreateConnection(_config);
     _model         = _connection.CreateModel();
     _serialization = serialization;
 }
 public void Connect(IConnectionHelper connectionHelper, string userAgent, int connectionTimeout, int readTimeout, PURLConnection purlConnection)
 {
     if (purlConnection.PURL.IsFile)
     {
         FileAttributes attributes = ((FileInfo)purlConnection.File).Attributes;
         if (attributes.HasFlag(FileAttributes.Directory))
         {
             connectionHelper.HandleFileDirectory(purlConnection.File);
         }
         else
         {
             string suffix = purlConnection.PURL.Suffix;
             if (suffix != null)
             {
                 if (connectionHelper.ParseFilesWithSuffix(suffix))
                 {
                     try
                     {
                         purlConnection.FileConnect();
                     }
                     catch (FileNotFoundException e)
                     {
                         Debug.WriteLine("ERROR: Can't open because FileNotFoundException");
                     }
                 }
             }
         }
     }
     else
     {
         purlConnection.NetworkConnectAndCatch(connectionHelper, userAgent, connectionTimeout, readTimeout);
     }
 }
 public void Connect(IConnectionHelper connectionHelper, string userAgent, int connectionTimeout, int readTimeout, PURLConnection purlConnection)
 {
     if (purlConnection.PURL.IsFile)
     {
         FileAttributes attributes = ((FileInfo) purlConnection.File).Attributes;
         if (attributes.HasFlag(FileAttributes.Directory))
         {
             connectionHelper.HandleFileDirectory(purlConnection.File);
         }
         else
         {
             string suffix = purlConnection.PURL.Suffix;
             if (suffix != null)
             {
                 if (connectionHelper.ParseFilesWithSuffix(suffix))
                 {
                     try
                     {
                         purlConnection.FileConnect();
                     }
                     catch (FileNotFoundException e)
                     {
                         Debug.WriteLine("ERROR: Can't open because FileNotFoundException");
                     }
                 }
             }
         }
     }
     else
     {
         purlConnection.NetworkConnectAndCatch(connectionHelper, userAgent, connectionTimeout, readTimeout);
     }
 }
Exemplo n.º 4
0
 public Newhouse591Repository(HttpClient httpClient,
                              IWebsiteUrlHelper websiteUrlHelper,
                              IConnectionHelper connectionHelper)
     : base(httpClient, websiteUrlHelper)
 {
     this._connectionHelper = connectionHelper;
 }
Exemplo n.º 5
0
 public SchemaUpdate(Configuration cfg, Settings settings)
 {
     configuration    = cfg;
     dialect          = settings.Dialect;
     connectionHelper = new SuppliedConnectionProviderConnectionHelper(settings.ConnectionProvider);
     exceptions       = new List <Exception>();
     formatter        = (settings.SqlStatementLogger.FormatSql ? FormatStyle.Ddl : FormatStyle.None).Formatter;
 }
		public SchemaUpdate(Configuration cfg, Settings settings)
		{
			configuration = cfg;
			dialect = settings.Dialect;
			connectionHelper = new SuppliedConnectionProviderConnectionHelper(settings.ConnectionProvider);
			exceptions = new List<Exception>();
			formatter = (settings.SqlStatementLogger.FormatSql ? FormatStyle.Ddl : FormatStyle.None).Formatter;
		}
Exemplo n.º 7
0
        public void MyTestInitialize()
        {
            _projectName = "Test";
            _credentials = new V1UserCredentials("Test", "Test");

            _mockServiceConnection = MockRepository.Mock <IServices>();
            _mockConnectionHelper  = MockRepository.Mock <IConnectionHelper>();
            _mockAssetType         = MockRepository.Mock <IAssetType>();
        }
Exemplo n.º 8
0
 public SchemaChangeValidator(Configuration cfg, IDictionary<string, string> connectionProperties)
 {
     this._configuration = cfg;
     this._dialect = Dialect.GetDialect(connectionProperties);
     var cfgProperties = new Dictionary<string, string>(this._dialect.DefaultProperties);
     foreach (var keyValuePair in connectionProperties)
         cfgProperties[keyValuePair.Key] = keyValuePair.Value;
     this._connectionHelper = new ManagedProviderConnectionHelper(cfgProperties);
 }
        public void GetADOWorkItemTrackingHttpClientNullUriThrowsExceptionTest()
        {
            // Arrange
            ConfigHelper.ADOUrl = null;
            _connectionHelper   = new ConnectionHelper();

            // Act & Assert
            var response = _connectionHelper.GetADOWorkItemTrackingHttpClient();
        }
Exemplo n.º 10
0
		public SchemaUpdate(Configuration cfg, Settings settings)
		{
			configuration = cfg;
			dialect = settings.Dialect;
			connectionHelper = new SuppliedConnectionProviderConnectionHelper(
				settings.ConnectionProvider
				);
			exceptions = new ArrayList();
		}
Exemplo n.º 11
0
        public void GetADOProjectClientEmptyUriThrowsExceptionTest()
        {
            // Arrange
            ConfigHelper.ADOUrl = string.Empty;
            _connectionHelper   = new ConnectionHelper();

            // Act & Assert
            var response = _connectionHelper.GetADOProjectClient();
        }
        public Mp3ViewModel(IConnectionHelper connectionHelper, ICursorControl cursor, IConverter converter, IFileHelper fileHelper)
        {
            this._connectionHelper = connectionHelper;
            this._cursor           = cursor;
            this._converter        = converter;
            this._fileHelper       = fileHelper;

            Initialize();
        }
        public NavigationViewModel(IConnectionHelper connectionHelper, ICursorControl cursor, IConverter converter, IFileHelper fileHelper)
        {
            this._connectionHelper = connectionHelper;
            this._cursor           = cursor;
            this._converter        = converter;
            this._fileHelper       = fileHelper;

            SelectedViewModel  = Mp3ViewModelInstance;
            Mp3BackgroundColor = (SolidColorBrush)Application.Current.Resources["DockPanel.Background.Selected"];
        }
Exemplo n.º 14
0
		public SchemaValidator(Configuration cfg, IDictionary<string, string> connectionProperties)
		{
			configuration = cfg;
			dialect = Dialect.Dialect.GetDialect(connectionProperties);
			IDictionary<string, string> props = new Dictionary<string, string>(dialect.DefaultProperties);
			foreach (var prop in connectionProperties)
			{
				props[prop.Key] = prop.Value;
			}
			connectionHelper = new ManagedProviderConnectionHelper(props);
		}
Exemplo n.º 15
0
        public MyPlexConnection(IConnectionHelper connectionHelper)
        {
            _connectionHelper = connectionHelper;
            _devices          = new ObservableCollectionEx <Device>();
            _servers          = new ObservableCollectionEx <Device>();
            _players          = new ObservableCollectionEx <Device>();

            Devices = new ReadOnlyObservableCollection <Device>(_devices);
            Servers = new ReadOnlyObservableCollection <Device>(_servers);
            Players = new ReadOnlyObservableCollection <Device>(_players);
        }
Exemplo n.º 16
0
 public MessageConsumer(
     IOptions <ConfigRabbitMQ> config,
     IConnectionHelper connectionFactory,
     ISerializationManager serialization,
     ILogger <MessageConsumer> logger
     )
 {
     _config        = config.Value;
     _connection    = connectionFactory.CreateConnection(_config);
     _serialization = serialization;
     _logger        = logger;
 }
Exemplo n.º 17
0
        public SchemaValidator(Configuration cfg, IDictionary <string, string> connectionProperties)
        {
            configuration = cfg;
            dialect       = Dialect.Dialect.GetDialect(connectionProperties);
            IDictionary <string, string> props = new Dictionary <string, string>(dialect.DefaultProperties);

            foreach (var prop in connectionProperties)
            {
                props[prop.Key] = prop.Value;
            }
            connectionHelper = new ManagedProviderConnectionHelper(props);
        }
Exemplo n.º 18
0
		public SchemaUpdate(Configuration cfg, IDictionary<string, string> connectionProperties)
		{
			configuration = cfg;
			dialect = NHibernate.Dialect.Dialect.GetDialect(connectionProperties);
			Dictionary<string, string> props = new Dictionary<string, string>(dialect.DefaultProperties);
			foreach (KeyValuePair<string, string> prop in connectionProperties)
			{
				props[prop.Key] = prop.Value;
			}
			connectionHelper = new ManagedProviderConnectionHelper(props);
			exceptions = new ArrayList();
		}
Exemplo n.º 19
0
        public SchemaChangeValidator(Configuration cfg, IDictionary <string, string> connectionProperties)
        {
            this._configuration = cfg;
            this._dialect       = Dialect.GetDialect(connectionProperties);
            var cfgProperties = new Dictionary <string, string>(this._dialect.DefaultProperties);

            foreach (var keyValuePair in connectionProperties)
            {
                cfgProperties[keyValuePair.Key] = keyValuePair.Value;
            }
            this._connectionHelper = new ManagedProviderConnectionHelper(cfgProperties);
        }
Exemplo n.º 20
0
        public void GetADOProjectClientReturnsResponseTests()
        {
            // Arrange
            ConfigHelper.ADOUrl   = ConfigHelper.GetAppSetting("ADOUrl");
            ConfigHelper.ADOToken = ConfigHelper.GetAppSetting("ADOToken");
            _connectionHelper     = new ConnectionHelper();

            // Act
            var response = _connectionHelper.GetADOProjectClient();

            // Assert
            Assert.IsNotNull(response);
        }
Exemplo n.º 21
0
        public SqlCharacterRepositoryTests()
        {
            // mock
            _testRelationDatabaseHelper = TestHook.GetTestRelationDatabaseHelper();
            _database         = "character";
            _table            = "character";
            _connectionHelper = Substitute.For <IConnectionHelper>();
            _connectionHelper.Character.
            Returns(new SqlConnection(_testRelationDatabaseHelper.GetConnectionString(_database)));

            _testRelationDatabaseHelper.CreateDatabase(this._database);
            _testRelationDatabaseHelper.CreateTable(_database, _table);
        }
		public SchemaUpdate(Configuration cfg, IDictionary<string, string> configProperties)
		{
			configuration = cfg;
			dialect = Dialect.Dialect.GetDialect(configProperties);
			var props = new Dictionary<string, string>(dialect.DefaultProperties);
			foreach (var prop in configProperties)
			{
				props[prop.Key] = prop.Value;
			}
			connectionHelper = new ManagedProviderConnectionHelper(props);
			exceptions = new List<Exception>();
			formatter = (PropertiesHelper.GetBoolean(Environment.FormatSql, configProperties, true) ? FormatStyle.Ddl : FormatStyle.None).Formatter;
		}
        public void GetADOWorkItemTrackingHttpClientEmptyTokenReturnsResponseTest()
        {
            // Arrange
            ConfigHelper.ADOUrl   = ConfigHelper.GetAppSetting("ADOUrl");
            ConfigHelper.ADOToken = string.Empty;
            _connectionHelper     = new ConnectionHelper();

            // Act
            var response = _connectionHelper.GetADOWorkItemTrackingHttpClient();

            // Assert
            Assert.IsNotNull(response);
        }
 static IEnumerable <string> GetReservedWords(Dialect.Dialect dialect, IConnectionHelper connectionHelper)
 {
     connectionHelper.Prepare();
     try
     {
         var metaData = dialect.GetDataBaseSchema(connectionHelper.Connection);
         return(metaData.GetReservedWords());
     }
     finally
     {
         connectionHelper.Release();
     }
 }
Exemplo n.º 25
0
        public SchemaUpdate(Configuration cfg, IDictionary <string, string> configProperties)
        {
            configuration = cfg;
            dialect       = Dialect.Dialect.GetDialect(configProperties);
            var props = new Dictionary <string, string>(dialect.DefaultProperties);

            foreach (var prop in configProperties)
            {
                props[prop.Key] = prop.Value;
            }
            connectionHelper = new ManagedProviderConnectionHelper(props);
            exceptions       = new List <Exception>();
            formatter        = (PropertiesHelper.GetBoolean(Environment.FormatSql, configProperties, true) ? FormatStyle.Ddl : FormatStyle.None).Formatter;
        }
Exemplo n.º 26
0
        public void GetV1ConnectionReturnNoConnectionWithInvalidCredentials()
        {
            // Arrange
            _connectionHelper = new ConnectionHelper(new V1UserCredentials("Test", "Test"));

            // Act
            var response = _connectionHelper.GetV1Connection();

            // Assert
            Assert.IsNotNull(response);
            Assert.IsFalse(response.IsValid);
            Assert.AreEqual(response.ErrorMessage, "Unauthorized");
            Assert.IsNull(response.Connection);
        }
Exemplo n.º 27
0
        public void GetV1ConnectionReturnNoConnectionWithEmptyCredentials()
        {
            // Arrange
            _connectionHelper = new ConnectionHelper(new V1UserCredentials(string.Empty, string.Empty));

            // Act
            var response = _connectionHelper.GetV1Connection();

            // Assert
            Assert.IsNotNull(response);
            Assert.IsFalse(response.IsValid);
            Assert.AreEqual(response.ErrorMessage, "Invalid Username/Password.");
            Assert.IsNull(response.Connection);
        }
		private static Iesi.Collections.Generic.ISet<string> GetReservedWords(Dialect.Dialect dialect, IConnectionHelper connectionHelper)
		{
			Iesi.Collections.Generic.ISet<string> reservedDb = new HashedSet<string>();
			connectionHelper.Prepare();
			try
			{
				var metaData = dialect.GetDataBaseSchema(connectionHelper.Connection);
				foreach (var rw in metaData.GetReservedWords())
				{
					reservedDb.Add(rw.ToLowerInvariant());
				}
			}
			finally
			{
				connectionHelper.Release();
			}
			return reservedDb;
		}
Exemplo n.º 29
0
        private static ISet <string> GetReservedWords(Dialect.Dialect dialect, IConnectionHelper connectionHelper)
        {
            ISet <string> reservedDb = new HashedSet <string>();

            connectionHelper.Prepare();
            try
            {
                var metaData = dialect.GetDataBaseSchema(connectionHelper.Connection);
                foreach (var rw in metaData.GetReservedWords())
                {
                    reservedDb.Add(rw.ToLowerInvariant());
                }
            }
            finally
            {
                connectionHelper.Release();
            }
            return(reservedDb);
        }
Exemplo n.º 30
0
 public void NetworkConnectAndCatch(IConnectionHelper connectionHelper, String userAgent,
                                    int connectionTimeout = ParsedUri.CONNECT_TIMEOUT,
                                    int readTimeout       = ParsedUri.READ_TIMEOUT)
 {
     NetworkConnect(connectionHelper, userAgent, connectionTimeout, readTimeout);
     try
     {
         NetworkConnect(connectionHelper, userAgent, connectionTimeout, readTimeout);
     }
     catch (WebException e)
     {
         Timeout = true;
         CleanUp(e);
     }
     catch (Exception e) // catch all exceptions, including security
     {
         CleanUp(e);
     }
 }
Exemplo n.º 31
0
        public void GetV1ConnectionReturnConnectionSuccess()
        {
            // Arrange
            _connectionHelper = new ConnectionHelper(new V1UserCredentials("yourUsername", "yourPassowrd"));
            IServices _mockServiceConnection = MockRepository.Mock <IServices>();

            IAssetType _mockAssetType = MockRepository.Mock <IAssetType>();
            Oid        oid            = new Oid(_mockAssetType, 1, null);

            _mockServiceConnection.Expect(x => x.LoggedIn).Return(oid);
            _mockServiceConnection.Expect(x => x.Meta.GetAssetType(null)).IgnoreArguments().Return(_mockAssetType);
            // Act
            var response = _connectionHelper.GetV1Connection();

            // Assert
            Assert.IsNotNull(response);
            Assert.IsTrue(response.IsValid);
            Assert.AreEqual(response.ErrorMessage, string.Empty);
            Assert.IsNotNull(response.Connection);
            _mockAssetType.VerifyAllExpectations();
            _mockServiceConnection.VerifyAllExpectations();
        }
Exemplo n.º 32
0
 private PlexServerConnection(IConnectionHelper connectionHelper)
 {
     _connectionHelper = connectionHelper;
     NowPlaying        = new ReadOnlyObservableCollection <Video>(_nowPlaying);
     Clients           = new ReadOnlyObservableCollection <Server>(_clients);
 }
Exemplo n.º 33
0
 public DataAccess(ILogWriter log, IConfigFields config, IConnectionHelper connectionHelper)
 {
     _log              = log;
     _config           = config;
     _connectionHelper = connectionHelper;
 }
 public CustomerRepository(IConnectionHelper iConnectionHelper)
 {
     this._iConnectionHelper = iConnectionHelper;
 }
Exemplo n.º 35
0
 public void Connect(IConnectionHelper connectionHelper, String userAgent,
     int connectionTimeout, int readTimeout)
 {
     // get an InputStream, and set the mimeType, if not bad
     FundamentalPlatformSpecifics.Get().Connect(connectionHelper, userAgent, connectionTimeout, readTimeout, this);
 }
Exemplo n.º 36
0
 public void NetworkConnectAndCatch(IConnectionHelper connectionHelper, String userAgent,
     int connectionTimeout = ParsedUri.CONNECT_TIMEOUT,
     int readTimeout = ParsedUri.READ_TIMEOUT)
 {
     NetworkConnect(connectionHelper, userAgent, connectionTimeout, readTimeout);
     try
     {
         NetworkConnect(connectionHelper, userAgent, connectionTimeout, readTimeout);
     }
     catch (WebException e)
     {
         Timeout = true;
         CleanUp(e);
     }
     catch (Exception e) // catch all exceptions, including security
     {
         CleanUp(e);
     }
 }
Exemplo n.º 37
0
 public void Connect(IConnectionHelper connectionHelper, String userAgent,
                     int connectionTimeout, int readTimeout)
 {
     // get an InputStream, and set the mimeType, if not bad
     FundamentalPlatformSpecifics.Get().Connect(connectionHelper, userAgent, connectionTimeout, readTimeout, this);
 }
 static async Task <IEnumerable <string> > GetReservedWordsAsync(Dialect.Dialect dialect, IConnectionHelper connectionHelper, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     await(connectionHelper.PrepareAsync(cancellationToken)).ConfigureAwait(false);
     try
     {
         var metaData = dialect.GetDataBaseSchema(connectionHelper.Connection);
         return(metaData.GetReservedWords());
     }
     finally
     {
         connectionHelper.Release();
     }
 }
 static async Task UpdateDialectKeywordsAsync(Dialect.Dialect dialect, IConnectionHelper connectionHelper, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     dialect.RegisterKeywords(await(GetReservedWordsAsync(dialect, connectionHelper, cancellationToken)).ConfigureAwait(false));
 }
 static void UpdateDialectKeywords(Dialect.Dialect dialect, IConnectionHelper connectionHelper)
 {
     dialect.RegisterKeywords(GetReservedWords(dialect, connectionHelper));
 }
Exemplo n.º 41
0
		public SchemaValidator(Configuration cfg, Settings settings)
		{
			configuration = cfg;
			dialect = settings.Dialect;
			connectionHelper = new SuppliedConnectionProviderConnectionHelper(settings.ConnectionProvider);
		}