com.espertech.esper.regression.event.TestMapEventInvalidConfig.java Source code

Java tutorial

Introduction

Here is the source code for com.espertech.esper.regression.event.TestMapEventInvalidConfig.java

Source

/*
 * *************************************************************************************
 *  Copyright (C) 2006-2015 EsperTech, Inc. All rights reserved.                       *
 *  http://www.espertech.com/esper                                                     *
 *  http://www.espertech.com                                                           *
 *  ---------------------------------------------------------------------------------- *
 *  The software in this package is published under the terms of the GPL license       *
 *  a copy of which has been included with this distribution in the license.txt file.  *
 * *************************************************************************************
 */

package com.espertech.esper.regression.event;

import com.espertech.esper.client.*;
import com.espertech.esper.client.scopetest.EPAssertionUtil;
import com.espertech.esper.client.scopetest.SupportUpdateListener;
import com.espertech.esper.core.service.EPServiceProviderSPI;
import com.espertech.esper.event.EventAdapterService;
import com.espertech.esper.event.EventTypeMetadata;
import com.espertech.esper.event.EventTypeSPI;
import com.espertech.esper.metrics.instrumentation.InstrumentationHelper;
import com.espertech.esper.support.bean.SupportBean;
import com.espertech.esper.support.bean.SupportBeanComplexProps;
import com.espertech.esper.support.client.SupportConfigFactory;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class TestMapEventInvalidConfig extends TestCase {
    public void testInvalidConfig() {
        Properties properties = new Properties();
        properties.put("astring", "XXXX");

        Configuration configuration = SupportConfigFactory.getConfiguration();
        configuration.addEventType("MyInvalidEvent", properties);

        try {
            EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
            epService.initialize();
            fail();
        } catch (ConfigurationException ex) {
            // expected
        }

        EPServiceProvider epService = EPServiceProviderManager
                .getDefaultProvider(SupportConfigFactory.getConfiguration());
        epService.initialize();
    }
}