Esempio n. 1
0
 public void Should_be_possible_to_build_a_probeExecution_from_collectedObject()
 {
     CollectFactory collectFactory = new CollectFactory(provider.GetSession());
     ProbeResult probeResult = probeResultFactory.CreateProbeResultForRegistryCollect();
     
     ProbeExecution probeExecution = collectFactory.CreateAProbeExecution(probeResult, "registry");
     Assert.IsNotNull(probeExecution);
     Assert.AreEqual("registry", probeExecution.Capability);
     Assert.IsTrue(probeExecution.ExecutionLogs.Count == 8, "the probe execution not have executionLogs expecteds");            
     Assert.IsTrue(probeExecution.IsComplete(), "the probe execution not have a status expected");
 
 }
Esempio n. 2
0
        public CollectRequest CreateCollectRequestIncompleteAfterCollect(IDocumentSession session)
        {
            CollectRequest collectRequest = new CollectRequest();

            string definitionsInXml = GetOvalObjectInXML(".definitions.fdcc_xpfirewall_oval.xml");
            StringBuilder builder = new StringBuilder(definitionsInXml);
            var newDefinitiondoc = new DefinitionDocument()
            {
                OriginalId = "01",
                Text = builder.ToString()
            };
            session.Store(newDefinitiondoc);
            collectRequest.OvalDefinitionsId = newDefinitiondoc.Oid ;
            session.Store(collectRequest);
            CollectExecution collectExecution = new CollectExecution();
            collectExecution.RequestId = collectRequest.Oid;
            session.Store(collectExecution);
            collectExecution.SetDateStartCollect();
            collectExecution.SetDateEndCollect();
            //collectRequest.Collects.Add(collectExecution);
            ProbeResult probeResult = new ProbeResultFactory().CreateProbeResultForRegistryCollect();

            CollectFactory collectFactory = new CollectFactory(session);
            ProbeExecution probeExecution = collectFactory.CreateAProbeExecution(probeResult, "registry");
            CollectResult collectResult = new CollectResultFactory().CreateCollectResultForTheProbeExecution(probeResult);
            string systemCharacteristicsXml = this.GetSystemCharacteristicsInXML(".system_characteristics.fdcc_xpfirewall_oval.sc_incomplete.xml");            
            collectResult.SystemCharacteristics = systemCharacteristicsXml;

            probeExecution.SystemCharacteristics = collectResult.SystemCharacteristics;
            collectExecution.ProbeExecutions.Add(probeExecution);
           // collectRequest.Collects.Add(collectExecution);
            this.CreateTarget(session, collectRequest);
            session.SaveChanges();
            return collectRequest;
        }
Esempio n. 3
0
        public void Should_be_possible_to_build_a_probeExecution_with_the_error_status_if_exists_problems_in_the_log()
        {
            CollectFactory collectFactory = new CollectFactory(provider.GetSession());
            ProbeResult probeResult = probeResultFactory.CreateProbeResultForRegostryCollectWithError();

            ProbeExecution probeExecution = collectFactory.CreateAProbeExecution(probeResult, "registry");
            Assert.IsNotNull(probeExecution);
            Assert.AreEqual("registry", probeExecution.Capability);
            Assert.IsTrue(probeExecution.ExecutionLogs.Count == probeResult.ExecutionLog.Count(), "the probe execution not have executionLogs expecteds");            
            Assert.IsTrue(probeExecution.HasErrors(), "the probe execution not have a status expected");
        }
Esempio n. 4
0
        public CollectRequest CreateCollectRequestCompleteAfterCollect(IDocumentSession session)
        {
            CollectRequest collectRequest = new CollectRequest();
            session.Store(collectRequest);
            CollectExecution collectExecution = new CollectExecution();
            session.Store(collectExecution);
            collectExecution.RequestId = collectRequest.Oid;
            collectExecution.SetDateStartCollect();
            collectExecution.SetDateEndCollect();
            ProbeResult probeResult = new ProbeResultFactory().CreateProbeResultForRegistryCollect();
            
            CollectFactory collectFactory = new CollectFactory(session);            
            ProbeExecution probeExecution = collectFactory.CreateAProbeExecution(probeResult, "registry");
            CollectResult collectResult = new CollectResultFactory().CreateCollectResultForTheProbeExecution(probeResult);
            collectRequest.Result = collectResult;
            string systemCharacteristicsXml = this.GetSystemCharacteristicsInXML(".system_characteristics.oval.org.mitre.oval.sc.5368.xml");
            collectResult.SystemCharacteristics = systemCharacteristicsXml;

            probeExecution.SystemCharacteristics = collectResult.SystemCharacteristics;
            collectExecution.ProbeExecutions.Add(probeExecution);
            this.CreateTarget(session, collectRequest);
            //session.Store(collectRequest);
            collectExecution.RequestId = collectRequest.Oid;
            return collectRequest;

        }