public CollectExecutionManager(IProbeManager probeManager) { ProbeManager = probeManager; variableEvaluatorService = new VariableEvaluatorService(); collectTimeOut = new CollectTimeOutController(); Interrupted = false; }
public void Should_be_possible_to_evaluate_variables_from_request_collect() { var session = GetSession(); var collectRequest = new CollectRequestFactory() .CreateCollectRequestWithSpecificDefinitions( session, "definitionsWithLocalVariable.xml"); var evaluatedVariables = new VariableEvaluatorService().Evaluate(collectRequest, session); Assert.AreEqual(3, evaluatedVariables.GetQuantityOfVariables(), "The quantity of variables is not expected."); var variables = evaluatedVariables.GetVariableValueForVariableId("oval:org.mitre.oval:var:5000"); Assert.AreEqual(2, variables.Count(), "The quantity of variable of id 5000 is not expected."); Assert.AreEqual("oval:org.mitre.oval:obj:5000", variables.ElementAt(0).OvalComponentId, "The variable oval component id is not expected."); Assert.AreEqual(1, variables.ElementAt(0).values.Count(), 1, "The quantity of values from variable of id 5000 is not expected."); Assert.AreEqual("CurrentType", variables.ElementAt(0).values.ElementAt(0), "The value from variable of id 5000 is not expected."); variables = evaluatedVariables.GetVariableValueForVariableId("oval:org.mitre.oval:var:4000"); Assert.AreEqual(1, variables.Count(), "The quantity of variable of id 4000 is not expected"); Assert.AreEqual("oval:org.mitre.oval:obj:4000", variables.ElementAt(0).OvalComponentId, "The variable oval component id is not expected."); // not exists value because the system characteristics was not generate yet Assert.AreEqual(0, variables.ElementAt(0).values.Count(), "The quantity of values from variable of id 4000 is not expected"); }
public void Should_be_possible_to_evaluate_variables() { var session = GetSession(); string externalVariables = CreateOvalVariablesWithFakeValues(); var fakeCollectRequest = new CollectRequestFactory() .CreateCompleteCollectRequestAfterCollectWithSystemCharacteristics( session, string.Format(".definitions.{0}", FDCC_XPFIREWALL), ".system_characteristics.fdcc_xpfirewall_oval.sc.xml", CreateOvalVariablesWithFakeValues()); session.SaveChanges(); var evaluatedVariables = new VariableEvaluatorService().Evaluate(fakeCollectRequest, session); Assert.IsNotNull(evaluatedVariables); Assert.AreEqual(23, evaluatedVariables.GetQuantityOfVariables()); Assert.AreEqual("50001", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50001").Single().values.Single()); Assert.AreEqual("50031", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50031").Single().values.Single()); Assert.AreEqual("50041", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50041").Single().values.Single()); Assert.AreEqual("50051", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50051").Single().values.Single()); Assert.AreEqual("50071", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50071").Single().values.Single()); Assert.AreEqual("50081", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50081").Single().values.Single()); Assert.AreEqual("50091", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50091").Single().values.Single()); Assert.AreEqual("50111", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50111").Single().values.Single()); Assert.AreEqual("50131", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50131").Single().values.Single()); Assert.AreEqual("50141", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50141").Single().values.Single()); Assert.AreEqual("50151", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50151").Single().values.Single()); Assert.AreEqual("50161", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50161").Single().values.Single()); Assert.AreEqual("50171", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:50171").Single().values.Single()); Assert.AreEqual("51001", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51001").Single().values.Single()); Assert.AreEqual("51011", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51011").Single().values.Single()); Assert.AreEqual("51031", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51031").Single().values.Single()); Assert.AreEqual("51041", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51041").Single().values.Single()); Assert.AreEqual("51051", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51051").Single().values.Single()); Assert.AreEqual("51071", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51071").Single().values.Single()); Assert.AreEqual("51081", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51081").Single().values.Single()); Assert.AreEqual("51091", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51091").Single().values.Single()); Assert.AreEqual("51111", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51111").Single().values.Single()); Assert.AreEqual("51131", evaluatedVariables.GetVariableValueForVariableId("oval:gov.nist.fdcc.xpfirewall:var:51131").Single().values.Single()); }