protected override void fillContent(ArrayList l) { string name = show_full_qual || st == null?UmlModel.LongTypeName2Short(this.name) : st.Name; if (st == null || st.Deleted) { l.Add(new GuiString(FontStyle.Regular, FontTypes.DEFAULT, true, "\x00ABdeleted\xBB")); l.Add(new GuiString(FontStyle.Bold, FontTypes.DEFAULT, true, name)); return; } else { l.Add(new GuiString(FontStyle.Regular, FontTypes.DEFAULT, true, "\x00ABenumeration\xBB")); } l.Add(new GuiString(FontStyle.Bold, FontTypes.DEFAULT, true, name)); if (show_members) { l.Add(new GuiString()); if (st.Members != null) { foreach (UmlEnumField m in st.Members) { l.Add(new GuiString(0, FontTypes.DEFAULT, false, m.Name)); } } } }
public List <GeneralUseStructure> Converter(List <GeneralUseStructure> listModel, StructureType type) { UmlModel model = listModel.OfType <UmlModel> ().FirstOrDefault(); List <DirectedGraph> listGraph = TransformToGraph((UmlModel)model).ToList(); return(listGraph.Cast <GeneralUseStructure> ().ToList()); }
// private static UmlModelImporter java; /// <summary> /// Converts given model to an array of FiniteStateMachine. /// </summary> public static FiniteStateMachine[] TransformToFsm(UmlModel model) { model2 = new UmlModel(""); model2 = model; List <FiniteStateMachine> machines = new List <FiniteStateMachine>(); UmlUseCaseDiagram useCaseDiagram = model.Diagrams.OfType <UmlUseCaseDiagram>().FirstOrDefault(); if (useCaseDiagram == null) { throw new Exception("No use case diagram found. Cannot continue."); } foreach (UmlUseCase useCase in useCaseDiagram.UmlObjects.OfType <UmlUseCase>()) { UmlActivityDiagram activityDiagram = model.Diagrams .OfType <UmlActivityDiagram>() .Where(x => x.Name == useCase.Name) .FirstOrDefault(); //if (activityDiagram == null) //{ // throw new Exception("Could not find any Activity Diagram named " + useCase.Name); //} if (activityDiagram != null && ContainsInclude(useCaseDiagram, useCase) == false) { FiniteStateMachine generatedMachine = new FiniteStateMachine(useCase.Name); generatedMachine = ActivityDiagramToFsm(activityDiagram, model); machines.Add(generatedMachine); } } return(machines.ToArray()); }
public override void Drop( ) { if (dropitem == null) { throw new ArgumentException("have nothing to drop"); } parent.AddObject(dropitem, UmlModel.GetUniversal(dropobj)); action = MouseAction.None; // insert Inheritance ArrayList l = new ArrayList(parent.active_objects); foreach (GuiObject a in l) { if (a is GuiClass) { GuiClass c = a as GuiClass; // TODO ????????? /*if( c.st.bases != null && c.st.bases.Contains( dropitem.st.fullname ) ) { * NewRelation( dropitem, c, UmlRelationType.Inheritance ); * } else if( dropitem.st.bases != null && dropitem.st.bases.Contains( c.st.fullname ) ) { * NewRelation( c, dropitem, UmlRelationType.Inheritance ); * }*/ } } dropitem = null; }
private void ValidateUseCaseDiagram(UmlModel model, UmlDiagram diagram) { foreach (UmlUseCase uCase in diagram.UmlObjects.OfType <UmlUseCase> ()) { ValidateUseCase(model, diagram, uCase); } //checks for actors if (diagram.UmlObjects.OfType <UmlActor> ().Count() < 1) { log("[ERROR] Missing actor in " + HttpUtility.UrlDecode(diagram.Name) + ". At least 1 actor is required to continue.", 3); } //checks for Use Cases if (diagram.UmlObjects.OfType <UmlUseCase> ().Count() < 1) { log("[ERROR] No use case found in " + HttpUtility.UrlDecode(diagram.Name) + ". At least 1 use case is required to continue.", 3); } //validate diagram's elements foreach (UmlBase item in diagram.UmlObjects) { //validate by type if (item is UmlAssociation) { ValidateAssociation(diagram, item); } if (item is UmlActor) { ValidateActor(diagram, item); } } }
/// <summary> /// Inicia a validacao de um ou mais diagramas. /// </summary> public Boolean Validator(UmlModel model) { foreach (UmlDiagram diagram in model.Diagrams) { if (diagram.UmlObjects.OfType <UmlInitialState>().Count() != 1) { errors.Add("There is no Initial State or There are two or more of them (" + diagram.Name + ")"); } if (diagram.UmlObjects.OfType <UmlFinalState>().Count() != 1) { errors.Add("There is no Final State or There are two or more of them (" + diagram.Name + ")"); } foreach (UmlBase element in diagram.UmlObjects) { this.ValidateElement(diagram, element); } } foreach (String s in errors) { Console.WriteLine(s); } return(this.errors.Count() == 0); }
private Boolean GetNewTransition(UmlModel model, List <UmlTransition> list, Transition t, Boolean contem) { UmlTransition tranSource = GetUmlTransition(t.SourceState, model, true); UmlTransition tranTarget = GetUmlTransition(t.TargetState, model, false); UmlTransition newTransition = new UmlTransition(); newTransition.Source = tranSource.Source; newTransition.Target = tranTarget.Target; newTransition.Id = tranSource.Id; foreach (KeyValuePair <String, String> pair in tranTarget.TaggedValues) { newTransition.SetTaggedValue(pair.Key, pair.Value); } if (t.CycleTransition) { newTransition.SetTaggedValue("TDcycleTran", "true"); } if (t.EndCycle) { newTransition.SetTaggedValue("TDlastCycleTrans", "true"); } list.Add(newTransition); contem = true; return(contem); }
private void ValidateActionStateTransitionsTags(UmlDiagram diagram, UmlModel model, String fileName) { String[] path = fileName.Split('\\'); path = path.Where(w => w != path[path.Length - 1]).ToArray(); String pathNew = String.Join(@"\", path); foreach (UmlActionState s in diagram.UmlObjects.OfType <UmlActionState>()) { if (s.TaggedValues.Count > 1) { if (s.TaggedValues.Keys.Contains("cycles")) { String aux = s.GetTaggedValue("jude.hyperlink"); if (s.TaggedValues.Count - 1 > 1) { log("[WARNING] Invalid tagged values at {" + HttpUtility.UrlDecode(s.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 2); } //ValidateLineExcel(diagram, model, fileName, populate, s); } else if (s.TaggedValues.Count == 0) { continue; } else if (!s.TaggedValues.Keys.Contains("jude.hyperlink")) { log("[WARNING] Invalid tagged values at {" + HttpUtility.UrlDecode(s.Name) + "}. Found at {" + HttpUtility.UrlDecode(diagram.Name) + "}.", 2); } } } }
public List <GeneralUseStructure> Converter(List <GeneralUseStructure> listModel, StructureType type) { UmlModel model = listModel.OfType <UmlModel> ().FirstOrDefault(); List <FiniteStateMachine> listFSM = TransformToFsm(model).ToList(); return(listFSM.Cast <GeneralUseStructure> ().ToList()); }
public UmlDiagram(UmlModel model) { Model = model; model.Modified += OnModelModified; //model.EditsCommitted += OnModelEditsCommitted; model.AssemblyLoaded += OnAssemblyLoaded; classes = new ObservableCollection <UmlDiagramClass>(); Classes = new ReadOnlyObservableCollection <UmlDiagramClass>(classes); relations = new ObservableCollection <UmlDiagramRelation>(); Relations = new ReadOnlyObservableCollection <UmlDiagramRelation>(relations); notes = new ObservableCollection <UmlDiagramNote>(); Notes = new ReadOnlyObservableCollection <UmlDiagramNote>(notes); noteLinks = new ObservableCollection <UmlDiagramNoteLink>(); NoteLinks = new ReadOnlyObservableCollection <UmlDiagramNoteLink>(noteLinks); methodNodes = new ObservableCollection <UmlDiagramMethodNode>(); MethodNodes = new ReadOnlyObservableCollection <UmlDiagramMethodNode>(methodNodes); methodLinks = new ObservableCollection <UmlDiagramMethodLink>(); MethodLinks = new ReadOnlyObservableCollection <UmlDiagramMethodLink>(methodLinks); CopyDiagramToClipboardCommand = new DelegateCommand(OnExecuteCopyDiagramToClipboardCommand); OpenAssemblyCommand = new DelegateCommand(OnExecuteOpenAssemblyCommand); LoadAssemblyCommand = new DelegateCommand(OnExecuteLoadAssemblyCommand); ClassNames = new ObservableCollection <string>(); Tags = new ObservableCollection <string> { "DataController", "Controller", "ViewModel", "UI", "DataModel", "PresentationState", "Presentation", "SceneHandler" }; SyncClassNames(); filenames = new List <string> { @"C:\Repos\wc3\Output\x3.dll", @"C:\Repos\wc3\Output\x2.exe", @"C:\Repos\wc3\Output\x1.dll", @"C:\Repos\wc3\Output\DataModel.dll" }; UpdateFilenamesString(); }
private void OGMA(ClassNode lex) { model = new UmlModel("script"); GenerateUseCaseDiagram(); acdiagram = new UmlActivityDiagram("UseCase0"); UmlInitialState initial = new UmlInitialState(); initial.Name = "InitialNode"; acdiagram.UmlObjects.Add(initial); model.AddDiagram(acdiagram); LIST_IMPORT(lex.Derivations[0]); CLASS(lex.Derivations[1]); String currentActionValue = lastAssociation.GetTaggedValue("TDACTION"); lastAssociation.SetTaggedValue("TDACTION", currentActionValue + ""); acdiagram.UmlObjects.Add(lastAssociation); UmlFinalState final = new UmlFinalState(); final.Name = "FinalNode"; acdiagram.UmlObjects.Add(final); lastAssociation = new UmlTransition(); lastAssociation.Source = lastActivity; lastAssociation.Target = (UmlElement)acdiagram.UmlObjects[acdiagram.UmlObjects.Count - 1]; acdiagram.UmlObjects.Add(lastAssociation); }
private void ValidateUseCase(UmlModel model, UmlDiagram diagram, UmlUseCase uCase) { Boolean existeAC = false; String aux = uCase.GetTaggedValue("jude.hyperlink"); if (aux != null) { foreach (UmlActivityDiagram actD in model.Diagrams.OfType <UmlActivityDiagram> ()) { if ((aux == uCase.Name) && (aux == actD.Name)) { existeAC = true; break; } } } if (!existeAC) { log("[WARNING] Missing activity diagram for { " + HttpUtility.UrlDecode(uCase.Name) + " } use case.", 2); } if (String.IsNullOrEmpty(uCase.GetTaggedValue("TDPRECONDITIONS"))) { log("[WARNING] Missing TDpreConditions in " + HttpUtility.UrlDecode(diagram.Name) + " # " + HttpUtility.UrlDecode(uCase.Name) + " element.", 2); } if (String.IsNullOrEmpty(uCase.GetTaggedValue("TDPOSTCONDITIONS"))) { log("[WARNING] Missing TDpostConditions in " + HttpUtility.UrlDecode(diagram.Name) + " # " + HttpUtility.UrlDecode(uCase.Name) + " element.", 2); } }
private static List <UmlClass> ProcessIntersection(string token, UmlModel model) { List <List <UmlClass> > lists = token.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries) .Select(t => ProcessAssociation(t, model)).ToList(); return(lists.Aggregate((intersection, t) => intersection.Intersect(t).ToList())); }
public void GenerateScript(List <GeneralUseStructure> structure, String OATSExcelPath) { UmlModel model = structure.OfType <UmlModel>().First(); CleanModel(model); GenerateXlsTestScript(model); GenerateXlsTestData(model); }
public MainWindowViewModel() { model = new UmlModel(); ViewAreaViewModel = new ViewAreaViewModel(model); TaskPanelViewModel = new TaskPanelViewModel(); ViewAreaViewModel.PropertyChanged += OnViewAreaPropertyChanged; OnViewAreaPropertyChanged(null, null); }
private static List <UmlClass> ProcessUnion(string token, UmlModel model) { List <List <UmlClass> > lists = token.Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries) .Select(t => ProcessSubtraction(t, model)).ToList(); return(lists.Aggregate((union, t) => union.Union(t).ToList())); }
public static GuiClass CreateClass(StaticView parent, int x, int y, UmlClass cl) { GuiClass c = GuiClass.fromUML(cl); c.X = x; c.Y = y; parent.AddObject(c, UmlModel.GetUniversal(cl)); return(c); }
public ViewAreaViewModel(UmlModel model) { this.model = model; //ViewportViewModels.Add(new ViewportViewModel(model)); //ViewportViewModels.Add(new ViewportViewModel(model)); //ViewportViewModels.Add(new ViewportViewModel(model)); ViewportViewModels.Add(new ViewportViewModel(model)); selectedViewportViewModel = ViewportViewModels[0]; }
/// <summary> /// Stops Fiddler proxy, restores proxy settings and prompt to save generated file. /// </summary> private void buttonStop_Click(object sender, RoutedEventArgs e) { this.isProxyRunning = false; //Stops Fiddler application. Fiddler.FiddlerApplication.Shutdown(); //Disable proxy in windows register. RegistryKey regKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); regKey.SetValue("ProxyEnable", 0); //Refresh system info. (So we don't need to restart windows). settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0); refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0); //Exports data to Uml Model. UmlModel model = this.generateXmlFromNavigationData(lista); //Creates dialog to set save path SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "XMI Document (*.xmi) | *.xmi"; //Abort saving if user close or cancel. if (dialog.ShowDialog() != true) { return; } //Call api to export XMI data. XmlDocument document = model.ToXmi(); //XmlDocument doc = new XmlDocument(); //doc.Load(@"C:\Users\COC-DELL-20\Desktop\teste.xmi"); //UmlModel modelNew = model.FromXmi(doc); //Initializer a new XML writer. XmlWriterSettings settings = new XmlWriterSettings() { Encoding = new UTF8Encoding(false), Indent = true, CheckCharacters = true }; //Save generated XML file to disk. using (XmlWriter writer = XmlWriter.Create(dialog.FileName, settings)) document.Save(writer); //Send message to screen. MessageBox.Show( File.Exists(dialog.FileName) //check for file existance. ? "File succesfully exported." : "Couldn't export file."); }
public UmlDiagramController(UmlModel model) { this.model = model; List <UmlClassController> controllers = new List <UmlClassController>(); foreach (var umlClass in model.UmlClasses) { controllers.Add(new UmlClassController(umlClass)); } UmlClassControllers = new ObservableCollection <UmlClassController>(controllers); }
private static IEnumerable <UmlClass> GetClassesOrCreateClass(string name, UmlModel model, bool canCreateNew) { IEnumerable <UmlClass> classes = FindClasses(name, model).ToList(); if (!classes.Any() && !ContainsWildcards(name) && canCreateNew) { var umlClass = model.CreateClassFromDiagram(name); classes = FindClasses(name, model).ToList(); } return(classes); }
public DirectedGraph[] TransformToGraph(UmlModel model) { List <DirectedGraph> graphs = new List <DirectedGraph> (); foreach (UmlSequenceDiagram sequenceDiagram in model.Diagrams.OfType <UmlSequenceDiagram> ()) { DirectedGraph graph = new DirectedGraph(); graph = SequenceDiagramToGraph(sequenceDiagram); graphs.Add(graph); } return(graphs.ToArray()); }
private void filterToActDiagOnly(ref UmlModel u) { UmlModel aux = new UmlModel(); foreach (UmlDiagram ud in u.Diagrams) { if (ud is UmlActivityDiagram) { aux.AddDiagram(ud); } } u = aux; }
public Facade() { this.model = new UmlModel(); this.fsm = new FiniteStateMachine("test prod fsm"); //remove this piece of crap and add //a decent UI this.LoadUmlFromFile(); this.ConvertUmlModelToTaggedFsm(); this.GenerateTestSequencesWithHsi(); this.GenerateScriptsForLoadRunner(); this.ExecuteLoadRunner(); }
public UmlTransition GetUmlTransition(UmlElement act, UmlModel model) { foreach (UmlActivityDiagram actDiagram in model.Diagrams.OfType <UmlActivityDiagram> ()) { foreach (UmlTransition t in actDiagram.UmlObjects.OfType <UmlTransition> ()) { if (t.Source.Id.Equals(act.Id)) { return(t); } } } return(null); }
private void ValidateDuplicatedActivities(UmlModel model, UmlDiagram diagram) { UmlUseCaseDiagram ucDiagram = (UmlUseCaseDiagram)diagram; foreach (UmlUseCase useCase in ucDiagram.UmlObjects.OfType <UmlUseCase>()) { UmlActivityDiagram actDiagram = model.Diagrams.OfType <UmlActivityDiagram>().Where(x => x.Name.Equals(useCase.Name)).FirstOrDefault(); if (actDiagram != null && ContainsInclude(ucDiagram, useCase) == false) { List <String> listActionForSingleUseCase = new List <String>(); ValidateDuplicatedActivitiesRecCall(actDiagram, model, listActionForSingleUseCase, useCase); } } }
private UmlUseCase GetUseCase(FiniteStateMachine machine, UmlModel model) { foreach (UmlUseCaseDiagram item in model.Diagrams.OfType <UmlUseCaseDiagram> ()) { foreach (UmlUseCase useCase in item.UmlObjects.OfType <UmlUseCase> ()) { if (machine.Name.Equals(useCase.Name)) { return(useCase); } } } return(null); }
public void ValidateFunctionalTest() { UmlModel model = null; // TODO: Initialize to an appropriate value model = new UmlModel("Model X"); UmlActivityDiagram diagram = new UmlActivityDiagram(""); //UmlUseCaseDiagram case1 = new UmlUseCaseDiagram(); UmlInitialState initial = new UmlInitialState(); UmlFinalState final = new UmlFinalState(); UmlActionState action = new UmlActionState(); UmlActionState action1 = new UmlActionState(); UmlTransition transition = new UmlTransition(); UmlTransition transition1 = new UmlTransition(); UmlTransition transition2 = new UmlTransition(); initial.Name = "initial0"; final.Name = "final0"; diagram.UmlObjects.Add(initial); transition.Source = initial; transition.Target = action; action.SetTaggedValue("jude.hyperlink", "teste"); transition1.Source = action; transition1.Target = action1; transition1.SetTaggedValue("FTaction", ""); transition1.SetTaggedValue("FTexpectedResult", "Use parameters in the shared step below."); transition2.Source = action1; transition2.Target = final; diagram.UmlObjects.Add(action); diagram.UmlObjects.Add(action1); diagram.UmlObjects.Add(transition); diagram.UmlObjects.Add(transition1); diagram.UmlObjects.Add(transition2); diagram.UmlObjects.Add(transition2); List <KeyValuePair <string, int> > expected = new List <KeyValuePair <string, int> >(); // TODO: Initialize to an appropriate value List <KeyValuePair <string, int> > actual = ValidatorFactory.CreateValidator().Validate(model, ""); Assert.AreEqual(expected.Count, actual.Count); IEnumerator <KeyValuePair <string, int> > e1 = expected.GetEnumerator(); IEnumerator <KeyValuePair <string, int> > e2 = actual.GetEnumerator(); while (e1.MoveNext() && e2.MoveNext()) { Assert.AreEqual(e1.Current, e2.Current); } }
private void PopulateTestCase(String[][] matriz, FiniteStateMachine machine, UmlModel model, TestPlan testPlan, UmlUseCase useCase) { for (int k = 0; k < matriz.Length; k++) { testPlan.Name = useCase.Name; Transition t = new Transition(); List <Transition> listTransition = new List <Transition> (); String[] arraySequence = matriz[k]; int maxUseCaseLines = int.MaxValue; foreach (String input in arraySequence) { t = GetTransition(input, t.TargetState, machine); if (t != null) { listTransition.Add(t); UmlTransition tran = GetUmlTransition(model, t); foreach (KeyValuePair <String, String> pair in tran.TaggedValues) { int aux = GetUsedFilesLineCount(pair.Value); if (maxUseCaseLines > aux) { maxUseCaseLines = aux; } } } } TestCase testCase = null; if (maxUseCaseLines == int.MaxValue) { ResetParamFilesPointers(); } else { ResetParamFilesPointers(maxUseCaseLines); } do { testCase = FillTestCase(model, useCase, listTransition, testCase); if (testCase != null) { testPlan.TestCases.Add(testCase); } currLine++; } while (doAgain && (currLine < maxLine)); } }
/// <summary> /// Inicia a validacao de um ou mais diagramas. /// </summary> public override List <KeyValuePair <String, Int32> > Validate(List <GeneralUseStructure> listModelStructure, String fileName) { //TODO Create an UmlModel reference variable, cast model to UmlModel type and refactor method to use new variable. errors = new List <KeyValuePair <String, Int32> > (); UmlModel model = listModelStructure.OfType <UmlModel> ().FirstOrDefault(); //if (model.Diagrams.OfType<UmlUseCaseDiagram>().Count() > 1) //{ // log("There must be only one UseCase Diagram.", 3); //} //Looking for diagrams inside given model foreach (UmlDiagram diagram in model.Diagrams) { //validate by diagram type if (diagram is UmlUseCaseDiagram) { ValidateUseCaseDiagram(model, diagram); } else if (diagram is UmlActivityDiagram) { ValidateActivityDiagram(diagram, model, fileName); } } //locate reference cycles foreach (UmlActivityDiagram diagram in model.Diagrams.OfType <UmlActivityDiagram> ()) { Stack <UmlActivityDiagram> visitedDiagrams = new Stack <UmlActivityDiagram> (); visitedDiagrams.Push(diagram); HasCircularReference(visitedDiagrams, model, diagram); } //list log is null when model don't have a loop if (listLog != null) { foreach (String item in listLog) { log(item, 3); } listLog = null; } else { log("An error was found while parsing XML file.", 3); } return(errors); }