public RabbitMqModelCache(IConnectionCache connectionCache, ITaskSupervisor supervisor, ModelSettings modelSettings)
        {
            _connectionCache = connectionCache;
            _modelSettings = modelSettings;

            _cacheTaskScope = supervisor.CreateScope($"{TypeMetadataCache<RabbitMqModelCache>.ShortName}", CloseScope);
        }
示例#2
0
        public RabbitMqModelCache(IConnectionCache connectionCache, ITaskSupervisor supervisor, ModelSettings modelSettings)
        {
            _connectionCache = connectionCache;
            _modelSettings   = modelSettings;

            _cacheTaskScope = supervisor.CreateScope($"{TypeMetadataCache<RabbitMqModelCache>.ShortName}", CloseScope);
        }
        public void Init()
        {
            _session    = Isolate.Fake.Instance <HttpSessionStateBase>();
            _connection = Isolate.Fake.Instance <IDbConnection>();
            _cache      = new HttpSessionStateCache(_session);

            Isolate.WhenCalled(() => _session[HttpSessionStateCache.ConnectionSetting] = null).ReturnRecursiveFake();
        }
        public void Init()
        {
            _session = Isolate.Fake.Instance<HttpSessionStateBase>();
            _connection = Isolate.Fake.Instance<IDbConnection>();
            _cache = new HttpSessionStateCache(_session);

            Isolate.WhenCalled(() => _session[HttpSessionStateCache.ConnectionSetting] = null).ReturnRecursiveFake();
        }
示例#5
0
 public RabbitMqReceiveTransport(IConnectionCache connectionCache, ReceiveSettings settings,
                                 params ExchangeBindingSettings[] exchangeBindings)
 {
     _connectionCache   = connectionCache;
     _settings          = settings;
     _exchangeBindings  = exchangeBindings;
     _receiveObservers  = new ReceiveObservable();
     _endpointObservers = new ReceiveEndpointObservable();
 }
 public RabbitMqReceiveTransport(IConnectionCache connectionCache, ReceiveSettings settings,
     params ExchangeBindingSettings[] exchangeBindings)
 {
     _connectionCache = connectionCache;
     _settings = settings;
     _exchangeBindings = exchangeBindings;
     _receiveObservers = new ReceiveObservable();
     _endpointObservers = new ReceiveEndpointObservable();
 }
        public void Init()
        {
            _cache = Isolate.Fake.Instance<IConnectionCache>();
            _connection = Isolate.Fake.Instance<IDbConnection>();
            Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall();
            Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection);
            InitCache();

            _config = new SqLiteConfig();
        }
示例#8
0
        private IDbConnection ReturnConnectionFromCache(IConnectionCache cache)
        {
            if (cache.HasNoConnection)
            {
                cache.SetConnection(new SQLiteConnection(_connectionString));
            }

            if (cache.GetConnection().State == ConnectionState.Closed) cache.GetConnection().Open();
            return cache.GetConnection();
        }
        public void Init()
        {
            _cache      = Isolate.Fake.Instance <IConnectionCache>();
            _connection = Isolate.Fake.Instance <IDbConnection>();
            Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall();
            Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection);
            InitCache();

            _config = new SqLiteConfig();
        }
示例#10
0
        private IDbConnection ReturnConnectionFromCache(IConnectionCache cache)
        {
            if (cache.HasNoConnection)
            {
                cache.SetConnection(new SQLiteConnection(_connectionString));
            }

            if (cache.GetConnection().State == ConnectionState.Closed)
            {
                cache.GetConnection().Open();
            }
            return(cache.GetConnection());
        }
示例#11
0
        public ChatServerModule(IKernel kernel)
        {
            Kernel           = kernel;
            _config          = kernel.Get <IConfig>();
            _sessionCache    = Kernel.Get <ISessionCache>();
            _connectionCache = new ConnectionCache(_sessionCache);
            Kernel.Bind <IConnectionCache>().ToMethod(x => _connectionCache);
            Kernel.Bind <ChatServerModule>().ToMethod(x => this);
            _sessionCache.SessionClosed += SessionCacheOnSessionClosed;
            var chatApiUri = $"http://{_config.LocalIP}:{_config.LocalChatPort}/";

            _webApp = WebApp.Start(chatApiUri, Configuration);
            Console.WriteLine($"Chat server started at {chatApiUri}");
        }
示例#12
0
        public ConnectionManager(
            IVSGitServices vsGitServices,
            IConnectionCache cache,
            ILoginManager loginManager,
            IApiClientFactory apiClientFactory)
        {
            this.vsGitServices    = vsGitServices;
            this.cache            = cache;
            this.loginManager     = loginManager;
            this.apiClientFactory = apiClientFactory;

            Connections = new ObservableCollection <IConnection>();
            LoadConnectionsFromCache().Forget();
        }
        public void SetANewConnectionWhenConnectionCacheIsEmptyAndInMemoryDatabase()
        {
            Isolate.CleanUp();
            _cache = Isolate.Fake.Instance <IConnectionCache>();

            _connection = Isolate.Fake.Instance <IDbConnection>();
            Isolate.WhenCalled(() => _cache.HasNoConnection).WillReturn(true);
            Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection);
            Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall();
            Isolate.WhenCalled(() => _connection.ConnectionString).WillReturn(SqLiteConfig.InMemoryDbConnectionString);
            InitCache();

            _config = new SqLiteConfig();
            _config.GetConnection();
            Isolate.Verify.WasCalledWithAnyArguments(() => _cache.SetConnection(_connection));
        }
 public ConnectionManager(
     IProgram program,
     IConnectionCache cache,
     IKeychain keychain,
     ILoginManager loginManager,
     IUsageTracker usageTracker)
 {
     this.program      = program;
     this.cache        = cache;
     this.keychain     = keychain;
     this.loginManager = loginManager;
     this.usageTracker = usageTracker;
     loaded            = new TaskCompletionSource <object>();
     connections       = new Lazy <ObservableCollectionEx <IConnection> >(
         this.CreateConnections,
         LazyThreadSafetyMode.ExecutionAndPublication);
 }
 public static void MyClassInitialize(TestContext testContext)
 {
     _cache = new TestConnectionCache();
 }
示例#16
0
 public ActiveMqSessionCache(IActiveMqHost host, IConnectionCache connectionCache)
     : base(new SessionContextFactory(connectionCache, host))
 {
 }
示例#17
0
 public ChatHub()
 {
     _connectionCache = ChatServerModule.Kernel.Get <IConnectionCache>();
     _serverModule    = ChatServerModule.Kernel.Get <ChatServerModule>();
 }
示例#18
0
 public ModelContextFactory(IConnectionCache connectionCache, IRabbitMqHost host)
 {
     _connectionCache = connectionCache;
     _host            = host;
 }
示例#19
0
 private static IDbConnection GetConnectionFromSessionState(IConnectionCache cache)
 {
     return cache.GetConnection();
 }
示例#20
0
 public RabbitMqModelCache(IConnectionCache connectionCache)
 {
     _connectionCache = connectionCache;
 }
示例#21
0
 public ModelContextFactory(IConnectionCache connectionCache, IAmazonSqsHost host)
 {
     _connectionCache = connectionCache;
     _host            = host;
 }
示例#22
0
 public RabbitMqModelCache(IConnectionCache connectionCache)
 {
     _connectionCache = connectionCache;
 }
        public void SetANewConnectionWhenConnectionCacheIsEmptyAndInMemoryDatabase()
        {
            Isolate.CleanUp();
            _cache = Isolate.Fake.Instance<IConnectionCache>();

            _connection = Isolate.Fake.Instance<IDbConnection>();
            Isolate.WhenCalled(() => _cache.HasNoConnection).WillReturn(true);
            Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection);
            Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall();
            Isolate.WhenCalled(() => _connection.ConnectionString).WillReturn(SqLiteConfig.InMemoryDbConnectionString);
            InitCache();

            _config = new SqLiteConfig();
            _config.GetConnection();
            Isolate.Verify.WasCalledWithAnyArguments(() => _cache.SetConnection(_connection));
        }
 private static IDbConnection GetConnectionFromSessionState(IConnectionCache cache)
 {
     return(cache.GetConnection());
 }
示例#25
0
 public static void MyClassInitialize(TestContext testContext)
 {
     _cache = new TestConnectionCache();
 }
示例#26
0
 public AmazonSqsModelCache(IAmazonSqsHost host, IConnectionCache connectionCache)
     : base(new ModelContextFactory(connectionCache, host))
 {
 }
示例#27
0
 public RabbitMqModelCache(IRabbitMqHost host, IConnectionCache connectionCache)
     : base(new ModelContextFactory(connectionCache, host))
 {
 }
 public SessionContextFactory(IConnectionCache connectionCache, IActiveMqHost host)
 {
     _connectionCache = connectionCache;
     _host            = host;
 }