public void GetLogFilesForNewCharacter() { var newCharacterName = new CharacterName("Figurant"); Expect(subscriber.ReceivedMessages.Count(m => m.CharacterName == newCharacterName), EqualTo(0)); CreateNewCharacterDirWithALog("Figurant", "_Event.2012-07.txt"); IWurmCharacterLogFiles manager = null; WaitUntilTrue(() => { try { manager = System.GetForCharacter(newCharacterName); return(true); } catch (Exception exception) { Trace.WriteLine(exception.Message); return(false); } }); subscriber.WaitMessages(1, m => m.CharacterName == newCharacterName); var results = manager.GetLogFiles(DateTime.MinValue, DateTime.MaxValue, LogType.Event); Expect(results.Count(), EqualTo(1)); }
public CharacterLogsMonitorEngineFactory( IWurmApiLogger logger, SingleFileMonitorFactory singleFileMonitorFactory, IWurmCharacterLogFiles wurmCharacterLogFiles, [NotNull] IInternalEventAggregator internalEventAggregator) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (singleFileMonitorFactory == null) { throw new ArgumentNullException(nameof(singleFileMonitorFactory)); } if (wurmCharacterLogFiles == null) { throw new ArgumentNullException(nameof(wurmCharacterLogFiles)); } if (internalEventAggregator == null) { throw new ArgumentNullException(nameof(internalEventAggregator)); } this.logger = logger; this.singleFileMonitorFactory = singleFileMonitorFactory; this.wurmCharacterLogFiles = wurmCharacterLogFiles; this.internalEventAggregator = internalEventAggregator; }
public ServerHistoryProvider( CharacterName characterName, IPersistent<PersistentModel.ServerHistory> persistentData, IWurmLogsMonitorInternal logsMonitor, IWurmLogsHistory logsSearcher, IWurmServerList wurmServerList, ILogger logger, IWurmCharacterLogFiles wurmCharacterLogFiles) { if (characterName == null) throw new ArgumentNullException("characterName"); if (persistentData == null) throw new ArgumentNullException("persistentData"); if (logsMonitor == null) throw new ArgumentNullException("logsMonitor"); if (logsSearcher == null) throw new ArgumentNullException("logsSearcher"); if (wurmServerList == null) throw new ArgumentNullException("wurmServerList"); if (logger == null) throw new ArgumentNullException("logger"); if (wurmCharacterLogFiles == null) throw new ArgumentNullException("wurmCharacterLogFiles"); this.characterName = characterName; this.sortedServerHistory = new SortedServerHistory(persistentData); this.persistentData = persistentData; this.logsMonitor = logsMonitor; this.logsSearcher = logsSearcher; this.wurmServerList = wurmServerList; this.logger = logger; this.wurmCharacterLogFiles = wurmCharacterLogFiles; logsMonitor.SubscribeInternal(characterName, LogType.Event, HandleEventLogEntries); }
public ServerHistoryProvider( [NotNull] CharacterName characterName, [NotNull] IPersistent <PersistentModel.ServerHistory> persistentData, [NotNull] IWurmLogsMonitorInternal logsMonitor, [NotNull] IWurmLogsHistory logsSearcher, [NotNull] IWurmServerList wurmServerList, [NotNull] IWurmApiLogger logger, [NotNull] IWurmCharacterLogFiles wurmCharacterLogFiles, [NotNull] IInternalEventAggregator eventAggregator) { if (characterName == null) { throw new ArgumentNullException(nameof(characterName)); } if (persistentData == null) { throw new ArgumentNullException(nameof(persistentData)); } if (logsMonitor == null) { throw new ArgumentNullException(nameof(logsMonitor)); } if (logsSearcher == null) { throw new ArgumentNullException(nameof(logsSearcher)); } if (wurmServerList == null) { throw new ArgumentNullException(nameof(wurmServerList)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (wurmCharacterLogFiles == null) { throw new ArgumentNullException(nameof(wurmCharacterLogFiles)); } if (eventAggregator == null) { throw new ArgumentNullException(nameof(eventAggregator)); } this.characterName = characterName; sortedServerHistory = new SortedServerHistory(persistentData); this.persistentData = persistentData; this.logsMonitor = logsMonitor; this.logsSearcher = logsSearcher; this.wurmServerList = wurmServerList; this.logger = logger; this.wurmCharacterLogFiles = wurmCharacterLogFiles; this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); logsMonitor.SubscribeInternal(characterName, LogType.Event, HandleEventLogEntries); }
public CharacterMonthlyLogHeuristics(IPersistent<WurmCharacterLogsEntity> persistentData, MonthlyHeuristicsExtractorFactory monthlyHeuristicsExtractorFactory, IWurmCharacterLogFiles wurmCharacterLogFiles) { if (persistentData == null) throw new ArgumentNullException("persistentData"); if (monthlyHeuristicsExtractorFactory == null) throw new ArgumentNullException("monthlyHeuristicsExtractorFactory"); if (wurmCharacterLogFiles == null) throw new ArgumentNullException("wurmCharacterLogFiles"); this.persistentData = persistentData; this.monthlyHeuristicsExtractorFactory = monthlyHeuristicsExtractorFactory; this.wurmCharacterLogFiles = wurmCharacterLogFiles; }
public CharacterLogsMonitorEngineFactory( ILogger logger, SingleFileMonitorFactory singleFileMonitorFactory, IWurmCharacterLogFiles wurmCharacterLogFiles, [NotNull] IInternalEventAggregator internalEventAggregator) { if (logger == null) throw new ArgumentNullException("logger"); if (singleFileMonitorFactory == null) throw new ArgumentNullException("singleFileMonitorFactory"); if (wurmCharacterLogFiles == null) throw new ArgumentNullException("wurmCharacterLogFiles"); if (internalEventAggregator == null) throw new ArgumentNullException("internalEventAggregator"); this.logger = logger; this.singleFileMonitorFactory = singleFileMonitorFactory; this.wurmCharacterLogFiles = wurmCharacterLogFiles; this.internalEventAggregator = internalEventAggregator; }
public void Setup() { ClientMock.PopulateFromZip(Path.Combine(TestPaksZippedDirFullPath, "logs-samples-emptyfiles.7z")); TestGuyDirectoryInfo = new DirectoryInfo(ClientMock.InstallDirectory.FullPath) .GetDirectories("players") .Single() .GetDirectories("Testguy") .Single(); TotalFileCount = TestGuyDirectoryInfo.GetDirectories("logs").Single().GetFiles().Length; System = Fixture.WurmApiManager.WurmLogFiles; TestGuyLogFiles = System.GetForCharacter(TestGuyCharacterName); }
public CharacterMonthlyLogHeuristics(IPersistent <WurmCharacterLogsEntity> persistentData, MonthlyHeuristicsExtractorFactory monthlyHeuristicsExtractorFactory, IWurmCharacterLogFiles wurmCharacterLogFiles) { if (persistentData == null) { throw new ArgumentNullException(nameof(persistentData)); } if (monthlyHeuristicsExtractorFactory == null) { throw new ArgumentNullException(nameof(monthlyHeuristicsExtractorFactory)); } if (wurmCharacterLogFiles == null) { throw new ArgumentNullException(nameof(wurmCharacterLogFiles)); } this.persistentData = persistentData; this.monthlyHeuristicsExtractorFactory = monthlyHeuristicsExtractorFactory; this.wurmCharacterLogFiles = wurmCharacterLogFiles; }
public CharacterLogsMonitorEngine( [NotNull] CharacterName characterName, [NotNull] IWurmApiLogger logger, [NotNull] SingleFileMonitorFactory singleFileMonitorFactory, [NotNull] IWurmCharacterLogFiles wurmCharacterLogFiles, [NotNull] IInternalEventAggregator internalEventAggregator) { if (characterName == null) { throw new ArgumentNullException(nameof(characterName)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (singleFileMonitorFactory == null) { throw new ArgumentNullException(nameof(singleFileMonitorFactory)); } if (wurmCharacterLogFiles == null) { throw new ArgumentNullException(nameof(wurmCharacterLogFiles)); } if (internalEventAggregator == null) { throw new ArgumentNullException(nameof(internalEventAggregator)); } this.characterName = characterName; this.logger = logger; this.singleFileMonitorFactory = singleFileMonitorFactory; this.wurmCharacterLogFiles = wurmCharacterLogFiles; lastRefresh = Time.Get.LocalNowOffset; internalEventAggregator.Subscribe(this); lock (locker) { RebuildAllMonitors(); } }
public void CreatesManagerForNewCharacter() { CreateNewCharacterEmptyDir("Newguy"); // there is a delay before new directory gets observed IWurmCharacterLogFiles manager = null; WaitUntilTrue(() => { try { manager = System.GetForCharacter(new CharacterName("Newguy")); return(true); } catch (Exception exception) { Trace.WriteLine(exception.Message); return(false); } }); var files = manager.GetLogFiles(DateTime.MinValue, DateTime.MaxValue); Expect(files.Count(), EqualTo(0)); }