/* *************************************************************************************** * 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.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.supportregression.bean.SupportBean; import com.espertech.esper.supportregression.bean.SupportMarketDataBean; import com.espertech.esper.supportregression.client.SupportConfigFactory; public class TestJoinNoTableName extends TestCase { private EPServiceProvider epService; private SupportUpdateListener updateListener; private Object[] setOne = new Object[5]; private Object[] setTwo = new Object[5]; public void setUp() { epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration()); epService.initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.startTest(epService, this.getClass(), getName());} updateListener = new SupportUpdateListener(); String joinStatement = "select * from " + SupportMarketDataBean.class.getName() + "#length(3)," + SupportBean.class.getName() + "#length(3)" + " where symbol=theString and volume=longBoxed"; EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement); joinView.addListener(updateListener); for (int i = 0; i < setOne.length; i++) { setOne[i] = new SupportMarketDataBean("IBM", 0, (long) i, ""); SupportBean theEvent = new SupportBean(); theEvent.setTheString("IBM"); theEvent.setLongBoxed((long) i); setTwo[i] = theEvent; } } protected void tearDown() throws Exception { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.endTest();} updateListener = null; } public void testJoinUniquePerId() { sendEvent(setOne[0]); sendEvent(setTwo[0]); assertNotNull(updateListener.getLastNewData()); } private void sendEvent(Object theEvent) { epService.getEPRuntime().sendEvent(theEvent); } }