public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { CommandCallList childCommands = commandCall.Children; childCommands.SetUp(evaluator, resultRecorder); childCommands.Execute(evaluator, resultRecorder); childCommands.Verify(evaluator, resultRecorder); String expression = commandCall.Expression; Object result = evaluator.Evaluate(expression); if (result != null && result is Boolean) { if ((Boolean)result) { ProcessTrueResult(commandCall, resultRecorder); } else { ProcessFalseResult(commandCall, resultRecorder); } } else { throw new InvalidExpressionException("Expression '" + expression + "' did not produce a boolean result (needed for assertTrue)."); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { CommandCallList childCommands = commandCall.Children; childCommands.SetUp(evaluator, resultRecorder); childCommands.Execute(evaluator, resultRecorder); childCommands.Verify(evaluator, resultRecorder); String expression = commandCall.Expression; Object result = evaluator.Evaluate(expression); if (result != null && result is Boolean) { if ((Boolean) result) { ProcessTrueResult(commandCall, resultRecorder); } else { ProcessFalseResult(commandCall, resultRecorder); } } else { throw new InvalidExpressionException("Expression '" + expression + "' did not produce a boolean result (needed for assertTrue)."); } }
protected override void ProcessFalseResult(CommandCall commandCall, IResultRecorder resultRecorder) { resultRecorder.Failure("expected true but was false", commandCall.Element.ToXml()); string expected = commandCall.Element.Text; AnnounceFailure(commandCall.Element, expected, "== false"); }
protected override void ProcessTrueResult(CommandCall commandCall, global::Concordion.Api.IResultRecorder resultRecorder) { resultRecorder.Failure("expected false but was true", commandCall.Element.ToXml()); string expected = commandCall.Element.Text; AnnounceFailure(commandCall.Element, expected, "== true"); }
public Command(string name, CommandCall fn, ConsoleMenu menu) { this.UnpaddedLabel = name; this.Label = name; this.function = fn; this.menu = menu; }
public override IModable copyDeep() { var result = new CommandCall(); result.ProcedureID = Modable.copyDeep(ProcedureID); result.Parameters = Modable.copyDeep(Parameters); return(result); }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { CommandCallList childCommands = commandCall.Children; childCommands.SetUp(evaluator, resultRecorder); evaluator.Evaluate(commandCall.Expression); childCommands.Execute(evaluator, resultRecorder); childCommands.Verify(evaluator, resultRecorder); }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { CommandCallList childCommands = commandCall.Children; childCommands.SetUp(evaluator, resultRecorder); evaluator.Evaluate(commandCall.Expression); childCommands.Execute(evaluator, resultRecorder); childCommands.Verify(evaluator, resultRecorder); }
public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { try { m_command.Execute(commandCall, evaluator, resultRecorder); } catch (Exception e) { resultRecorder.Error(e); AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression); } }
public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'run' is not supported"); var element = commandCall.Element; var href = element.GetAttributeValue("href"); Check.NotNull(href, "The 'href' attribute must be set for an element containing concordion:run"); var runnerType = commandCall.Expression; var expression = element.GetAttributeValue("params", "concordion"); if (expression != null) { evaluator.Evaluate(expression); } try { IRunner concordionRunner; Runners.TryGetValue(runnerType, out concordionRunner); // TODO - re-check this. Check.NotNull(concordionRunner, "The runner '" + runnerType + "' cannot be found. " + "Choices: (1) Use 'concordion' as your runner (2) Ensure that the 'concordion.runner." + runnerType + "' System property is set to a name of an IRunner implementation " + "(3) Specify an assembly fully qualified class name of an IRunner implementation"); var result = concordionRunner.Execute(evaluator.Fixture, commandCall.Resource, href).Result; if (result == Result.Success) { resultRecorder.Success(); AnnounceSuccess(element); } else if (result == Result.Ignored) { resultRecorder.Ignore(); AnnounceIgnored(element); } else { resultRecorder.Failure(string.Format("test {0} failed", href), commandCall.Element.ToXml()); AnnounceFailure(element); } } catch (Exception e) { resultRecorder.Error(e); AnnounceError(e, element, expression); } }
public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { try { m_command.Execute(commandCall, evaluator, resultRecorder); } catch (Exception e) { resultRecorder.Record(Result.Exception); OnExceptionCaught(commandCall.Element, e, commandCall.Expression); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { try { m_command.Verify(commandCall, evaluator, resultRecorder); } catch (Exception e) { resultRecorder.Record(Result.Exception); OnExceptionCaught(commandCall.Element, e, commandCall.Expression); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { try { m_command.Verify(commandCall, evaluator, resultRecorder); } catch (Exception e) { resultRecorder.Error(e); AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression); } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { var pattern = new Regex("(#.+?) *: *(.+)"); var matcher = pattern.Match(commandCall.Expression); if (!matcher.Success) { throw new InvalidOperationException("The expression for a \"verifyRows\" should be of the form: #var : collectionExpr"); } var loopVariableName = matcher.Groups[1].Value; var iterableExpression = matcher.Groups[2].Value; var obj = evaluator.Evaluate(iterableExpression); Check.NotNull(obj, "Expression returned null (should be an IEnumerable)."); Check.IsTrue(obj is IEnumerable, obj.GetType() + " is not IEnumerable"); Check.IsTrue(!(obj is IDictionary), obj.GetType() + " does not have a predictable iteration order"); var iterable = (IEnumerable)obj; var tableSupport = new TableSupport(commandCall); var detailRows = tableSupport.GetDetailRows(); AnnounceExpressionEvaluated(commandCall.Element); int index = 0; foreach (var loopVar in iterable) { evaluator.SetVariable(loopVariableName, loopVar); Row detailRow; if (detailRows.Count > index) { detailRow = detailRows[index]; } else { detailRow = tableSupport.AddDetailRow(); AnnounceSurplusRow(detailRow.RowElement); } tableSupport.CopyCommandCallsTo(detailRow); commandCall.Children.Verify(evaluator, resultRecorder); index++; } for (; index < detailRows.Count; index++) { Row detailRow = detailRows[index]; resultRecorder.Failure(string.Format("missing row {0}", detailRow), commandCall.Element.ToXml()); AnnounceMissingRow(detailRow.RowElement); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { try { m_command.Verify(commandCall, evaluator, resultRecorder); } catch (Exception e) { resultRecorder.Record(Result.Exception); AnnounceThrowableCaught(commandCall.Element, e, commandCall.Expression); } }
public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'run' is not supported"); var element = commandCall.Element; var href = element.GetAttributeValue("href"); Check.NotNull(href, "The 'href' attribute must be set for an element containing concordion:run"); var runnerType = commandCall.Expression; var expression = element.GetAttributeValue("params", "concordion"); if (expression != null) { evaluator.Evaluate(expression); } try { IRunner concordionRunner; Runners.TryGetValue(runnerType, out concordionRunner); // TODO - re-check this. Check.NotNull(concordionRunner, "The runner '" + runnerType + "' cannot be found. " + "Choices: (1) Use 'concordion' as your runner (2) Ensure that the 'concordion.runner." + runnerType + "' System property is set to a name of an IRunner implementation " + "(3) Specify an assembly fully qualified class name of an IRunner implementation"); var result = concordionRunner.Execute(evaluator.Fixture, commandCall.Resource, href).Result; if (result == Result.Success) { resultRecorder.Success(); AnnounceSuccess(element); } else if (result == Result.Ignored) { resultRecorder.Ignore(); AnnounceIgnored(element); } else { resultRecorder.Failure(string.Format("test {0} failed", href), commandCall.Element.ToXml()); AnnounceFailure(element); } } catch (Exception e) { resultRecorder.Error(e); AnnounceError(e, element, expression); } }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { IExecuteStrategy strategy; if (commandCall.Element.IsNamed("table")) { strategy = new TableExecuteStrategy(); } else { strategy = new DefaultExecuteStrategy(); } strategy.Execute(commandCall, evaluator, resultRecorder); }
public static String LaunchCommand(String SERVER, String USER, String PWD, String FILE) { String res = String.Empty; String COMMAND = "CALL PGM(PMBRS/PBRS30CL) PARM('@FILE@')"; AS400 as400 = null; try { COMMAND = COMMAND.Replace("@FILE@", FILE.PadRight(18)); // Create an AS400 object as400 = new AS400(SERVER, USER, PWD); // Create a Command object CommandCall command = new CommandCall(as400); // Run the command. Boolean success = command.run(COMMAND); if (success) { res = "Commando Eseguito Correttamente."; } else { res = "Command Failed!"; } AS400Message[] messageList = command.getMessageList(); foreach (AS400Message message in messageList) { res += message.getText() + "\n"; } return(res); } catch (Exception ex) { return(ex.Message); } finally { try { // Make sure to disconnect as400.disconnectAllServices(); } catch { } } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { var pattern = new Regex("(#.+?) *: *(.+)"); var matcher = pattern.Match(commandCall.Expression); if (!matcher.Success) { throw new InvalidOperationException("The expression for a \"verifyRows\" should be of the form: #var : collectionExpr"); } var loopVariableName = matcher.Groups[1].Value; var iterableExpression = matcher.Groups[2].Value; var obj = evaluator.Evaluate(iterableExpression); Check.NotNull(obj, "Expression returned null (should be an IEnumerable)."); Check.IsTrue(obj is IEnumerable, obj.GetType() + " is not IEnumerable"); Check.IsTrue(!(obj is IDictionary), obj.GetType() + " does not have a predictable iteration order"); var iterable = (IEnumerable)obj; var tableSupport = new TableSupport(commandCall); var detailRows = tableSupport.GetDetailRows(); AnnounceExpressionEvaluated(commandCall.Element); int index = 0; foreach (var loopVar in iterable) { evaluator.SetVariable(loopVariableName, loopVar); Row detailRow; if (detailRows.Count > index) { detailRow = detailRows[index]; } else { detailRow = tableSupport.AddDetailRow(); AnnounceSurplusRow(detailRow.RowElement); } tableSupport.CopyCommandCallsTo(detailRow); commandCall.Children.Verify(evaluator, resultRecorder); index++; } for (; index < detailRows.Count; index++) { Row detailRow = detailRows[index]; resultRecorder.Record(Result.Failure); AnnounceMissingRow(detailRow.RowElement); } }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { IExecuteStrategy strategy; if (commandCall.Element.IsNamed("table")) { strategy = new TableExecuteStrategy(); } else { strategy = new DefaultExecuteStrategy(); } strategy.Execute(commandCall, evaluator, resultRecorder); }
public void RegisterCommand(string funcName, int paramCount, CommandCall aFuncCall) { funcName = funcName.ToLower(); SFuncCall aNewFuncCall = new SFuncCall(paramCount, aFuncCall); if (funcTable.ContainsKey(funcName)) { Debug.LogError("Command:" + funcName + " already exists!"); return; } else { funcTable[funcName] = aNewFuncCall; } }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { TableSupport tableSupport = new TableSupport(commandCall); IList<Row> detailRows = tableSupport.GetDetailRows(); foreach (Row detailRow in detailRows) { if (detailRow.GetCells().Count != tableSupport.ColumnCount) { throw new Exception("The <table> 'execute' command only supports rows with an equal number of columns."); } commandCall.Element = detailRow.RowElement; tableSupport.CopyCommandCallsTo(detailRow); commandCall.Execute(evaluator, resultRecorder); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { object savedTextValue = evaluator.GetVariable(TEXT_VARIABLE); object savedHrefValue = evaluator.GetVariable(HREF_VARIABLE); try { evaluator.SetVariable(TEXT_VARIABLE, commandCall.Element.Text); evaluator.SetVariable(HREF_VARIABLE, getHref(commandCall.Element)); m_command.Verify(commandCall, evaluator, resultRecorder); } finally { evaluator.SetVariable(TEXT_VARIABLE, savedTextValue); evaluator.SetVariable(HREF_VARIABLE, savedHrefValue); } }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { TableSupport tableSupport = new TableSupport(commandCall); IList <Row> detailRows = tableSupport.GetDetailRows(); foreach (Row detailRow in detailRows) { if (detailRow.GetCells().Count != tableSupport.ColumnCount) { throw new Exception("The <table> 'execute' command only supports rows with an equal number of columns."); } commandCall.Element = detailRow.RowElement; tableSupport.CopyCommandCallsTo(detailRow); commandCall.Execute(evaluator, resultRecorder); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { object savedTextValue = evaluator.GetVariable(TEXT_VARIABLE); object savedHrefValue = evaluator.GetVariable(HREF_VARIABLE); try { evaluator.SetVariable(TEXT_VARIABLE, commandCall.Element.Text); evaluator.SetVariable(HREF_VARIABLE, getHref(commandCall.Element)); m_command.Verify(commandCall, evaluator, resultRecorder); } finally { evaluator.SetVariable(TEXT_VARIABLE, savedTextValue); evaluator.SetVariable(HREF_VARIABLE, savedHrefValue); } }
private void NewCommand(CommandType commandType) { if (activeState != null) { string raw = Interaction.InputBox("Enter command ID: ", "New Command"); int commandID; bool success = int.TryParse(raw.Trim(), out commandID); if (!success) { MessageBox.Show("ERROR: Invalid command ID."); } else { var cmd = new CommandCall() { CommandID = commandID }; if (commandType == CommandType.Entry) { activeState.EntryCommands.Add(cmd); } else if (commandType == CommandType.Exit) { activeState.ExitCommands.Add(cmd); } else if (commandType == CommandType.While) { activeState.WhileCommands.Add(cmd); } else { activeCondition.PassCommands.Add(cmd); } if (activeCondition != null) { var s = ConditionTree.SelectedNode; ConditionTree.SelectedNode = null; ConditionTree.SelectedNode = s; } else { } } } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'echo' is not supported"); Object result = evaluator.Evaluate(commandCall.Expression); Element element = commandCall.Element; if (result != null) { element.AppendText(result.ToString()); } else { Element child = new Element("em"); child.AppendText("null"); element.AppendChild(child); } }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { increaseLevel(evaluator); ListSupport listSupport = new ListSupport(commandCall); foreach (ListEntry listEntry in listSupport.GetListEntries()) { commandCall.Element = listEntry.Element; if (listEntry.IsItem) { commandCall.Execute(evaluator, resultRecorder); } if (listEntry.IsList) { Execute(commandCall, evaluator, resultRecorder); } } decreaseLevel(evaluator); }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { increaseLevel(evaluator); ListSupport listSupport = new ListSupport(commandCall); foreach (ListEntry listEntry in listSupport.GetListEntries()) { commandCall.Element = listEntry.Element; if (listEntry.IsItem) { commandCall.Execute(evaluator, resultRecorder); } if (listEntry.IsList) { Execute(commandCall, evaluator, resultRecorder); } } decreaseLevel(evaluator); }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'echo' is not supported"); Object result = evaluator.Evaluate(commandCall.Expression); Element element = commandCall.Element; if (result != null) { element.AppendText(result.ToString()); } else { Element child = new Element("em"); child.AppendText("null"); element.AppendChild(child); } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'assertEquals' is not supported"); Element element = commandCall.Element; object actual = evaluator.Evaluate(commandCall.Expression); string expected = element.Text; if (m_comparer.Compare(actual, expected) == 0) { resultRecorder.Record(Result.Success); OnSuccessReported(element); } else { resultRecorder.Record(Result.Failure); OnFailureReported(element, actual, expected); } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'assertEquals' is not supported"); Element element = commandCall.Element; object actual = evaluator.Evaluate(commandCall.Expression); string expected = element.Text; if (m_comparer.Compare(actual, expected) == 0) { resultRecorder.Record(Result.Success); OnSuccessReported(element); } else { resultRecorder.Record(Result.Failure); OnFailureReported(element, actual, expected); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'assertEquals' is not supported"); Element element = commandCall.Element; object actual = evaluator.Evaluate(commandCall.Expression); string expected = element.Text; if (this.m_Comparer.Compare(actual, expected) == 0) { resultRecorder.Success(); AnnounceSuccess(element); } else { resultRecorder.Failure(string.Format("expected {0} but was {1}", expected, actual), element.ToXml()); AnnounceFailure(element, expected, actual); } }
public override void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside an 'assertEquals' is not supported"); Element element = commandCall.Element; object actual = evaluator.Evaluate(commandCall.Expression); string expected = element.Text; if (this.m_Comparer.Compare(actual, expected) == 0) { resultRecorder.Success(); AnnounceSuccess(element); } else { resultRecorder.Failure(string.Format("expected {0} but was {1}", expected, actual), element.ToXml()); AnnounceFailure(element, expected, actual); } }
public void setUp(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { }
protected abstract void ProcessTrueResult(CommandCall commandCall, IResultRecorder resultRecorder);
protected override void ProcessTrueResult(CommandCall commandCall, IResultRecorder resultRecorder) { resultRecorder.Record(Result.Success); AnnounceSuccess(commandCall.Element); }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { throw new InvalidOperationException("Unexpected call to SpecificationCommand's Verify() method. Only the Execute() method should be called."); }
public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
protected override void ProcessFalseResult(CommandCall commandCall, IResultRecorder resultRecorder) { resultRecorder.Record(Result.Failure); string expected = commandCall.Element.Text; AnnounceFailure(commandCall.Element, expected, "== false"); }
public abstract void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder);
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { this.LogWriter.WriteLine(commandCall.Element.Text); }
public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { Check.IsFalse(commandCall.HasChildCommands, "Nesting commands inside a 'set' is not supported"); evaluator.SetVariable(commandCall.Expression, commandCall.Element.Text); }
public abstract void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder);
public void AddCommand(string label, CommandCall action) { commands.Add(new Command(label, action, this)); applyPadding(); }
protected override void ProcessFalseResult(CommandCall commandCall, global::Concordion.Api.IResultRecorder resultRecorder) { resultRecorder.Record(Result.Success); OnSuccessReported(commandCall.Element); }
protected override void ProcessTrueResult(CommandCall commandCall, global::Concordion.Api.IResultRecorder resultRecorder) { resultRecorder.Record(Result.Failure); OnFailureReported(commandCall.Element, commandCall.Expression, "== false"); }
public void execute(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { this.LogWriter.WriteLine(commandCall.getElement().getText()); }
public override void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { AnnounceBeforeProcessingEvent(commandCall.Resource, commandCall.Element); commandCall.Children.ProcessSequentially(evaluator, resultRecorder); AnnounceAfterProcessingEvent(commandCall.Resource, commandCall.Element); }
public void verify(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { }
protected abstract void ProcessTrueResult(CommandCall commandCall, IResultRecorder resultRecorder);
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
protected override void ProcessTrueResult(CommandCall commandCall, IResultRecorder resultRecorder) { resultRecorder.Success(); AnnounceSuccess(commandCall.Element); }
public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
protected override void ProcessTrueResult(CommandCall commandCall, global::Concordion.Api.IResultRecorder resultRecorder) { resultRecorder.Record(Result.Failure); string expected = commandCall.Element.Text; AnnounceFailure(commandCall.Element, expected, "== true"); }
public SFuncCall(int paramCountIn, CommandCall callIn) { paramCount = paramCountIn; call = callIn; }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { OnSpecificationCommandProcessing(commandCall.Resource, commandCall.Element); commandCall.Children.ProcessSequentially(evaluator, resultRecorder); OnSpecificationCommandProcessed(commandCall.Resource, commandCall.Element); }