Package de.novanic.eventservice.service.registry

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


        assertNull(theEvents);
    }

    @Test
    public void testAddEventUserSpecific_3() {
        final EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();
        theEventRegistry.registerUser(TEST_DOMAIN, TEST_USER_ID, null);
        theEventRegistry.registerUser(TEST_DOMAIN, TEST_USER_ID_2, 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_2); //the event was for another user
        assertNotNull(theEvents);
        assertTrue(theEvents.isEmpty());
    }
View Full Code Here


        assertTrue(theEvents.isEmpty());
    }

    @Test
    public void testAddEventUserSpecific_4() {
        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); //the event is for another domain, but that is unimportant, because the event is user specific.
        assertNotNull(theEvents);
        assertFalse(theEvents.isEmpty());
        assertEquals(1, theEvents.size());
    }
View Full Code Here

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

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

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());

        assertNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));

        final EmptyEventFilter theEventFilter = new EmptyEventFilter(0);
        myEventExecutorService.setEventFilter(TEST_DOMAIN, theEventFilter);

        assertNotNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));
        assertEquals(theEventFilter, myEventExecutorService.getEventFilter(TEST_DOMAIN));

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(0, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());
    }
View Full Code Here

        assertEquals(0, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());
    }

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

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());

        assertNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));

        final EmptyEventFilter theEventFilter = new EmptyEventFilter(0);
        myEventExecutorService.setEventFilter(TEST_DOMAIN, new EmptyEventFilter(0));

        assertNotNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));
        assertEquals(theEventFilter, myEventExecutorService.getEventFilter(TEST_DOMAIN));

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(0, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());

        myEventExecutorService.removeEventFilter(TEST_DOMAIN);

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());
    }
View Full Code Here

        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());
    }

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

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());

        assertNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));

        final EmptyEventFilter theEventFilter = new EmptyEventFilter(0);
        myEventExecutorService.setEventFilter(TEST_DOMAIN, new EmptyEventFilter(0));

        assertNotNull(myEventExecutorService.getEventFilter(TEST_DOMAIN));
        assertEquals(theEventFilter, myEventExecutorService.getEventFilter(TEST_DOMAIN));

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(0, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());

        myEventExecutorService.setEventFilter(TEST_DOMAIN, null);

        theEventRegistry.addEvent(TEST_DOMAIN, new EmptyEvent());
        assertEquals(1, theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID).size());
    }
View Full Code Here

        final WebDescriptorConfigurationLoader theWebDescriptorConfigurationLoader = new WebDescriptorConfigurationLoader(aConfig);
        final EventServiceConfigurationFactory theEventServiceConfigurationFactory = EventServiceConfigurationFactory.getInstance();
        theEventServiceConfigurationFactory.addConfigurationLoader(ConfigLevelFactory.DEFAULT, theWebDescriptorConfigurationLoader);

        final EventRegistryFactory theEventRegistryFactory = EventRegistryFactory.getInstance();
        EventRegistry theEventRegistry = theEventRegistryFactory.getEventRegistry();

        if(theWebDescriptorConfigurationLoader.isAvailable()) {
            theEventServiceConfigurationFactory.loadEventServiceConfiguration();
        }
        return theEventRegistry;
View Full Code Here

TOP

Related Classes of de.novanic.eventservice.service.registry.EventRegistry

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.