Examples of RemoteEvent


Examples of net.jini.core.event.RemoteEvent

      throw new NoSuchElementException();

        long logNum = getLogNum(rcount);
        File log = getLogFile(logNum);
        LogInputStream in = null;
        RemoteEvent evt = null;
        try {
            // get the input stream
            in = streamPool.getLogInputStream(log, rpos);
            // read the event
            evt = eventReader.read(in);
View Full Code Here

Examples of net.jini.core.event.RemoteEvent

        long readCount = rcount;
        long readPosition = rpos;
        long logNum = getLogNum(readCount);
        File log = getLogFile(logNum);
        RemoteEvent evt = null;
        ArrayList rData = new ArrayList();
        int i = 0;
        LogInputStream in = null;
        boolean done = false;
       
View Full Code Here

Examples of net.jini.core.event.RemoteEvent

        if (timeout < 0) {
            throw new
                IllegalArgumentException("Timeout value must non-negative");
        }
       
  RemoteEvent re = null
        LocalRemoteEventData lred = getNextValidLocalRemoteEventData(iter);
        if (lred != null) {
            re = lred.re;
            lastEventCookie = lred.cookie;
        } else { // get next batch of events, if any
View Full Code Here

Examples of net.jini.core.event.RemoteEvent

  for (i = 0; i < NUM_EVENTS; i++) {
      events[i] = myGen.generateEvent(evtReg.getID(), 3);
  }

  RemoteEvent[] bogus = {
      new RemoteEvent(myGen, 9999, 9999, null),
      new RemoteEvent(myGen, 5678, 1234, null),
  };

  logger.log(Level.INFO, "Wating for event delivery");
  eventCount = NUM_EVENTS;
        getCollectedRemoteEvents(tpl, mr, eventCount, MAX_WAIT);
View Full Code Here

Examples of net.jini.core.event.RemoteEvent

  for (i = 0; i < NUM_EVENTS; i++) {
      events[i] = myGen.generateEvent(evtReg.getID(), 3);
  }

  RemoteEvent[] bogus = {
      new RemoteEvent(myGen, 9999, 9999, null),
      new RemoteEvent(myGen, 5678, 1234, null),
  };

  logger.log(Level.INFO, "Wating for event delivery");
  eventCount = NUM_EVENTS;
        getCollectedRemoteEvents(tpl, mr, eventCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery count of " + eventCount);
  assertCount(tpl, eventCount);
  logger.log(Level.INFO, "Verifying events ");
  assertEvents(tpl, events);
  if(tpl.verifyEvents(bogus)) {
      throw new TestException("Successfully verified bogus events");
  }

        // Get iterator handle before cancelling associated reg
        RemoteEventIterator rei = mr.getRemoteEvents();
       
  logger.log(Level.INFO, "Cancelling registration lease");
  mrl.cancel();

  logger.log(Level.INFO, "Generating " + NUM_EVENTS + " more events");
  try {
      for (i = 0; i < NUM_EVENTS; i++) {
          events[i] = myGen.generateEvent(evtReg.getID(), 3);
      }
  } catch (ServerException se) {
      if (se.detail != null &&
          se.detail instanceof NoSuchObjectException) {
    // can safely ignore this since we expect
    // that the registration has expired.
          logger.log(Level.INFO, "Caught NoSuchObjectException - expected");
      } else { throw se; }
  }
       
        // Would like to assert that the event count hasn't changed, but
        // invoking getRemoteEvents should fail with NSOE, as above.

  try {
      logger.log(Level.INFO, "Re-cancelling registration lease");
      mrl.cancel();
      throw new TestException("Successfully cancelled a cancelled registration");
  } catch (UnknownLeaseException ule) {
      logger.log(Level.INFO, "Caught UnknownLeaseException - expected");
  }
       
  try {
      logger.log(Level.INFO, "Calling getRemoteEvents on expired reg");
      mr.getRemoteEvents();
      throw new TestException("Successfully called a cancelled registration");
  } catch (NoSuchObjectException nsoe) {
      logger.log(Level.INFO, "Caught NoSuchObjectException - expected");
  }
       
  try {
      logger.log(Level.INFO, "Calling addUnknownEvents on expired reg");
      mr.addUnknownEvents(new java.util.ArrayList());
      throw new TestException("Successfully called a cancelled registration");
  } catch (NoSuchObjectException nsoe) {
      logger.log(Level.INFO, "Caught NoSuchObjectException - expected");
  }
       
        logger.log(Level.INFO, "Calling next() on expired reg iterator");
        RemoteEvent re;
        boolean done = false;
        int exceptionCount = 0;
        while (!done) {
           try {
               re = rei.next(MAX_WAIT);
View Full Code Here

Examples of org.openengsb.core.workflow.api.model.RemoteEvent

    }

    @Test
    public void testWrapRemoteEvent_shouldWrapEvent() throws Exception {
        TestEvent event = new TestEvent(3L, "bla");
        RemoteEvent wrapEvent = RemoteEventUtil.wrapEvent(event);
        Map<String, String> properties = wrapEvent.getNestedEventProperties();
        assertThat(wrapEvent.getClassName(), is(TestEvent.class.getName()));
        assertThat(properties.get("processId"), is("3"));
    }
View Full Code Here

Examples of org.openengsb.core.workflow.api.model.RemoteEvent

        assertThat(properties.get("processId"), is("3"));
    }

    @Test
    public void testRegisterEvent_shouldRegisterEvent() throws Exception {
        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        reg.setProcessId(3L);
        regService.registerEvent(reg, "testPort", "test://localhost");
        service.processEvent(new TestEvent());
        verify(outgoingPort, timeout(5000)).send(any(MethodCallMessage.class));
    }
View Full Code Here

Examples of org.openengsb.core.workflow.api.model.RemoteEvent

        verify(outgoingPort, timeout(5000)).send(any(MethodCallMessage.class));
    }

    @Test
    public void testRegisterEvent_shouldCreateRule() throws Exception {
        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        int oldCount = manager.listAll(RuleBaseElementType.Rule).size();
        regService.registerEvent(reg, "testPort", "test://localhost");
        assertThat(manager.listAll(RuleBaseElementType.Rule).size(), is(oldCount + 1));
    }
View Full Code Here

Examples of org.openengsb.core.workflow.api.model.RemoteEvent

    @Test
    public void testRegisterEvent_shouldProcessRemoteEvent() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);
        trackInvocations((DummyExampleDomain) domains.get("example"), latch).doSomething("it works");

        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        regService.registerEvent(reg, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());
        assertThat("did not call example.doSomething() after RemoteEvent", latch.await(5, TimeUnit.SECONDS), is(true));
View Full Code Here

Examples of org.openengsb.core.workflow.api.model.RemoteEvent

    @Test
    public void testRegisterMultipleEvents_shouldOnlyProcessOneEvent() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);
        trackInvocations((DummyExampleDomain) domains.get("example"), latch).doSomething("it works");

        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        regService.registerEvent(reg, "testPort", "test://localhost", "workflowService");
        RemoteEvent reg2 = new RemoteEvent(TestEvent.class.getName());
        Map<String, String> nestedEventProperties = new HashMap<String, String>();
        nestedEventProperties.put("value", "testValue");
        reg2.setNestedEventProperties(nestedEventProperties);
        regService.registerEvent(reg2, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.