public Class getUnderlyingType() { // If the additional properties are empty, such as when wrapping a native event by means of // wildcard-only select // then the underlying type is simply the wrapped type. if (isNoMapProperties) { return underlyingEventType.getUnderlyingType(); } else { return Pair.class; } }
public void testConfiguredViaPropsAndXML() { Configuration configuration = SupportConfigFactory.getConfiguration(); configuration .getEngineDefaults() .getEventMeta() .setDefaultEventRepresentation(Configuration.EventRepresentation.OBJECTARRAY); configuration.addEventType( "MyOAType", "bean,theString,map".split(","), new Object[] {SupportBean.class.getName(), "string", "java.util.Map"}); EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration); epService.initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.startTest(epService, this.getClass(), getName()); } EventType eventType = epService.getEPAdministrator().getConfiguration().getEventType("MyOAType"); assertEquals(Object[].class, eventType.getUnderlyingType()); assertEquals(String.class, eventType.getPropertyType("theString")); assertEquals(Map.class, eventType.getPropertyType("map")); assertEquals(SupportBean.class, eventType.getPropertyType("bean")); EPStatement stmt = epService .getEPAdministrator() .createEPL("select bean, theString, map('key'), bean.theString from MyOAType"); SupportUpdateListener listener = new SupportUpdateListener(); stmt.addListener(listener); assertEquals(Object[].class, stmt.getEventType().getUnderlyingType()); SupportBean bean = new SupportBean("E1", 1); epService .getEPRuntime() .sendEvent( new Object[] {bean, "abc", Collections.singletonMap("key", "value")}, "MyOAType"); EPAssertionUtil.assertProps( listener.assertOneGetNew(), "bean,theString,map('key'),bean.theString".split(","), new Object[] {bean, "abc", "value", "E1"}); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.endTest(); } }