private void RunAssertionThreading(ThreadingProfile threadingProfile) { concatNode = new ExprConcatNode(); var textA = "This is the first text"; var textB = "Second text"; var textC = "Third text, some more"; foreach (var text in Arrays.AsList(textA, textB, textC)) { concatNode.AddChildNode(new ExprConstantNodeImpl(text)); } concatNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container, threadingProfile)); var numThreads = 4; var numLoop = 10000; var threads = new List <Pair <Thread, SupportConcat> >(numThreads); for (var i = 0; i < numThreads; i++) { var supportConcat = new SupportConcat(concatNode, numLoop, textA + textB + textC); var thread = new Thread(supportConcat.Run); threads.Add(new Pair <Thread, SupportConcat>(thread, supportConcat)); thread.Start(); } foreach (var threadPair in threads) { threadPair.First.Join(); Assert.IsFalse(threadPair.Second.IsFail); } }
public ExprConcatNodeEvalWNew( ExprConcatNode parent, ExprEvaluator[] evaluators) { this.parent = parent; this.evaluators = evaluators; }
public ExprConcatNodeForge( ExprConcatNode parent, ThreadingProfile threadingProfile) { _parent = parent; _threadingProfile = threadingProfile; }
public SupportConcat( ExprConcatNode node, int numLoop, string expectedResult) { this.node = node; this.numLoop = numLoop; this.expectedResult = expectedResult; }
public void TestToExpressionString() { concatNode = new ExprConcatNode(); concatNode.AddChildNode(new SupportExprNode("a")); concatNode.AddChildNode(new SupportExprNode("b")); Assert.AreEqual("\"a\"||\"b\"", ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(concatNode)); concatNode.AddChildNode(new SupportExprNode("c")); Assert.AreEqual("\"a\"||\"b\"||\"c\"", ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(concatNode)); }
public ExprConcatNodeEvalThreadLocal( ExprConcatNode parent, ExprEvaluator[] evaluators) { localBuffer = new SystemThreadLocal<StringBuilder>(() => new StringBuilder()); buffer = localBuffer.GetOrCreate(); this.parent = parent; this.evaluators = evaluators; buffer = localBuffer.GetOrCreate(); }
protected internal static string Evaluate( EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext context, StringBuilder buffer, ExprEvaluator[] evaluators, ExprConcatNode parent) { foreach (var child in evaluators) { var result = (string) child.Evaluate(eventsPerStream, isNewData, context); if (result == null) { return null; } buffer.Append(result); } return buffer.ToString(); }
public void SetUp() { concatNode = new ExprConcatNode(); }