示例#1
0
        public virtual void testGetResource()
        {
            JDFDoc          doc = new JDFDoc(ElementName.JMF);
            JDFJMF          jmf = doc.getJMFRoot();
            JDFCommand      c   = jmf.appendCommand(EnumType.PipePull);
            JDFPipeParams   pp  = c.appendPipeParams();
            JDFExposedMedia xm  = (JDFExposedMedia)pp.appendResource(ElementName.EXPOSEDMEDIA);

            Assert.AreEqual(EnumResourceClass.Handling, xm.getResourceClass());
            JDFMedia m = (JDFMedia)pp.appendResource(ElementName.MEDIA);

            Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass());
            JDFRefElement rm = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget());
            Assert.AreEqual(xm, pp.getResource(ElementName.EXPOSEDMEDIA));
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(m, pp.getResource(ElementName.MEDIA));
            try
            {
                Assert.IsNull(pp.getResource("MediaLink"));
                Assert.Fail();
            }
            catch (JDFException)
            {
                // nop
            }

            JDFResourceLink rl = pp.appendResourceLink(ElementName.EXPOSEDMEDIA, true);

            rl.setrRef(xm.getID());
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(rl.getTarget(), pp.getResource(null));
        }