public virtual void testAddSpawned() { // Test AddCreated with one parameter JDFDoc doc2 = new JDFDoc("JDF"); JDFNode node2 = doc2.getJDFRoot(); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(new JDFAttributeMap("SheetName", "s1")); JDFSpawned m1 = myAuditPool.addSpawned(node2, null, null, null, null); Assert.IsNotNull(m1); JDFSpawned m2 = myAuditPool.addSpawned(node2, null, null, null, vMap); Assert.IsNotNull(m2); Assert.AreEqual(vMap, m2.getPartMapVector()); Assert.IsNull(myAuditPool.getElement(ElementName.PART)); }
/// /// <summary> * Append a Spawned audit element /// * </summary> /// * <param name="spawned"> the spawned node </param> /// * <param name="rRefsRO"> a vector of rRefs that are spawned read-only </param> /// * <param name="rRefsRW"> a vector of rRefs that are spawned read-write </param> /// * <param name="by"> the author keyword </param> /// * <param name="vmParts"> /// * </param> /// * <returns> JDFAudit - the newly created Spawned audit /// * /// * default: AddSpawned(spawned, new Vector(), new Vector(), JDFConstants.EMPTYSTRING, new /// * VJDFAttributeMap()) </returns> /// public virtual JDFSpawned addSpawned(JDFNode spawned, VString rRefsRO, VString rRefsRW, string by, VJDFAttributeMap vmParts) { JDFSpawned a = (JDFSpawned)addAudit(JDFAudit.EnumAuditType.Spawned, by); a.setAttribute(JDFConstants.JREF, spawned.getID(), null); string ms = null; if (rRefsRO != null && !rRefsRO.IsEmpty()) { ms = StringUtil.setvString(rRefsRO); a.setAttribute(AttributeName.RREFSROCOPIED, ms, null); } if (rRefsRW != null && !rRefsRW.IsEmpty()) { ms = StringUtil.setvString(rRefsRW); a.setAttribute(AttributeName.RREFSRWCOPIED, ms, null); } a.setPartMapVector(vmParts); return(a); }
public virtual void testStatusEquals() { // test if the auto classes implement the correct status // compare EnumNodeStatus JDFAuditPool myAuditPool = null; JDFDoc jdfDoc = new JDFDoc(ElementName.JDF); JDFNode jdfRoot = (JDFNode)jdfDoc.getRoot(); Assert.IsTrue(jdfRoot != null, "No Root found"); if (jdfRoot == null) { return; // soothe findbugs ;) } JDFAncestor ancestor = jdfRoot.appendAncestorPool().appendAncestor(); ancestor.setStatus(EnumNodeStatus.Completed); myAuditPool = jdfRoot.getCreateAuditPool(); JDFPhaseTime phaseTime = myAuditPool.addPhaseTime(JDFElement.EnumNodeStatus.Completed, null, null); JDFSpawned spawned = myAuditPool.addSpawned(jdfRoot, null, null, null, null); spawned.setStatus(JDFElement.EnumNodeStatus.Completed); Assert.AreEqual(spawned.getStatus(), phaseTime.getStatus()); Assert.AreEqual(spawned.getStatus(), ancestor.getStatus()); JDFDoc jmfDoc = new JDFDoc(ElementName.JMF); JDFJMF jmfRoot = jmfDoc.getJMFRoot(); Assert.IsTrue(jmfRoot != null, "No Root found"); if (jmfRoot == null) { return; // soothe findbugs ;) } JDFAcknowledge acknowledge = jmfRoot.appendAcknowledge(); acknowledge.setType("PipePush"); // Type is required and its existance // is validated for messages JDFJobPhase jobPhase = acknowledge.appendJobPhase(); jobPhase.setStatus(EnumNodeStatus.Completed); JDFMessage message = jmfRoot.appendMessageElement(EnumFamily.Command, null); message.setType("PipePush"); // Type is required and its existance is // validated for messages JDFPipeParams pipeParams = message.appendPipeParams(); pipeParams.setStatus(EnumNodeStatus.Completed); Assert.AreEqual(jobPhase.getStatus(), pipeParams.getStatus()); Assert.AreEqual(spawned.getStatus(), pipeParams.getStatus()); // compare EnumResStatus JDFDoc responseDoc = new JDFDoc(ElementName.RESPONSE); JDFResponse responseRoot = (JDFResponse)responseDoc.getRoot(); Assert.IsTrue(responseRoot != null, "No Root found"); if (responseRoot == null) { return; // soothe findbugs ;) } responseRoot.setType(ElementName.RESOURCE); JDFResourceInfo resInfo = responseRoot.appendResourceInfo(); resInfo.setResStatus(EnumResStatus.Available); JDFDoc commandDoc = new JDFDoc(ElementName.COMMAND); JDFCommand commandRoot = (JDFCommand)commandDoc.getRoot(); Assert.IsTrue(commandRoot != null, "No Root found"); if (commandRoot == null) { return; // soothe findbugs ;) } commandRoot.setType(ElementName.RESOURCE); JDFResourceCmdParams resCmdParams = commandRoot.appendResourceCmdParams(); resCmdParams.setResStatus(EnumResStatus.Available); Assert.AreEqual(resInfo.getStatus(), resCmdParams.getStatus()); // check EnumQueueStatus JDFDoc queueDoc = new JDFDoc(ElementName.QUEUE); JDFQueue queueRoot = (JDFQueue)queueDoc.getRoot(); Assert.IsTrue(queueRoot != null, "No Root found"); if (queueRoot == null) { return; // soothe findbugs ;) } queueRoot.setQueueStatus(EnumQueueStatus.Running); // check EnumQueueEntryStatus JDFQueueEntry queueEntry = queueRoot.appendQueueEntry(); queueEntry.setQueueEntryStatus(EnumQueueEntryStatus.Running); }