Ejemplo n.º 1
0
        public virtual void testFitsContext()
        {
            JDFDoc  d = new JDFDoc(ElementName.TEST);
            JDFTest t = (JDFTest)d.getRoot();

            t.init();
            t.setContext("//JDF");
            JDFDoc  jdf  = new JDFDoc(ElementName.JDF);
            JDFNode node = jdf.getJDFRoot();

            node.setType(EnumType.ProcessGroup);
            JDFNode     node2 = node.addJDFNode("foobar");
            JDFResource r2    = node.addResource("res", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);

            Assert.IsTrue(t.fitsContext(node));
            Assert.IsTrue(t.fitsContext(node2));
            t.setContext("JDF");
            Assert.IsTrue(t.fitsContext(node));
            Assert.IsTrue(t.fitsContext(node2));
            t.setContext("/JDF");
            Assert.IsTrue(t.fitsContext(node));
            Assert.IsFalse(t.fitsContext(node2));
            t.setContext("res");
            Assert.IsTrue(t.fitsContext(r2));
            t.setContext("/res");
            Assert.IsFalse(t.fitsContext(r2));
        }
Ejemplo n.º 2
0
        public virtual void testIsPresentPartition()
        {
            JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.IsPresentEvaluation, true);
            JDFTest   tst = act.getTest();

            tst.setContext("//Component");
            JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)tst.getTerm();

            ipe.setRefTarget(ptState);
            Assert.AreEqual(ptState.getID(), ipe.getrRef());

            JDFDoc  doc  = new JDFDoc("JDF");
            JDFNode node = doc.getJDFRoot();

            node.setType("fnarf", false);
            JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null);

            comp.setProductType("Cover");

            XMLDoc   rep     = new XMLDoc("root", null);
            KElement eRep    = rep.getRoot();
            bool     fitsJDF = tst.fitsJDF(comp, eRep);

            Assert.IsTrue(fitsJDF);
            comp    = (JDFComponent)comp.addPartition(EnumPartIDKey.SheetName, "s1");
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsTrue(fitsJDF, "also partition leaves ");
        }
Ejemplo n.º 3
0
        public virtual void testAction()
        {
            JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.or, false);
            JDFTest   tst = act.getTest();

            tst.setContext("/JDF/ResourcePool/Component");
            JDFor or = (JDFor)((JDFnot)tst.getTerm()).getTerm(EnumTerm.or, 0);
            JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)or.appendTerm(EnumTerm.IsPresentEvaluation);

            ipe.setRefTarget(ptState);
            Assert.AreEqual(ptState.getID(), ipe.getrRef());

            JDFEnumerationEvaluation enev = (JDFEnumerationEvaluation)or.appendTerm(EnumTerm.EnumerationEvaluation);

            enev.setRefTarget(compState);
            enev.setRegExp("(.+ )*FinalProduct( .+)*");

            JDFDoc  doc  = new JDFDoc("JDF");
            JDFNode node = doc.getJDFRoot();

            node.setType("fnarf", false);
            JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null);

            XMLDoc   rep     = new XMLDoc("root", null);
            KElement eRep    = rep.getRoot();
            bool     fitsJDF = tst.fitsJDF(comp, eRep);

            Assert.IsTrue(fitsJDF);

            comp.setProductType("foobar");
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have pt");

            List <ValuedEnum> v = new List <ValuedEnum>();

            v.Add(EnumComponentType.FinalProduct);
            comp.setComponentType(v);
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have both");

            comp.removeAttribute("ProductType");
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have final");

            v = new List <ValuedEnum>();
            v.Add(EnumComponentType.PartialProduct);
            comp.setComponentType(v);
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsTrue(fitsJDF, "have no final");
        }