/* *************************************************************************************** * 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.expr; import com.espertech.esper.client.*; import com.espertech.esper.client.scopetest.SupportUpdateListener; import com.espertech.esper.metrics.instrumentation.InstrumentationHelper; import com.espertech.esper.supportregression.bean.SupportBean; import com.espertech.esper.supportregression.client.SupportConfigFactory; import junit.framework.TestCase; import java.math.BigDecimal; import java.math.MathContext; public class TestBigNumberSupportMathContext extends TestCase { private EPServiceProvider epService; private SupportUpdateListener listener; public void setUp() { Configuration configuration = SupportConfigFactory.getConfiguration(); configuration.getEngineDefaults().getExpression().setMathContext(MathContext.DECIMAL32); epService = EPServiceProviderManager.getDefaultProvider(configuration); epService.initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.startTest(epService, this.getClass(), getName());} listener = new SupportUpdateListener(); epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class); } protected void tearDown() throws Exception { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.endTest();} listener = null; } public void testMathContextDivide() { // cast and divide EPStatement stmtDivide = epService.getEPAdministrator().createEPL("Select cast(1.6, BigDecimal) / cast(9.2, BigDecimal) from SupportBean"); stmtDivide.setSubscriber(new Object() { public void update(BigDecimal value) {} }); epService.getEPRuntime().sendEvent(new SupportBean()); } }