Пример #1
0
        public virtual void testValidateExtensionschema()
        {
            JDFDoc       doc      = new JDFDoc("JDF");
            JDFValidator checkJDF = new JDFValidator();

            checkJDF.setPrint(false);
            checkJDF.bQuiet = true;
            checkJDF.level  = EnumValidationLevel.Incomplete;
            DirectoryInfo foo = new DirectoryInfo(sm_dirTestSchema);

            Assert.IsTrue(foo.Exists, "please mount the svn schema parallel to JDFLibNet");
            FileInfo jdfxsd = new FileInfo(sm_dirTestSchema + "JDF.xsd");

            checkJDF.setJDFSchemaLocation(jdfxsd);
            JDFNode n = doc.getJDFRoot();

            n.setType(EnumType.ConventionalPrinting);
            JDFMedia med = (JDFMedia)n.addResource("Media", null, EnumUsage.Input, null, null, null, null);

            checkJDF.setIgnorePrivate(false);
            doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true);
            XMLDoc @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf");

            Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile/SchemaValidationOutput/@ValidationResult", null), "Valid");

            checkJDF.schemaLocation += " http://www.extension.com " + sm_dirTestData + "extension.xsd";
            med.setAttribute("ext:ExtensionAtt", "a", "http://www.extension.com");
            KElement fooBar = med.appendElement("ext:FooBar", "http://www.extension.com");

            fooBar.setAttribute("ID", "f1");
            fooBar.setAttribute("Fnarf", "4");

            doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true);
            @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf");
            Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[2]/SchemaValidationOutput/@ValidationResult", null), "Error");

            med.setAttribute("ext:ExtensionAtt", "3", "http://www.extension.com");
            doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true);
            @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf");
            Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[3]/SchemaValidationOutput/@ValidationResult", null), "Valid");

            fooBar.setAttribute("Fnarf", "bad");
            doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true);
            @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf");
            Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[4]/SchemaValidationOutput/@ValidationResult", null), "Error");
        }
Пример #2
0
        public virtual void testCombinedVarnish()
        {
            JDFElement.setLongID(false);
            JDFDoc  d            = new JDFDoc("JDF");
            JDFNode n            = d.getJDFRoot();
            VString vCombiNodes  = new VString("ConventionalPrinting Varnishing", " ");
            VString vSeparations = new VString("Cyan Magenta Yellow Black Varnish", " ");

            n.setCombined(vCombiNodes);

            JDFConventionalPrintingParams cpp = (JDFConventionalPrintingParams)n.addResource(ElementName.CONVENTIONALPRINTINGPARAMS, null, EnumUsage.Input, null, null, null, null);

            cpp.setModuleAvailableIndex(new JDFIntegerRangeList("1 ~ 6"));
            cpp.setModuleIndex(new JDFIntegerRangeList("1 ~ 4 6"));
            cpp.appendXMLComment("Module 0 and 7 are varnishing modules, 1-4 are process colors and 6 is the ink module used to varnish", null);
            n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null);
            JDFExposedMedia xm = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null);

            n.appendNodeInfo();
            JDFMedia media = xm.appendMedia();

            media.setMediaType(EnumMediaType.Plate);
            JDFInk ink = (JDFInk)n.appendMatchingResource("Ink", JDFNode.EnumProcessUsage.AnyInput, null);

            JDFResource     vp           = n.addResource("VarnishingParams", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);
            JDFExposedMedia xmVarnish    = (JDFExposedMedia)n.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null);
            JDFMedia        mediaVarnish = xmVarnish.appendMedia();

            mediaVarnish.setAttribute("MediaType", "Sleeve");

            JDFResourceLink    rl = n.getLink(xmVarnish, null);
            JDFColorantControl cc = (JDFColorantControl)n.appendMatchingResource(ElementName.COLORANTCONTROL, JDFNode.EnumProcessUsage.AnyInput, null);

            cc.getCreateDeviceColorantOrder().appendXMLComment("Should the VarnishingParams seps be excluded, as is shown here?", null);
            cc.getCreateDeviceColorantOrder().setSeparations(vSeparations);

            rl.setCombinedProcessIndex(new JDFIntegerList("1"));
            vSeparations.addAll(new VString("PreVarnish Varnish2", " "));

            for (int i = 0; i < vSeparations.Count; i++)
            {
                string sep = vSeparations.stringAt(i);
                ink.addPartition(EnumPartIDKey.Separation, sep);
                if (!sep.Equals("PreVarnish") && !sep.Equals("Varnish2"))
                {
                    xm.addPartition(EnumPartIDKey.Separation, sep);
                }
                if (sep.Equals("Varnish2"))
                {
                    vp.appendXMLComment("full varnishing in a varnishing module with or wihtout a sleeve. Full varnishing means to cover the complete media surface.", null);
                    xmVarnish.addPartition(EnumPartIDKey.Separation, sep);
                    JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep);
                    varnishPart.setAttribute("ModuleIndex", "7");
                    varnishPart.setAttribute("VarnishMethod", "Sleeve");
                    varnishPart.setAttribute("VarnishArea", "Spot");
                }
                else if (sep.Equals("Varnish"))
                {
                    vp.appendXMLComment("varnishing in a printing module only  with a mandatory plate. The plate may be exposed or not, for example,  for full varnihing. ", null);
                    // xmVarnish.addPartition(EnumPartIDKey.Separation, sep);
                    JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep);
                    varnishPart.setAttribute("ModuleIndex", "6");
                    varnishPart.setAttribute("VarnishMethod", "Plate");
                    varnishPart.setAttribute("VarnishArea", "Full");
                }
                else if (sep.Equals("PreVarnish"))
                {
                    vp.appendXMLComment("varnishing in a varnishing module only with a mandatory prepared sleeve ", null);
                    xmVarnish.addPartition(EnumPartIDKey.Separation, sep);
                    JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep);
                    varnishPart.setAttribute("ModuleIndex", "0");
                    varnishPart.setAttribute("VarnishMethod", "Sleeve");
                    varnishPart.setAttribute("VarnishArea", "Full");
                }
            }

            d.write2File(sm_dirTestDataTemp + "varnishing.jdf", 2, true);
        }
Пример #3
0
        public virtual void testApplyResourceCmd()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFCommand c = jmf.appendCommand();

            jmf.setSenderID("DeviceSenderID");

            c.setType(EnumType.Resource);
            JDFResourceCmdParams rqp = c.appendResourceCmdParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName("Media");
            JDFMedia mediaRQP = (JDFMedia)rqp.appendElement("Media");

            mediaRQP.setDimension(new JDFXYPair(20, 30));

            JDFDoc  docJDF = new JDFDoc(ElementName.JDF);
            JDFNode jdf    = docJDF.getJDFRoot();

            jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting);
            JDFMedia mediaJDF = (JDFMedia)jdf.addResource("Media", null, EnumUsage.Input, null, null, null, null);

            mediaJDF.setDimension(new JDFXYPair(40, 60));
            rqp.setJobID(jdf.getJobID(true));
            rqp.setJobPartID(jdf.getJobPartID(true));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2 = (JDFMedia)jdf.getMatchingResource("Media", EnumProcessUsage.AnyInput, null, 0);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension());

            JDFAttributeMap sheetMap = new JDFAttributeMap("SheetName", "S1");

            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(200, 300));

            JDFMedia m2Sheet = (JDFMedia)m2.addPartition(EnumPartIDKey.SheetName, "S1");

            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(200, 300), m2Sheet.getDimension(), "overwrote leaf root dimension");

            sheetMap.put(EnumPartIDKey.SheetName, "S2");
            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(300, 400));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet2 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.IsNotNull(m2Sheet2);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(300, 400), m2Sheet2.getDimension(), "overwrote leaf root dimension");

            JDFMedia mPartRQP = (JDFMedia)mediaRQP.addPartition(EnumPartIDKey.SheetName, "S3");

            sheetMap.put(EnumPartIDKey.SheetName, "S3");
            rqp.setPartMap(sheetMap);
            mPartRQP.setDimension(new JDFXYPair(400, 600));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet3 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(400, 600), m2Sheet3.getDimension(), "overwrote leaf root dimension");
            Assert.IsFalse(m2Sheet3.hasAttribute_KElement("ID", null, false));

            mPartRQP.setAttribute(AttributeName.DIMENSION, "");
            mediaRQP.removeAttribute(AttributeName.DIMENSION);
            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet4 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.IsFalse(m2Sheet4.hasAttribute_KElement(AttributeName.DIMENSION, null, false), "removed leaf dimension");
        }