/* *************************************************************************************** * Copyright (C) 2006 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.epl; import com.espertech.esper.client.scopetest.EPAssertionUtil; import com.espertech.esper.client.scopetest.SupportUpdateListener; import com.espertech.esper.metrics.instrumentation.InstrumentationHelper; import junit.framework.TestCase; import com.espertech.esper.client.EPServiceProvider; import com.espertech.esper.client.EPServiceProviderManager; import com.espertech.esper.client.EPStatement; import com.espertech.esper.client.Configuration; import com.espertech.esper.supportregression.client.SupportConfigFactory; import com.espertech.esper.supportregression.bean.SupportBean; public class TestLiteralConstants extends TestCase { private EPServiceProvider epService; private SupportUpdateListener updateListener; public void setUp() { Configuration config = SupportConfigFactory.getConfiguration(); config.addEventType("SupportBean", SupportBean.class.getName()); epService = EPServiceProviderManager.getDefaultProvider(config); epService.initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.startTest(epService, this.getClass(), getName());} updateListener = new SupportUpdateListener(); } protected void tearDown() throws Exception { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.endTest();} updateListener = null; } public void testLiteral() { String statement = "select 0x23 as mybyte, " + "'\u0041' as myunicode," + "08 as zero8, " + "09 as zero9, " + "008 as zeroZero8 " + "from SupportBean"; EPStatement stmt = epService.getEPAdministrator().createEPL(statement); stmt.addListener(updateListener); epService.getEPRuntime().sendEvent(new SupportBean("e1", 100)); EPAssertionUtil.assertProps(updateListener.assertOneGetNewAndReset(), "mybyte,myunicode,zero8,zero9,zeroZero8".split(","), new Object[] {(byte) 35, "A", 8, 9, 8}); } }