Ejemplo n.º 1
0
        public virtual void testAppendDevCapInPool_JMF()
        {
            JDFDoc            doc = new JDFDoc("MessageService");
            JDFMessageService ms  = (JDFMessageService)doc.getRoot();
            JDFDevCaps        dcs = ms.appendDevCaps();

            dcs.setName("foo");
            JDFDevCap dc = dcs.appendDevCapInPool();

            Assert.AreEqual(dc, dcs.getDevCap());
            Assert.AreEqual(dc.getName(), dcs.getName());
        }
Ejemplo n.º 2
0
        public virtual void testAppendDevCapInPool_DeviceCap()
        {
            JDFDoc       doc = new JDFDoc("DeviceCap");
            JDFDeviceCap ms  = (JDFDeviceCap)doc.getRoot();
            JDFDevCaps   dcs = ms.appendDevCaps();

            dcs.setName("foo");
            JDFDevCap dc = dcs.appendDevCapInPool();

            Assert.AreEqual(dc, dcs.getDevCap());
            Assert.AreEqual(dc.getName(), dcs.getName());
        }
Ejemplo n.º 3
0
        public virtual void testUsageCounterDevCaps()
        {
            JDFDoc       duc       = new JDFDoc("DeviceCap");
            JDFDeviceCap devicecap = (JDFDeviceCap)duc.getRoot();
            JDFDevCaps   dcs       = devicecap.appendDevCaps();

            dcs.setName(ElementName.USAGECOUNTER);
            JDFDevCap dc = dcs.appendDevCapInPool();

            dc.setMinOccurs(3);
            dc.setMaxOccurs(3);
            JDFNameState counterID = dc.appendNameState(AttributeName.COUNTERID);

            counterID.setAllowedValueList(new VString("ID_Black ID_Color ID_Total", null));
            counterID.setListType(EnumListType.SingleValue);
            duc.write2File(sm_dirTestDataTemp + "DevCapUsageCounter.jdf", 2, false);
        }
Ejemplo n.º 4
0
        public virtual void testJMFDevCaps()
        {
            JDFDoc doc   = new JDFDoc(ElementName.JMF);
            JDFJMF jmfDC = doc.getJMFRoot();

            JDFResponse r = jmfDC.appendResponse(EnumType.KnownMessages);

            jmfDC.setSenderID("DeviceSenderID");

            JDFMessageService ms = r.appendMessageService();

            ms.setJMFRole(EnumJMFRole.Sender);
            ms.setQuery(true);
            ms.setType("KnownDevices");
            JDFDevCaps dcs = ms.appendDevCaps();

            dcs.setName("DeviceList");
            JDFDevCap dc   = dcs.appendDevCapInPool();
            JDFDevCap dcDI = dc.appendDevCap();

            dcDI.setName(ElementName.DEVICEINFO);
            dcDI.setMinOccurs(1);
            dcDI.setMaxOccurs(1);
            JDFStringState state = dcDI.appendStringState(AttributeName.DEVICEID);

            state.setRequired(true);

            state = dcDI.appendStringState(AttributeName.DEVICESTATUS);
            state.setRequired(true);
            state.appendValueAllowedValue("Running");

            ms = r.appendMessageService();
            ms.setJMFRole(EnumJMFRole.Sender);
            ms.setQuery(true);
            ms.setType("KnownMessages");
            dcs = ms.appendDevCaps();
            dcs.setName("MessageService");
            dc    = dcs.appendDevCapInPool();
            state = dc.appendStringState(AttributeName.TYPE);
            state.setRequired(true);
            state = dc.appendStringState("Foo");
            state.setRequired(false);

            JDFActionPool ap = ms.appendActionPool();
            JDFAction     a  = ap.appendActionTest(EnumTerm.IsPresentEvaluation, true);
            JDFTest       t  = a.getTest();

            // JDFTerm term=
            t.getTerm();
            // TODO
            JDFDoc docJMF = new JDFDoc("JMF");
            JDFJMF jmf    = docJMF.getJMFRoot();

            for (int i = 0; i < 3; i++)
            {
                JDFResponse   resp = jmf.appendResponse(EnumType.KnownDevices);
                JDFDeviceList dl   = resp.appendDeviceList();
                JDFDeviceInfo di   = dl.appendDeviceInfo();
                di.setDeviceID("d123");
                di.setDeviceStatus(EnumDeviceStatus.Running);
                XMLDoc report = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true);
                Assert.AreEqual("true", report.getRoot().getAttribute("IsValid"));
            }
            {
                JDFResponse       resp = jmf.appendResponse(EnumType.KnownMessages);
                JDFMessageService mi   = resp.appendMessageService();
                mi.setType("FooBar");
                doc.write2File(sm_dirTestDataTemp + "JMFDevCap.xml", 2, false);
                docJMF.write2File(sm_dirTestDataTemp + "JMFDevCapTest.jmf", 2, false);
            }
            XMLDoc report_1 = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true);

            Assert.AreEqual("true", report_1.getRoot().getAttribute("IsValid"));

            doc.write2File(sm_dirTestDataTemp + "JMFDevCap.xml", 2, false);
            docJMF.write2File(sm_dirTestDataTemp + "JMFDevCapTest.jmf", 2, false);
            {
                jmf.appendResponse(EnumType.AbortQueueEntry);
            }
            report_1 = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true);
            Assert.AreEqual("false", report_1.getRoot().getAttribute("IsValid"));
        }