public void Run(RegressionEnvironment env) { RegressionPath path = new RegressionPath(); string epl = "@Name('s0') create window MyWindow#keepall as SupportEventWithManyArray;\n" + "insert into MyWindow select * from SupportEventWithManyArray;\n"; env.CompileDeploy(epl, path); SendManyArray(env, new int[] {1, 2}, new int[] {3, 4}); SendManyArray(env, new int[] {3, 4}, new int[] {1, 2}); SendManyArray(env, new int[] {1, 2}, new int[] {3, 5}); SendManyArray(env, new int[] {3, 4}, new int[] {1, 2}); SendManyArray(env, new int[] {1, 2}, new int[] {3, 4}); EPFireAndForgetQueryResult result = env.CompileExecuteFAF("select distinct IntOne from MyWindow", path); EPAssertionUtil.AssertPropsPerRow( result.Array, "IntOne".SplitCsv(), new object[][] { new object[] {new int[] {1, 2}}, new object[] {new int[] {3, 4}} }); result = env.CompileExecuteFAF("select distinct IntOne, IntTwo from MyWindow", path); EPAssertionUtil.AssertPropsPerRow( result.Array, "IntOne,IntTwo".SplitCsv(), new object[][] { new object[] {new int[] {1, 2}, new int[] {3, 4}}, new object[] {new int[] {3, 4}, new int[] {1, 2}}, new object[] {new int[] {1, 2}, new int[] {3, 5}} }); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { SetupInfra(env, namedWindow); EPCompiled insertA = CompileRuntimePath(env, "A", "insert into MyInfra(c0, c1) values ('A1', 10)"); EPCompiled insertB = CompileRuntimePath(env, "B", "insert into MyInfra(c2, c3) values (20, 'B1')"); env.Runtime.FireAndForgetService.ExecuteQuery(insertA); env.Runtime.FireAndForgetService.ExecuteQuery(insertB); EPCompiled selectA = CompileRuntimePath(env, "A", "select * from MyInfra"); EPCompiled selectB = CompileRuntimePath(env, "B", "select * from MyInfra"); EPFireAndForgetQueryResult resultA = env.Runtime.FireAndForgetService.ExecuteQuery(selectA); EPAssertionUtil.AssertPropsPerRow(resultA.GetEnumerator(), "c0,c1".SplitCsv(), new object[][] { new object[] { "A1", 10 } }); EPFireAndForgetQueryResult resultB = env.Runtime.FireAndForgetService.ExecuteQuery(selectB); EPAssertionUtil.AssertPropsPerRow(resultB.GetEnumerator(), "c2,c3".SplitCsv(), new object[][] { new object[] { 20, "B1" } }); env.UndeployAll(); }
private static void AssertFAFInsertResult( EPFireAndForgetQueryResult resultOne, string[] propertyNames, EPStatement stmt) { Assert.AreEqual(0, resultOne.Array.Length); Assert.AreSame(resultOne.EventType, stmt.EventType); }
private static void AssertFAFNot( RegressionEnvironment env, RegressionPath path, String epl) { String faf = "@Hint('index(MyInfraIndex, bust)') select * from MyInfra where " + epl; EPFireAndForgetQueryResult result = env.CompileExecuteFAF(faf, path); Assert.AreEqual(0, result.Array.Length); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var epl = "@public create window WinSB#keepall as SupportBean;\n" + "insert into WinSB select * from SupportBean;\n"; if (namedWindow) { epl += "@public create window Infra#unique(Id) as (Id int, Value string);\n"; } else { epl += "@public create table Infra(Id int primary key, Value string);\n"; } epl += "@public create index InfraIndex on Infra(Value);\n" + "insert into Infra select Id, P00 as Value from SupportBean_S0;\n"; env.CompileDeploy(epl, path); var numRows = 10000; // less than 1M for (var i = 0; i < numRows; i++) { SendSB(env, "v" + i, 0); SendS0(env, -1 * i, "v" + i); } EPFireAndForgetQueryResult result = null; var delta = PerformanceObserver.TimeMillis( () => { var query = "select (select Id from Infra as i where i.Value = wsb.TheString) as c0 from WinSB as wsb"; result = CompileExecute(env, path, query); }); Assert.That(delta, Is.LessThan(1000), "delta is " + delta); Assert.AreEqual(numRows, result.Array.Length); for (var i = 0; i < numRows; i++) { Assert.AreEqual(-1 * i, result.Array[i].Get("c0")); } env.UndeployAll(); }
private static void AssertIndexChoiceJoin( RegressionEnvironment env, bool namedWindow, string[] indexes, object[] preloadedEvents, string datawindowOne, string datawindowTwo, params IndexAssertion[] assertions) { var path = new RegressionPath(); if (namedWindow) { env.CompileDeploy("create window W1." + datawindowOne + " as SupportSimpleBeanOne", path); env.CompileDeploy("create window W2." + datawindowTwo + " as SupportSimpleBeanTwo", path); } else { env.CompileDeploy( "create table W1 (S1 String primary key, I1 int primary key, D1 double primary key, L1 long primary key)", path); env.CompileDeploy( "create table W2 (S2 String primary key, I2 int primary key, D2 double primary key, L2 long primary key)", path); } env.CompileDeploy("insert into W1 select S1,I1,D1,L1 from SupportSimpleBeanOne", path); env.CompileDeploy("insert into W2 select S2,I2,D2,L2 from SupportSimpleBeanTwo", path); foreach (var index in indexes) { env.CompileDeploy(index, path); } foreach (var @event in preloadedEvents) { env.SendEventBean(@event); } var count = 0; foreach (var assertion in assertions) { log.Info("======= Testing #" + count++); var epl = INDEX_CALLBACK_HOOK + (assertion.Hint ?? "") + "select * from W1 as w1, W2 as w2 " + "where " + assertion.WhereClause; EPFireAndForgetQueryResult result = null; try { result = env.CompileExecuteFAF(epl, path); } catch (EPCompileExceptionItem ex) { log.Error("Failed to process:" + ex.Message, ex); if (assertion.EventSendAssertion == null) { // no assertion, expected Assert.IsTrue(ex.Message.Contains("index hint busted")); continue; } throw new EPException("Unexpected statement exception: " + ex.Message, ex); } // assert index and access SupportQueryPlanIndexHook.AssertJoinAllStreamsAndReset(assertion.Unique); assertion.FafAssertion.Invoke(result); } env.UndeployAll(); }