Project

General

Profile

6237.diff

Vladimir Tsichevski, 09/05/2022 06:18 PM

Download (12.5 KB)

View differences:

rules/annotations/annotations.xml 2022-09-05 21:48:35 +0000
261 261
**     AL2 20220324          Store the "poly" functions (the ones which return a value from dynamic-function.
262 262
**     CA  202200420         REST services written directly in Java can be configured via the 'rest-service'
263 263
**                           element.
264
**     VVT 20220906          OEUnit support: annotations/oeunit added. See #6237.
264 265
*/
265 266
 -->
266 267
 
......
674 675
   <rule-set name="annotations/method_defs" />
675 676
   <rule-set name="annotations/procedures" />
676 677
   <rule-set name="annotations/legacy_services" />
678
   <rule-set name="annotations/oeunit" />
677 679
   <rule-set name="annotations/case_statements" />
678 680
   <rule-set name="annotations/input_output" />
679 681
   <rule-set name="annotations/assignment_style_stmt_rewriting" />
rules/annotations/legacy_services.rules 2022-09-05 22:10:06 +0000
5 5
** Module   : legacy_services.rules
6 6
** Abstract : handle legacy services (REST, WS) preparation
7 7
**
8
** Copyright (c) 2019-2021, Golden Code Development Corporation.
8
** Copyright (c) 2019-2022, Golden Code Development Corporation.
9 9
**
10 10
** _#_ _I_ __Date__ ______________________________________Description_______________________________________
11 11
** 001 CA  20190606 Created initial version.
......
18 18
**                  services.
19 19
**     CA  20211012 Fixed generated WSDL and reworked SOAP support to rely on namespace, when resolving an
20 20
**                  operation.
21
** 005 VVT 20220906 OEUnit support: code removing all annotations removed. See #6237.
21 22
*/
22 23
 -->
23 24
 
......
303 304
            <rule>keep
304 305
               <action>hasSrvs = true</action>
305 306
               
306
               <action on="false">ref.remove()</action>
307
               <!-- Do NOT remove everything blindly! We still need some annotations for other
308
                    purposes like OEUnit -->
309
               <!-- <action on="false">ref.remove()</action> -->
307 310
            </rule>
308 311
         </while>
309 312
      </function>
rules/annotations/oeunit.rules 2022-09-05 22:12:33 +0000
1
<?xml version="1.0"?>
2
<!-- 
3
/*
4
** Module   : oeunit.rules
5
** Abstract : rewrite 4gl OEUnit annotations to JUnit 5 annotations
6
**
7
** Copyright (c) 2022, Golden Code Development Corporation.
8
**
9
** _#_ _I_ __Date__  ___________________________Description____________________________
10
** 001 VVT 20220906  Initial version
11
*/
12
 -->
13
<!--
14
** This program is free software: you can redistribute it and/or modify
15
** it under the terms of the GNU Affero General Public License as
16
** published by the Free Software Foundation, either version 3 of the
17
** License, or (at your option) any later version.
18
**
19
** This program is distributed in the hope that it will be useful,
20
** but WITHOUT ANY WARRANTY; without even the implied warranty of
21
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
** GNU Affero General Public License for more details.
23
**
24
** You may find a copy of the GNU Affero GPL version 3 at the following
25
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
26
** 
27
** Additional terms under GNU Affero GPL version 3 section 7:
28
** 
29
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
30
**   terms apply to the works covered under the License.  These additional terms
31
**   are non-permissive additional terms allowed under Section 7 of the GNU
32
**   Affero GPL version 3 and may not be removed by you.
33
** 
34
**   0. Attribution Requirement.
35
** 
36
**     You must preserve all legal notices or author attributions in the covered
37
**     work or Appropriate Legal Notices displayed by works containing the covered
38
**     work.  You may not remove from the covered work any author or developer
39
**     credit already included within the covered work.
40
** 
41
**   1. No License To Use Trademarks.
42
** 
43
**     This license does not grant any license or rights to use the trademarks
44
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
45
**     of Golden Code Development Corporation. You are not authorized to use the
46
**     name Golden Code, FWD, or the names of any author or contributor, for
47
**     publicity purposes without written authorization.
48
** 
49
**   2. No Misrepresentation of Affiliation.
50
** 
51
**     You may not represent yourself as Golden Code Development Corporation or FWD.
52
** 
53
**     You may not represent yourself for publicity purposes as associated with
54
**     Golden Code Development Corporation, FWD, or any author or contributor to
55
**     the covered work, without written authorization.
56
** 
57
**   3. No Misrepresentation of Source or Origin.
58
** 
59
**     You may not represent the covered work as solely your work.  All modified
60
**     versions of the covered work must be marked in a reasonable way to make it
61
**     clear that the modified work is not originating from Golden Code Development
62
**     Corporation or FWD.  All modified versions must contain the notices of
63
**     attribution required in this license.
64
-->
65
<rule-set>
66
   <worker class="com.goldencode.p2j.uast.ProgressPatternWorker" namespace="prog" />
67
   <walk-rules>
68
      <rule>this.type == prog.annotation
69
            and parent.type == prog.method_def
70
         <!-- Get initial annotation name -->
71
         <variable name="annoName" type="java.lang.String" />
72
         <action>annoName = this.getAnnotation("javaname")</action>
73

  
74
         <!-- Replace OEUnit annotation names (made after JUnit 4) by JUnit 5 names -->
75
         <rule>annoName == "Before"
76
            <action>annoName = "org.junit.jupiter.api.BeforeEach"</action>
77
         <rule on="false">annoName == "After"
78
            <action>annoName = "org.junit.jupiter.api.AfterEach"</action>
79
         <rule on="false">annoName == "BeforeClass"
80
            <action>annoName = "org.junit.jupiter.api.BeforeAll"</action>
81
         <rule on="false">annoName == "AfterClass"
82
            <action>annoName = "org.junit.jupiter.api.AfterAll"</action>
83
         <rule on="false">annoName == "Ignore"
84
            <action>annoName = "org.junit.jupiter.api.Disabled"</action>
85
         </rule>
86
         </rule>
87
         </rule>
88
         </rule>
89
         </rule>
90

  
91
         <!-- Write it back -->
92
         <action>copy.putAnnotation("javaname", annoName)</action>
93
      </rule>
94
      
95
   </walk-rules>
96
</rule-set>
rules/convert/core_conversion.xml 2022-09-05 21:47:55 +0000
5 5
** Module   : core_conversion.xml
6 6
** Abstract : primary "driver" for code conversion
7 7
**
8
** Copyright (c) 2005-2021, Golden Code Development Corporation.
8
** Copyright (c) 2005-2022, Golden Code Development Corporation.
9 9
**
10 10
** _#_ _I_ __Date__ __JPRM__ ____________________________Description_____________________________
11 11
** 001 GES 20050719   @21720 This version supports the conversion of most
......
68 68
**     CA  20210203          Fixed conversion issues with OUTPUT/INPUT-OUTPUT for extent or scalar parameters,
69 69
**                           involved in dynamic or static OO calls, functions or procedure calls.  This 
70 70
**                           includes mostly cases for OO properties/variables (static and non-static).
71
** 026 VVT 20220906          OEUnit support: convert/oeunit added. See #6237.
71 72
*/
72 73
 -->
73 74
 
......
181 182
        Progress source constructs into the equivalent Java constructs
182 183
        rooted in the Java AST -->
183 184
   <rule-set honor-hidden="true" input="tree" load-condition="runtime-query">
185
      <rule-set name="convert/oeunit" />
184 186
      <rule-set name="convert/variable_definitions" />
185 187
      <!-- the order of the following rules is important - method_definitions' ascent-rules will
186 188
           emit the signature's parameter annotations -->
rules/convert/oeunit.rules 2022-09-05 22:17:08 +0000
1
<?xml version="1.0"?>
2
<!-- 
3
/*
4
** Module   : oeunit.rules
5
** Abstract : Java OEUnit Java annotation references beautifier
6
**
7
** Copyright (c) 2022, Golden Code Development Corporation.
8
**
9
** _#_ _I_ __Date__  ___________________________Description____________________________
10
** 001 VVT 20220906  Initial version
11
*/
12
 -->
13
<!--
14
** This program is free software: you can redistribute it and/or modify
15
** it under the terms of the GNU Affero General Public License as
16
** published by the Free Software Foundation, either version 3 of the
17
** License, or (at your option) any later version.
18
**
19
** This program is distributed in the hope that it will be useful,
20
** but WITHOUT ANY WARRANTY; without even the implied warranty of
21
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
** GNU Affero General Public License for more details.
23
**
24
** You may find a copy of the GNU Affero GPL version 3 at the following
25
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
26
** 
27
** Additional terms under GNU Affero GPL version 3 section 7:
28
** 
29
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
30
**   terms apply to the works covered under the License.  These additional terms
31
**   are non-permissive additional terms allowed under Section 7 of the GNU
32
**   Affero GPL version 3 and may not be removed by you.
33
** 
34
**   0. Attribution Requirement.
35
** 
36
**     You must preserve all legal notices or author attributions in the covered
37
**     work or Appropriate Legal Notices displayed by works containing the covered
38
**     work.  You may not remove from the covered work any author or developer
39
**     credit already included within the covered work.
40
** 
41
**   1. No License To Use Trademarks.
42
** 
43
**     This license does not grant any license or rights to use the trademarks
44
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
45
**     of Golden Code Development Corporation. You are not authorized to use the
46
**     name Golden Code, FWD, or the names of any author or contributor, for
47
**     publicity purposes without written authorization.
48
** 
49
**   2. No Misrepresentation of Affiliation.
50
** 
51
**     You may not represent yourself as Golden Code Development Corporation or FWD.
52
** 
53
**     You may not represent yourself for publicity purposes as associated with
54
**     Golden Code Development Corporation, FWD, or any author or contributor to
55
**     the covered work, without written authorization.
56
** 
57
**   3. No Misrepresentation of Source or Origin.
58
** 
59
**     You may not represent the covered work as solely your work.  All modified
60
**     versions of the covered work must be marked in a reasonable way to make it
61
**     clear that the modified work is not originating from Golden Code Development
62
**     Corporation or FWD.  All modified versions must contain the notices of
63
**     attribution required in this license.
64
-->
65
<rule-set>
66
   <worker class="com.goldencode.p2j.convert.ConverterHelper" namespace="help" />
67
   <worker class="com.goldencode.p2j.uast.ProgressPatternWorker" namespace="prog" />
68
   <variable name="hasJUnit5Annotations" type="java.lang.Boolean"/>
69

  
70
   <!-- Detect if any of JUnit 5 annotations exist in the tree -->
71
   <walk-rules>
72
      <rule>this.type == prog.annotation
73
            and parent.type == prog.method_def
74
         <variable name="annoName" type="java.lang.String" />
75
         <action>annoName = this.getAnnotation("javaname")</action>
76
         <rule>
77
            annoName == "org.junit.jupiter.api.BeforeEach" or
78
            annoName == "org.junit.jupiter.api.AfterEach"  or
79
            annoName == "org.junit.jupiter.api.BeforeAll"  or
80
            annoName == "org.junit.jupiter.api.AfterAll"   or
81
            annoName == "org.junit.jupiter.api.Disabled"
82
            <!-- Replace fully-qualified name by simple name -->
83
            <action>copy.putAnnotation("javaname", annoName.substring(22))</action>
84
            <action>hasJUnit5Annotations = true</action>
85
         </rule>
86
      </rule>
87
   </walk-rules>
88
   <post-rules>
89
      <rule>hasJUnit5Annotations == true
90
         <action>help.createImport("org.junit.jupiter.api.*")</action>
91
         <action>hasJUnit5Annotations = false</action>
92
      </rule>
93
   </post-rules>
94
   
95
</rule-set>