private readonly JDFCommand queueCommand; // the jdf command template that is used to generate a new message for each dropped file /// /// <summary> * /// * constructor for a simple queue based hotfolder watcher that is automagically started in its own thread /// * </summary> /// * <param name="_hotFolderDir"> the hot folder directory to watch </param> /// * <param name="_storageDir"> the storage directory wher hot files are moved to </param> /// * <param name="ext"> the file extensions that are moved - if null no filtering </param> /// * <param name="hfListener"> callback that receives the generated JMF - the location of the stored file will be found in the standard command parameters </param> /// * <param name="_queueCommand"> the jmf template that will be used to generate a new message, null creates an empty SubmitQueueEntry template </param> /// public QueueHotFolder(DirectoryInfo _hotFolderDir, DirectoryInfo _storageDir, string ext, QueueHotFolderListener hfListener, JDFJMF _queueCommand) { JDFJMF _queueCommandLocal = _queueCommand; storageDir = _storageDir; if (!storageDir.Exists) { storageDir.Create(); // just in case } qhfl = hfListener; if (_queueCommandLocal == null) { _queueCommandLocal = JDFJMF.createJMF(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry); } queueCommand = _queueCommandLocal.getCommand(0); hf = new HotFolder(_hotFolderDir, ext, this); }
public virtual void testGetMessageServiceForJMFType() { JDFMessage m = JDFJMF.createJMF(JDFMessage.EnumFamily.Acknowledge, EnumType.KnownDevices).getMessageElement(null, null, 0); JDFResponse resp = JDFJMF.createJMF(JDFMessage.EnumFamily.Response, EnumType.KnownMessages).getResponse(0); JDFMessageService ms = resp.appendMessageService(); ms.setType(EnumType.AbortQueueEntry); ms.setAcknowledge(true); Assert.IsNull(JDFDeviceCap.getMessageServiceForJMFType(m, resp), "wrong type"); JDFMessageService ms2 = resp.appendMessageService(); ms2.setType(EnumType.KnownDevices); ms2.setQuery(true); Assert.IsNull(JDFDeviceCap.getMessageServiceForJMFType(m, resp), "wrong type"); JDFMessageService ms3 = resp.appendMessageService(); ms3.setType(EnumType.KnownDevices); ms3.setAcknowledge(true); Assert.AreEqual(ms3, JDFDeviceCap.getMessageServiceForJMFType(m, resp), "family and type match"); }
public virtual void testPerfectingJMF() { JDFElement.setLongID(false); JDFJMF jmfStatus = JDFJMF.createJMF(EnumFamily.Signal, EnumType.Status); jmfStatus.setSenderID("thePress"); JDFSignal sig = jmfStatus.getSignal(0); JDFDeviceInfo di = sig.appendDeviceInfo(); di.setDeviceStatus(EnumDeviceStatus.Running); JDFJobPhase jp = di.appendJobPhase(); jp.setJobID("jobID"); jp.setJobPartID("jobPartID"); jp.setStatus(EnumNodeStatus.InProgress); JDFModuleStatus ms = jp.appendModuleStatus(); ms.setModuleID("ID_Perfecting_1"); ms.setModuleType("PerfectingModule"); ms.setDeviceStatus(EnumDeviceStatus.Idle); ms = jp.appendModuleStatus(); ms.setModuleType("PrintModule"); ms.setDeviceStatus(EnumDeviceStatus.Running); ms.setModuleIndex(new JDFIntegerRangeList("0 1 3 4")); ms = jp.appendModuleStatus(); ms.setModuleType("PrintModule"); ms.setDeviceStatus(EnumDeviceStatus.Idle); ms.setModuleIndex(new JDFIntegerRangeList("2")); jmfStatus.getOwnerDocument_JDFElement().write2File(sm_dirTestDataTemp + "StatusPerfecting.jmf", 2, false); Assert.IsTrue(jmfStatus.isValid(EnumValidationLevel.Complete), "known defect - wait for autoclass fix"); }