Esempio n. 1
0
        public virtual void testMultiModule()
        {
            StatusCounter scRIP = new StatusCounter(n,null,null);

            scRIP.addModule("ID_RIP","RIP");
            StatusCounter scSetter = new StatusCounter(n,null,null);

            scSetter.addModule("ID_Setter","Platesetter");

            MultiModuleStatusCounter msc = new MultiModuleStatusCounter();

            msc.addModule(scRIP);
            msc.addModule(scSetter);

            JDFExposedMedia m = (JDFExposedMedia)n.getMatchingResource("ExposedMedia",null,null,0);

            resID = m.getID();
            scRIP.setFirstRefID(resID);
            scRIP.addPhase(resID,200,0,true);
            bool bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = scRIP.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);
            JDFJobPhase   jp         = deviceInfo.getJobPhase(0);

            Assert.AreEqual(200,jp.getAmount(),0);
            scRIP.addPhase(resID,0,100,true);
            scRIP.setTrackWaste(m.getID(),true);
            bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");
            Assert.IsFalse(bChanged);
            JDFDoc dJMFAll = msc.getStatusResponse();

            Assert.AreEqual(dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,1);
            scSetter.setPhase(EnumNodeStatus.InProgress,"seti",EnumDeviceStatus.Running,"run");
            scSetter.setFirstRefID(resID);
            scSetter.addPhase(resID,400,0,true);
            dJMFAll = msc.getStatusResponse();
            Assert.AreEqual(2,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,"1 RIP, 1 setter");

            scRIP.setActiveNode(null,null,null);
            bChanged = scRIP.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(1,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);

            scSetter.setActiveNode(null,null,null);
            bChanged = scSetter.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(0,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);
        }
Esempio n. 2
0
        public virtual void testStateReportRequired()
        {
            JDFDoc    d  = new JDFDoc("DevCap");
            JDFDevCap dc = (JDFDevCap)d.getRoot();

            dc.setName("foo");
            JDFIntegerState @is = dc.appendIntegerState();

            @is.setName("bar1");
            @is.setRequired(true);
            JDFIntegerState is2 = dc.appendIntegerState();

            is2.setName("bar2");
            is2.setRequired(false);

            JDFDoc   d2  = new JDFDoc("foo");
            KElement foo = d2.getRoot();

            JDFDoc   d3     = new JDFDoc("parent");
            KElement parent = d3.getRoot();

            dc.stateReport(foo, EnumFitsValue.Allowed, EnumValidationLevel.Complete, false, true, parent);
            Assert.IsTrue(parent.ToString().IndexOf("bar1") >= 0);
            Assert.IsFalse(parent.ToString().IndexOf("bar2") >= 0);
        }
Esempio n. 3
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc("DurationState");

            iState = (JDFDurationState)doc.getRoot();
        }
Esempio n. 4
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc("IntegerState");

            iState = (JDFIntegerState)doc.getRoot();
        }
Esempio n. 5
0
        public override void setUp()
        {
            base.setUp();
            JDFElement.setLongID(false);

            JDFDoc doc = new JDFDoc("Device");

            device = (JDFDevice)doc.getRoot();

            devicecap = device.appendDeviceCap();
            devicecap.setCombinedMethod(EnumCombinedMethod.None);
            devicecap.setTypeExpression("(fnarf)|(blub)");
            devicecap.setTypes(new VString("fnarf blub", null));
            JDFDevCapPool dcp = devicecap.appendDevCapPool();
            JDFDevCaps    dcs = devicecap.appendDevCaps();

            dcs.setContext(EnumContext.Resource);
            dcs.setName("Component");
            dcs.setRequired(true);
            JDFDevCap dc = dcp.appendDevCap();

            dc.setID("dc_Component");
            dcs.setDevCapRef(dc);
            compState = dc.appendEnumerationState("ComponentType");
            ptState   = dc.appendNameState("ProductType");
        }
Esempio n. 6
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc("MatrixState");

            sState = (JDFMatrixState)doc.getRoot();
        }
Esempio n. 7
0
        public override void setUp()
        {
            // TODO Auto-generated method stub
            base.setUp();
            JDFDoc doc = new JDFDoc(ElementName.QUEUE);

            q = (JDFQueue)doc.getRoot();
            JDFQueueEntry qe = q.appendQueueEntry();

            qe.setQueueEntryID("qe1");
            qe.setJobID("j1");
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Waiting);
            qe.setPriority(5);
            qe = q.appendQueueEntry();
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Waiting);
            qe.setPriority(55);
            qe.setQueueEntryID("qe2");
            qe.setJobID("j2");
            qe = q.appendQueueEntry();
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Held);
            qe.setPriority(99);
            qe.setQueueEntryID("qe3");
            qe.setJobID("j3");
            qe = q.appendQueueEntry();
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Completed);
            qe.setQueueEntryID("qe4");
            qe.setJobID("j4");
            qe = q.appendQueueEntry();
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Running);
            qe.setQueueEntryID("qe5");
            qe.setJobID("j5");
            iThread = 0;
        }
Esempio n. 8
0
        public virtual void testMergeLastPhase()
        {
            JDFDoc       d  = new JDFDoc("JDF");
            JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool();
            JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null);
            JDFJobPhase  jp = di.createJobPhaseFromPhaseTime(pt);

            jp.setPhaseAmount(200);
            jp.setAmount(200);
            jp.setPhaseWaste(100);
            JDFDate       d1  = jp.getPhaseStartTime();
            JDFDoc        doc = new JDFDoc(ElementName.DEVICEINFO);
            JDFDeviceInfo di2 = (JDFDeviceInfo)doc.getRoot();

            JDFJobPhase jp2 = (JDFJobPhase)di2.copyElement(jp, null);

            jp2.setPhaseStartTime(new JDFDate());
            StatusCounter.sleep(1000);
            jp2.setPhaseAmount(300);
            jp2.setPhaseWaste(30);
            jp2.setAmount(500);
            Assert.IsTrue(di2.mergeLastPhase(di));
            Assert.AreEqual(d1, jp2.getPhaseStartTime());
            Assert.AreEqual(130.0, jp2.getPhaseWaste(), 0.0);
            Assert.AreEqual(500.0, jp2.getPhaseAmount(), 0.0);
            Assert.AreEqual(500.0, jp2.getAmount(), 0.0);
        }
Esempio n. 9
0
        public virtual void testgetMatchingElementsFromParentSingle()
        {
            JDFDoc    ddc = new JDFDoc("DevCap");
            JDFDoc    dde = new JDFDoc("Layout");
            JDFDevCap dc  = (JDFDevCap)ddc.getRoot();
            JDFLayout e   = (JDFLayout)dde.getRoot();

            JDFDevCap dc1 = dc.appendDevCap();

            dc1.setName("Media");
            dc1.setMaxOccurs(1);
            dc1.setMinOccurs(1);

            for (int i = 0; i < 2; i++)
            {
                string mediaType = i == 0 ? "Paper" : "Plate";
                e.appendElement("Media").setAttribute("MediaType", mediaType);
            }
            VElement devCapVector = dc.getDevCapVector(null, true);
            VElement vMatch       = ((JDFDevCap)devCapVector.item(0)).getMatchingElementsFromParent(e, devCapVector);

            Assert.AreEqual(2, vMatch.Count);
            Assert.AreEqual(e.getElement("Media", null, 0), vMatch.item(0));
            Assert.AreEqual(e.getElement("Media", null, 1), vMatch.item(1));
        }
Esempio n. 10
0
 public virtual void testNonAsciiFileURL()
 {
     for (int i = 0; i < 2; i++) // loop over escape and non-escape
     {
         FileInfo f  = new FileInfo("4€5%äö.txt");
         FileInfo f2 = FileUtil.getFileInDirectory(new DirectoryInfo(sm_dirTestDataTemp), f);
         f2.Delete();
         SupportClass.FileSupport.CreateNewFile(f2);
         f2.Refresh();
         Assert.IsTrue(f2.Exists);
         string   url  = UrlUtil.fileToUrl(f2, i == 0);
         XMLDoc   doc  = new XMLDoc("URL", null);
         KElement root = doc.getRoot();
         root.setAttribute("url", url);
         doc.write2File(sm_dirTestDataTemp + "url.xml", 2, false);
         JDFParser p = new JDFParser();
         p.bKElementOnly = true;
         JDFDoc   d        = p.parseFile(sm_dirTestDataTemp + "url.xml");
         KElement root2    = d.getRoot();
         string   urlParse = root2.getAttribute("url");
         Assert.AreEqual(url, urlParse);
         FileInfo f3 = UrlUtil.urlToFile(urlParse);
         Assert.AreEqual(f2.FullName, f3.FullName);
         Assert.IsTrue(f3.Exists);
     }
 }
Esempio n. 11
0
        public virtual void testgetMatchingElementsFromParentMulti()
        {
            JDFDoc    ddc = new JDFDoc("DevCap");
            JDFDoc    dde = new JDFDoc("Layout");
            JDFDevCap dc  = (JDFDevCap)ddc.getRoot();
            JDFLayout e   = (JDFLayout)dde.getRoot();

            for (int i = 0; i < 2; i++)
            {
                JDFDevCap dc1 = dc.appendDevCap();
                dc1.setName("Media");
                dc1.setMaxOccurs(1);
                dc1.setMinOccurs(1);
                JDFEnumerationState es = dc1.appendEnumerationState("MediaType");
                string mediaType       = i == 0 ? "Paper" : "Plate";
                es.setAllowedValueList(new VString(mediaType, null));

                e.appendElement("Media").setAttribute("MediaType", mediaType);
            }
            VElement devCapVector = dc.getDevCapVector(null, true);

            for (int i = 0; i < 2; i++)
            {
                VElement vMatch = ((JDFDevCap)devCapVector.item(i)).getMatchingElementsFromParent(e, devCapVector);
                Assert.AreEqual(1, vMatch.Count);
                Assert.AreEqual(e.getElement("Media", null, i), vMatch.item(0));
            }
        }
Esempio n. 12
0
        public virtual void testEvent()
        {
            Assert.IsNull(sc.getDocJMFNotification(false));
            sc.setEvent("id", "value", "blah blah");
            d = sc.getDocJMFNotification(false);
            JDFDoc d2 = sc.getDocJMFNotification(false);

            Assert.IsTrue(d.getRoot().isEqual(d2.getRoot()));
            d  = sc.getDocJMFNotification(true);
            d2 = sc.getDocJMFNotification(false);
            Assert.IsNull(d2);
            JDFJMF          jmf  = d.getJMFRoot();
            JDFNotification noti = jmf.getSignal(0).getNotification();

            Assert.AreEqual(noti.getJobID(), n.getJobID(true));
            Assert.IsNotNull(noti.getEvent());
            d.write2File(sm_dirTestDataTemp + "jmfNotification.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
            sc.setEvent("id1", "value", "blah blah");
            sc.setEvent("id2", "value", "blah blah blah");
            d   = sc.getDocJMFNotification(false);
            jmf = d.getJMFRoot();
            Assert.AreEqual(2, jmf.numChildElements(ElementName.SIGNAL,null));
            sc.setEvent("id2","value","blah blah blah");
            d   = sc.getDocJMFNotification(true);
            jmf = d.getJMFRoot();
            Assert.AreEqual(3,jmf.numChildElements(ElementName.SIGNAL,null));
            d = sc.getDocJMFNotification(true);
            Assert.IsNull(d);
        }
Esempio n. 13
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));
        }
Esempio n. 14
0
        public virtual void testEnumerationState()
        {
            JDFDoc d = new JDFDoc("EnumerationState");
            JDFEnumerationState es = (JDFEnumerationState)d.getRoot();
            VString             v  = new VString();

            v.Add("foo");
            v.Add("bar");

            es.setAllowedValueList(v);
            Assert.IsTrue(es.fitsValue("foo", EnumFitsValue.Allowed));
            Assert.IsTrue(es.fitsValue("bar", EnumFitsValue.Allowed));
            Assert.IsFalse(es.fitsValue("fnarf", EnumFitsValue.Allowed));

            es.setListType(EnumListType.List);
            Assert.IsTrue(es.fitsValue("foo", EnumFitsValue.Allowed));
            Assert.IsTrue(es.fitsValue("foo bar", EnumFitsValue.Allowed));
            Assert.IsTrue(es.fitsValue("foo bar foo", EnumFitsValue.Allowed));
            Assert.IsFalse(es.fitsValue("foo bar fnarf", EnumFitsValue.Allowed));

            es.setListType(EnumListType.CompleteList);
            Assert.IsFalse(es.fitsValue("foo", EnumFitsValue.Allowed));
            Assert.IsTrue(es.fitsValue("foo bar", EnumFitsValue.Allowed));
            Assert.IsTrue(es.fitsValue("bar foo", EnumFitsValue.Allowed));
            Assert.IsFalse(es.fitsValue("foo bar foo", EnumFitsValue.Allowed));
            Assert.IsFalse(es.fitsValue("foo bar fnarf", EnumFitsValue.Allowed));

            // TODO implement more list types
            // es.setListType(EnumListType.OrderedList);
            // Assert.IsFalse(es.fitsValue("foo", EnumFitsValue.Allowed));
            // Assert.IsTrue(es.fitsValue("foo bar", EnumFitsValue.Allowed));
            // Assert.IsFalse(es.fitsValue("bar foo", EnumFitsValue.Allowed));
            // Assert.IsFalse(es.fitsValue("foo bar foo", EnumFitsValue.Allowed));
            // Assert.IsFalse(es.fitsValue("foo bar fnarf", EnumFitsValue.Allowed));
        }
Esempio n. 15
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc("NameState");

            theState = (JDFNameState)doc.getRoot();
            theState.setAllowedValueList(new VString("a b c d", null));
        }
Esempio n. 16
0
        public override void setUp()
        {
            base.setUp();
            JDFElement.setLongID(false);
            JDFDoc doc = new JDFDoc(ElementName.DEVICEINFO);

            di = (JDFDeviceInfo)doc.getRoot();
        }
Esempio n. 17
0
        public virtual void testsetFamily()
        {
            JDFDoc            doc = new JDFDoc(ElementName.MESSAGESERVICE);
            JDFMessageService ms  = (JDFMessageService)doc.getRoot();

            ms.setFamily(EnumFamily.Query);
            Assert.IsTrue(ms.getQuery());
        }
Esempio n. 18
0
        public override void setUp()
        {
            // TODO Auto-generated method stub
            base.setUp();
            JDFDoc d = new JDFDoc("ComChannel");

            cc = (JDFComChannel)d.getRoot();
        }
Esempio n. 19
0
        public override void setUp()
        {
            // TODO Auto-generated method stub
            base.setUp();
            JDFDoc d = new JDFDoc("Person");

            person = (JDFPerson)d.getRoot();
        }
Esempio n. 20
0
        public virtual void testSetMimeURL()
        {
            JDFDoc      d  = new JDFDoc("FileSpec");
            JDFFileSpec fs = (JDFFileSpec)d.getRoot();

            fs.setMimeURL("file:/c/test.pdf");
            Assert.AreEqual("application/pdf", fs.getMimeType());
            Assert.AreEqual("file:/c/test.pdf", fs.getURL());
        }
Esempio n. 21
0
        public virtual void testGetCombinedMethod()
        {
            JDFDoc            d  = new JDFDoc(ElementName.DEVICECAP);
            JDFDeviceCap      dc = (JDFDeviceCap)d.getRoot();
            List <ValuedEnum> v  = new List <ValuedEnum>();

            v.Add(EnumCombinedMethod.None);
            CollectionAssert.AreEqual(v, dc.getCombinedMethod(), "default is none");
        }
Esempio n. 22
0
        public virtual void testGetAvailability()
        {
            JDFDoc    d  = new JDFDoc("DevCap");
            JDFDevCap dc = (JDFDevCap)d.getRoot();

            dc.setAvailability(EnumAvailability.NotInstalled);
            Assert.AreEqual(EnumAvailability.NotInstalled, dc.getAvailability());
            Assert.AreEqual(EnumAvailability.NotInstalled, dc.getModuleAvailability());
        }
Esempio n. 23
0
        public void testFitsValue_StringState()
        {
            JDFDoc         jdfDoc = new JDFDoc(ElementName.STRINGSTATE);
            JDFStringState root   = (JDFStringState)jdfDoc.getRoot();

            root.appendValueAllowedValue("foo");
            Assert.IsTrue(root.fitsValue("foo", EnumFitsValue.Allowed));
            Assert.IsFalse(root.fitsValue("bar", EnumFitsValue.Allowed));
        }
        public override void setUp()
        {
            base.setUp();
            JDFDoc d = new JDFDoc(ElementName.QUEUE);

            theQueue = (JDFQueue)d.getRoot();
            d        = new JDFDoc(ElementName.JMF);
            theJMF   = d.getJMFRoot();
            qsp      = theJMF.appendCommand(EnumType.SubmitQueueEntry).appendQueueSubmissionParams();
        }
Esempio n. 25
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc d = new JDFDoc(ElementName.QUEUE);

            theQueue = (JDFQueue)d.getRoot();
            d        = new JDFDoc(ElementName.JMF);
            theJMF   = d.getJMFRoot();
            filter   = theJMF.appendCommand(EnumType.AbortQueueEntry).appendQueueFilter();
        }
Esempio n. 26
0
        public override void setUp()
        {
            // TODO Auto-generated method stub
            base.setUp();

            jdfDoc  = new JDFDoc(ElementName.JDF);
            jdfRoot = (JDFNode)jdfDoc.getRoot();
            jdfRoot.setJobID("jobID");

            myAuditPool = jdfRoot.getCreateAuditPool();
        }
Esempio n. 27
0
        public virtual void testAppendResource()
        {
            JDFDoc               doc = new JDFDoc(ElementName.PIPEPARAMS);
            JDFPipeParams        pp  = (JDFPipeParams)doc.getRoot();
            JDFCoilBindingParams cbp = (JDFCoilBindingParams)pp.appendResource(ElementName.COILBINDINGPARAMS);

            Assert.AreEqual(EnumResourceClass.Parameter, cbp.getResourceClass());
            JDFHeadBandApplicationParams hap = (JDFHeadBandApplicationParams)pp.appendResource(ElementName.HEADBANDAPPLICATIONPARAMS);

            Assert.AreEqual(EnumResourceClass.Parameter, hap.getResourceClass());
        }
Esempio n. 28
0
        public virtual void testValidTest1()
        {
            JDFDoc  d = new JDFDoc(ElementName.TEST);
            JDFTest t = (JDFTest)d.getRoot();

            t.init();
            t.appendTerm(EnumTerm.IsPresentEvaluation);
            Assert.IsTrue(t.isValid(EnumValidationLevel.Complete));
            t.appendTerm(EnumTerm.BooleanEvaluation); // no two are allowed
            Assert.IsFalse(t.isValid(EnumValidationLevel.Complete));
        }
Esempio n. 29
0
        public virtual void testEnumerationEvaluation()
        {
            JDFDoc d = new JDFDoc(ElementName.ENUMERATIONEVALUATION);
            JDFEnumerationEvaluation ee = (JDFEnumerationEvaluation)d.getRoot();

            ee.setRegExp("a( b)?");
            Assert.IsTrue(ee.fitsValue("a"));
            Assert.IsTrue(ee.fitsValue("a b"));
            Assert.IsFalse(ee.fitsValue("a b c"));
            Assert.IsFalse(ee.fitsValue("c"));
        }
Esempio n. 30
0
        public virtual void testSetTolerance()
        {
            JDFDoc d = new JDFDoc(ElementName.XYPAIREVALUATION);
            JDFXYPairEvaluation ie = (JDFXYPairEvaluation)d.getRoot();

            ie.setTolerance(new JDFXYPair(1, 1));
            Assert.AreEqual("1 1", ie.getTolerance().ToString());
            ie.setValueList(new JDFXYPair(1.5, 1.5));
            ie.appendBasicPreflightTest("foo");
            Assert.IsTrue(ie.fitsMap(new JDFAttributeMap("foo", "1.2 1.6")));
        }