Package de.novanic.eventservice.config

Examples of de.novanic.eventservice.config.EventServiceConfiguration


        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();
View Full Code Here


        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();
View Full Code Here

    public void testGetEncoding_Error() throws Exception {
        testGetEncoding_Error(StreamingServerConnector.class);
    }

    private StreamingServerConnector createStreamingServerConnector(int aMaxWaitingTime, OutputStream anOutputStream) throws EventServiceException, IOException {
        final EventServiceConfiguration theConfiguration = createConfiguration(0, aMaxWaitingTime, 90000);
        return createStreamingServerConnector(anOutputStream, null, theConfiguration);
    }
View Full Code Here

        theConstructor.newInstance(createConfiguration(0, 30000, 90000));
        assertEquals("utf-8", ConnectionStrategyServerConnectorAdapter.getEncoding());
    }

    public void testGetEncoding_Error(Class<? extends ConnectionStrategyServerConnectorAdapter> aConnectorClass) throws Exception {
        final EventServiceConfiguration theConfiguration = createConfiguration(0, 30000, 90000);
        theConfiguration.getConfigMap().put(ConfigParameter.CONNECTION_STRATEGY_ENCODING, null);
        try {
            Constructor<? extends ConnectionStrategyServerConnectorAdapter> theConstructor = aConnectorClass.getConstructor(EventServiceConfiguration.class);
            theConstructor.newInstance(theConfiguration);
            ConnectionStrategyServerConnectorAdapter.getEncoding();
            fail("Exception expected, because the encoding isn't defined!");
View Full Code Here

    @Test
    public void testInit() {
        EventRegistryFactory theEventRegistryFactory = EventRegistryFactory.getInstance();
        EventRegistry theEventRegistry = theEventRegistryFactory.getEventRegistry();

        EventServiceConfiguration theConfiguration = theEventRegistry.getConfiguration();
        assertSame(theConfiguration, theEventRegistryFactory.getEventRegistry().getConfiguration());

        tearDownEventServiceConfiguration();
        EventServiceConfiguration theNewConfiguration = createConfiguration(0, 1, 2);
        setUp(theNewConfiguration);

        theEventRegistryFactory = EventRegistryFactory.getInstance();

        assertNotSame(theNewConfiguration, theConfiguration);
View Full Code Here

        assertSame(theNewConfiguration, theEventRegistryFactory.getEventRegistry().getConfiguration());
    }

    @Test
    public void testInit_Log() {
        EventServiceConfiguration theNewConfiguration = createConfiguration(0, 1, 2);

        final TestLoggingHandler theTestLoggingHandler = new TestLoggingHandler();
       
        Logger theLogger = Logger.getLogger(DefaultEventRegistry.class.getName());
        final Level theOldLevel = theLogger.getLevel();
View Full Code Here

    @Test
    public void testLoad() {
        ConfigurationLoader theConfigurationLoader = new PropertyConfigurationLoader();
        assertTrue(theConfigurationLoader.isAvailable());

        EventServiceConfiguration theConfiguration = theConfigurationLoader.load();
        assertEquals("Properties \"eventservice.properties\"", theConfiguration.getConfigDescription());
        assertEquals(Integer.valueOf(0), theConfiguration.getMinWaitingTime());
        assertEquals(Integer.valueOf(20000), theConfiguration.getMaxWaitingTime());
        assertEquals(Integer.valueOf(90000), theConfiguration.getTimeoutTime());
        assertNull(theConfiguration.getConnectionStrategyClientConnectorClassName());
        assertEquals(LongPollingServerConnector.class.getName(), theConfiguration.getConnectionStrategyServerConnectorClassName());
        assertNull(theConfiguration.getConnectionStrategyEncoding());
        assertNull(theConfiguration.getMaxEvents());
    }
View Full Code Here

    @Test
    public void testLoad_2() {
        ConfigurationLoader theConfigurationLoader = new PropertyConfigurationLoader("eventservice.bak.properties");
        assertTrue(theConfigurationLoader.isAvailable());

        EventServiceConfiguration theConfiguration = theConfigurationLoader.load();
        assertEquals("Properties \"eventservice.bak.properties\"", theConfiguration.getConfigDescription());
        assertEquals(Integer.valueOf(2000), theConfiguration.getMinWaitingTime());
        assertEquals(Integer.valueOf(5000), theConfiguration.getMaxWaitingTime());
        assertEquals(Integer.valueOf(50000), theConfiguration.getTimeoutTime());
        assertEquals(SessionConnectionIdGenerator.class.getName(), theConfiguration.getConnectionIdGeneratorClassName());
        assertEquals("de.novanic.eventservice.client.connection.strategy.connector.streaming.GWTStreamingClientConnector", theConfiguration.getConnectionStrategyClientConnectorClassName());
        assertEquals(StreamingServerConnector.class.getName(), theConfiguration.getConnectionStrategyServerConnectorClassName());
        assertEquals("iso-8859-1", theConfiguration.getConnectionStrategyEncoding());
        assertEquals(Integer.valueOf(5000), theConfiguration.getMaxEvents());
    }
View Full Code Here

    @Test
    public void testLoad_3() {
        ConfigurationLoader theConfigurationLoader = new PropertyConfigurationLoader("empty.properties");
        assertTrue(theConfigurationLoader.isAvailable());

        EventServiceConfiguration theConfiguration = theConfigurationLoader.load();

        assertNotNull(theConfiguration.getConfigDescription());
        assertEquals("Properties \"empty.properties\"", theConfiguration.getConfigDescription());

        assertNull(theConfiguration.getMinWaitingTime());
        assertNull(theConfiguration.getMaxWaitingTime());
        assertNull(theConfiguration.getTimeoutTime());
        assertNull(theConfiguration.getConnectionIdGeneratorClassName());
        assertNull(theConfiguration.getConnectionStrategyClientConnectorClassName());
        assertNull(theConfiguration.getConnectionStrategyServerConnectorClassName());
        assertNull(theConfiguration.getMaxEvents());
    }
View Full Code Here

        assertNull(theConfiguration.getMaxEvents());
    }

    @Test
    public void testLoad_With_Defaults() {
        EventServiceConfiguration theConfiguration = EventServiceConfigurationFactory.getInstance().loadEventServiceConfiguration();
        assertEquals("Properties \"eventservice.properties\"", theConfiguration.getConfigDescription());
        assertEquals(Integer.valueOf(0), theConfiguration.getMinWaitingTime());
        assertEquals(Integer.valueOf(20000), theConfiguration.getMaxWaitingTime());
        assertEquals(Integer.valueOf(90000), theConfiguration.getTimeoutTime());
        assertEquals(DefaultClientConnector.class.getName(), theConfiguration.getConnectionStrategyClientConnectorClassName());
        assertEquals(LongPollingServerConnector.class.getName(), theConfiguration.getConnectionStrategyServerConnectorClassName());
        assertEquals("utf-8", theConfiguration.getConnectionStrategyEncoding());
        assertEquals(Integer.valueOf(1000), theConfiguration.getMaxEvents());
    }
View Full Code Here

TOP

Related Classes of de.novanic.eventservice.config.EventServiceConfiguration

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.