private void ValidateActor(UmlDiagram diagram, UmlBase item) { UmlActor actor = (UmlActor)item; //store requires tags for Actor element String[] requiresTags = new String[] { "TDHOST" }; foreach (String tag in requiresTags) { String value = actor.GetTaggedValue(tag); if (value == null) { log("[ERROR] Missing " + tag + " in " + HttpUtility.UrlDecode(diagram.Name) + " # " + HttpUtility.UrlDecode(actor.Name) + " element.", 3); } else { switch (tag) { case "TDHOST": if (tag.Length < 1) { log("[ERROR] Tag {" + tag + "} has no valid value for Actor {" + HttpUtility.UrlDecode(actor.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 3); } break; } } } }
private void ValidateActor(UmlDiagram diagram, UmlBase item) { UmlActor actor = (UmlActor)item; //store required tags for Actor element String[] requiredTags = new String[] { "TDHOST", "TDRAMPUPTIME", "TDRAMPDOWNTIME", "TDPOPULATION" }; foreach (String tag in requiredTags) { String value = actor.GetTaggedValue(tag); if (value == null) { log("[ERROR] Missing " + tag + " in " + HttpUtility.UrlDecode(diagram.Name) + " # " + HttpUtility.UrlDecode(actor.Name) + " element. Using empty string as value.", 3); } else { switch (tag) { case "TDHOST": if (tag.Length < 1) { log("[ERROR] Tag {" + tag + "} has no valid value for Actor {" + HttpUtility.UrlDecode(actor.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 3); } break; default: Double val = 0; try { val = Convert.ToDouble(actor.GetTaggedValue(tag)); } catch { log("[ERROR] Tag {" + tag + "} has no valid value for Actor {" + HttpUtility.UrlDecode(actor.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 3); } if (val <= 0) { log("[ERROR] Tag {" + tag + "} has no valid value for Actor {" + HttpUtility.UrlDecode(actor.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 3); } break; } } } }
private void AddScenarioInformation(UmlActor actor) { try { //scenario.HostSUT.Name = actor.GetTaggedValue("TDHOST"); scenario.ExecutionTime = Convert.ToInt32(actor.GetTaggedValue("TDTIME")); scenario.RampUpTime = Convert.ToInt32(actor.GetTaggedValue("TDRAMPUPTIME")); scenario.RampUpUser = Convert.ToInt32(actor.GetTaggedValue("TDRAMPUPUSER")); scenario.RampDownTime = Convert.ToInt32(actor.GetTaggedValue("TDRAMPDOWNTIME")); scenario.RampDownUser = Convert.ToInt32(actor.GetTaggedValue("TDRAMPDOWNUSER")); scenario.Population = Convert.ToInt32(actor.GetTaggedValue("TDPOPULATION")); } catch { //do something } }