ontomde-java 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/History.txt +10 -0
  2. data/Manifest.txt +156 -0
  3. data/README.txt +98 -0
  4. data/Rakefile +21 -0
  5. data/bin/ontomde-java +5 -0
  6. data/generateRdocFile.sh +16 -0
  7. data/lib/ontomde-java.rb +45 -0
  8. data/lib/ontomde-java/crank.rb +13 -0
  9. data/lib/ontomde-java/crank/context.rb +384 -0
  10. data/lib/ontomde-java/crank/crankJpa.rb +103 -0
  11. data/lib/ontomde-java/crank/equals.rb +83 -0
  12. data/lib/ontomde-java/crank/facelets.rb +243 -0
  13. data/lib/ontomde-java/crank/facesconfig.rb +113 -0
  14. data/lib/ontomde-java/crank/helper.rb +46 -0
  15. data/lib/ontomde-java/crank/main.rb +51 -0
  16. data/lib/ontomde-java/crank/menu.rb +39 -0
  17. data/lib/ontomde-java/crank/menu2.rb +78 -0
  18. data/lib/ontomde-java/crank/validation.rb +34 -0
  19. data/lib/ontomde-java/ejb2.rb +3 -0
  20. data/lib/ontomde-java/ejb2/main-ejb2.rb +194 -0
  21. data/lib/ontomde-java/flex.rb +7 -0
  22. data/lib/ontomde-java/flex/Editor.mxml.as.rb +184 -0
  23. data/lib/ontomde-java/flex/Editor.mxml.rb +701 -0
  24. data/lib/ontomde-java/flex/ImportationAS.rb +40 -0
  25. data/lib/ontomde-java/flex/ValueObjectAS.rb +338 -0
  26. data/lib/ontomde-java/flex/fileTypes.rb +19 -0
  27. data/lib/ontomde-java/flex/main.rb +347 -0
  28. data/lib/ontomde-java/frontend/command.rb +324 -0
  29. data/lib/ontomde-java/frontend/command.rdoc +583 -0
  30. data/lib/ontomde-java/frontend/defaultOptions.rb +124 -0
  31. data/lib/ontomde-java/frontend/options.rb +555 -0
  32. data/lib/ontomde-java/frontend/steps.rb +287 -0
  33. data/lib/ontomde-java/java/accessorCode.rb +528 -0
  34. data/lib/ontomde-java/java/accessorSignature.rb +347 -0
  35. data/lib/ontomde-java/java/annotationOntoMDE.rb +88 -0
  36. data/lib/ontomde-java/java/apache.rb +34 -0
  37. data/lib/ontomde-java/java/build.rb +80 -0
  38. data/lib/ontomde-java/java/collectionMapping.rb +112 -0
  39. data/lib/ontomde-java/java/component.rb +446 -0
  40. data/lib/ontomde-java/java/contextualize.rb +43 -0
  41. data/lib/ontomde-java/java/enumAssignable.rb +75 -0
  42. data/lib/ontomde-java/java/enumCompatibilityLayer.rb +195 -0
  43. data/lib/ontomde-java/java/equals.rb +91 -0
  44. data/lib/ontomde-java/java/groovy.rb +95 -0
  45. data/lib/ontomde-java/java/java.rb +1329 -0
  46. data/lib/ontomde-java/java/java.rdoc +78 -0
  47. data/lib/ontomde-java/java/javaDatatypeMapping.rb +156 -0
  48. data/lib/ontomde-java/java/javaHelper.rb +25 -0
  49. data/lib/ontomde-java/java/java_todo.rdoc +3 -0
  50. data/lib/ontomde-java/java/javadoc.rb +254 -0
  51. data/lib/ontomde-java/java/meta.rb +28 -0
  52. data/lib/ontomde-java/java/operationAsClass.rb +144 -0
  53. data/lib/ontomde-java/java/security.rb +260 -0
  54. data/lib/ontomde-java/java/stateMachine.rb +415 -0
  55. data/lib/ontomde-java/java/tenant.rb +65 -0
  56. data/lib/ontomde-java/java/xsd.rb +1363 -0
  57. data/lib/ontomde-java/java/xsdCollectionMapping.rb +112 -0
  58. data/lib/ontomde-java/java/xsdDatatypeMapping.rb +103 -0
  59. data/lib/ontomde-java/jpa.rb +17 -0
  60. data/lib/ontomde-java/jpa/configuration.rb +176 -0
  61. data/lib/ontomde-java/jpa/finder.rb +102 -0
  62. data/lib/ontomde-java/jpa/jpa.rb +531 -0
  63. data/lib/ontomde-java/jpa/jpa.rdoc +20 -0
  64. data/lib/ontomde-java/jpa/locking.rb +18 -0
  65. data/lib/ontomde-java/jpa/mapping.rb +314 -0
  66. data/lib/ontomde-java/jpa/redefined.rb +77 -0
  67. data/lib/ontomde-java/jpa/simulationAutoImplement.rb +54 -0
  68. data/lib/ontomde-java/jpdl.rb +9 -0
  69. data/lib/ontomde-java/jpdl/bpm.pprj +1745 -0
  70. data/lib/ontomde-java/jpdl/bpm.rdf +140 -0
  71. data/lib/ontomde-java/jpdl/bpm.rdfs +231 -0
  72. data/lib/ontomde-java/jpdl/constant.rb +5 -0
  73. data/lib/ontomde-java/jpdl/graphic.rb +52 -0
  74. data/lib/ontomde-java/jpdl/jpdl.rb +281 -0
  75. data/lib/ontomde-java/jpdl/jpdl_deploy.rb +114 -0
  76. data/lib/ontomde-java/jpdl/main.rb +348 -0
  77. data/lib/ontomde-java/jpdl/main.rdoc +2 -0
  78. data/lib/ontomde-java/jpdl/processOperationToClass.rb +316 -0
  79. data/lib/ontomde-java/kbjava.rb +6 -0
  80. data/lib/ontomde-java/kbjava/rdfToJava.rb +407 -0
  81. data/lib/ontomde-java/struts.rb +27 -0
  82. data/lib/ontomde-java/struts/MessageResources.rb +359 -0
  83. data/lib/ontomde-java/struts/action.rb +883 -0
  84. data/lib/ontomde-java/struts/blob.rb +11 -0
  85. data/lib/ontomde-java/struts/exceptionHandling.rb +167 -0
  86. data/lib/ontomde-java/struts/footer.rb +128 -0
  87. data/lib/ontomde-java/struts/form.rb +450 -0
  88. data/lib/ontomde-java/struts/header.rb +37 -0
  89. data/lib/ontomde-java/struts/header_link.rb +39 -0
  90. data/lib/ontomde-java/struts/jsp_edit.rb +870 -0
  91. data/lib/ontomde-java/struts/jsp_edit_field.rb +1 -0
  92. data/lib/ontomde-java/struts/jsp_edit_js.rb +124 -0
  93. data/lib/ontomde-java/struts/jsp_index.rb +136 -0
  94. data/lib/ontomde-java/struts/localeAction.rb +641 -0
  95. data/lib/ontomde-java/struts/main.rb +41 -0
  96. data/lib/ontomde-java/struts/mappingForBean.rb +132 -0
  97. data/lib/ontomde-java/struts/mappingForJsp.rb +272 -0
  98. data/lib/ontomde-java/struts/mappingToJavaHierarchy.rb +87 -0
  99. data/lib/ontomde-java/struts/reloadAction.rb +33 -0
  100. data/lib/ontomde-java/struts/spring.rb +89 -0
  101. data/lib/ontomde-java/struts/struts-config.rb +232 -0
  102. data/lib/ontomde-java/struts/validation.rb +116 -0
  103. data/lib/ontomde-java/struts/validator.rb +341 -0
  104. data/lib/ontomde-java/struts/webXml.rb +195 -0
  105. data/lib/ontomde-java/struts/xmlForm.rb +308 -0
  106. data/lib/ontomde-java/version.rb +5 -0
  107. data/profiling.xls +0 -0
  108. data/test/.classpath +14 -0
  109. data/test/.project +17 -0
  110. data/test/.settings/org.eclipse.jdt.core.prefs +23 -0
  111. data/test/Rakefile +71 -0
  112. data/test/build.xml +34 -0
  113. data/test/classpath.rb +15 -0
  114. data/test/lib/junit-4.1.jar +0 -0
  115. data/test/load1.rb +3 -0
  116. data/test/load2.rb +3 -0
  117. data/test/log4j.properties +46 -0
  118. data/test/model/.project +11 -0
  119. data/test/model/BigProject.mdzip +0 -0
  120. data/test/model/BigProject.mdzip.nt +102866 -0
  121. data/test/model/ClassDiagram.EntArch.gif +0 -0
  122. data/test/model/ClassDiagram.emx.gif +0 -0
  123. data/test/model/ClassDiagram.mdzip.gif +0 -0
  124. data/test/model/model_ea71.bis.ea.xmi +149 -0
  125. data/test/model/model_ea71.ea.xmi +4470 -0
  126. data/test/model/model_ea71.eap +0 -0
  127. data/test/model/model_ea71_README.txt +8 -0
  128. data/test/model/multipleInheritance.emx +466 -0
  129. data/test/model/multipleInheritance.emx.nt +2428 -0
  130. data/test/model/simple1-530.ofp +0 -0
  131. data/test/model/simple1-includedAsReference.emx +169 -0
  132. data/test/model/simple1.emx +3729 -0
  133. data/test/model/simple1.emx.fragments.nt +81 -0
  134. data/test/model/simple1.emx.nt +5760 -0
  135. data/test/model/simple1.mdzip +0 -0
  136. data/test/model/simple1.mdzip.nt +11500 -0
  137. data/test/model/simple1.oe530.nt +1986 -0
  138. data/test/model/simple1.oe600.nt +1627 -0
  139. data/test/src/RuntimeTest.java +656 -0
  140. data/test/src/testsLevel1.java +174 -0
  141. data/test/src/testsLevel2.java +29 -0
  142. data/test/src/testsLevel3.java +40 -0
  143. data/test/test-ea7.sh +15 -0
  144. data/test/test-magicDraw.sh +10 -0
  145. data/test/test-mi.sh +9 -0
  146. data/test/test-oe530.sh +10 -0
  147. data/test/test-oe600.sh +11 -0
  148. data/test/test-rsm.sh +11 -0
  149. data/test/test_export_ea71.rb +5 -0
  150. data/test/test_export_oe530.rb +4 -0
  151. data/test/test_export_oe600.rb +4 -0
  152. data/test/test_export_rsm60.rb +4 -0
  153. data/test/trace +419 -0
  154. data/test/uml_test.rb +1434 -0
  155. data/test/uml_test.xls +0 -0
  156. data/test/unit_test.rb +6 -0
  157. metadata +224 -0
data/test/uml_test.rb ADDED
@@ -0,0 +1,1434 @@
1
+ #require 'test/unit'
2
+ require 'test/unit'
3
+ require 'test/unit/ui/console/testrunner.rb'
4
+ require 'ontomde-uml2'
5
+
6
+ # cf: http://www.ruby-doc.org/core/classes/Test/Unit/Assertions.html#M006697
7
+
8
+
9
+
10
+ UML_FILES=[]
11
+
12
+ MODELER=Set.new
13
+
14
+ module Modeler
15
+ MODELER_EA71=1
16
+ MODELER_RSM6=2
17
+ MODELER_OE60=3
18
+ MODELER_OE53=4
19
+ MODELER_UNKNOWN=-1
20
+
21
+ def ns_EA71(msg)
22
+ if MODELER.include?(MODELER_EA71)
23
+ fail("Enteprise Architect 7.1 does not support this feature:\n#{msg}")
24
+ end
25
+ end
26
+ def ns_OE60(msg)
27
+ if MODELER.include?(MODELER_OE60)
28
+ fail("Objecteering 6.0 does not support this feature\n#{msg}")
29
+ end
30
+ end
31
+ def ns_OE53(msg)
32
+ if MODELER.include?(MODELER_OE60)
33
+ fail("Objecteering 5.3 does not support this feature\n#{msg}")
34
+ end
35
+ end
36
+ #not applicable
37
+ def na_OE60()
38
+ return MODELER.include?(MODELER_OE60)
39
+ end
40
+ def na_rsm6()
41
+ return MODELER.include?(MODELER_RSM6)
42
+ end
43
+ def na_EA71
44
+ return MODELER.include?(MODELER_EA71)
45
+ end
46
+ def is_EA71
47
+ return MODELER.include?(MODELER_EA71)
48
+ end
49
+ end
50
+
51
+ module TestDocumentation
52
+ def test_commentOnClass
53
+ checkComment(getCdt,/__DOC_CDT__/)
54
+ end
55
+ def test_commentOnInterface
56
+ checkComment(getI1,/__DOC_INTERFACE__/)
57
+ end
58
+ def test_commentOnProperty
59
+ checkComment(getAnIA,/__DOC_PROP__/)
60
+ end
61
+ def test_commentOnEnumProperty
62
+ checkComment(getCdtCoul,/__DOC_PROP_ENUM__/)
63
+ end
64
+ def test_commentOnEnum
65
+ checkComment(getCouleurs,/__DOC_ENUM__/)
66
+ end
67
+ def test_commentOnLiteral
68
+ ns_OE60("Modeler does not support comment on enumeration literal")
69
+ checkComment(getPique,/__DOC_LIT__/)
70
+ end
71
+ def test_parameterComment
72
+ checkComment(getAnIntParam,/__DOC_PARAM__/)
73
+ end
74
+ def testComponentComment
75
+ checkComment(getComponent,/__DOC_COMPONENT__/)
76
+ end
77
+ def test_usecaseComment
78
+ checkComment(getAUseCase,/__USECASE_DOCUMENTATION__/)
79
+ end
80
+ def test_statemachineComment
81
+ checkComment(getStateMachine,/__STATE_MACHINE_DOC__/)
82
+ end
83
+ def test_stateComment
84
+ checkComment(getState,/__STATE_DOC__/)
85
+ end
86
+ def test_stateTransitionComment
87
+ ns_EA71("comment on transition not available on model (althougth available on diagram)")
88
+ checkComment(getTransition,/__STATE_TRANSITION_DOC__/)
89
+ end
90
+ def test_stateRegionComment
91
+ ns_EA71("comment on region not available on model (althougth available on diagram)")
92
+ checkComment(getRegion,/__STATEMACHINE_REGION_DOC__/)
93
+ end
94
+
95
+ end
96
+
97
+ module TestsEnumLit
98
+ def test_couleur_hasPique
99
+ enumHasLit(getCouleurs,getPique)
100
+ end
101
+ def test_couleur_hasCoeur
102
+ enumHasLit(getCouleurs,getCoeur)
103
+ end
104
+ def test_couleur_hasCarreau
105
+ enumHasLit(getCouleurs,getCarreau)
106
+ end
107
+ def test_couleur_hasTrefle
108
+ enumHasLit(getCouleurs,getTrefle)
109
+ end
110
+ end
111
+ module TestsStatic
112
+ def test_NotStaticPropertyEnum
113
+ checkNotStatic(getCdtCoul)
114
+ end
115
+ def test_notStaticProperty
116
+ checkNotStatic(getAnIA)
117
+ end
118
+ def test_staticProperty
119
+ checkStatic(getASIA)
120
+ end
121
+ def test_staticOperation
122
+ checkStatic(getStaticVoidOperation)
123
+ end
124
+ def test_notStaticConstructor
125
+ checkNotStatic(getCustomConstrutor)
126
+ end
127
+ def test_StaticEnumOperation
128
+ ns_OE60("Modeler does not support operation on enumeration")
129
+ checkStatic(getOEE)
130
+ end
131
+ end
132
+ module TestUnique
133
+ def test_uniqueAssociation
134
+ checkNotUnique(getNonUniqueAssoc)
135
+ end
136
+ def test_uniqueAttribute
137
+ checkUnique(find("a Unique Attribute",Cuml_Property))
138
+ end
139
+ def test_NonuniqueAttribute
140
+ checkNotUnique(find("a Non Unique Attribute",Cuml_Property))
141
+ end
142
+ end
143
+
144
+ module TestsDerived
145
+ def test_derivedAssociation
146
+ checkDerived(find("derivedA",Cuml_Property))
147
+ end
148
+ def test_notDerivedAssociation
149
+ checkNotDerived(getSortedA)
150
+ checkNotDerived(getAnIA)
151
+ end
152
+ end
153
+
154
+ module TestsOrdered
155
+ def test_NotOrderedProperty
156
+ checkNotOrdered(getAnIA)
157
+ end
158
+ def test_OrderedProperty
159
+ checkOrdered(getSortedA)
160
+ end
161
+ def test_OrderedReturnParameter
162
+ checkOrdered(getReturnParamList)
163
+ end
164
+ def test_notOrderedReturnParameter
165
+ checkNotOrdered(getReturnParamSet)
166
+ end
167
+ end
168
+ module TestsReadOnly
169
+ def test_NotReadOnlyProperty
170
+ checkNotReadOnly(getSortedA)
171
+ end
172
+ def test_NotReadOnlyAssociation
173
+ checkNotReadOnly(getSortedA)
174
+ end
175
+ def test_ReadOnlyProperty
176
+ checkReadOnly(find("readOnlyT",Cuml_Property))
177
+ end
178
+ end
179
+ module TestsImplements
180
+ def test_cdt_implems_i1
181
+ hasImplements(getCdt,getI1)
182
+ end
183
+ def test_cdt_implems_i3
184
+ hasImplements(getCdt,getI3)
185
+ end
186
+ def test_ClassDoesNotImplement
187
+ hasNotImplements(getCdt,getI2)
188
+ end
189
+ def test_ComponentImplementsInterface
190
+ hasImplements(getComponent,getI2)
191
+ end
192
+ def test_ComponentDoesNotImplementsInterface
193
+ hasNotImplements(getComponent,getI1)
194
+ end
195
+ end
196
+ module TestsGeneralisation
197
+ def test_I3_I5_inheritance
198
+ hasGeneralization(getI3,getI5)
199
+ end
200
+ def test_I1_I2_inheritance
201
+ hasGeneralization(getI1,getI2)
202
+ end
203
+ def test_I1_I4_inheritance
204
+ hasGeneralization(getI1,getI4)
205
+ end
206
+ end
207
+ module TestsOwnedMember
208
+ def test_P11_in_P1
209
+ hasOwnedMember(getP1,getP11)
210
+ end
211
+ def test_P11_not_in_P1
212
+ #testing that test is not always true
213
+ hasNotOwnedMember(getP11,getP1)
214
+ end
215
+ def test_Cdt_in_P1
216
+ hasOwnedMember(getP1,getCdt)
217
+ end
218
+ def test_I1_in_P1
219
+ hasOwnedMember(getP1,getI1)
220
+ end
221
+ def test_I2_in_P1
222
+ hasOwnedMember(getP1,getI2)
223
+ end
224
+ def test_I3_in_P1
225
+ hasOwnedMember(getP1,getI3)
226
+ end
227
+ def test_I4_in_P1
228
+ hasOwnedMember(getP1,getI4)
229
+ end
230
+ def test_I5_in_P1
231
+ hasOwnedMember(getP1,getI5)
232
+ end
233
+ def test_couleurs_in_P1
234
+ hasOwnedMember(getP1,getCouleurs)
235
+ end
236
+ def test_C2_in_P11
237
+ hasOwnedMember(getP11,getC2)
238
+ end
239
+ def test_Component_in_P1
240
+ hasOwnedMember(getP1,getComponent)
241
+ end
242
+ end
243
+ module TestsNested
244
+ def test_InnerClass
245
+ hasNestedClassifier(getCdt,getInnerClassInsideCdt)
246
+ end
247
+ end
248
+
249
+ module TestClassType
250
+ def test_checkType_Carreau
251
+ findEnforceType("Carreau",Cuml_EnumerationLiteral)
252
+ end
253
+ def test_checkType_ClassDeuxNxPkg
254
+ findEnforceType("ClassDeuxNxPkg",Cuml_Class)
255
+ end
256
+ def test_checkType_ClasseDeTest
257
+ findEnforceType("Classe De Test",Cuml_Class)
258
+ end
259
+ def test_checkType_Classe3
260
+ findEnforceType("Classe3",Cuml_Class)
261
+ end
262
+ def test_checkType_Coeur
263
+ findEnforceType("Coeur",Cuml_EnumerationLiteral)
264
+ end
265
+ def test_checkType_Couleurs
266
+ findEnforceType("Couleurs",Cuml_Enumeration)
267
+ end
268
+ def test_checkType_Create
269
+ caseSensitive=false
270
+ multipleOccurence=true
271
+ #findEnforceType("CreaTe",Cuml_Stereotype,multipleOccurence,caseSensitive)
272
+ end
273
+ def test_checkType_EmptyEnum
274
+ findEnforceType("EmptyEnum",Cuml_Enumeration)
275
+ end
276
+ def test_checkType_InnerClassInsideCdt
277
+ findEnforceType("InnerClassInsideCdt",Cuml_Class)
278
+ end
279
+ def test_checkType_Interface1
280
+ findEnforceType("Interface1",Cuml_Interface)
281
+ end
282
+ def test_checkType_Interface2
283
+ findEnforceType("Interface2",Cuml_Interface)
284
+ end
285
+ def test_checkType_Interface3
286
+ findEnforceType("Interface3",Cuml_Interface)
287
+ end
288
+ def test_checkType_Interface4
289
+ findEnforceType("Interface4",Cuml_Interface)
290
+ end
291
+ def test_checkType_Interface5
292
+ findEnforceType("Interface5",Cuml_Interface)
293
+ end
294
+ def test_checkType_OperationEmptyEnum
295
+ ns_OE60("Modeler does not support operation on enumeration")
296
+ findEnforceType("OperationEmptyEnum",Cuml_Operation)
297
+ end
298
+ def test_checkType_OperationOutOfSpaceEnum
299
+ ns_OE60("Modeler does not support operation on enumeration")
300
+ findEnforceType("OperationOutOfSpaceEnum",Cuml_Operation)
301
+ end
302
+ def test_checkType_OutOfSpaceEnum
303
+ findEnforceType("OutOfSpaceEnum",Cuml_Enumeration)
304
+ end
305
+ def test_checkType_OutOfSpaceEnumProperty
306
+ ns_OE60("Modeler does not support property on enumeration")
307
+ findEnforceType("OutOfSpaceEnumProperty",Cuml_Property)
308
+ end
309
+ def test_checkType_Pique
310
+ findEnforceType("Pique",Cuml_EnumerationLiteral)
311
+ end
312
+ def test_checkType_Trefle
313
+ findEnforceType("Trefle",Cuml_EnumerationLiteral)
314
+ end
315
+ def test_checkType_aPackageMethod
316
+ findEnforceType("a Package Method",Cuml_Operation)
317
+ end
318
+ def test_checkType_aPrivateMethod
319
+ findEnforceType("a Private Method",Cuml_Operation)
320
+ end
321
+ def test_checkType_aStaticIntAttribute
322
+ findEnforceType("a Static Int Attribute",Cuml_Property)
323
+ end
324
+ def test_checkType_aStaticVoidOperation
325
+ findEnforceType("a Static Void Operation",Cuml_Operation)
326
+ end
327
+ def test_checkType_aStringAttribute
328
+ findEnforceType("a String Attribute",Cuml_Property)
329
+ end
330
+ def test_checkType_aBinaryOperation
331
+ findEnforceType("aBinaryOperation",Cuml_Operation)
332
+ end
333
+ def test_checkType_aBooleanAttribute
334
+ findEnforceType("aBooleanAttribute",Cuml_Property)
335
+ end
336
+ def test_checkType_anIntAttribute
337
+ findEnforceType("an Int Attribute",Cuml_Property)
338
+ end
339
+ def test_checkType_anIntParam
340
+ findEnforceType("anIntParam",Cuml_Parameter)
341
+ end
342
+ def test_checkType_classWithEntityAuxiliaryStereotype
343
+ findEnforceType("classWithEntityAuxiliaryStereotype",Cuml_Class)
344
+ end
345
+ def test_checkType_classeabstraite
346
+ findEnforceType("classeabstraite",Cuml_Property)
347
+ end
348
+ def test_checkType_compositeElement
349
+ findEnforceType("compositeElement",Cuml_Property)
350
+ end
351
+ def test_checkType_compositeElementOne
352
+ findEnforceType("compositeElementOne",Cuml_Property)
353
+ end
354
+ def test_checkType_couleur
355
+ findEnforceType("couleur",Cuml_Property)
356
+ end
357
+ def test_checkType_couleurOneMany
358
+ findEnforceType("couleurOneMany",Cuml_Property)
359
+ end
360
+ def test_checkType_couleurZeroMany
361
+ findEnforceType("couleurZeroMany",Cuml_Property)
362
+ end
363
+ def test_checkType_couleurZeroOne
364
+ findEnforceType("couleurZeroOne",Cuml_Property)
365
+ end
366
+ def test_checkType_customConstructor
367
+ findEnforceType("customConstructor",Cuml_Operation)
368
+ end
369
+ def test_checkType_defaultConstructor
370
+ findEnforceType("defaultConstructor",Cuml_Operation)
371
+ end
372
+ def test_checkType_derivedA
373
+ findEnforceType("derivedA",Cuml_Property)
374
+ end
375
+ def test_checkType_interface5
376
+ findEnforceType("interface5",Cuml_Property)
377
+ end
378
+ def test_checkType_methodReturnSetOfClasse3
379
+ findEnforceType("methodReturnSetOfClasse3",Cuml_Operation)
380
+ end
381
+ def test_checkType_pack1
382
+ findEnforceType("pack1",Cuml_Package)
383
+ end
384
+ def test_checkType_pack11
385
+ findEnforceType("pack11",Cuml_Package)
386
+ end
387
+ def test_checkType_pack2
388
+ findEnforceType("pack2",Cuml_Package)
389
+ end
390
+ def test_checkType_roleB
391
+ findEnforceType("roleB",Cuml_Property)
392
+ end
393
+ def test_checkType_sortedA
394
+ findEnforceType("sortedA",Cuml_Property)
395
+ end
396
+ def test_checkType_uneStringDansInterface5
397
+ findEnforceType("uneStringDansInterface5",Cuml_Property)
398
+ end
399
+ def test_checkType_AbstractClass
400
+ findEnforceType("ClasseAbstraite",Cuml_Class)
401
+ end
402
+ def test_checkType_AbstractOperation
403
+ findEnforceType("methodeAbstraite",Cuml_Operation,true)
404
+ end
405
+ end
406
+
407
+
408
+ module RepositoryGetters
409
+ def getAUseCase
410
+ return find("a Use Case",Cuml_UseCase)
411
+ end
412
+ def getNonUniqueAssoc
413
+ return find("nonUnique",Cuml_Property)
414
+ end
415
+ def getCdtCoul
416
+ return find("couleur",Cuml_Property)
417
+ end
418
+ def getClassAux
419
+ find("classWithEntityAuxiliaryStereotype",Cuml_Class)
420
+ end
421
+ def getCustomConstrutor
422
+ find("customConstructor",Cuml_Operation)
423
+ end
424
+ def getDefaultConstructor
425
+ find("defaultConstructor",Cuml_Operation)
426
+ end
427
+
428
+ # enums
429
+ def getCouleurs
430
+ return find("Couleurs",Cuml_Enumeration)
431
+ end
432
+ def getPique
433
+ return find("Pique",Cuml_EnumerationLiteral)
434
+ end
435
+ def getCoeur
436
+ return find("Coeur",Cuml_EnumerationLiteral)
437
+ end
438
+ def getCarreau
439
+ return find("Carreau",Cuml_EnumerationLiteral)
440
+ end
441
+ def getTrefle
442
+ return find("Trefle",Cuml_EnumerationLiteral)
443
+ end
444
+ def getASIA
445
+ return find("a Static Int Attribute",Cuml_Property)
446
+ end
447
+ def getAbstractClass
448
+ return find("ClasseAbstraite",Cuml_Class)
449
+ end
450
+ def getAbstractOperation
451
+ return find("abstractMethodOne",Cuml_Operation)
452
+ end
453
+ def getSortedA
454
+ find("sortedA",Cuml_Property)
455
+ end
456
+ def getStaticVoidOperation
457
+ return find("a Static Void Operation",Cuml_Operation)
458
+ end
459
+ def getI1
460
+ return find("Interface1",Cuml_Interface)
461
+ end
462
+ def getI2
463
+ return find("Interface2",Cuml_Interface)
464
+ end
465
+ def getI3
466
+ return find("Interface3",Cuml_Interface)
467
+ end
468
+ def getI4
469
+ return find("Interface4",Cuml_Interface)
470
+ end
471
+ def getI5
472
+ return find("Interface5",Cuml_Interface)
473
+ end
474
+ def getC2
475
+ return find("ClassDeuxNxPkg",Cuml_Class)
476
+ end
477
+ def getAnIA
478
+ return find("an Int Attribute",Cuml_Property)
479
+ end
480
+ def getOEE
481
+ find("OperationEmptyEnum",Cuml_Operation)
482
+ end
483
+ def getOOOSE
484
+ find("OperationOutOfSpaceEnum",Cuml_Operation)
485
+ end
486
+ def getOSEnum
487
+ find("OutOfSpaceEnum",Cuml_Enumeration)
488
+ end
489
+ def getEmptyEnum
490
+ find("EmptyEnum",Cuml_Enumeration)
491
+ end
492
+ def getInterface5Property
493
+ find("uneStringDansInterface5",Cuml_Property)
494
+ end
495
+ def getOutOfSpaceEnumProperty
496
+ ns_OE60("Modeler does not support property on enumeration")
497
+ find("OutOfSpaceEnumProperty",Cuml_Property)
498
+ end
499
+ def getP1
500
+ return find("pack1",Cuml_Package)
501
+ end
502
+ def getP2
503
+ return find("pack2",Cuml_Package)
504
+ end
505
+ def getP11
506
+ return find("pack11",Cuml_Package)
507
+ end
508
+ def getInnerClassInsideCdt
509
+ find("InnerClassInsideCdt",Cuml_Class)
510
+ end
511
+ # Class De test
512
+ def getCdt
513
+ return find("Classe De Test",Cuml_Class)
514
+ end
515
+ def getCompositeAssoc
516
+ find("compositeElement",Cuml_Property)
517
+ end
518
+ def getCompositeAssocOne
519
+ find("compositeElementOne",Cuml_Property)
520
+ end
521
+ def getClasseAbstraiteAssoc
522
+ find("classeabstraite",Cuml_Property)
523
+ end
524
+ def getInterface5Assoc
525
+ find("interface5",Cuml_Property)
526
+ end
527
+ def getAnIntParam
528
+ find("anIntParam",Cuml_Parameter)
529
+ end
530
+ def getCouleurZeroManyProp
531
+ find("couleurZeroMany",Cuml_Property)
532
+ end
533
+ def getCouleurZeroOneProp
534
+ find("couleurZeroOne",Cuml_Property)
535
+ end
536
+ def getCouleurOneManyProp
537
+ find("couleurOneMany",Cuml_Property)
538
+ end
539
+ end
540
+
541
+ module TestsHelpers
542
+ @@r=nil
543
+ def getModel
544
+ return @@r
545
+ end
546
+ def setup
547
+ return unless @@r.nil?
548
+ if(MODELER.empty?)
549
+ puts "getting model name from command line parameter"
550
+ if(ARGVsaved.empty?)
551
+ puts "Model file name expected on command line"
552
+ exit(1)
553
+ end
554
+ UML_FILES.clear
555
+ UML_FILES.concat(ARGVsaved)
556
+ end
557
+
558
+ @@r=Crdf_Repository.new
559
+ @@r.loadUml2
560
+ UML_FILES.each { |src|
561
+ @@r.loadModelFromFile(src)
562
+ }
563
+ end
564
+ DIRECT=[
565
+ ['a Region','file:///model/EAID_SR000001_92E0_46c2_B688_D19D37190DC5'],
566
+ ['a Fork State', 'file:///model/EAID_7554D931_5A38_4115_9A94_09E7CF48AE7E'],
567
+ ['a Join State','file:///model/EAID_DA7E6223_183E_4a2b_92F9_8FB63A136470']
568
+ ]
569
+
570
+ def findEvery(reqType)
571
+ r=Set.new
572
+ @@r.each_value { |v|
573
+ ok=false
574
+ reqType.each {|t|
575
+ ok=true if v.kind_of?(t)
576
+ }
577
+ next unless ok
578
+ next if v.to_s.index("base$")==0 # hack for filtering out RSM profile elements
579
+ r.add(v)
580
+ }
581
+ assert(r.length>0,"No element typed #{reqType} found in model")
582
+ return r
583
+ end
584
+
585
+ def find(str,reqType,caseSensitive=true)
586
+ find_base(str,reqType,false,false,caseSensitive)
587
+ end
588
+ def findEnforceType(str,reqType,multipleOccurenceIsOK=false,caseSensitive=true)
589
+ find_base(str,reqType,true,multipleOccurenceIsOK,caseSensitive)
590
+ end
591
+ def find_base(str,reqType,enforce_type=false,multipleOccurenceIsOK=false,caseSensitive=true)
592
+ ret=nil
593
+ DIRECT.each { |v|
594
+ next if v[0].to_s!=str
595
+ f=@@r[v[1]]
596
+ ret=f unless f.nil?
597
+ }
598
+ @@r.each_value { |v|
599
+ #next if (!reqType.nil?) && (reqType!=v.class)
600
+ next unless v.respond_to? :uml_name
601
+ next unless caseSensitive ? (v.uml_name.to_s==str) : str.casecmp(v.uml_name.to_s)
602
+ if ret.nil?
603
+ ret=v
604
+ next
605
+ end
606
+ fail("FOUND MULTIPLE ELEMENTS IN REPOSITORY FOR (class=#{reqType}) (uml_name='#{str}')") unless multipleOccurenceIsOK
607
+ }
608
+ sample=<<END
609
+ sample for an interface:
610
+ <http://kb#_4jNV8GqYEduiOKqS5xMIhQ> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Interface> .
611
+
612
+ sample for a class:
613
+ <http://kb#_4jNV8GqYEduiOKqS5xMIhQ> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Class> .
614
+
615
+ END
616
+ assert_not_nil(ret,"MISSING ELEMENT IN REPOSITORY (class=#{reqType}) (uml_name='#{str}'). \nThis error is either because element has not been created in source UML MODEL, because element is spelled differentcly, or because of a bug in export chain.\nPlease refer to reference UML model for comparison (Rational RSM file).")
617
+ assert_equal(reqType,ret.class,"Element #{str} found with bad type\n#{sample}") if enforce_type
618
+ return ret
619
+ end
620
+
621
+ def checkStatic(a,isStatic=true)
622
+ assert(a.uml_isStatic? == isStatic,%{#{a.class} '#{a}' should #{isStatic ? "":"not"} be static"})
623
+ end
624
+ def checkNotStatic(a)
625
+ checkStatic(a,false)
626
+ end
627
+
628
+ def checkOrdered(a,ordered=true)
629
+ sample=<<END
630
+
631
+ SAMPLE:
632
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#name> "#{a.uml_name}" .
633
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#isOrdered> "#{ordered}" .
634
+ END
635
+ assert(a.uml_isOrdered? == ordered,%{#{a.class} '#{a}' should #{ordered ? "":"not"} be ordered. #{sample}"})
636
+ end
637
+ def checkNotOrdered(a)
638
+ checkOrdered(a,false)
639
+ end
640
+
641
+ def checkUnique(a,ordered=true)
642
+ sample=<<END
643
+
644
+ SAMPLE:
645
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#name> "#{a.uml_name}" .
646
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#isUnique> "#{ordered}" .
647
+ END
648
+ assert(a.uml_isUnique? == ordered,%{#{a.class} '#{a}' should #{ordered ? "":"not"} be unique (no duplicate in collection). #{sample}"})
649
+ end
650
+ def checkNotUnique(a)
651
+ checkUnique(a,false)
652
+ end
653
+
654
+ def checkReadOnly(a,ordered=true)
655
+ sample=<<END
656
+
657
+ SAMPLE:
658
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#name> "#{a.uml_name}" .
659
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#isReadOnly> "#{ordered}" .
660
+ END
661
+ assert(a.uml_isReadOnly? == ordered,%{#{a.class} '#{a}' should #{ordered ? "":"not"} be readonly (no duplicate in collection). #{sample}"})
662
+ end
663
+ def checkNotReadOnly(a)
664
+ checkReadOnly(a,false)
665
+ end
666
+
667
+ def checkDerived(a,val=true)
668
+ assert(a.uml_isDerived? == val,%{#{a.class} '#{a}' should #{val ? "":"not"} be derived"})
669
+ end
670
+ def checkNotDerived(a)
671
+ checkDerived(a,false)
672
+ end
673
+
674
+ def checkIsComposite(assoc)
675
+ assert_not_nil(assoc.uml_aggregation_one0,"#{assoc}:#{assoc.class} uml_aggregation field is empty")
676
+ assert(assoc.uml_aggregation_one.isComposite?,"#{assoc}:#{assoc.class} should be a composition")
677
+ end
678
+ def checkIsAggregation(assoc)
679
+ assert_not_nil(assoc.uml_aggregation_one0,"#{assoc}:#{assoc.class} uml_aggregation field is empty")
680
+ assert(assoc.uml_aggregation_one.isShared?,"#{assoc}:#{assoc.class} should be an aggregation (shared)")
681
+ end
682
+ def checkIsAggregationKindNone(assoc)
683
+ assert_not_nil(assoc.uml_aggregation_one0,"#{assoc}:#{assoc.class} uml_aggregation field is empty")
684
+ assert(assoc.uml_aggregation_one.isNone?,"#{assoc}:#{assoc.class} should be a regulare association taggregationKind none)(not shared, not an association)")
685
+ end
686
+
687
+ def checkIsPublic(assoc)
688
+ assert_not_nil(assoc.uml_visibility_one0,"#{assoc}:#{assoc.class} uml_visibility field is empty")
689
+ assert(assoc.uml_visibility_one.isPublic? ,"#{assoc}:#{assoc.class} has wrong visibility)")
690
+ end
691
+ def checkIsPrivate(assoc)
692
+ assert_not_nil(assoc.uml_visibility_one0,"#{assoc}:#{assoc.class} uml_visibility field is empty")
693
+ assert(assoc.uml_visibility_one.isPrivate? ,"#{assoc}:#{assoc.class} has wrong visibility)")
694
+ end
695
+ def checkIsProtected(assoc)
696
+ assert_not_nil(assoc.uml_visibility_one0,"#{assoc}:#{assoc.class} uml_visibility field is empty")
697
+ assert(assoc.uml_visibility_one.isProtected? ,"#{assoc}:#{assoc.class} has wrong visibility)")
698
+ end
699
+ def checkIsPackage(assoc)
700
+ assert_not_nil(assoc.uml_visibility_one0,"#{assoc}:#{assoc.class} uml_visibility field is empty")
701
+ assert(assoc.uml_visibility_one.isPackage? ,"#{assoc}:#{assoc.class} has wrong visibility)")
702
+ end
703
+
704
+ def checkAbstract(assoc)
705
+ assert(assoc.uml_isAbstract?,"#{assoc}:#{assoc.class} uml_isAbstract should be true")
706
+ end
707
+ def checkNotAbstract(assoc)
708
+ assert(!(assoc.uml_isAbstract?),"#{assoc}:#{assoc.class} uml_isAbstract should not be true")
709
+ end
710
+ def hasNotImplements(elt,interface)
711
+ hasImplements(elt,interface,false)
712
+ end
713
+ def hasImplements(elt,interface,has=true)
714
+ found=nil
715
+ elt.uml_implementation.each {|r|
716
+ next unless r.uml_supplier_one0==interface
717
+ found=r
718
+ }
719
+
720
+ sample=<<END
721
+
722
+ <http://kb#_ERsh0Gr6Edq5PInRr6uhgA> <http://uml/2#implementation> <http://kb#_8XJuUH6bEdqmEp6K9GS6ZQ> .
723
+ <http://kb#_8XJuUH6bEdqmEp6K9GS6ZQ> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Implementation> .
724
+ <http://kb#_8XJuUH6bEdqmEp6K9GS6ZQ> <http://uml/2#supplier> <http://kb#_4iph8H6bEdqmEp6K9GS6ZQ>
725
+ END
726
+
727
+ assert_not_nil(found,"#{elt.class} '#{elt}' should implement interface '#{interface}'") if has
728
+ assert_nil(found,"#{elt.class} '#{elt}' should not implement interface '#{interface}'") unless has
729
+ end
730
+
731
+ def hasGeneralization(elt,general)
732
+ sample=<<END
733
+ <http://kb#_bbbbbbbbbbb> <http://uml/2#generalization> <http://kb#_aaaa> .
734
+
735
+ <http://kb#_aaaa> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Generalization> .
736
+ <http://kb#_aaaa> <http://uml/2#specific> <http://kb#_bbbbbbbbbbb> .
737
+ <http://kb#_aaaa> <http://uml/2#general> <http://kb#cccccc> .
738
+ END
739
+
740
+ found=nil
741
+ elt.uml_generalization.each {|r|
742
+ next unless r.uml_general_one0==general
743
+ found=r
744
+ }
745
+ assert_not_nil(found,"#{elt.class} '#{elt}' should inherit from '#{general}' #{sample}")
746
+ end
747
+
748
+ def hasNotOwnedMember(owner,owned)
749
+ hasOwnedMember(owner,owned,false)
750
+ end
751
+ def hasOwnedMember(owner,owned,has=true)
752
+ found=owner.uml_ownedMember.include?(owned)
753
+ assert(found,"missing uml_ownedMember #{owned} for #{owner.class} '#{owner}'") if has
754
+ assert(!found,"wrong uml_ownedMember #{owned} for #{owner.class} '#{owner}'") unless has
755
+ end
756
+
757
+ def hasNotOwnedOperation(owner,owned)
758
+ hasOwnedOperation(owner,owned,false)
759
+ end
760
+ def hasOwnedOperation(owner,owned,has=true)
761
+ found=owner.uml_ownedOperation.include?(owned)
762
+ assert(found,"missing uml_ownedOperation #{owned} for #{owner.class} '#{owner}'") if has
763
+ assert(!found,"extraneous uml_ownedOperation #{owned} for #{owner.class} '#{owner}'") unless has
764
+ end
765
+ def hasNestedClassifier(owner,owned)
766
+ found=owner.uml_nestedClassifier.include?(owned)
767
+ assert(found,"missing uml_nestedClassifier #{owned} for #{owner.class} '#{owner}'")
768
+ end
769
+
770
+ def hasOwnedAttribute(owner,owned)
771
+ found=owner.uml_ownedAttribute.include?(owned)
772
+ assert(found,"missing uml_ownedAttribute #{owned} for #{owner.class} '#{owner}'")
773
+ end
774
+ def hasNotOwnedAttribute(owner,owned)
775
+ found=owner.uml_ownedAttribute.include?(owned)
776
+ assert(!found,"#{owned} property should not be in uml_ownedAttribute for class #{owner.class} '#{owner}'")
777
+ end
778
+
779
+ def hasStereotype(elt,stereotype)
780
+ sample=<<END
781
+
782
+ SAMPLE NTRIPLE CODE:
783
+ <http://kb#_m563wGq0EdypcdFc0YdcPQ> <http://uml/2#appliedStereotype> <http://kb#eeee> .
784
+ <http://kb#eeee> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Stereotype> .
785
+ <http://kb#eeee> <http://uml/2#name> "Documentation" .
786
+
787
+ Note: Stereotypes names are not case sensitive (Documentation == documentation)
788
+ END
789
+ assert(elt.umlx_hasStereotype?(stereotype.to_s),"#{elt}:#{elt.class} is missing stereotype #{stereotype} #{sample}")
790
+ casesensitive=false
791
+ #find(stereotype.to_s,Cuml_Stereotype,casesensitive)
792
+ end
793
+ def enumHasLit(enum,lit)
794
+ assert(enum.uml_ownedLiteral.include?(lit),"Enum '#{enum}' should contain literal '#{lit}'")
795
+ end
796
+ def checkComment(a,regexp)
797
+ sample=<<END
798
+
799
+ SAMPLE NTRIPLE CODE:
800
+ <http://kb#_4iph8H6bEdqmEp6K9GS6ZQ> <http://uml/2#ownedComment> <http://kb#_2hVSsAl_Ed2sVL6lpXUdDw> ."
801
+ <http://kb#_2hVSsAl_Ed2sVL6lpXUdDw> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#Comment> .
802
+ <http://kb#_2hVSsAl_Ed2sVL6lpXUdDw> <http://uml/2#body> "interface documentation\\r\\nkey for unit tests: __DOC_INTERFACE__" .
803
+ END
804
+ x=""
805
+ a.uml_ownedComment.each {|c|
806
+ assert_equal(Cuml_Comment,c.class,"#{a}:#{a.class} has badly typed comment.#{sample}.\ndebug:\n comment.uri=#{c.rdf_uri}\n comment.type=#{c.class}\n comment.to_s=>>>#{c.to_s}<<<<")
807
+ x=x+c.uml_body_one0+c.to_s
808
+ }
809
+ assert_match(regexp,x,%{element "#{a}":#{a.class} does not have expected comment : #{regexp.source}#{sample}})
810
+ end
811
+ def checkCardinalityUpper(elt,card)
812
+ checkCardinality(elt,true,card)
813
+ end
814
+ def checkCardinalityLower(elt,card)
815
+ checkCardinality(elt,false,card)
816
+ end
817
+
818
+
819
+ def checkCardinality(elt,upper,card)
820
+ sample=<<END
821
+
822
+ SAMPLES:
823
+ <http://kb#_UMtX4WUPEdu7KJt1RylUMg> <http://uml/2#lowerValue> <http://kb#_UM3I4GUPEdu7KJt1RylUMg> .
824
+ <http://kb#_UM3I4GUPEdu7KJt1RylUMg> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#LiteralInteger> .
825
+ <http://kb#_UM3I4GUPEdu7KJt1RylUMg> <http://uml/2#value> "0" .
826
+
827
+ <http://kb#_LmgcAGp-EduiOKqS5xMIhQ> <http://uml/2#upperValue> <http://kb#_4jNV8GqYEduiOKqS5xMIhQ> .
828
+ <http://kb#_4jNV8GqYEduiOKqS5xMIhQ> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://uml/2#LiteralUnlimitedNatural>
829
+ <http://kb#_4jNV8GqYEduiOKqS5xMIhQ> <http://uml/2#value> "-1" .
830
+
831
+ END
832
+
833
+
834
+
835
+ x= upper ? elt.uml_upperValue : elt.uml_lowerValue
836
+ assert(!x.empty?, %{missing #{upper ? "upperValue" : "lowerValue"} =~ /#{card.source}/ for #{elt}:#{elt.class} #{sample}})
837
+ #assert_match
838
+ assert_match(card,x.to_s,"Bad cardinality for element #{elt}:#{elt.class} #{sample}")
839
+ end
840
+ def checkRaisedException(method,excep,neg=true)
841
+ found=nil
842
+ method.uml_raisedException.each { |r|
843
+ next if r!=excep
844
+ assert(found.nil?,"Exception #{r}thrown multiple times by method #{method}")
845
+ found=r
846
+ }
847
+ assert(!found.nil?,"Method #{method.to_s} should throw exception #{excep.to_s}") if neg
848
+ assert(found.nil?,"Method #{method} should *NOT* throw exception #{excep}") unless neg
849
+ end
850
+ def checkNotRaisedException(method,excep)
851
+ checkRaisedException(method,excep,false)
852
+ end
853
+ end
854
+
855
+ module TestsOwnedOperation
856
+ def test_emptyEnum_hasOperation #TEST1
857
+ ns_OE60("Modeler does not support Operation on enumeration")
858
+ hasOwnedOperation(getEmptyEnum, getOEE)
859
+ end
860
+ def test_OutOfSpaceEnum_hasOperation
861
+ ns_OE60("Modeler does not support Operation on enumeration")
862
+ hasOwnedOperation(getOSEnum,getOOOSE)
863
+ end
864
+ def test_ComponentHasOperation
865
+ hasOwnedOperation(getComponent,find("aComponentOperation",Cuml_Operation))
866
+ hasNotOwnedOperation(getComponent,getOOOSE)
867
+ end
868
+ end
869
+ module TestsOwnedAttribute
870
+ def test_OutOfSpaceEnum_hasAttribute
871
+ ns_OE60("Modeler does not support property on enumeration")
872
+ hasOwnedAttribute(getOSEnum,getOutOfSpaceEnumProperty)
873
+ end
874
+ def test_Interface_has_property
875
+ hasOwnedAttribute(getI5,getInterface5Property)
876
+ end
877
+ def test_ComponentHasAttribute
878
+ hasOwnedAttribute(getComponent,find("aComponentAttribute",Cuml_Property))
879
+ hasNotOwnedAttribute(getComponent,getInterface5Property)
880
+ end
881
+ end
882
+
883
+ module TestOwnedParameter
884
+ def test_OperationWithOneParameter
885
+ op=find("setAnInt",Cuml_Operation)
886
+ n="anIntParam"
887
+ found=nil
888
+ op.uml_ownedParameter.each {|p|
889
+ assert(found==nil,"Operation #{op} has more than one parameter")
890
+ found=p
891
+
892
+ assert_equal(n, p.uml_name.to_s,"Operation #{op} should have a parameter named #{n}")
893
+ }
894
+ assert(found!=nil,"Operation #{op} should have a parameter named #{n}")
895
+
896
+ end
897
+ def test_OperationWithNoParameter_notEmpty
898
+ assert(!(find("setAnInt",Cuml_Operation).uml_ownedParameter.empty?),"method setAnInt should have parameter")
899
+ end
900
+ def test_OperationWithNoParameter_empty
901
+ assert(getDefaultConstructor.uml_ownedParameter.empty?,"method #{getDefaultConstructor} should not have any parameter")
902
+ end
903
+ end
904
+ module TestDirectionParameter
905
+ def test_ParameterDirectionKind_return
906
+ o=find("get A Boolean",Cuml_Operation)
907
+ p=o.umlx_returnResult_one0
908
+ # (o.uml_ownedParameter+o.uml_returnResult).each {|r|
909
+ # p=r
910
+ # }
911
+ assert_not_nil(p,"operation #{o} has no parameter")
912
+ assert_not_nil(p.uml_direction_one0,"missing direction for parameter #{p}")
913
+ assert(p.uml_direction_one.isReturn?,"wrong direction for parameter #{p} (in expected)")
914
+ end
915
+ def test_ParameterDirectionKind_in
916
+ p=find("OwnedParameter1",Cuml_Parameter)
917
+ assert_not_nil(p.uml_direction_one0,"missing direction for parameter #{p}")
918
+ assert(p.uml_direction_one.isIn?,"wrong direction for parameter #{p} (in expected)")
919
+ end
920
+ def test_ParameterDirectionKind_out
921
+
922
+ end
923
+ def test_ParameterDirectionKind_inout
924
+
925
+ end
926
+ end
927
+
928
+ module TestsStereotypes
929
+ #def test_stereotype_create
930
+ # caseSensitive=false
931
+ # find("CreaTe",Cuml_Stereotype,caseSensitive)
932
+ #end
933
+ def test_customConstructor_has_stereotype_create
934
+ hasStereotype(getCustomConstrutor,"Create")
935
+ end
936
+ def test_defaultConstructor_has_stereotype_create
937
+ hasStereotype(getDefaultConstructor,"CreaTe")
938
+ end
939
+ def test_Aux_has_stereotype_auxiliary
940
+ hasStereotype(getClassAux,"AuxiLiarY")
941
+ end
942
+ def test_pack1ShouldHaveStereotypeFramework
943
+ hasStereotype(find("pack1",Muml_Package),"frAMEwork")
944
+ end
945
+ def test_stereotypeOnSourceAssociation
946
+ hasStereotype(find("withQualifier",Cuml_Property),"tEsT")
947
+ end
948
+ def test_stereotypeOnTargetAssociation
949
+ hasStereotype(p=find("withQualifierBiNav",Cuml_Property),"teST")
950
+ end
951
+
952
+ end
953
+ module TestAggregationKind
954
+ def test_compositeAssocIsComposition
955
+ checkIsComposite(getCompositeAssoc)
956
+ end
957
+ def test_compositeAssocOneIsComposition
958
+ checkIsComposite(getCompositeAssocOne)
959
+ end
960
+ def test_isAggregation
961
+ checkIsAggregation(getClasseAbstraiteAssoc)
962
+ end
963
+ def test_isAggregationKindNone
964
+ checkIsAggregationKindNone(getInterface5Assoc)
965
+ end
966
+ end
967
+
968
+ module TestCardinality
969
+ MANY=/^\*|-1$/
970
+ ONE=/^1$/
971
+ ZERO=/^0$/
972
+ def test_cardinalityPropertyUpperMany
973
+ checkCardinalityUpper(getCouleurZeroManyProp,MANY)
974
+ end
975
+ def test_cardinalityPropertyUpperOne
976
+ checkCardinalityUpper(getCouleurZeroOneProp,ONE)
977
+ end
978
+ def test_cardinalityPropertyUpperCustom
979
+ p=find("roleB",Cuml_Property)
980
+ checkCardinalityUpper(p,/^890$/)
981
+ end
982
+ def test_cardinalityPropertyLowerZero
983
+ checkCardinalityLower(getCouleurZeroOneProp,ZERO)
984
+ end
985
+ def test_cardinalityPropertyLowerOne
986
+ checkCardinalityLower(getCouleurOneManyProp,ONE)
987
+ end
988
+ def test_cardinalityPropertyLowerCustom
989
+ p=find("roleB",Cuml_Property)
990
+ checkCardinalityLower(p,/^49$/)
991
+ end
992
+ def test_cardinalityReturnParameter1
993
+ checkCardinalityUpper(getReturnParamList,MANY)
994
+ end
995
+ def test_cardinalityReturnParameter2
996
+ checkCardinalityUpper(getReturnParamSet,MANY)
997
+ end
998
+ def test_cardinalityReturnParameterLowerOne
999
+ checkCardinalityLower(getReturnParamSet,ONE)
1000
+ end
1001
+ def test_cardinalityReturnParameterLowerZero
1002
+ checkCardinalityLower(getReturnParamList,ZERO)
1003
+ end
1004
+
1005
+ def getReturnParamList
1006
+ find("methodReturnListOfClasse3",Cuml_Operation).umlx_returnResult_one0
1007
+ end
1008
+ def getReturnParamSet
1009
+ find("methodReturnSetOfClasse3",Cuml_Operation).umlx_returnResult_one0
1010
+ end
1011
+ def test_card_bidi_OneMony
1012
+ # check that bidi associations are not mixed up
1013
+ checkCardinalityUpper(find("bidi_c2_2_s",Cuml_Class),MANY)
1014
+ #checkCardinalityLower(find("bidi_c2_2_s",Cuml_Class),ZERO)
1015
+ end
1016
+ end
1017
+
1018
+ module TestVisibility
1019
+ def test_publicMethod
1020
+ checkIsPublic(find("aBinaryOperation",Cuml_Operation))
1021
+ end
1022
+ def test_privateMethod
1023
+ checkIsPrivate(find("a Private Method",Cuml_Operation))
1024
+ end
1025
+ def test_packageMethod
1026
+ checkIsPackage(find("a Package Method",Cuml_Operation))
1027
+ end
1028
+ end
1029
+
1030
+ module TestReturnParameter
1031
+ def test_hasReturnParameter
1032
+ o=find("methodReturnSetOfClasse3",Cuml_Operation)
1033
+ ret=o.umlx_returnResult_one0
1034
+ assert_not_nil(ret,"missing return for #{o}:#{o.class}")
1035
+ checkType(ret,find("Classe3",Cuml_Class))
1036
+ end
1037
+ end
1038
+
1039
+ module TestType
1040
+ STRING=/^string$/i
1041
+ INT=/^int|integer$/i
1042
+ BOOLEAN=/^boolean$/i
1043
+ def test_propertyWithTypeString
1044
+ checkDatatype(find("a String Attribute",Cuml_Property),STRING )
1045
+ end
1046
+ def test_propertyWithTypeInt
1047
+ checkDatatype(find("an Int Attribute",Cuml_Property),INT )
1048
+ end
1049
+ def test_propertyWithTypeBoolean
1050
+ checkDatatype(find("aBooleanAttribute",Cuml_Property),BOOLEAN )
1051
+ end
1052
+ def test_propertyWithTypeEnum
1053
+ checkType(getCdtCoul,getCouleurs)
1054
+ end
1055
+
1056
+ def checkDatatype(elt,reg)
1057
+ t=elt.uml_type_one0
1058
+ assert_not_nil(t,"#{elt}:#{elt.class} has no uml_type")
1059
+ assert(t.kind_of?(Muml_DataType),"wrong class for uml_type for #{elt}:#{elt.class}")
1060
+ assert_match(reg,t.to_s,"wrong uml_type for #{elt}:#{elt.class}")
1061
+ end
1062
+ def checkType(elt,ty)
1063
+ t=elt.uml_type_one0
1064
+ assert_not_nil(t,"#{elt}:#{elt.class} has no uml_type")
1065
+ #assert(t.kind_of?(Muml_Classifier),"wrong class for uml_type for #{elt}:#{elt.class}")
1066
+ assert_equal(ty,t,"wrong uml_type for #{elt}:#{elt.class}")
1067
+ end
1068
+ end
1069
+
1070
+ module TestThrows
1071
+ def getMethodThrows2
1072
+ return find("methodeThrowsMyExceptionAndMyException2",Muml_Operation)
1073
+ end
1074
+ def getMethodThrows1
1075
+ return find("methodeThrowsMyException",Muml_Operation)
1076
+ end
1077
+ def getException1
1078
+ return find("MyException",Muml_Class)
1079
+ end
1080
+ def getException2
1081
+ return find("MyException2",Muml_Class)
1082
+ end
1083
+
1084
+ def test_MethodThrowsA1
1085
+ checkRaisedException(getMethodThrows2,getException1)
1086
+ end
1087
+ def test_MethodThrowsA2
1088
+ checkRaisedException(getMethodThrows2,getException2)
1089
+ end
1090
+ def test_MethodThrowB1
1091
+ checkRaisedException(getMethodThrows1,getException1)
1092
+ end
1093
+ def test_MethodThrowB2
1094
+ checkNotRaisedException(getMethodThrows1,getException2)
1095
+ end
1096
+ def test_MethodNoThrow
1097
+ checkNotRaisedException(getStaticVoidOperation,getException1)
1098
+ end
1099
+ end
1100
+
1101
+ module TestAbstract
1102
+ def test_classAbstract
1103
+ checkAbstract(getAbstractClass)
1104
+ end
1105
+ def test_classNotAbstract
1106
+ checkNotAbstract(getCdt)
1107
+ end
1108
+ def test_methodAbstract
1109
+ checkAbstract(getAbstractOperation)
1110
+ end
1111
+ def test_methodNotAbstract
1112
+ checkNotAbstract(getStaticVoidOperation)
1113
+ end
1114
+ end
1115
+
1116
+ #other test specific known element
1117
+ #This test serie check that repository contains no invalid element
1118
+ module TestEvery
1119
+ def test_EveryTypedElementHasAType
1120
+ err=""
1121
+ i=0
1122
+ findEvery( [Muml_Property,Muml_Parameter]).each {|t|
1123
+ next unless t.uml_type.empty?
1124
+ i=i+1
1125
+ err=err+"#{i}: No uml_type found for element #{t.to_s}:#{t.class}\n"
1126
+ }
1127
+ assert(err.length==0,err)
1128
+ end
1129
+ def test_everyStereotypeHaveNames
1130
+ err=""
1131
+ i=0
1132
+ fe=findEvery( [Muml_Stereotype])
1133
+ fe.each {|t|
1134
+ next unless t.uml_name.empty?
1135
+ i=i+1
1136
+ err=err+"#{i}: No uml_name found for element #{t.to_s}:#{t.class}\n"
1137
+ }
1138
+ assert(err.length==0,err)
1139
+ assert(fe.length>0,"Model should contain at least one element of type stereotype")
1140
+ end
1141
+
1142
+ end
1143
+
1144
+ module TestBiNavigable
1145
+ def test_bidi
1146
+ src_c=getCdt
1147
+ tgt_c=find("ClassDeuxNxPkg",Cuml_Class)
1148
+
1149
+ src_p=find("bidi_c2_3_s",Cuml_Property)
1150
+ tgt_p=find("bidi_cdt_3_s",Cuml_Property)
1151
+
1152
+ hasOwnedAttribute(src_c,src_p)
1153
+ hasOwnedAttribute(tgt_c,tgt_p)
1154
+
1155
+ src_a=src_p.uml_association_one0
1156
+ tgt_a=tgt_p.uml_association_one0
1157
+
1158
+ assert_not_nil(src_a,"missing uml_association for property #{src_p.to_s}")
1159
+ assert_not_nil(tgt_a,"missing uml_association for property #{tgt_p.to_s}")
1160
+
1161
+ assert_equal(src_a,tgt_a, "both association end should link to the same association")
1162
+
1163
+ assert(src_a.uml_memberEnd.include?(src_p),"association end should contain #{src_p} property")
1164
+ assert(src_a.uml_memberEnd.include?(tgt_p),"association end should contain #{tgt_p} property")
1165
+ end
1166
+
1167
+
1168
+
1169
+ def test_not_bidi
1170
+ src_c=getCdt
1171
+ tgt_c=find("ClassA",Cuml_Class)
1172
+
1173
+ tgt_p=find("classdetest_ro",Cuml_Property)
1174
+ src_p=find("readOnlyT",Cuml_Property)
1175
+
1176
+ hasOwnedAttribute(src_c,src_p)
1177
+ hasNotOwnedAttribute(tgt_c,tgt_p) #non navigable property is not owned by class.
1178
+
1179
+ src_a=src_p.uml_association_one0
1180
+ tgt_a=tgt_p.uml_association_one0
1181
+
1182
+ assert_not_nil(src_a,"missing uml_association for property #{src_p.to_s}")
1183
+ assert_not_nil(tgt_a,"missing uml_association for property #{tgt_p.to_s}")
1184
+
1185
+ assert_equal(src_a,tgt_a, "both association end should link to the same association")
1186
+
1187
+ assert(src_a.uml_memberEnd.include?(src_p),"association end should contain #{src_p} property")
1188
+ assert(src_a.uml_memberEnd.include?(tgt_p),"association end should contain #{tgt_p} property")
1189
+ end
1190
+ end
1191
+
1192
+ module TestQualifier
1193
+ def test_aQualifier1
1194
+ findEnforceType("aQualifier1",Cuml_Property)
1195
+ end
1196
+
1197
+ def test_associationHasAQualifierOnSource
1198
+ p=find("withQualifierMany",Cuml_Property)
1199
+ q1=find("aQualifier1",Cuml_Property)
1200
+ assert(p.uml_qualifier.include?(q1),"Property #{p} should have a qualifier name #{q1}")
1201
+ assert(!q1.uml_type.empty?,"Qualifier #{q1} does not have a uml_type")
1202
+ end
1203
+
1204
+ def test_associationHasAQualifierOnTarget
1205
+ p=find("withQualifierBiNav",Cuml_Property)
1206
+ q1=find("aQualifier2",Cuml_Property)
1207
+ assert(p.uml_qualifier.include?(q1),"Property #{p} should have a qualifier name #{q1}")
1208
+ assert(!q1.uml_type.empty?,"Qualifier #{q1} does not have a uml_type")
1209
+ end
1210
+
1211
+ end
1212
+ module TestModel
1213
+ def test_pack1InAModel
1214
+ p=find("pack1",Muml_Package)
1215
+ m=p.umlx_owner_one
1216
+ assert_not_nil(m,"Element #{p} has no owner")
1217
+ assert(m.umlx_isARootNamespace? , "Element #{p} should be owned by a Model or package stereotypd root.")
1218
+ end
1219
+ end
1220
+
1221
+ module TestJavaSuite
1222
+ def test_additionalForJavaSuite
1223
+ w=find("withQualifier",Muml_Property)
1224
+ assert(!w.uml_isDerived?,"#{w}:#{w.class} should not be derived")
1225
+ end
1226
+ end
1227
+
1228
+ module TestComponent
1229
+ def getComponent
1230
+ return find("aComponent",Cuml_Component)
1231
+ end
1232
+ def getComponent2
1233
+ return find("aSecondComponent",Cuml_Component)
1234
+ end
1235
+ def test_componentIsHere
1236
+
1237
+ end
1238
+ end
1239
+ module TestStateMachine
1240
+ def getStateMachine
1241
+ return find("a State Machine2",Cuml_StateMachine)
1242
+ end
1243
+ def test_checkType_StateMachine
1244
+ findEnforceType("a State Machine",Cuml_StateMachine)
1245
+ end
1246
+ def test_checkType_State
1247
+ findEnforceType("a State",Cuml_State)
1248
+ end
1249
+ def getState
1250
+ find("a State",Cuml_State)
1251
+ end
1252
+ def test_checkType_CompositeState
1253
+ findEnforceType("a Composite State",Cuml_State)
1254
+ end
1255
+ def test_checkType_StartState
1256
+ checkPseudoState("a Start State",Cuml_PseudostateKind::Initial)
1257
+ end
1258
+ def test_checkType_StartState
1259
+ findEnforceType("a Final State",Cuml_FinalState)
1260
+ end
1261
+ def test_checkType_DecisionState
1262
+ checkPseudoState("a Decision State",Cuml_PseudostateKind::Choice)
1263
+ end
1264
+ def test_checkType_forkState
1265
+ checkPseudoState("a Fork State",Cuml_PseudostateKind::Fork)
1266
+ end
1267
+ def test_checkType_joinState
1268
+ ns_EA71("Join pseudo state not supported")
1269
+ checkPseudoState("a Join State",Cuml_PseudostateKind::Join)
1270
+ end
1271
+ def test_checkType_transition
1272
+ findEnforceType("from A Start State To a State",Cuml_Transition)
1273
+ end
1274
+ def getTransition
1275
+ return find("from A Start State To a State",Cuml_Transition)
1276
+ end
1277
+ def getStateMachine
1278
+ return find("a State Machine",Cuml_StateMachine)
1279
+ end
1280
+ def test_checkType_stateMachine
1281
+ return findEnforceType("a State Machine",Cuml_StateMachine)
1282
+ end
1283
+ def test_transitionSource
1284
+ assert(find("a Start State",nil)==getTransition.uml_source_one0,"Transition '#{getTransition}' should have uml_source == 'a Start State' instead of '#{getTransition.uml_source_one0}'")
1285
+ end
1286
+ def test_transitionTarget
1287
+ assert(find("a State",nil)==getTransition.uml_target_one0,"Transition '#{getTransition}' should have uml_target == 'a State' instead of '#{getTransition.uml_target_one0}'")
1288
+ end
1289
+ def test_checkType_region
1290
+ findEnforceType("a Region",Cuml_Region)
1291
+ end
1292
+ def getRegion
1293
+ find("a Region",Cuml_Region)
1294
+ end
1295
+ def test_check_StateInRegion
1296
+ assert(getRegion.uml_subvertex.include?(getState),"Region 'a Region' should include state 'a State' in its uml_subvertex")
1297
+ assert(!getRegion.uml_subvertex.include?(getRegion),"test internal error")
1298
+ end
1299
+ def test_check_RegionInStateMachine
1300
+ assert(getStateMachine.uml_region.include?(getRegion),"state Machine 'a State Machine' should include region 'a Region' in uml_region")
1301
+ assert(!getStateMachine.uml_region.include?(getStateMachine),"test internal error")
1302
+ end
1303
+
1304
+ def test_check_StateMachineInPackage
1305
+ assert(getP1.uml_ownedMember.include?(getStateMachine),"Package P1 should include state machine 'a State Machine' in uml_ownedElement")
1306
+ end
1307
+
1308
+
1309
+ def checkPseudoState(label,kind)
1310
+ s=findEnforceType(label,Cuml_Pseudostate)
1311
+ assert(kind==s.uml_kind_one0,"'#{s}' state should have uml_kind==#{kind} instead of #{s.uml_kind_one0}")
1312
+ #<http://uml/2#pseudostateKind_choice>
1313
+ #<http://uml/2#pseudostateKind_deepHistory>
1314
+ #<http://uml/2#pseudostateKind_entryPoint
1315
+ #<http://uml/2#pseudostateKind_exitPoint>
1316
+ #<http://uml/2#pseudostateKind_fork>
1317
+ #<http://uml/2#pseudostateKind_initial>
1318
+ #<http://uml/2#pseudostateKind_join>
1319
+ #<http://uml/2#pseudostateKind_junction>
1320
+ #<http://uml/2#pseudostateKind_shallowHistory>
1321
+ #<http://uml/2#pseudostateKind_terminate>
1322
+ end
1323
+
1324
+ end
1325
+
1326
+ module TestTemplate
1327
+ def test_tpl
1328
+ tpl=find("ClassWithParameter",Cuml_Class)
1329
+ assert(!tpl.uml_ownedTemplateSignature.empty?,"class #{tpl} should contain a template signature")
1330
+
1331
+ found_pt=nil
1332
+ tpl.uml_ownedTemplateSignature.each {|ts|
1333
+ # Muml_TemplateSignature
1334
+ ts.uml_ownedParameter.each { |tp|
1335
+ #Muml_TemplateParameter
1336
+ c=tp.uml_ownedParameteredElement_one
1337
+ assert_nil(found_pt,"found more than one template parameter for #{tpl}")
1338
+ found_pt=c
1339
+ }
1340
+ }
1341
+ assert(!found_pt.nil?,"class #{tpl} is missing template parameter")
1342
+ pt=find("T",Cuml_Class)
1343
+ assert(found_pt==pt,"class #{tpl} template parameter expected to be #{pt}")
1344
+ param=find("paramTPL",Cuml_Parameter)
1345
+ assert(!param.uml_type.empty?,"missing type for paramTPL")
1346
+ assert(param.uml_type_one==pt,"paramTPM.uml_type should be equal to T")
1347
+ end
1348
+ end
1349
+ module TestIncremental
1350
+ def test_increment_AA
1351
+ return unless is_EA71
1352
+ findEvery( [Muml_Class]).each {|t|
1353
+ next if t.uml_name.to_s!="AA"
1354
+ fail "Model should not contain element AA"
1355
+ }
1356
+ end
1357
+ def test_increment_AAb
1358
+ return unless is_EA71
1359
+ find("AA-rename",Muml_Class)
1360
+ end
1361
+ end
1362
+ module TestEA
1363
+ #EA does not support cardinality on parameter
1364
+ #This with encode cardinality on parameter name:
1365
+ # xxxx String[1..10] --> xxxx[1..10] String
1366
+ def test_cardinality_parameter
1367
+ #return unless is_EA71
1368
+ #elt=find("paramListOfString[3..10]",Muml_Parameter)
1369
+ elt=find("paramListOfString",Muml_Parameter)
1370
+
1371
+ checkCardinalityLower(elt,/^3$/)
1372
+ checkCardinalityUpper(elt,/^10$/)
1373
+ end
1374
+ end
1375
+
1376
+
1377
+
1378
+ class Test_ontomde_base < Test::Unit::TestCase
1379
+ include Modeler
1380
+ include TestsEnumLit
1381
+ include TestsStereotypes
1382
+ include TestsStatic
1383
+ include TestsGeneralisation
1384
+ include TestsImplements
1385
+ include TestsOwnedMember
1386
+ include TestsNested
1387
+ include RepositoryGetters
1388
+ include TestsHelpers
1389
+ include TestsOwnedOperation
1390
+ include TestsOwnedAttribute
1391
+ include TestAggregationKind
1392
+ include TestsOrdered
1393
+ include TestsReadOnly
1394
+ include TestsDerived
1395
+ include TestDocumentation
1396
+ include TestCardinality
1397
+ include TestVisibility
1398
+ include TestType
1399
+ include TestReturnParameter
1400
+ include TestClassType
1401
+ include TestUnique
1402
+ include TestThrows
1403
+ include TestEvery
1404
+ include TestAbstract
1405
+ include TestOwnedParameter
1406
+ include TestBiNavigable
1407
+ include TestDirectionParameter
1408
+ include TestQualifier
1409
+ include TestModel
1410
+ include TestJavaSuite
1411
+ include TestComponent
1412
+ include TestStateMachine
1413
+ include TestTemplate
1414
+ include TestIncremental
1415
+ include TestEA
1416
+ end
1417
+
1418
+ def runOntomdeTest(file,modeler=Modeler::MODELER_UNKNOWN)
1419
+ Dir.chdir(File.dirname(__FILE__))
1420
+ MODELER.clear
1421
+ MODELER.add(modeler)
1422
+ UML_FILES.clear
1423
+ if file.kind_of?(String)
1424
+ UML_FILES<< file
1425
+ else
1426
+ file.each { |f|
1427
+ UML_FILES<< f
1428
+ }
1429
+ end
1430
+ Test::Unit::UI::Console::TestRunner.run(Test_ontomde_base)
1431
+ end
1432
+
1433
+ #copy before it gets cleanup
1434
+ ARGVsaved=ARGV.clone