public void SetUp()
 {
     theLogger   = new NulloLogger();
     theListener = new StubListener();
     theSession  = new StubSession();
     theManager  = new ClarifySessionManager(new[] { theListener, theListener }, theLogger);
 }
        public void Configure(IClarifySession session)
        {
            _logger.LogInfo("Configuring new session " + session.Id);

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to configure newly created session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Created(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when configuring newly created session", e);
                    throw;
                }
            }

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to configure newly started session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Started(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when starting session", e);
                    throw;
                }
            }
        }
 public HistoryBuilder(IClarifySession session, ISchemaCache schemaCache, IActEntryTemplatePolicyConfiguration templatePolicyConfiguration, IHistoryItemAssembler historyItemAssembler)
 {
     _session = session;
     _schemaCache = schemaCache;
     _templatePolicyConfiguration = templatePolicyConfiguration;
     _historyItemAssembler = historyItemAssembler;
 }
        public void Configure(IClarifySession session)
        {
            _logger.LogInfo("Configuring new session " + session.Id);

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to configure newly created session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Created(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when configuring newly created session", e);
                    throw;
                }

            }

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to configure newly started session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Started(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when starting session", e);
                    throw;
                }
            }
        }
        public void SessionStarted(IClarifySession session)
        {
            if (!_schemaCache.IsValidTable("fc_login_monitor"))
            {
                _logger.LogDebug("Unable to log user authentication. No fc_login_monitor table is present.");
                return;
            }

            var host = GetLocalhostFqdn();

            _logger.LogDebug("Logging application {0} authentication for user {1} on host {2} with session id {3}.", _settings.ApplicationName, session.UserName, host, session.Id);

            var dataSet = session.CreateDataSet();

            var monitorGeneric = dataSet.CreateGeneric("fc_login_monitor");
            var monitorRow     = monitorGeneric.AddNew();

            monitorRow["application"]  = _settings.ApplicationName;
            monitorRow["login_time"]   = FCGeneric.NOW_DATE;
            monitorRow["logout_time"]  = FCGeneric.MIN_DATE;
            monitorRow["login_name"]   = session.UserName;
            monitorRow["fcsessionid"]  = session.Id.ToString();
            monitorRow["num_sessions"] = _sessionUsageReporter.GetActiveSessionCount();

            if (_schemaCache.IsValidField("fc_login_monitor", "server"))
            {
                monitorRow["server"] = host;
            }

            monitorRow["comments"] = _applicationUrl.Url;

            monitorRow.RelateByID(session.SessionUserID, "fc_login_monitor2user");
            monitorRow.Update();
        }
 public void SetUp()
 {
     theLogger = new NulloLogger();
     theListener = new StubListener();
     theSession = new StubSession();
     theManager = new ClarifySessionManager(new[] {theListener, theListener}, theLogger);
 }
Exemple #7
0
        public void SessionExpired(IClarifySession session)
        {
            var id = session.Id;

            if (!_schemaCache.IsValidTable("fc_login_monitor"))
            {
                _logger.LogDebug("Unable to log session expiration. No fc_login_monitor table is present.");
                return;
            }

            var dataSet        = _session().CreateDataSet();
            var monitorGeneric = dataSet.CreateGenericWithFields("fc_login_monitor");

            monitorGeneric.Filter(f => f.Equals("fcsessionid", id.ToString()));
            monitorGeneric.Query();

            if (monitorGeneric.Count < 1)
            {
                _logger.LogDebug("Could not find expired session {0} row in login monitor", id);
                return;
            }

            var monitorRow = monitorGeneric.DataRows().First();

            monitorRow["logout_time"] = FCGeneric.NOW_DATE;
            monitorRow.Update();

            _logger.LogDebug("Set logout time for session {0} in login monitor.", id);
        }
        public void SessionExpired(IClarifySession session)
        {
            var id = session.Id;
            if (!_schemaCache.IsValidTable("fc_login_monitor"))
            {
                _logger.LogDebug("Unable to log session expiration. No fc_login_monitor table is present.");
                return;
            }

            var dataSet = _session().CreateDataSet();
            var monitorGeneric = dataSet.CreateGenericWithFields("fc_login_monitor");
            monitorGeneric.Filter(f => f.Equals("fcsessionid", id.ToString()));
            monitorGeneric.Query();

            if(monitorGeneric.Count < 1)
            {
                _logger.LogDebug("Could not find expired session {0} row in login monitor", id);
                return;
            }

            var monitorRow = monitorGeneric.DataRows().First();
            monitorRow["logout_time"] = FCGeneric.NOW_DATE;
            monitorRow.Update();

            _logger.LogDebug("Set logout time for session {0} in login monitor.", id);
        }
 public HistoryBuilder(IClarifySession session, ISchemaCache schemaCache, IActEntryTemplatePolicyConfiguration templatePolicyConfiguration, IHistoryItemAssembler historyItemAssembler)
 {
     _session     = session;
     _schemaCache = schemaCache;
     _templatePolicyConfiguration = templatePolicyConfiguration;
     _historyItemAssembler        = historyItemAssembler;
 }
        public void SessionStarted(IClarifySession session)
        {
            if (!_schemaCache.IsValidTable("fc_login_monitor"))
            {
                _logger.LogDebug("Unable to log user authentication. No fc_login_monitor table is present.");
                return;
            }

            var host = GetLocalhostFqdn();

            _logger.LogDebug("Logging application {0} authentication for user {1} on host {2} with session id {3}.", _settings.ApplicationName, session.UserName, host, session.Id);

            var dataSet = session.CreateDataSet();

            var monitorGeneric = dataSet.CreateGeneric("fc_login_monitor");
            var monitorRow = monitorGeneric.AddNew();
            monitorRow["application"] = _settings.ApplicationName;
            monitorRow["login_time"] = FCGeneric.NOW_DATE;
            monitorRow["logout_time"] = FCGeneric.MIN_DATE;
            monitorRow["login_name"] = session.UserName;
            monitorRow["fcsessionid"] = session.Id.ToString();
            monitorRow["num_sessions"] = _sessionUsageReporter.GetActiveSessionCount();

            if(_schemaCache.IsValidField("fc_login_monitor", "server"))
            {
                monitorRow["server"] = host;
            }

            monitorRow["comments"] = _applicationUrl.Url;

            monitorRow.RelateByID(session.SessionUserID, "fc_login_monitor2user");
            monitorRow.Update();
        }
 public HistoryBuilder(IClarifySession session, ISchemaCache schemaCache, IActEntryTemplatePolicyConfiguration templatePolicyConfiguration, IContainer container)
 {
     _session = session;
     _schemaCache = schemaCache;
     _templatePolicyConfiguration = templatePolicyConfiguration;
     _container = container;
 }
 public DovetailGenericModelMapVisitor(IClarifySession session, ISchemaCache schemaCache, IMappingTransformRegistry registry, IServiceLocator services, IMappingVariableExpander expander)
 {
     _session     = session;
     _schemaCache = schemaCache;
     _registry    = registry;
     _services    = services;
     _expander    = expander;
 }
 public CaseHistoryAssemblerPolicy(IClarifySession session, HistoryBuilder historyBuilder,
                                   HistorySettings historySettings, ILogger logger)
 {
     _session         = session;
     _historyBuilder  = historyBuilder;
     _historySettings = historySettings;
     _logger          = logger;
 }
 public CaseHistoryAssemblerPolicy(IClarifySession session, HistoryBuilder historyBuilder,
     HistorySettings historySettings, ILogger logger)
 {
     _session = session;
     _historyBuilder = historyBuilder;
     _historySettings = historySettings;
     _logger = logger;
 }
Exemple #15
0
            public override void setup()
            {
                var sessionId = Guid.NewGuid();

                _session = MockRepository.GenerateStub <IClarifySession>();
                _session.Stub(s => s.Id).Return(sessionId);

                _cut.addSessionToCache(UserName, _session);
            }
 private bool IsSessionValid(IClarifySession session)
 {
     var isSessionValid = _clarifyApplication.IsSessionValid(session.Id);
     if(!isSessionValid)
     {
         _logger.LogDebug("Ejecting inactive session {0} for user {1}.".ToFormat(session.Id, session.UserName));
         _clarifySessionCache.EjectSession(session.UserName);
     }
     return isSessionValid;
 }
Exemple #17
0
        public static ClarifySession AsClarifySession(this IClarifySession session)
        {
            var wrapper = session as IClarifySessionWrapper;

            if (wrapper == null)
            {
                throw new InvalidOperationException(string.Format("Session must implement {0}", typeof(IClarifySessionWrapper).Name));
            }

            return(wrapper.Clarify);
        }
        public void Created(IClarifySession session)
        {
            var utcTimezone = _locale.TimeZones.FirstOrDefault(t => t.UtcOffsetSeconds == 0);

            if (utcTimezone == null)
                throw new ApplicationException("No timezone with a zero GMT offset was found.");

            var clarify = session.AsClarifySession();

            clarify.LocalTimeZone = utcTimezone;
            clarify.SetNullStringsToEmpty = true;

            // This option is here because we do not check schema field sizes when writing to the database.
            // It could be removed if this is resolved in the future.
            clarify.TruncateStringFields = true;
        }
        public void Created(IClarifySession session)
        {
            var utcTimezone = _locale.TimeZones.FirstOrDefault(t => t.UtcOffsetSeconds == 0);

            if (utcTimezone == null)
            {
                throw new ApplicationException("No timezone with a zero GMT offset was found.");
            }

            var clarify = session.AsClarifySession();

            clarify.LocalTimeZone         = utcTimezone;
            clarify.SetNullStringsToEmpty = true;

            // This option is here because we do not check schema field sizes when writing to the database.
            // It could be removed if this is resolved in the future.
            clarify.TruncateStringFields = true;
        }
        public void Eject(IClarifySession session)
        {
            _logger.LogInfo("Ejecting session " + session.Id);

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to observe the closing of session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Closed(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when closing session", e);
                    throw;
                }
            }
        }
 public override void setup()
 {
     _clarifyApplication.Expect(s => s.CreateSession(_settings.ApplicationUsername, ClarifyLoginType.User)).Return(_expectedSession);
     _clarifyApplication.Stub(s => s.IsSessionValid(_expectedSession.SessionID)).Return(true);
     _result = _cut.GetApplicationSession();
 }
 public bool addSessionToCache(string username, IClarifySession session)
 {
     return _agentSessionCacheByUsername.TryAdd(username, session);
 }
 public void Started(IClarifySession session)
 {
 }
Exemple #24
0
 public HistoryEmployeeAssembler(IClarifySession session)
 {
     _session = session;
 }
Exemple #25
0
 public void Eject(IClarifySession session)
 {
     Ejected = true;
 }
Exemple #26
0
 public static FieldOpsToolkit CreateFieldOpsToolkit(this IClarifySession session)
 {
     return(new FieldOpsToolkit(session.AsClarifySession()));
 }
Exemple #27
0
 public static SqlHelper CreateSqlHelper(this IClarifySession session, string sql)
 {
     return(new SqlHelper(sql));
 }
Exemple #28
0
 public ObjectMother(IClarifySession clarifySession)
 {
     _clarifySession = clarifySession;
 }
 public void Started(IClarifySession session)
 {
     Calls.Add("Started " + ++_count);
 }
            public override void setup()
            {
                var username = _settings.ApplicationUsername;
                var sessionId = Guid.NewGuid();
                _session = MockRepository.GenerateStub<IClarifySession>();
                _session.Stub(s => s.Id).Return(sessionId);

                _cut.addSessionToCache(username, _session);

                _result = _cut.EjectSession(username);
            }
            public override void setup()
            {
                var sessionId = Guid.NewGuid();
                _session = MockRepository.GenerateStub<IClarifySession>();
                _session.Stub(s => s.Id).Return(sessionId);

                _cut.addSessionToCache(UserName, _session);
            }
 public void Started(IClarifySession session)
 {
 }
 public void Closed(IClarifySession session)
 {
     Calls.Add("Closed " + ++_count);
 }
 public void Closed(IClarifySession session)
 {
 }
 public DovetailGenericModelMapVisitor(IClarifySession session, ISchemaCache schemaCache)
 {
     _session     = session;
     _schemaCache = schemaCache;
 }
        public void Eject(IClarifySession session)
        {
            _logger.LogInfo("Ejecting session " + session.Id);

            foreach (var listener in _listeners)
            {
                _logger.LogDebug("Using {0} to observe the closing of session {1}", listener.GetType().Name, session.Id);

                try
                {
                    listener.Closed(session);
                }
                catch (Exception e)
                {
                    _logger.LogError("Error in listener when closing session", e);
                    throw;
                }
            }
        }
 public post_handler(IClarifySession session)
 {
     _session = session;
 }
Exemple #38
0
 public void SessionStarted(IClarifySession session)
 {
     _reporter.GetActiveSessionCount();
 }
Exemple #39
0
 public static SupportToolkit CreateSupportToolkit(this IClarifySession session)
 {
     return(new SupportToolkit(session.AsClarifySession()));
 }
 public void Eject(IClarifySession session)
 {
     Ejected = true;
 }
Exemple #41
0
 public static InterfacesToolkit CreateInterfacesToolkit(this IClarifySession session)
 {
     return(new InterfacesToolkit(session.AsClarifySession()));
 }
 public post_handler(IClarifySession session)
 {
     _session = session;
 }
Exemple #43
0
 public void SessionExpired(IClarifySession session)
 {
     // no-op
 }
 public void Created(IClarifySession session)
 {
     Calls.Add("Created " + ++_count);
 }
Exemple #45
0
 public void Configure(IClarifySession session)
 {
     throw new System.NotImplementedException();
 }
 public void Started(IClarifySession session)
 {
     Calls.Add("Started " + ++_count);
 }
 public DovetailGenericModelMapVisitor(IClarifySession session, ISchemaCache schemaCache)
 {
     _session = session;
     _schemaCache = schemaCache;
 }
 public void addSessionToCache(string username, IClarifySession session)
 {
     _agentSessionCacheByUsername.Add(username, session);
 }
 public ObjectMother(IClarifySession clarifySession)
 {
     _clarifySession = clarifySession;
 }
 public void Closed(IClarifySession session)
 {
 }
 public void addSessionToCache(string username, IClarifySession session)
 {
     _agentSessionCacheByUsername.Add(username, session);
 }
 public void Configure(IClarifySession session)
 {
     throw new System.NotImplementedException();
 }