Examples of EventRegistry


Examples of com.db4o.events.EventRegistry

    return fNewsCounterDAO;
  }

  private void initEventRegistry() {
    EventRegistry eventRegistry = EventRegistryFactory.forObjectContainer(fDb);

    EventListener4 updatedListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processUpdatedEvent(args);
      }
    };

    EventListener4 creatingListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processCreatingEvent(args);
      }
    };

    EventListener4 createdListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processCreatedEvent(args);
      }
    };

    EventListener4 deletingListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processDeletingEvent(args);
      }
    };

    EventListener4 deletedListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processDeletedEvent(args);
      }
    };

    EventListener4 activatedListener = new EventListener4() {
      public void onEvent(Event4 e, EventArgs args) {
        processActivated(args);
      }
    };

    eventRegistry.activated().addListener(activatedListener);
    eventRegistry.created().addListener(createdListener);
    eventRegistry.creating().addListener(creatingListener);
    eventRegistry.updated().addListener(updatedListener);
    eventRegistry.deleting().addListener(deletingListener);
    eventRegistry.deleted().addListener(deletedListener);
  }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

    public void testAddEvent_Init_WithoutSession() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("X");
        final String theUserId = "test_user";
        final Event theEvent = new Event() {};

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(theDomain, theUserId, null);

        RemoteEventServiceServlet theRemoteEventServiceServlet = new DummyRemoteEventServlet(theDomain, theEvent);
        theRemoteEventServiceServlet.init(null);

        final List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), theUserId);
        assertNotNull(theEvents);
        assertEquals(1, theEvents.size());
        assertSame(theDomain, theEvents.get(0).getDomain());
        assertSame(theEvent, theEvents.get(0).getEvent());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

    public void testAddEvent_WithoutSession() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("X");
        final String theUserId = "test_user";
        final Event theEvent = new Event() {};

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(theDomain, theUserId, null);

        DummyRemoteEventServlet theRemoteEventServiceServlet = new DummyRemoteEventServlet(theDomain, theEvent);
        theRemoteEventServiceServlet.addEventCall();

        final List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), theUserId);
        assertNotNull(theEvents);
        assertEquals(1, theEvents.size());
        assertSame(theDomain, theEvents.get(0).getDomain());
        assertSame(theEvent, theEvents.get(0).getEvent());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

    public void testAddEventUserSpecific_WithoutSession() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("X");
        final String theUserId = "test_user";
        final Event theEvent = new Event() {};

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(theDomain, theUserId, null);

        DummyRemoteEventServlet theRemoteEventServiceServlet = new DummyRemoteEventServlet(theDomain, theEvent);
        try {
            theRemoteEventServiceServlet.addEventUserSpecificCall();
            fail("Exception expected, because the HTTPRequest shouldn't be available!");
        } catch(NoSessionAvailableException e) {}

        final List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), theUserId);
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

    }

    public void run() {
        isStarted = true;

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(myDomain, myUserId, null);

        isFinished = true;
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

    }

    public void run() {
        isStarted = true;

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        if(myDomain != null) {
            theEventRegistry.unlisten(myDomain, myUserId);
        } else {
            theEventRegistry.unlisten(myUserId);
        }
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

        theEventServiceConfigurationFactory.removeConfigurationLoader(new PropertyConfigurationLoader());

        myEventService = new DummyEventServiceImpl(new DummyServletConfig(SessionConnectionIdGenerator.class.getName()));
        super.setUp(myEventService);

        EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        assertSame(theEventRegistry, EventRegistryFactory.getInstance().getEventRegistry());
        myEventService.destroy();
        assertNotSame(theEventRegistry, EventRegistryFactory.getInstance().getEventRegistry());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

        assertFalse(myEventExecutorService.isUserRegistered(TEST_DOMAIN_2));
    }

    @Test
    public void testAddEvent() {
        final EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(TEST_DOMAIN, TEST_USER_ID, null);

        List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());

        myEventExecutorService.addEvent(TEST_DOMAIN, new EmptyEvent());
        theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertFalse(theEvents.isEmpty());
        assertEquals(1, theEvents.size());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

        assertEquals(1, theEvents.size());
    }

    @Test
    public void testAddEvent_2() {
        final EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(TEST_DOMAIN, TEST_USER_ID, null);

        List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());

        myEventExecutorService.addEvent(TEST_DOMAIN_2, new EmptyEvent());
        theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());
    }
View Full Code Here

Examples of de.novanic.eventservice.service.registry.EventRegistry

        assertTrue(theEvents.isEmpty());
    }

    @Test
    public void testAddEventUserSpecific() {
        final EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(TEST_DOMAIN, TEST_USER_ID, null);

        List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());

        myEventExecutorService.addEventUserSpecific(new EmptyEvent());
        theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNotNull(theEvents);
        assertFalse(theEvents.isEmpty());
        assertEquals(1, theEvents.size());
    }
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.