コード例 #1
0
        public OpenKitInitializer(IOpenKitBuilder builder)
        {
            logger = builder.Logger;
            privacyConfiguration = PrivacyConfiguration.From(builder);
            openKitConfiguration = OpenKitConfiguration.From(builder);

            timingProvider    = new DefaultTimingProvider();
            threadIdProvider  = new DefaultThreadIdProvider();
            sessionIdProvider = new DefaultSessionIdProvider();

            beaconCache        = new BeaconCache(logger);
            beaconCacheEvictor = new BeaconCacheEvictor(logger, beaconCache, BeaconCacheConfiguration.From(builder),
                                                        timingProvider);

            var httpClientConfig = HttpClientConfiguration.From(openKitConfiguration);
            // shared thread suspender between BeaconSender and HttpClient. HttpClient will be woken up when
            // BeaconSender shuts down
            var beaconSenderThreadSuspender = new InterruptibleThreadSuspender();

            beaconSender = new BeaconSender(
                logger,
                httpClientConfig,
                new DefaultHttpClientProvider(logger, beaconSenderThreadSuspender),
                timingProvider,
                beaconSenderThreadSuspender);
            var watchdogThreadSuspender = new InterruptibleThreadSuspender();

            sessionWatchdog = new SessionWatchdog(
                logger,
                new SessionWatchdogContext(timingProvider, watchdogThreadSuspender));
        }
コード例 #2
0
        public void SetUp()
        {
            mockLogger = Substitute.For <ILogger>();
            mockOpenKitConfiguration = Substitute.For <IOpenKitConfiguration>();
            mockOpenKitConfiguration.ApplicationId.Returns(string.Empty);
            mockOpenKitConfiguration.ApplicationName.Returns(string.Empty);
            mockOpenKitConfiguration.ApplicationVersion.Returns(string.Empty);
            mockOpenKitConfiguration.DeviceId.Returns(DeviceId);

            mockPrivacyConfiguration = Substitute.For <IPrivacyConfiguration>();
            mockBeaconCache          = Substitute.For <IBeaconCache>();
            mockSessionIdProvider    = Substitute.For <ISessionIdProvider>();
            mockThreadIdProvider     = Substitute.For <IThreadIdProvider>();
            mockTimingProvider       = Substitute.For <ITimingProvider>();
            mockParent = Substitute.For <IOpenKitComposite>();

            mockInput = Substitute.For <ISessionCreatorInput>();
            mockInput.Logger.Returns(mockLogger);
            mockInput.OpenKitConfiguration.Returns(mockOpenKitConfiguration);
            mockInput.PrivacyConfiguration.Returns(mockPrivacyConfiguration);
            mockInput.BeaconCache.Returns(mockBeaconCache);
            mockInput.SessionIdProvider.Returns(mockSessionIdProvider);
            mockInput.ThreadIdProvider.Returns(mockThreadIdProvider);
            mockInput.TimingProvider.Returns(mockTimingProvider);
            mockInput.CurrentServerId.Returns(ServerId);
        }
コード例 #3
0
        public void SetUp()
        {
            mockLogger = Substitute.For <ILogger>();
            mockLogger.IsInfoEnabled.Returns(true);
            mockLogger.IsDebugEnabled.Returns(true);

            mockPrivacyConfig = Substitute.For <IPrivacyConfiguration>();
            mockPrivacyConfig.DataCollectionLevel.Returns(ConfigurationDefaults.DefaultDataCollectionLevel);
            mockPrivacyConfig.CrashReportingLevel.Returns(ConfigurationDefaults.DefaultCrashReportingLevel);

            mockOpenKitConfig = Substitute.For <IOpenKitConfiguration>();
            mockOpenKitConfig.ApplicationId.Returns(AppId);
            mockOpenKitConfig.DeviceId.Returns(DeviceId);
            mockOpenKitConfig.ApplicationName.Returns(AppName);
            mockOpenKitConfig.OperatingSystem.Returns(string.Empty);
            mockOpenKitConfig.Manufacturer.Returns(string.Empty);
            mockOpenKitConfig.ModelId.Returns(string.Empty);

            mockTimingProvider     = Substitute.For <ITimingProvider>();
            mockThreadIdProvider   = Substitute.For <IThreadIdProvider>();
            mockSessionIdProvider  = Substitute.For <ISessionIdProvider>();
            mockBeaconCache        = Substitute.For <IBeaconCache>();
            mockBeaconSender       = Substitute.For <IBeaconSender>();
            mockBeaconCacheEvictor = Substitute.For <IBeaconCacheEvictor>();
            mockSessionWatchdog    = Substitute.For <ISessionWatchdog>();
        }
コード例 #4
0
 public void SetUp()
 {
     mockery = new Mockery();
     dependencySessionContainer = mockery.NewMock<ISessionContainer>();
     dependencyDb = mockery.NewMock<IWorkTimeAccountingPlatformDAO>();
     dependencySessionIdProvider = mockery.NewMock<ISessionIdProvider>();
     testee = new CommunicationService(dependencySessionContainer, dependencyDb, dependencySessionIdProvider);
 }
コード例 #5
0
 internal TestBeaconBuilder()
 {
     logger            = Substitute.For <ILogger>();
     beaconCache       = Substitute.For <IBeaconCache>();
     clientIpAddress   = "127.0.0.1";
     sessionIdProvider = Substitute.For <ISessionIdProvider>();
     threadIdProvider  = Substitute.For <IThreadIdProvider>();
     timingProvider    = Substitute.For <ITimingProvider>();
     randomGenerator   = Substitute.For <IPrnGenerator>();
 }
コード例 #6
0
 public StateMachineManagerDataService(
     ISessionIdProvider sessionIdProvider,
     ILocaleManager localeManager,
     IAssetsManager assetsManager,
     IScriptHost scriptHost)
 {
     this.sessionIdProvider = sessionIdProvider;
     this.localeManager     = localeManager;
     this.assetsManager     = assetsManager;
     this.scriptHost        = scriptHost;
 }
コード例 #7
0
ファイル: SessionManager.cs プロジェクト: MakoLab/fractus
        /// <summary>
        /// Initializes the <see cref="SessionManager"/> class.
        /// </summary>
        static SessionManager()
        {
            FractusKernelSectionHandler handler = (FractusKernelSectionHandler)ConfigurationManager.GetSection("fractusKernel");

            SessionManager.sessionTimeoutInMinutes = handler.SessionTimeout;
            bool desktopMode = handler.DesktopMode;

            SessionManager.sessionIdProvider = CreateSessionIdProvider(desktopMode);

            SessionManager.session = CreateSession(desktopMode);
            SessionManager.session.SessionExpired += new SessionExpiredDelegate <Guid>(OnSessionExpired);
        }
コード例 #8
0
 public TestOpenKitBuilder()
 {
     logger             = Substitute.For <ILogger>();
     privacyConfig      = Substitute.For <IPrivacyConfiguration>();
     openKitConfig      = Substitute.For <IOpenKitConfiguration>();
     threadIdProvider   = Substitute.For <IThreadIdProvider>();
     timingProvider     = Substitute.For <ITimingProvider>();
     sessionIdProvider  = Substitute.For <ISessionIdProvider>();
     beaconCache        = Substitute.For <IBeaconCache>();
     beaconSender       = Substitute.For <IBeaconSender>();
     beaconCacheEvictor = Substitute.For <IBeaconCacheEvictor>();
     sessionWatchdog    = Substitute.For <ISessionWatchdog>();
 }
コード例 #9
0
        internal SessionCreator(ISessionCreatorInput input, string clientIpAddress)
        {
            Logger = input.Logger;
            openKitConfiguration = input.OpenKitConfiguration;
            privacyConfiguration = input.PrivacyConfiguration;
            BeaconCache          = input.BeaconCache;
            ThreadIdProvider     = input.ThreadIdProvider;
            TimingProvider       = input.TimingProvider;
            ClientIpAddress      = clientIpAddress;

            serverId = input.CurrentServerId;
            continuousSessionIdProvider     = input.SessionIdProvider;
            continuousRandomNumberGenerator = new DefaultPrnGenerator();

            InitializeFixedNumberProviders();
        }
コード例 #10
0
ファイル: OpenKit.cs プロジェクト: stefaneberl/openkit-dotnet
        /// <summary>
        /// Constructor for creating an OpenKit instance.
        /// </summary>
        /// <param name="initializer">provider to get all OpenKit related configuration parameters.</param>
        internal OpenKit(IOpenKitInitializer initializer)
        {
            logger = initializer.Logger;
            privacyConfiguration = initializer.PrivacyConfiguration;
            openKitConfiguration = initializer.OpenKitConfiguration;

            timingProvider    = initializer.TimingProvider;
            threadIdProvider  = initializer.ThreadIdProvider;
            sessionIdProvider = initializer.SessionIdProvider;

            beaconCache        = initializer.BeaconCache;
            beaconCacheEvictor = initializer.BeaconCacheEvictor;

            beaconSender    = initializer.BeaconSender;
            sessionWatchdog = initializer.SessionWatchdog;

            LogOpenKitInstanceCreation(logger, openKitConfiguration);
        }
コード例 #11
0
 public FixedSessionIdProvider(ISessionIdProvider sessionIdProvider)
 {
     sessionId = sessionIdProvider.GetNextSessionId();
 }
コード例 #12
0
 internal TestOpenKitBuilder With(ISessionIdProvider provider)
 {
     this.sessionIdProvider = provider;
     return(this);
 }
コード例 #13
0
 internal TestBeaconBuilder With(ISessionIdProvider provider)
 {
     sessionIdProvider = provider;
     return(this);
 }
コード例 #14
0
 public CommunicationService(ISessionContainer sessionContainer, IWorkTimeAccountingPlatformDAO db, ISessionIdProvider sessionIdProvider)
 {
     _sessionContainer = sessionContainer;
     _db = db;
     _sessionIdProvider = sessionIdProvider;
 }
コード例 #15
0
ファイル: DefaultSession.cs プロジェクト: UStack/UWeb
        public DefaultSession(ISessionProvider sessionProvider, ISessionIdProvider sessionIdProvider)
        {
            sessionId = sessionIdProvider.Get();

            entries = sessionProvider.GetSession(sessionId);
        }