Search in sources :

Example 6 with ALeaf

use of com.ge.verdict.synthesis.dtree.ALeaf in project VERDICT by ge-high-assurance.

the class DTreeConstructorTest method testUnmitigatedMixed.

@Test
public void testUnmitigatedMixed() {
    DLeaf.Factory factory = new DLeaf.Factory();
    CostModel dummyCosts = new CostModel(new File(getClass().getResource("dummyCosts.xml").getPath()));
    int dal = 5;
    SystemModel system = new SystemModel("S1");
    Attack attack1 = new Attack(system.getAttackable(), "A1", "An attack", Prob.certain(), CIA.I);
    Attack attack2 = new Attack(system.getAttackable(), "A2", "An attack", Prob.certain(), CIA.I);
    Defense defense1 = new Defense(attack1);
    defense1.addDefenseClause(Collections.singletonList(new Defense.DefenseLeaf("D1", Optional.empty())));
    ADTree adtree = new ADOr(new ADNot(defense1), attack1, attack2);
    Fraction[] costs = Util.fractionCosts(new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
    DTree dtree = new DAnd(Arrays.asList(new DOr(Collections.singletonList(new DAnd(Collections.singletonList(new DLeaf("S1", "D1", "A1", 0, dal, costs, factory))))), new ALeaf(attack2)));
    Assertions.assertThat(DTreeConstructor.construct(adtree, dummyCosts, dal, false, false, factory).prettyPrint()).isEqualTo(dtree.prettyPrint());
}
Also used : DLeaf(com.ge.verdict.synthesis.dtree.DLeaf) ADNot(com.ge.verdict.attackdefensecollector.adtree.ADNot) DTree(com.ge.verdict.synthesis.dtree.DTree) ADTree(com.ge.verdict.attackdefensecollector.adtree.ADTree) ADOr(com.ge.verdict.attackdefensecollector.adtree.ADOr) DOr(com.ge.verdict.synthesis.dtree.DOr) ALeaf(com.ge.verdict.synthesis.dtree.ALeaf) Fraction(org.apache.commons.math3.fraction.Fraction) Attack(com.ge.verdict.attackdefensecollector.adtree.Attack) ADAnd(com.ge.verdict.attackdefensecollector.adtree.ADAnd) DAnd(com.ge.verdict.synthesis.dtree.DAnd) Defense(com.ge.verdict.attackdefensecollector.adtree.Defense) ADTree(com.ge.verdict.attackdefensecollector.adtree.ADTree) SystemModel(com.ge.verdict.attackdefensecollector.model.SystemModel) ADOr(com.ge.verdict.attackdefensecollector.adtree.ADOr) File(java.io.File) Test(org.junit.Test)

Aggregations

ADTree (com.ge.verdict.attackdefensecollector.adtree.ADTree)6 ALeaf (com.ge.verdict.synthesis.dtree.ALeaf)6 DLeaf (com.ge.verdict.synthesis.dtree.DLeaf)6 DTree (com.ge.verdict.synthesis.dtree.DTree)6 Attack (com.ge.verdict.attackdefensecollector.adtree.Attack)5 ADOr (com.ge.verdict.attackdefensecollector.adtree.ADOr)4 SystemModel (com.ge.verdict.attackdefensecollector.model.SystemModel)4 DOr (com.ge.verdict.synthesis.dtree.DOr)4 Test (org.junit.Test)4 Defense (com.ge.verdict.attackdefensecollector.adtree.Defense)3 ADAnd (com.ge.verdict.attackdefensecollector.adtree.ADAnd)2 ADNot (com.ge.verdict.attackdefensecollector.adtree.ADNot)2 Approach (com.ge.verdict.synthesis.VerdictSynthesis.Approach)2 DAnd (com.ge.verdict.synthesis.dtree.DAnd)2 DCondition (com.ge.verdict.synthesis.dtree.DCondition)2 File (java.io.File)2 LinkedHashSet (java.util.LinkedHashSet)2 Fraction (org.apache.commons.math3.fraction.Fraction)2 AttackDefenseCollector (com.ge.verdict.attackdefensecollector.AttackDefenseCollector)1 DefenseCondition (com.ge.verdict.attackdefensecollector.adtree.DefenseCondition)1