Package de.novanic.eventservice.service.registry.user

Examples of de.novanic.eventservice.service.registry.user.UserInfo


    }

    @Test
    public void testListen() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(700, theByteArrayOutputStream);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        ListenResult theListenResult = theListenRunnable.getListenResult();
        assertEquals(1, theListenResult.getEvents().size());
View Full Code Here


    @Test
    public void testListen_2() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final Domain theDomain_2 = DomainFactory.getDomain("test_domain_2");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(700, theByteArrayOutputStream);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());
        Thread.sleep(200);
        theUserInfo.addEvent(theDomain_2, new DummyEvent());

        theListenThread.join();

        ListenResult theListenResult = theListenRunnable.getListenResult();
        assertEquals(2, theListenResult.getEvents().size());
View Full Code Here

        assertTrue(theByteArrayOutputStream.toString().contains("test_domain_2"));
    }

    @Test
    public void testListen_Error() throws Exception {
        final UserInfo theUserInfo = new UserInfo("test_user");

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(0, new DummyServletOutputStreamNotClosable());

        TestLoggingHandler theTestLoggingHandler = new TestLoggingHandler();
View Full Code Here

    }

    @Test
    public void testListen_Error_2() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(0, new DummyServletOutputStreamNotFlushable());

        TestLoggingHandler theTestLoggingHandler = new TestLoggingHandler();

        Logger theLogger = Logger.getLogger(StreamingServerConnector.class.getName());
        final Level theOldLevel = theLogger.getLevel();
        try {
            theLogger.setLevel(Level.FINEST);
            theLogger.addHandler(theTestLoggingHandler);

            ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
            Thread theListenThread = new Thread(theListenRunnable);
            theListenThread.start();

            theUserInfo.addEvent(theDomain, new DummyEvent());

            theListenThread.join();

            assertNotNull(theTestLoggingHandler.getLastMessage());
            assertTrue(theTestLoggingHandler.getLastMessage().contains("Flush") || theTestLoggingHandler.getLastMessage().contains("flush"));
View Full Code Here

        }
    }

    @Test
    public void testListen_Error_3() throws Exception {
        final UserInfo theUserInfo = new UserInfo("test_user");

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(0, new DummyServletOutputStreamNotWritable());

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
View Full Code Here

    }

    @Test
    public void testListen_Error_4() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        final EventServiceConfiguration theConfiguration = createConfiguration(0, 700, 90000);
        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(theByteArrayOutputStream, new DummyEventSerializationPolicy(), theConfiguration);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
View Full Code Here

    }

    @Test
    public void testListen_Error_5() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        final EventServiceConfiguration theConfiguration = createConfiguration(0, 700, 90000);
        theConfiguration.getConfigMap().put(ConfigParameter.CONNECTION_STRATEGY_ENCODING, "XYZ");
        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(theByteArrayOutputStream, new EventSerializationPolicy(), theConfiguration);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
View Full Code Here

     * @throws Exception exception
     */
    @Test
    public void testListen_Min_Waiting() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(700, theByteArrayOutputStream);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        ListenResult theListenResult = theListenRunnable.getListenResult();
        assertEquals(1, theListenResult.getEvents().size());
View Full Code Here

     * @throws Exception exception
     */
    @Test
    public void testListen_Min_Waiting_2() throws Exception {
        final Domain theDomain = DomainFactory.getDomain("test_domain");
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(700, theByteArrayOutputStream);

        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        ListenResult theListenResult = theListenRunnable.getListenResult();
        assertEquals(1, theListenResult.getEvents().size());
View Full Code Here

        assertContainsScriptCycle(theOutput);
    }

    @Test
    public void testListen_Max_Waiting() throws Exception {
        final UserInfo theUserInfo = new UserInfo("test_user");

        ByteArrayOutputStream theByteArrayOutputStream = new ByteArrayOutputStream();

        StreamingServerConnector theStreamingServerConnector = createStreamingServerConnector(700, theByteArrayOutputStream);
View Full Code Here

TOP

Related Classes of de.novanic.eventservice.service.registry.user.UserInfo

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.