private void UpdateSystemInformationOfTarget(IDocumentSession session, CollectRequest collectRequest, FamilyEnumeration plataform, ExecutionLogBuilder executionLog) { if (!collectRequest.Target.IsSystemInformationDefined()) { executionLog.CollectSystemInformation(); ISystemInformationService systemInformationService = ProbeManager.GetSystemInformationService(plataform); if (systemInformationService != null) { try { this.GetSystemInformationFromTarget(collectRequest, systemInformationService); session.SaveChanges(); } catch (RecoverableProbeException ex) { CollectExecution collectExecution = this.CreateCollectExecution(session, collectRequest); collectExecution.SetDateStartCollect(); this.ConfigureTheCollectRequestWithAnErrorProbeExecute(collectRequest, "SystemInformation", collectExecution, ex, executionLog); session.SaveChanges(); throw new SystemInformationException(ex.Message, ex); } catch (Exception ex) { CreateCollectionExcutionWithError(session, collectRequest, "SystemInformation", ex, executionLog); session.SaveChanges(); throw new SystemInformationException(ex.Message, ex); } } } }
public void Shoud_be_possible_to_inform_the_systemInformation_collect() { ExecutionLogBuilder executionLog = new ExecutionLogBuilder(); executionLog.StartCollectOf("Registry"); executionLog.TryConnectToHost("176.16.3.166"); executionLog.CollectingInformationFrom("oval:id:7589"); executionLog.CollectSystemInformation(); executionLog.EndCollectOf("Registry"); IEnumerable <ProbeLogItem> executionsLog = executionLog.BuildExecutionLogs(); Assert.AreEqual(5, executionsLog.Count()); }