Beispiel #1
0
        public virtual void testMediaRef()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.EXPOSEDMEDIA);

            JDFResourceInfo ri = s.appendResourceInfo();
            JDFExposedMedia xm = (JDFExposedMedia)ri.appendElement("ExposedMedia");

            JDFResourceInfo ri2 = s.appendResourceInfo();
            JDFMedia        m   = (JDFMedia)ri2.appendElement("Media");
            JDFRefElement   rm  = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget(), "works initially ");
            Assert.AreEqual(m, rm.getTarget(), "also works with cache");
        }
Beispiel #2
0
        public virtual void testUsageCounter()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.USAGECOUNTER);

            JDFResourceInfo ri = s.appendResourceInfo();

            ri.setActualAmount(42);
            JDFUsageCounter uc = (JDFUsageCounter)ri.appendElement(ElementName.USAGECOUNTER);

            uc.setID("UsageCounterID");
            uc.setScope(EnumScope.Job);
            uc.setCounterID("DeviceCounterID");
            uc.setResStatus(EnumResStatus.Available, true);
            uc.setCounterTypes(new VString("NormalSize", " "));
            doc.write2File(sm_dirTestDataTemp + "JMFResourceSignal.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
        }
Beispiel #3
0
        ///
        ///	 <summary> * sets all relevant parameters of this to the values specified in resourceLink or its linked resource or JDF node
        ///	 *  </summary>
        ///	 * <param name="resourceLink"> the resourceLink to extract the information from </param>
        ///	 * <param name="rqp"> parameters </param>
        ///
        public virtual void setLink(JDFResourceLink resourceLink, JDFResourceQuParams rqp)
        {
            if (resourceLink == null)
            {
                return;
            }
            JDFAmountPool ap = resourceLink.getAmountPool();

            if (ap != null)
            {
                copyElement(ap, null);
            }
            else
            {
                if (resourceLink.hasAttribute(AttributeName.ACTUALAMOUNT))
                {
                    setActualAmount(resourceLink.getActualAmount(null));
                }
                if (resourceLink.hasAttribute(AttributeName.AMOUNT))
                {
                    setAmount(resourceLink.getAmount(null));
                }
            }
            setProcessUsage(resourceLink.getEnumProcessUsage());

            JDFResource r = resourceLink.getTarget();

            if (r == null && rqp != null)
            {
                rqp.setExact(false);
            }

            bool bExact = rqp == null ? false : rqp.getExact();

            if (!bExact || r == null) // if we do not have a resource let's limp
            // along and provide as much as we have
            {
                setResourceName(resourceLink.getLinkedResourceName());
                setAttribute(AttributeName.RESOURCEID, resourceLink.getrRef());
                EnumUsage usage = resourceLink.getUsage();
                if (usage != null)
                {
                    setAttribute(AttributeName.USAGE, usage.getName());
                }
                if (r != null && r.hasAttribute(AttributeName.PRODUCTID))
                {
                    setProductID(r.getProductID());
                }
            }
            else
            {
                // create a copy of the resource in the original jdf
                JDFResource rr = (JDFResource)r.getParentNode_KElement().copyElement(r, null);
                rr.inlineRefElements(null, null, true);
                // move resource copy from the original node into this document
                moveElement(rr, null);
            }
        }
Beispiel #4
0
        public virtual void testGetIdentifier()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFQuery c = jmf.appendQuery();

            jmf.setSenderID("MISSenderID");
            c.setType(EnumType.Resource);
            JDFResourceQuParams rqp = c.getCreateResourceQuParams(0);

            rqp.setJobID("J1");
            rqp.setJobPartID("p2");
            Assert.AreEqual(new NodeIdentifier("J1", "p2", null), rqp.getIdentifier());
        }
Beispiel #5
0
        public virtual void testResourceQuParams()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFQuery c = jmf.appendQuery();

            jmf.setSenderID("MISSenderID");
            c.setType(EnumType.Resource);
            JDFResourceQuParams rqp      = c.getCreateResourceQuParams(0);
            List <ValuedEnum>   vClasses = new List <ValuedEnum>();

            vClasses.Add(EnumResourceClass.Consumable);
            vClasses.Add(EnumResourceClass.Handling);
            rqp.setClasses(vClasses);
            Assert.AreEqual(vClasses.ToString(), rqp.getClasses().ToString());
        }
Beispiel #6
0
        public virtual void testMedia()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.MEDIA);

            JDFResourceInfo ri = s.appendResourceInfo();

            ri.getCreateAmountPool();
            // TODO continue
        }
Beispiel #7
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));
        }