Ejemplo n.º 1
0
        public virtual void testMediaCatalog()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            jmf.setSenderID("DeviceSenderID");

            JDFQuery q = jmf.appendQuery(EnumType.Resource);

            q.setXMLComment("This is the query for a catalog");

            JDFResourceQuParams rqp = q.appendResourceQuParams();

            rqp.setExact(true);
            rqp.setXMLComment("Scope=Allowed is a new attribute to describe that we want a complet list of all known resources");
            rqp.setResourceName(ElementName.MEDIA);
            //		rqp.setAttribute("Scope", "Allowed");

            JDFResponse r = q.createResponse().getResponse(0);

            r = (JDFResponse)jmf.moveElement(r, null);
            r.setXMLComment("This is the response to the query - generally it will be in it's own jmf...\nThe list of ResourceInfo + the ResourceQuParams could also be specified in a Signal.");

            for (int i = 1; i < 5; i++)
            {
                JDFResourceInfo ri = r.appendResourceInfo();
                ri.setResourceName("Media");
                JDFMedia m = (JDFMedia)ri.appendResource("Media");
                m.setDescriptiveName("Description of Media #" + i);
                m.setDimensionCM(new JDFXYPair(i * 10, 13 + i % 2 * 20));
                m.setBrand("Brand #" + i);
                m.setProductID("ProductID_" + i);
                m.setMediaType(EnumMediaType.Paper);
                m.setResStatus((i < 2 ? EnumResStatus.Available : EnumResStatus.Unavailable), false);
                ri.setXMLComment("More attributes can be added as needed; Available = loaded");
            }
            doc.write2File(sm_dirTestDataTemp + "MediaCatalog.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
        }