Package de.novanic.eventservice.service.registry

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


    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

    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

    }

    public void run() {
        isStarted = true;

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

        isFinished = true;
    }
View Full Code Here

    }

    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

        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

        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

        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

        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

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

    @Test
    public void testAddEventUserSpecific_2() {
        final EventRegistry theEventRegistry = EventRegistryFactory.getInstance().getEventRegistry();

        List<DomainEvent> theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID);
        assertNull(theEvents);

        myEventExecutorService.addEventUserSpecific(new EmptyEvent());
        theEvents = theEventRegistry.listen(getLongPollingListener(), TEST_USER_ID); //the user is not registered
        assertNull(theEvents);
    }
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.