rgen 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/CHANGELOG +15 -0
  2. data/lib/instantiators/ea_instantiator.rb +5 -2
  3. data/lib/metamodels/uml13_metamodel.rb +10 -10
  4. data/lib/mmgen/templates/annotations.tpl +1 -1
  5. data/lib/mmgen/templates/metamodel_generator.tpl +1 -1
  6. data/lib/rgen/ecore/ecore.rb +2 -2
  7. data/lib/rgen/ecore/ecore_instantiator.rb +4 -2
  8. data/lib/rgen/ecore/ecore_transformer.rb +6 -1
  9. data/lib/rgen/environment.rb +5 -0
  10. data/lib/rgen/environment.rb.bak +42 -0
  11. data/lib/rgen/instantiator/abstract_xml_instantiator.rb +40 -5
  12. data/lib/rgen/instantiator/ecore_xml_instantiator.rb +1 -1
  13. data/lib/rgen/instantiator/xmi11_instantiator.rb +1 -1
  14. data/lib/rgen/metamodel_builder/builder_extensions.rb +57 -39
  15. data/lib/rgen/serializer/xmi20_serializer.rb +60 -0
  16. data/lib/rgen/serializer/xml_serializer.rb +61 -0
  17. data/lib/rgen/template_language/output_handler.rb +15 -27
  18. data/lib/rgen/template_language/template_container.rb +1 -1
  19. data/lib/rgen/transformer.rb +50 -8
  20. data/test/metamodel_builder_test.rb +22 -0
  21. data/test/metamodel_roundtrip_test.rb +10 -0
  22. data/test/metamodel_roundtrip_test/TestModel.rb +2 -0
  23. data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +10 -8
  24. data/test/metamodel_roundtrip_test/houseMetamodel.ecore +8 -0
  25. data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +268 -0
  26. data/test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb +8 -5
  27. data/test/output_handler_test.rb +10 -0
  28. data/test/transformer_test.rb +13 -1
  29. metadata +7 -3
  30. data/lib/rgen/metamodel_builder/build_helper.rb +0 -51
@@ -0,0 +1,268 @@
1
+ <ecore:EPackage xmi:version="2.0" name="HouseMetamodel" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
2
+ <eClassifiers name="House" abstract="false" instanceClassName="HouseMetamodel::House" interface="false" ePackage="#/" xsi:type="ecore:EClass">
3
+ <eStructuralFeatures name="size" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true">
4
+ </eStructuralFeatures>
5
+ <eStructuralFeatures name="module" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true">
6
+ </eStructuralFeatures>
7
+ <eStructuralFeatures name="address" derived="false" transient="false" changeable="false" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true">
8
+ <eAnnotations eModelElement="#//House/address" xsi:type="ecore:EAnnotation">
9
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="derived">
10
+ </details>
11
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Not Specified" key="containment">
12
+ </details>
13
+ <details xsi:type="ecore:EStringToStringMapEntry" value="{A8DF581B-9AC6-4f75-AB48-8FAEDFC6E068}" key="ea_guid">
14
+ </details>
15
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="duplicates">
16
+ </details>
17
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="collection">
18
+ </details>
19
+ <details xsi:type="ecore:EStringToStringMapEntry" value="String" key="type">
20
+ </details>
21
+ <details xsi:type="ecore:EStringToStringMapEntry" value="volatile=0;" key="styleex">
22
+ </details>
23
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="upperBound">
24
+ </details>
25
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ordered">
26
+ </details>
27
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="lowerBound">
28
+ </details>
29
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="position">
30
+ </details>
31
+ </eAnnotations>
32
+ </eStructuralFeatures>
33
+ <eStructuralFeatures name="bathroom" derived="false" containment="false" transient="true" changeable="true" resolveProxies="true" eContainingClass="#//House" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Bathroom" unique="true">
34
+ </eStructuralFeatures>
35
+ <eStructuralFeatures name="kitchen" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Kitchen/house" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Kitchen" unique="true">
36
+ <eAnnotations eModelElement="#//House/kitchen" xsi:type="ecore:EAnnotation">
37
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment">
38
+ </details>
39
+ </eAnnotations>
40
+ </eStructuralFeatures>
41
+ <eStructuralFeatures name="room" derived="false" containment="true" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Room/house" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Room" unique="true">
42
+ </eStructuralFeatures>
43
+ <eAnnotations eModelElement="#//House" xsi:type="ecore:EAnnotation">
44
+ <details xsi:type="ecore:EStringToStringMapEntry" value="dummy" key="stereotype">
45
+ </details>
46
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
47
+ </details>
48
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2005-09-16 19:52:18" key="date_created">
49
+ </details>
50
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
51
+ </details>
52
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-02-28 08:29:19" key="date_modified">
53
+ </details>
54
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
55
+ </details>
56
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
57
+ </details>
58
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
59
+ </details>
60
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD" key="package">
61
+ </details>
62
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
63
+ </details>
64
+ <details xsi:type="ecore:EStringToStringMapEntry" value="HouseMetamodel" key="package_name">
65
+ </details>
66
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
67
+ </details>
68
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
69
+ </details>
70
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
71
+ </details>
72
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
73
+ </details>
74
+ </eAnnotations>
75
+ </eClassifiers>
76
+ <eClassifiers name="Person" abstract="false" instanceClassName="HouseMetamodel::Person" interface="false" ePackage="#/" xsi:type="ecore:EClass">
77
+ <eStructuralFeatures name="sex" derived="false" transient="false" changeable="true" eContainingClass="#//Person" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="#//SexEnum" unique="true">
78
+ </eStructuralFeatures>
79
+ <eStructuralFeatures name="home" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//Person" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="0" eType="#//House" unique="true">
80
+ <eAnnotations eModelElement="#//Person/home" xsi:type="ecore:EAnnotation">
81
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment">
82
+ </details>
83
+ </eAnnotations>
84
+ </eStructuralFeatures>
85
+ <eAnnotations eModelElement="#//Person" xsi:type="ecore:EAnnotation">
86
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
87
+ </details>
88
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:23" key="date_created">
89
+ </details>
90
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
91
+ </details>
92
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:26" key="date_modified">
93
+ </details>
94
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
95
+ </details>
96
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
97
+ </details>
98
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
99
+ </details>
100
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD" key="package">
101
+ </details>
102
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
103
+ </details>
104
+ <details xsi:type="ecore:EStringToStringMapEntry" value="HouseMetamodel" key="package_name">
105
+ </details>
106
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
107
+ </details>
108
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
109
+ </details>
110
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
111
+ </details>
112
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
113
+ </details>
114
+ </eAnnotations>
115
+ </eClassifiers>
116
+ <eClassifiers name="SexEnum" instanceClassName="HouseMetamodel::SexEnum" ePackage="#/" xsi:type="ecore:EEnum">
117
+ <eLiterals name="male" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum">
118
+ </eLiterals>
119
+ <eLiterals name="female" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum">
120
+ </eLiterals>
121
+ </eClassifiers>
122
+ <eClassifiers name="MeetingPlace" abstract="false" instanceClassName="HouseMetamodel::MeetingPlace" interface="false" ePackage="#/" xsi:type="ecore:EClass">
123
+ <eAnnotations eModelElement="#//MeetingPlace" xsi:type="ecore:EAnnotation" source="testmodel">
124
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
125
+ </details>
126
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:40:46" key="date_created">
127
+ </details>
128
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
129
+ </details>
130
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:44:02" key="date_modified">
131
+ </details>
132
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
133
+ </details>
134
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
135
+ </details>
136
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
137
+ </details>
138
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD" key="package">
139
+ </details>
140
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
141
+ </details>
142
+ <details xsi:type="ecore:EStringToStringMapEntry" value="HouseMetamodel" key="package_name">
143
+ </details>
144
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
145
+ </details>
146
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
147
+ </details>
148
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
149
+ </details>
150
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
151
+ </details>
152
+ </eAnnotations>
153
+ </eClassifiers>
154
+ <eSubpackages name="Rooms" xsi:type="ecore:EPackage" eSuperPackage="#/">
155
+ <eClassifiers name="Bathroom" abstract="false" instanceClassName="HouseMetamodel::Rooms::Bathroom" interface="false" ePackage="#//Rooms" xsi:type="ecore:EClass" eSuperTypes="#//Rooms/Room">
156
+ <eAnnotations eModelElement="#//Rooms/Bathroom" xsi:type="ecore:EAnnotation">
157
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
158
+ </details>
159
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:32:25" key="date_created">
160
+ </details>
161
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
162
+ </details>
163
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:23" key="date_modified">
164
+ </details>
165
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
166
+ </details>
167
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
168
+ </details>
169
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
170
+ </details>
171
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08" key="package">
172
+ </details>
173
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
174
+ </details>
175
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Rooms" key="package_name">
176
+ </details>
177
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
178
+ </details>
179
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
180
+ </details>
181
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
182
+ </details>
183
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
184
+ </details>
185
+ </eAnnotations>
186
+ </eClassifiers>
187
+ <eClassifiers name="Room" abstract="false" instanceClassName="HouseMetamodel::Rooms::Room" interface="false" ePackage="#//Rooms" xsi:type="ecore:EClass">
188
+ <eStructuralFeatures name="house" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//Rooms/Room" eOpposite="#//House/room" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="#//House" unique="true">
189
+ <eAnnotations eModelElement="#//Rooms/Room/house" xsi:type="ecore:EAnnotation">
190
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment">
191
+ </details>
192
+ </eAnnotations>
193
+ </eStructuralFeatures>
194
+ <eAnnotations eModelElement="#//Rooms/Room" xsi:type="ecore:EAnnotation">
195
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
196
+ </details>
197
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2005-09-16 19:52:28" key="date_created">
198
+ </details>
199
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
200
+ </details>
201
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-22 21:15:25" key="date_modified">
202
+ </details>
203
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
204
+ </details>
205
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
206
+ </details>
207
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
208
+ </details>
209
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08" key="package">
210
+ </details>
211
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
212
+ </details>
213
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Rooms" key="package_name">
214
+ </details>
215
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
216
+ </details>
217
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
218
+ </details>
219
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
220
+ </details>
221
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
222
+ </details>
223
+ </eAnnotations>
224
+ </eClassifiers>
225
+ <eClassifiers name="Kitchen" abstract="false" instanceClassName="HouseMetamodel::Rooms::Kitchen" interface="false" ePackage="#//Rooms" xsi:type="ecore:EClass" eSuperTypes="#//MeetingPlace #//Rooms/Room">
226
+ <eStructuralFeatures name="house" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//Rooms/Kitchen" eOpposite="#//House/kitchen" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//House" unique="true">
227
+ <eAnnotations eModelElement="#//Rooms/Kitchen/house" xsi:type="ecore:EAnnotation">
228
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment">
229
+ </details>
230
+ </eAnnotations>
231
+ </eStructuralFeatures>
232
+ <eAnnotations eModelElement="#//Rooms/Kitchen" xsi:type="ecore:EAnnotation">
233
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status">
234
+ </details>
235
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2005-11-30 19:26:13" key="date_created">
236
+ </details>
237
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype">
238
+ </details>
239
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-22 21:15:34" key="date_modified">
240
+ </details>
241
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged">
242
+ </details>
243
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype">
244
+ </details>
245
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version">
246
+ </details>
247
+ <details xsi:type="ecore:EStringToStringMapEntry" value="EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08" key="package">
248
+ </details>
249
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="isSpecification">
250
+ </details>
251
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Rooms" key="package_name">
252
+ </details>
253
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="complexity">
254
+ </details>
255
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="phase">
256
+ </details>
257
+ <details xsi:type="ecore:EStringToStringMapEntry" value="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;" key="style">
258
+ </details>
259
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype">
260
+ </details>
261
+ </eAnnotations>
262
+ </eClassifiers>
263
+ </eSubpackages>
264
+ <eSubpackages name="DependingOnRooms" xsi:type="ecore:EPackage" eSuperPackage="#/">
265
+ <eClassifiers name="RoomSub" abstract="false" instanceClassName="HouseMetamodel::DependingOnRooms::RoomSub" interface="false" ePackage="#//DependingOnRooms" xsi:type="ecore:EClass" eSuperTypes="#//Rooms/Room">
266
+ </eClassifiers>
267
+ </eSubpackages>
268
+ </ecore:EPackage>
@@ -4,15 +4,18 @@ module HouseMetamodel
4
4
  extend RGen::MetamodelBuilder::ModuleExtension
5
5
  include RGen::MetamodelBuilder::DataTypes
6
6
 
7
+ SexEnum = Enum.new(:name => 'SexEnum', :literals =>[ :male, :female ])
7
8
 
8
9
  class House < RGen::MetamodelBuilder::MMBase
9
- has_attr 'address', String, :ordered => :true, :unique => :true, :changeable => false, :volatile => :false, :transient => :false, :unsettable => :false, :derived => :false
10
+ annotation :source => "bla", :details => {'a' => 'b'}
11
+ has_attr 'address', String, :changeable => false
10
12
  end
11
13
 
12
14
  class MeetingPlace < RGen::MetamodelBuilder::MMBase
13
15
  end
14
16
 
15
17
  class Person < RGen::MetamodelBuilder::MMBase
18
+ has_attr 'sex', HouseMetamodel::SexEnum
16
19
  end
17
20
 
18
21
 
@@ -33,7 +36,7 @@ module HouseMetamodel
33
36
  end
34
37
  end
35
38
 
36
- HouseMetamodel::House.contains_one_uni 'bathroom', HouseMetamodel::Rooms::Bathroom, :ordered => true, :unique => true, :changeable => true, :volatile => false, :transient => false, :unsettable => false, :derived => false, :lowerBound => 1, :resolveProxies => true
37
- HouseMetamodel::Rooms::Kitchen.contains_one 'house', HouseMetamodel::House, 'kitchen', :ordered => true, :unique => true, :changeable => true, :volatile => false, :transient => false, :unsettable => false, :derived => false, :resolveProxies => true, :opposite_ordered => true, :opposite_unique => true, :opposite_changeable => true, :opposite_volatile => false, :opposite_transient => false, :opposite_unsettable => false, :opposite_derived => false, :opposite_lowerBound => 1, :opposite_resolveProxies => true
38
- HouseMetamodel::Rooms::Room.many_to_one 'house', HouseMetamodel::House, 'room', :ordered => true, :unique => true, :changeable => true, :volatile => false, :transient => false, :unsettable => false, :derived => false, :resolveProxies => true, :opposite_ordered => true, :opposite_unique => true, :opposite_changeable => true, :opposite_volatile => false, :opposite_transient => false, :opposite_unsettable => false, :opposite_derived => false, :opposite_resolveProxies => true
39
- HouseMetamodel::Person.contains_many_uni 'house', HouseMetamodel::House, :ordered => true, :unique => true, :changeable => true, :volatile => false, :transient => false, :unsettable => false, :derived => false, :resolveProxies => true
39
+ HouseMetamodel::House.has_one 'bathroom', HouseMetamodel::Rooms::Bathroom, :lowerBound => 1
40
+ HouseMetamodel::House.one_to_one 'kitchen', HouseMetamodel::Rooms::Kitchen, 'house', :lowerBound => 1
41
+ HouseMetamodel::House.contains_many 'room', HouseMetamodel::Rooms::Room, 'house'
42
+ HouseMetamodel::Person.has_many 'house', HouseMetamodel::House
@@ -37,4 +37,14 @@ class MetamodelBuilderTest < Test::Unit::TestCase
37
37
  h << "Start \n\n"
38
38
  assert_equal " Start\n", h.to_s
39
39
  end
40
+ def test_performance
41
+ h = RGen::TemplateLanguage::OutputHandler.new
42
+ h.mode = :explicit
43
+ h.indent = 1
44
+ line = (1..50).collect{|w| "someword"}.join(" ")+"\n"
45
+ # repeat more often to make performance differences visible
46
+ 20.times do
47
+ h << line
48
+ end
49
+ end
40
50
  end
@@ -14,6 +14,9 @@ class TransformerTest < Test::Unit::TestCase
14
14
  class ModelIn
15
15
  attr_accessor :name
16
16
  end
17
+
18
+ class ModelInSub < ModelIn
19
+ end
17
20
 
18
21
  class ModelAIn
19
22
  attr_accessor :name
@@ -110,6 +113,15 @@ class TransformerTest < Test::Unit::TestCase
110
113
  assert_equal 1, t.modelInTrans_count
111
114
  end
112
115
 
116
+ def test_transformer_subclass
117
+ from = ModelInSub.new
118
+ from.name = "TestName"
119
+ t = MyTransformer.new
120
+ assert t.trans(from).is_a?(ModelOut)
121
+ assert_equal "TestName", t.trans(from).name
122
+ assert_equal 1, t.modelInTrans_count
123
+ end
124
+
113
125
  def test_transformer_array
114
126
  froms = [ModelIn.new, ModelIn.new]
115
127
  froms[0].name = "M1"
@@ -186,7 +198,7 @@ class TransformerTest < Test::Unit::TestCase
186
198
  end
187
199
  UML13.ecore.eClassifiers.each do |c|
188
200
  copy c.instanceClass
189
- end
201
+ end
190
202
  end
191
203
 
192
204
  MODEL_DIR = File.join(File.dirname(__FILE__),"testmodel")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rgen
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.0
7
- date: 2007-08-08 00:00:00 +02:00
6
+ version: 0.4.1
7
+ date: 2007-11-25 00:00:00 +01:00
8
8
  summary: Ruby Modelling and Generator Framework
9
9
  require_paths:
10
10
  - lib
@@ -48,6 +48,7 @@ files:
48
48
  - lib/rgen/auto_class_creator.rb
49
49
  - lib/rgen/ecore
50
50
  - lib/rgen/environment.rb
51
+ - lib/rgen/environment.rb.bak
51
52
  - lib/rgen/find_helper.rb
52
53
  - lib/rgen/instantiator
53
54
  - lib/rgen/metamodel_builder
@@ -55,6 +56,7 @@ files:
55
56
  - lib/rgen/model_comparator.rb
56
57
  - lib/rgen/model_dumper.rb
57
58
  - lib/rgen/name_helper.rb
59
+ - lib/rgen/serializer
58
60
  - lib/rgen/template_language
59
61
  - lib/rgen/template_language.rb
60
62
  - lib/rgen/transformer.rb
@@ -69,13 +71,14 @@ files:
69
71
  - lib/rgen/instantiator/xmi11_instantiator.rb
70
72
  - lib/rgen/metamodel_builder/builder_extensions.rb
71
73
  - lib/rgen/metamodel_builder/builder_runtime.rb
72
- - lib/rgen/metamodel_builder/build_helper.rb
73
74
  - lib/rgen/metamodel_builder/data_types.rb
74
75
  - lib/rgen/metamodel_builder/intermediate
75
76
  - lib/rgen/metamodel_builder/metamodel_description.rb
76
77
  - lib/rgen/metamodel_builder/mm_multiple.rb
77
78
  - lib/rgen/metamodel_builder/module_extension.rb
78
79
  - lib/rgen/metamodel_builder/intermediate/annotation.rb
80
+ - lib/rgen/serializer/xmi20_serializer.rb
81
+ - lib/rgen/serializer/xml_serializer.rb
79
82
  - lib/rgen/template_language/directory_template_container.rb
80
83
  - lib/rgen/template_language/output_handler.rb
81
84
  - lib/rgen/template_language/template_container.rb
@@ -98,6 +101,7 @@ files:
98
101
  - test/xml_instantiator_test.rb
99
102
  - test/metamodel_roundtrip_test/houseMetamodel.ecore
100
103
  - test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
104
+ - test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore
101
105
  - test/metamodel_roundtrip_test/TestModel.rb
102
106
  - test/metamodel_roundtrip_test/TestModel_Regenerated.rb
103
107
  - test/template_language_test/expected_result.txt
@@ -1,51 +0,0 @@
1
- # RGen Framework
2
- # (c) Martin Thiede, 2006
3
-
4
- require 'rgen/name_helper'
5
-
6
- module RGen
7
-
8
- module MetamodelBuilder
9
-
10
- class BuildHelper
11
- include NameHelper
12
-
13
- def self.build(mod,bnd,tpl)
14
- mod.module_eval ERB.new(tpl).result(BuildHelper.new(mod, bnd).bnd)
15
- end
16
- def initialize(mod, bnd)
17
- @outer_binding = bnd
18
- @mod = mod
19
- end
20
- def bnd
21
- binding
22
- end
23
- def method_missing(m, *args)
24
- if args.empty?
25
- eval("#{m}",@outer_binding)
26
- else
27
- @mod.instance_eval do
28
- send(m,*args)
29
- end
30
- end
31
- end
32
- def type_check_code(varname, props)
33
- code = ""
34
- if props.impl_type.is_a?(Class)
35
- code << "unless #{varname}.nil? or #{varname}.is_a? #{props.impl_type}\n"
36
- expected = props.impl_type.to_s
37
- elsif props.impl_type.is_a?(RGen::MetamodelBuilder::DataTypes::Enum)
38
- code << "unless #{varname}.nil? or [#{props.impl_type.literals_as_strings.join(',')}].include?(#{varname})\n"
39
- expected = "["+props.impl_type.literals_as_strings.join(',')+"]"
40
- else
41
- raise StandardError.new("Unkown type "+props.impl_type.to_s)
42
- end
43
- code << "raise _assignmentTypeError(self,#{varname},\"#{expected}\")\n"
44
- code << "end"
45
- code
46
- end
47
- end
48
-
49
- end
50
-
51
- end