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)); }
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); }
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>(); }
public void SetUp() { mockery = new Mockery(); dependencySessionContainer = mockery.NewMock<ISessionContainer>(); dependencyDb = mockery.NewMock<IWorkTimeAccountingPlatformDAO>(); dependencySessionIdProvider = mockery.NewMock<ISessionIdProvider>(); testee = new CommunicationService(dependencySessionContainer, dependencyDb, dependencySessionIdProvider); }
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>(); }
public StateMachineManagerDataService( ISessionIdProvider sessionIdProvider, ILocaleManager localeManager, IAssetsManager assetsManager, IScriptHost scriptHost) { this.sessionIdProvider = sessionIdProvider; this.localeManager = localeManager; this.assetsManager = assetsManager; this.scriptHost = scriptHost; }
/// <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); }
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>(); }
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(); }
/// <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); }
public FixedSessionIdProvider(ISessionIdProvider sessionIdProvider) { sessionId = sessionIdProvider.GetNextSessionId(); }
internal TestOpenKitBuilder With(ISessionIdProvider provider) { this.sessionIdProvider = provider; return(this); }
internal TestBeaconBuilder With(ISessionIdProvider provider) { sessionIdProvider = provider; return(this); }
public CommunicationService(ISessionContainer sessionContainer, IWorkTimeAccountingPlatformDAO db, ISessionIdProvider sessionIdProvider) { _sessionContainer = sessionContainer; _db = db; _sessionIdProvider = sessionIdProvider; }
public DefaultSession(ISessionProvider sessionProvider, ISessionIdProvider sessionIdProvider) { sessionId = sessionIdProvider.Get(); entries = sessionProvider.GetSession(sessionId); }