Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mbc

Pages: 1 [2] 3 4 ... 16
16
Suggestions and Requests / Re: object garbage collection
« on: August 17, 2003, 10:09:31 am »
There is such an ability: select Edit - Find Object, and check "Find orphans".

Hope this is what you are looking for.

Mikkel

17
Here is a large chunk of code for you. It is pretty quick-and-dirty programming that I did in order to get some nice system test documentation out quickly.

Sorry that I don't have the time to document it nicely for you, but I can tell you that:

1. GenerateTestDescriptions is the macro that I call to start it all. It searches for a bookmark in the Word document and inserts the test descriptions in that place (replacing old test descriptions).

2. ListUseCasesWithoutTests is another macro. It is a utility to make a list of use cases that still need tests to be written. Just a tool for the software designer.

3. It is written for a specific EA model and will probably not work without modifications on other models.


I hope you find this helpful. As to a sharing forum, I don't think I will be sharing heaps of more code in the future, since I consider that producing this sort of thing is the way I make my living. I can't give it all away for free. ;) But I will certainly be glad to give advice and code snippets.

Mikkel

Code: [Select]

Public Enum eFindMode
   fmElementsWithoutTests
End Enum
Public m_Repository As Object
Public ListOfTests As New Collection

Sub GenerateTestDescriptions()
   
   If ActiveDocument.Bookmarks.Exists("SystemTests") = True Then
       ActiveDocument.Bookmarks("SystemTests").Select
       
       ''clear old text
       
       Selection.Text = " "
       ActiveDocument.Bookmarks.Add "SystemTests", Selection.Range
       Selection.Collapse wdCollapseStart
       
       ''create the repository object
       Set m_Repository = CreateObject("EA.Repository")
       
       ''open an EAP file
       m_Repository.OpenFile ("C:\Data\MyModel.EAP")
       
       IterateViews
       DocumentTests
       For idx = 1 To ListOfTests.Count
           ListOfTests.Remove 1
       Next
       
       ''close the repository and tidy up
       m_Repository.Exit
       Set m_Repository = Nothing
   
   Else
       MsgBox "Bookmark ""SystemTests"" must be defined"
   End If
   
End Sub


Sub IterateTests(aElement As Variant)
   Dim Testidx As Integer
   Dim Listidx As Integer
   Dim aTest As Object
   Dim TempString As String
   
   For Testidx = 0 To aElement.Tests.Count - 1
       
       Set aTest = Nothing
       Set aTest = aElement.Tests.GetAt(Testidx)
       TestNameArray = Split(aTest.Name, " ", 4)
       If aTest.Type <> "System" Then
           If ListOfTests.Count = 0 Then
               ListOfTests.Add aTest, aTest.Name
           Else
               For Listidx = 1 To ListOfTests.Count
                   TempString = ListOfTests(Listidx).Name
                   ListNameArray = Split(TempString, " ", 4)
                   listno = CInt(CStr(ListNameArray(2)))
                   testno = CInt(CStr(TestNameArray(2)))
                   If listno >= testno Then
                       ListOfTests.Add aTest, aTest.Name, Listidx
                       Exit For
                   Else
                       If Listidx = ListOfTests.Count Then
                           ListOfTests.Add aTest, aTest.Name
                           Exit For
                       End If
                   End If
               Next
           End If
       End If
   Next
   Set aTest = Nothing
End Sub


Sub DocumentTests()
   Dim idx As Integer
   For idx = 1 To ListOfTests.Count
       Set aTest = ListOfTests(idx)
       
       Selection.InsertAfter (aTest.Name)
       Selection.Paragraphs.Style = wdStyleHeading2
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
               
       Selection.InsertAfter ("Test Procedure")
       Selection.Paragraphs.Style = "Heading 3"
       Selection.Paragraphs.SpaceAfter = 12
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
               
       Selection.InsertAfter (aTest.Notes)
       Selection.Paragraphs.Style = "Normal List"
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
       
       Selection.InsertAfter ("Preconditions")
       Selection.Paragraphs.Style = wdStyleHeading3
       Selection.Paragraphs.SpaceAfter = 12
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
       
       Selection.InsertAfter (aTest.Input)
       Selection.Paragraphs.Style = "Normal List"
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
       
       Selection.InsertAfter ("Acceptance Criteria")
       Selection.Paragraphs.Style = wdStyleHeading3
       Selection.Paragraphs.SpaceAfter = 12
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
     
       Selection.InsertAfter (aTest.AcceptanceCriteria)
       Selection.Paragraphs.Style = "Normal List"
       Selection.InsertParagraphAfter
       Selection.Collapse Direction:=wdCollapseEnd
   Next
   Set aTest = Nothing
       
End Sub


Sub IterateElements(aPackage As Variant)
   Dim idx As Integer
   For idx = 0 To aPackage.Elements.Count - 1
       Selection.Collapse Direction:=wdCollapseEnd
       Set aElement = aPackage.Elements.GetAt(idx)
       If aElement.Type <> "Boundary" Then
           IterateTests aElement
       End If
   Next
End Sub


Sub IteratePackages(aView As Variant)
   Dim idx As Integer
   For idx = 0 To aView.Packages.Count - 1
       Set aPackage = aView.Packages.GetAt(idx)
       IterateElements aPackage
   Next
End Sub

Sub IterateViews()
   Dim idx As Integer
   Set aModel = m_Repository.Models.GetAt(0)
   For idx = 0 To aModel.Packages.Count - 1
       Set aView = aModel.Packages.GetAt(idx)
       If aView.Name = "Use Case Model" Then
           IteratePackages aView
       End If
   Next
End Sub


Sub FindIteratePackages(Mode As eFindMode, ParentPackage As Variant)
   Dim idx As Integer
   For idx = 0 To ParentPackage.Packages.Count - 1
       Set Package = ParentPackage.Packages.GetAt(idx)
       If TestPackage(Mode, Package) Then
           DoPackageAction Mode, Package
           FindIterateElements Mode, Package
           FindIteratePackages Mode, Package
       End If
   Next
End Sub
Sub FindIterateElements(Mode As eFindMode, ParentPackage As Variant)
   Dim idx As Integer
   For idx = 0 To ParentPackage.Elements.Count - 1
       Set Element = ParentPackage.Elements.GetAt(idx)
       If TestElement(Mode, ParentPackage, Element) Then
           DoElementAction Mode, ParentPackage, Element
       End If
   Next
End Sub

Function TestPackage(Mode As eFindMode, Package As Variant) As Boolean
   Dim Result As Boolean
   
   Select Case Mode
   Case eElementsWithoutTests
       Result = True
   End Select
   
   TestPackage = Result
End Function
Sub DoPackageAction(Mode As eFindMode, Package As Variant)
   Select Case Mode
   
   Case eElementsWithoutTests
   End Select

End Sub
Function TestElement(Mode As eFindMode, Package As Variant, Element As Variant) As Boolean
   Dim Result As Boolean
   
   Select Case Mode
   Case eElementsWithoutTests
       If (Element.Type = "UseCase") And (Element.Tests.Count = 0) Then
           Result = True
       Else
           Result = False
       End If
   End Select
   
   TestElement = Result
End Function
Sub DoElementAction(Mode As eFindMode, Package As Variant, Element As Variant)
   Select Case Mode
   
   Case eElementsWithoutTests
       Selection.InsertAfter Element.Name & " " & Chr(9) & "(" & Package.Name & ")"
       Selection.InsertParagraphAfter
   End Select

End Sub
Function OpenModel(FileName As String) As Variant

   ''create the repository object
   Set m_Repository = CreateObject("EA.Repository")
   
   ''open an EAP file
   m_Repository.OpenFile (FileName)
   
   Set Model = m_Repository.Models.GetAt(0)
   
   Set OpenModel = Model
End Function
Sub CloseModel()
   m_Repository.Exit
   Set m_Repository = Nothing
End Sub

Sub ListUseCasesWithoutTests()
   Dim idx As Integer
   Set Model = OpenModel("C:\Data\MyModel.EAP")
   
   For idx = 0 To Model.Packages.Count - 1
       Set Package = Model.Packages.GetAt(idx)
       If Package.Name = "Use Case Model" Then
           FindIteratePackages fmElementsWithoutTests, Package
       End If
   Next
   
   CloseModel
End Sub


18
I suggest you write a word macro that does this through the automation interface. If you are already a programmer, that is not too difficult. And it might save you the bother of converting your document to CSV each time.
I am using a word macro to do the opposite - that is generate test descriptions in word format from EA (because I didn't like the standard output format).

Mikkel

19
Suggestions and Requests / Re: EA in Team Environment
« on: July 30, 2003, 02:50:10 am »
I have just verified that it works. I am using build 618, but this has always been the way that EA has worked.
Note that the diagram will not be updated while you are viewing it. You have to open the diagram to see new changes.

In my little test, I opened a model, had my colleague move a class in a diagram, I opened that diagram and saw the class in the new position. I opened a different diagram, had my colleague add an operation to a class in the first diagram, I opened that diagram again and saw the new operation.

Mikkel

20
Suggestions and Requests / Re: EA in Team Environment
« on: July 29, 2003, 08:06:42 am »
Hi again

Note that I wrote "diagram", not "model". Let me be more specific:

1. User B opens the model
2. User A makes modifications
3. User B opens a diagram/package/element within the model.

In this case, user B will see the most recent version.

Mikkel

21
Suggestions and Requests / Re: EA in Team Environment
« on: July 29, 2003, 02:03:22 am »
Hi Orcus

In this case, the user B will not see the changes in the diagram:
1. User B opens a diagram
2. User A makes changes to a class in the diagram

In this case, user B will see the changes, because EA accesses the database every time an element is opened:
1. User A makes changes to a class in the diagram
2. User B opens a diagram

Is is not so that an EA user needs to Reload Model in order to see any changes. The Reload Model feature is mostly for updating the project browser tree.

I hope this clears things up a little.

Mikkel

22
General Board / Re: Reverse engineering Java collections
« on: March 26, 2010, 10:19:59 pm »
Hi Geert,

Thank you for your quick reply. I will send a feature request.

Mikkel

23
General Board / Reverse engineering Java collections
« on: March 26, 2010, 08:12:32 pm »
Hi everybody

I am a long time user (8+ years, I think) of EA for C++, but now I am just starting to use it with Java.


When I reverse engineer this:

Code: [Select]
public class MyFirstClass {
      protected List<MySecondClass> myListOfObjects = new ArrayList<MySecondClass>();
}

public class MySecondClass {
}

then I would expect a diagram with 2 classes with an association from MyFirstClass to MySecondClass with *-multiplicity.
However, no association is created. I have tried setting "List" as "default collection class" in Java code generation options, but apparently that makes no difference.

I hope someone has a solution to this. I have not been active on this forum for years, but back in the day Geoff Sparks and his people were always very quick with helpful replies.

Best regards,
Mikkel

24
General Board / Re: Deployment diagram / Relationship matrix
« on: October 15, 2002, 01:59:40 am »
I must admit that I have reached the limit of my "knowledge" about deployment diagrams now. By using "Change object type" I have been able to get some interesting but unclear and not very usable results.

But to return to my first reply, when I create a node, and then put components in it, I still get aggregation relationships - instances or not.

Mikkel

25
General Board / Re: Deployment diagram / Relationship matrix
« on: October 15, 2002, 01:16:30 am »
Actually, I don't think that having classes (components) reside in nodes is UML-compliant.
The UML specification says: "Component instances and objects may be contained within node instance symbols. This indicates that the items reside on the node instances".
Because nodes depict the run-time structure of a system, this makes sense to me.

Mikkel

26
General Board / Re: Deployment diagram / Relationship matrix
« on: October 14, 2002, 05:45:43 am »
What happens if you drag the components out of the node? My EA automatically creates aggregation (composition) relationships between the node and its components.
If this is also the case for you, you can select Link Type: Aggregation in the Relationship Matrix window. That works for me.

Hope this helps

Mikkel

27
General Board / Re: Entering transitions in statecharts
« on: December 06, 2007, 02:58:30 am »
I must agree with Jim here.

revdev wrote:
Quote
Since events can carry data and a state shouldn't have to know which event caused the transition, it is proper for the entry method to have just one event type to extract data from.


If the state (or entry method) doesn't know which event caused the transition, how can it extract data from it? Don't get me wrong, I agree that they shouldn't. My states don't receive data. Entry methods don't get data from events either, because they don't know about the events.

Actually, states getting data doesn't make much sense to me, because states don't DO anything. What would happen to the data?

The concept that I have, that uses data from events is actions. An action is specified for each transition - therefore it knows about the event.

Best regards,
Mikkel

28
General Board / Re: Entering transitions in statecharts
« on: November 27, 2007, 08:35:44 am »
Just downloaded the latest build (build 818 ), and yes! The bug has been fixed!!! Hurray for Sparx!

I don't know exactly which build fixes it. I think I skipped about 10-15 builds.

Best regards,
Mikkel

29
General Board / Re: Entering transitions in statecharts
« on: November 27, 2007, 08:05:00 am »
Hi revdev, I am completely with you on this issue!!! I have just been tearing my hair out over this problem.

Thanks gpc for your suggestion. The lower TWO options give the desired result (the third one suffers from the same weakness as the diagram editor). Anyway, in my opinion, the state-event table editor is a MAJOR step down from the diagram editor in ease of use. Finding the right states and events in the table is at least a thousand times harder than in a diagram.

I can only consider it a bug that the diagram editor creates duplicate triggers instead of letting you choose an existing one.

30
General Board / Re: Cascading Windows in Diagram View
« on: November 29, 2007, 07:48:51 am »
Quote
As another work-around: use the EA viewer for a 2nd look. That can only read and not mess around. (Haven't tried this)


True, but what we really need is multiple editable views.

Quote
Mikkel: I never saw it working with editing inside frames. You can dbl-click to open and edit. And the contents is updated dynamically.


Maybe it WAS a dream! Anyone have the old builds?

Mikkel

Pages: 1 [2] 3 4 ... 16