Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.EventSubscriber


  assertTrue(data.equals("Sent to: account@bank.com"));
    }

    public void waitForCompletion () throws Exception {
  // Obtain subscriber
  EventSubscriber subs = workflowService().createEventSubscriber ();

  // create the required  process
        WfRequester req = new DefaultRequester (workflowService());
  process = createProcess("ut-procdef-audit", "auditTest2", req);
  String procKey = process.key();
  assertTrue(process!=null);
  process.start ();

  WfAuditEvent e = null;
  while (true) {
            e = subs.receive(5000);
            assertTrue ("Timeout receiving event", e != null);
      if (e.eventType().equals (WfAuditEvent.PROCESS_STATE_CHANGED)
    && e.processKey().equals (procKey)
    && ((WfStateAuditEvent)e).newState().startsWith ("closed")) {
    break;
      }
  }
        assertTrue (e instanceof ProcessClosedAuditEvent);
        ProcessData res = ((ProcessClosedAuditEvent)e).result();
        assertTrue (res.keySet().size() == 2);
        assertTrue (res.keySet().contains("outVal1"));
        assertTrue (res.keySet().contains("inOutVal1"));
  assertTrue (subs.receive(2500) == null);
  workflowService().release (subs);
    }
View Full Code Here


  workflowService().release (subs);
    }

    public void testFilters () throws Exception {
  // Obtain subscribers
  EventSubscriber subs = workflowService().createEventSubscriber ();

  // create the required  process
        WfRequester req = new DefaultRequester (workflowService());
  process = createProcess("ut-procdef-audit", "auditTest2", req);
  String procKey = process.key();
  assertTrue(process != null);

  // additional subscribers
  final int[] counters = new int[5];
  EventSubscriber subsAll = workflowService().createEventSubscriber ();
  subsAll.setEventHandler(new WfAuditHandler () {
    public void receiveEvent (WfAuditEvent e) {
        counters[0] += 1;
    }
      });
  EventSubscriber subsProc = workflowService()
      .createEventSubscriber (procKey, null);
  subsProc.setEventHandler(new WfAuditHandler () {
    public void receiveEvent (WfAuditEvent e) {
        counters[1] += 1;
    }
      });
  EventSubscriber subsPSC = workflowService().createEventSubscriber
      (procKey, WfAuditEvent.PROCESS_STATE_CHANGED);
  subsPSC.setEventHandler(new WfAuditHandler () {
    public void receiveEvent (WfAuditEvent e) {
        assertTrue (e.eventType().equals
        (WfAuditEvent.PROCESS_STATE_CHANGED));
        counters[2] += 1;
    }
      });
  EventSubscriber subsASC = workflowService().createEventSubscriber
      (procKey, WfAuditEvent.ACTIVITY_STATE_CHANGED);
  subsASC.setEventHandler(new WfAuditHandler () {
    public void receiveEvent (WfAuditEvent e) {
        assertTrue (e.eventType().equals
        (WfAuditEvent.ACTIVITY_STATE_CHANGED));
        counters[3] += 1;
    }
      });
  EventSubscriber subsPASC = workflowService().createEventSubscriber
      (procKey, WfAuditEvent.PROCESS_STATE_CHANGED
       + ", " + WfAuditEvent.ACTIVITY_STATE_CHANGED);
  subsPASC.setEventHandler(new WfAuditHandler () {
    public void receiveEvent (WfAuditEvent e) {
        assertTrue (e.eventType().equals
        (WfAuditEvent.PROCESS_STATE_CHANGED)
        || e.eventType().equals
        (WfAuditEvent.ACTIVITY_STATE_CHANGED));
View Full Code Here

    /* Comment copied from interface. */
    public WfObject eventReceiver (WfAuditHandler handler)
  throws RemoteException {
  try {
      EventSubscriber es = new EventSubscriberImpl (null, null);
      es.setEventHandler (handler);
      return es;
  } catch (IOException e) {
      // This mapping is wrong but backward compatible, and the
      // method now deprecated anyway.
      throw (RemoteException)
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.EventSubscriber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.