rgen 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/CHANGELOG +9 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +73 -0
  4. data/lib/ea/xmi_class_instantiator.rb +45 -0
  5. data/lib/ea/xmi_helper.rb +26 -0
  6. data/lib/ea/xmi_metamodel.rb +19 -0
  7. data/lib/ea/xmi_object_instantiator.rb +42 -0
  8. data/lib/ea/xmi_to_classmodel.rb +78 -0
  9. data/lib/ea/xmi_to_objectmodel.rb +89 -0
  10. data/lib/mmgen/metamodel_generator.rb +19 -0
  11. data/lib/mmgen/mm_ext/uml_classmodel_ext.rb +71 -0
  12. data/lib/mmgen/mmgen.rb +21 -0
  13. data/lib/mmgen/templates/uml_classmodel.tpl +63 -0
  14. data/lib/rgen/array_extensions.rb +23 -0
  15. data/lib/rgen/auto_class_creator.rb +56 -0
  16. data/lib/rgen/environment.rb +57 -0
  17. data/lib/rgen/metamodel_builder.rb +102 -0
  18. data/lib/rgen/metamodel_builder/build_helper.rb +29 -0
  19. data/lib/rgen/metamodel_builder/builder_extensions.rb +191 -0
  20. data/lib/rgen/metamodel_builder/builder_runtime.rb +67 -0
  21. data/lib/rgen/name_helper.rb +18 -0
  22. data/lib/rgen/template_language.rb +169 -0
  23. data/lib/rgen/template_language/directory_template_container.rb +51 -0
  24. data/lib/rgen/template_language/output_handler.rb +84 -0
  25. data/lib/rgen/template_language/template_container.rb +153 -0
  26. data/lib/rgen/template_language/template_helper.rb +26 -0
  27. data/lib/rgen/transformer.rb +316 -0
  28. data/lib/rgen/xml_instantiator/dependency_resolver.rb +23 -0
  29. data/lib/rgen/xml_instantiator/xml_instantiator.rb +78 -0
  30. data/lib/rgen/xml_instantiator/xml_parser.rb +39 -0
  31. data/lib/uml/objectmodel_instantiator.rb +53 -0
  32. data/lib/uml/uml_classmodel.rb +92 -0
  33. data/lib/uml/uml_objectmodel.rb +65 -0
  34. data/test/array_extensions_test.rb +54 -0
  35. data/test/environment_test.rb +47 -0
  36. data/test/metamodel_builder_test.rb +175 -0
  37. data/test/metamodel_generator_test.rb +45 -0
  38. data/test/metamodel_generator_test/TestModel.rb +40 -0
  39. data/test/metamodel_generator_test/expected_result.txt +40 -0
  40. data/test/output_handler_test.rb +40 -0
  41. data/test/rgen_test.rb +13 -0
  42. data/test/template_language_test.rb +46 -0
  43. data/test/template_language_test/expected_result.txt +10 -0
  44. data/test/template_language_test/templates/content/chapter.tpl +5 -0
  45. data/test/template_language_test/templates/index/c/cmod.tpl +1 -0
  46. data/test/template_language_test/templates/index/chapter.tpl +3 -0
  47. data/test/template_language_test/templates/root.tpl +22 -0
  48. data/test/template_language_test/testout.txt +10 -0
  49. data/test/transformer_test.rb +176 -0
  50. data/test/xmi_class_instantiator_test.rb +107 -0
  51. data/test/xmi_instantiator_test/testmodel.eap +0 -0
  52. data/test/xmi_instantiator_test/testmodel.xml +962 -0
  53. data/test/xmi_object_instantiator_test.rb +65 -0
  54. metadata +117 -0
@@ -0,0 +1,65 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
+
3
+ require 'test/unit'
4
+ require 'ea/xmi_object_instantiator'
5
+
6
+ class XmiObjectInstantiatorTest < Test::Unit::TestCase
7
+
8
+ MODEL_DIR = File.join(File.dirname(__FILE__),"xmi_instantiator_test")
9
+
10
+ include XMIObjectInstantiator
11
+
12
+ def test_model
13
+ envUML = RGen::Environment.new
14
+ File.open(MODEL_DIR+"/testmodel.xml") { |f|
15
+ instantiateUMLObjectModel(envUML, f.read)
16
+ }
17
+
18
+ # check main package
19
+ mainPackage = envUML.elements.select {|e| e.is_a? UMLPackage and e.name == "HouseExampleModel"}.first
20
+ assert_not_nil mainPackage
21
+
22
+ # check main package objects
23
+ assert mainPackage.objects.is_a?(Array)
24
+ assert_equal 6, mainPackage.objects.size
25
+ assert mainPackage.objects.all?{|o| o.is_a?(UMLObject)}
26
+
27
+ someone = mainPackage.objects.select{|o| o.name == "Someone"}.first
28
+ assert_equal "Person", someone.classname
29
+
30
+ someonesHouse = mainPackage.objects.select{|o| o.name == "SomeonesHouse"}.first
31
+ assert_equal "House", someonesHouse.classname
32
+
33
+ greenRoom = mainPackage.objects.select{|o| o.name == "GreenRoom"}.first
34
+ assert_equal "Room", greenRoom.classname
35
+
36
+ yellowRoom = mainPackage.objects.select{|o| o.name == "YellowRoom"}.first
37
+ assert_equal "Room", yellowRoom.classname
38
+
39
+ hotRoom = mainPackage.objects.select{|o| o.name == "HotRoom"}.first
40
+ assert_equal "Kitchen", hotRoom.classname
41
+
42
+ wetRoom = mainPackage.objects.select{|o| o.name == "WetRoom"}.first
43
+ assert_equal "Bathroom", wetRoom.classname
44
+
45
+ # Someone to SomeonesHouse
46
+ assert someone.assocEnds.otherEnd.object.is_a?(Array)
47
+ assert_equal 1, someone.assocEnds.otherEnd.object.size
48
+ houseEnd = someone.assocEnds.otherEnd[0]
49
+ assert_equal someonesHouse.object_id, houseEnd.object.object_id
50
+ assert_equal "home", houseEnd.role
51
+
52
+ # Someone to SomeonesHouse
53
+ assert someonesHouse.localCompositeEnds.otherEnd.is_a?(Array)
54
+ assert_equal 4, someonesHouse.localCompositeEnds.otherEnd.size
55
+ assert someonesHouse.localCompositeEnds.otherEnd.all?{|e| e.role == "room"}
56
+ assert_not_nil someonesHouse.localCompositeEnds.otherEnd.object.select{|o| o == yellowRoom}.first
57
+ assert_not_nil someonesHouse.localCompositeEnds.otherEnd.object.select{|o| o == greenRoom}.first
58
+ assert_not_nil someonesHouse.localCompositeEnds.otherEnd.object.select{|o| o == hotRoom}.first
59
+ assert_not_nil someonesHouse.localCompositeEnds.otherEnd.object.select{|o| o == wetRoom}.first
60
+
61
+ # check overall number of UMLObject objects
62
+ assert_equal 6, envUML.elements.select{|e| e.is_a? UMLObject}.size
63
+
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: rgen
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.2.0
7
+ date: 2006-09-03 00:00:00 +02:00
8
+ summary: Ruby Modelling and Generator Framework
9
+ require_paths:
10
+ - lib
11
+ email:
12
+ homepage:
13
+ rubyforge_project: rgen
14
+ description: RGen is a framework supporting Model Driven Software Development (MDSD). This means that it helps you build Metamodels, instantiate Models, modify and transform Models and finally generate arbitrary textual content from it.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Martin Thiede
31
+ files:
32
+ - lib/ea
33
+ - lib/mmgen
34
+ - lib/rgen
35
+ - lib/uml
36
+ - lib/ea/xmi_class_instantiator.rb
37
+ - lib/ea/xmi_helper.rb
38
+ - lib/ea/xmi_metamodel.rb
39
+ - lib/ea/xmi_object_instantiator.rb
40
+ - lib/ea/xmi_to_classmodel.rb
41
+ - lib/ea/xmi_to_objectmodel.rb
42
+ - lib/mmgen/metamodel_generator.rb
43
+ - lib/mmgen/mmgen.rb
44
+ - lib/mmgen/mm_ext
45
+ - lib/mmgen/templates
46
+ - lib/mmgen/mm_ext/uml_classmodel_ext.rb
47
+ - lib/mmgen/templates/uml_classmodel.tpl
48
+ - lib/rgen/array_extensions.rb
49
+ - lib/rgen/auto_class_creator.rb
50
+ - lib/rgen/environment.rb
51
+ - lib/rgen/metamodel_builder
52
+ - lib/rgen/metamodel_builder.rb
53
+ - lib/rgen/name_helper.rb
54
+ - lib/rgen/template_language
55
+ - lib/rgen/template_language.rb
56
+ - lib/rgen/transformer.rb
57
+ - lib/rgen/xml_instantiator
58
+ - lib/rgen/metamodel_builder/builder_extensions.rb
59
+ - lib/rgen/metamodel_builder/builder_runtime.rb
60
+ - lib/rgen/metamodel_builder/build_helper.rb
61
+ - lib/rgen/template_language/directory_template_container.rb
62
+ - lib/rgen/template_language/output_handler.rb
63
+ - lib/rgen/template_language/template_container.rb
64
+ - lib/rgen/template_language/template_helper.rb
65
+ - lib/rgen/xml_instantiator/dependency_resolver.rb
66
+ - lib/rgen/xml_instantiator/xml_instantiator.rb
67
+ - lib/rgen/xml_instantiator/xml_parser.rb
68
+ - lib/uml/objectmodel_instantiator.rb
69
+ - lib/uml/uml_classmodel.rb
70
+ - lib/uml/uml_objectmodel.rb
71
+ - test/array_extensions_test.rb
72
+ - test/environment_test.rb
73
+ - test/metamodel_builder_test.rb
74
+ - test/metamodel_generator_test
75
+ - test/metamodel_generator_test.rb
76
+ - test/output_handler_test.rb
77
+ - test/rgen_test.rb
78
+ - test/template_language_test
79
+ - test/template_language_test.rb
80
+ - test/transformer_test.rb
81
+ - test/xmi_class_instantiator_test.rb
82
+ - test/xmi_instantiator_test
83
+ - test/xmi_object_instantiator_test.rb
84
+ - test/metamodel_generator_test/expected_result.txt
85
+ - test/metamodel_generator_test/TestModel.rb
86
+ - test/template_language_test/expected_result.txt
87
+ - test/template_language_test/templates
88
+ - test/template_language_test/testout.txt
89
+ - test/template_language_test/templates/content
90
+ - test/template_language_test/templates/index
91
+ - test/template_language_test/templates/root.tpl
92
+ - test/template_language_test/templates/content/chapter.tpl
93
+ - test/template_language_test/templates/index/c
94
+ - test/template_language_test/templates/index/chapter.tpl
95
+ - test/template_language_test/templates/index/c/cmod.tpl
96
+ - test/xmi_instantiator_test/testmodel.eap
97
+ - test/xmi_instantiator_test/testmodel.xml
98
+ - README
99
+ - CHANGELOG
100
+ - MIT-LICENSE
101
+ test_files: []
102
+
103
+ rdoc_options:
104
+ - --main
105
+ - README
106
+ extra_rdoc_files:
107
+ - README
108
+ - CHANGELOG
109
+ - MIT-LICENSE
110
+ executables: []
111
+
112
+ extensions: []
113
+
114
+ requirements: []
115
+
116
+ dependencies: []
117
+