예제 #1
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 ");
        }
예제 #2
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");
        }