6237.diff
build.gradle 2022-09-30 17:53:26 +0000 | ||
---|---|---|
102 | 102 |
** IAS 20220816 Added MariaDB udfs.sql to the p2j.jar |
103 | 103 |
** OM 20220812 Upgraded mariadb JDBC driver from 2.7.3 to 3.0.7 GA. |
104 | 104 |
** TW 20220928 Changed junixsocket dependency to official repository, and upped its version to latest. |
105 |
** VVT 2022xxxx JUnit5 dependencies updated to support both existing tests and custom test engine. |
|
106 |
** See #6237. |
|
105 | 107 |
*/ |
106 | 108 | |
107 | 109 |
/* |
... | ... | |
581 | 583 |
aspectjCompile group: 'org.aspectj', name: 'aspectjweaver', version: aspectjVersion |
582 | 584 |
} |
583 | 585 | |
584 |
fwdAllTest group: 'org.junit.platform', name: 'junit-platform-console-standalone', version: '1.7.1' |
|
586 |
// Adding JUnit5 jar both to client and server, so it will be also deployed to converted projects |
|
587 |
fwdClientServer group: 'org.junit.platform', |
|
588 |
name: 'junit-platform-engine', |
|
589 |
version: '1.9.0' |
|
590 | ||
591 |
fwdAllTest group: 'org.junit.platform', |
|
592 |
name: 'junit-platform-suite-engine', |
|
593 |
version: '1.9.0' |
|
594 |
fwdAllTest group: 'org.junit.platform', |
|
595 |
name: 'junit-platform-console', |
|
596 |
version: '1.9.0' |
|
597 |
fwdAllTest group: 'org.junit.platform', |
|
598 |
name: 'junit-platform-engine', |
|
599 |
version: '1.9.0' |
|
585 | 600 |
} |
586 | 601 | |
587 | 602 |
// inject ant-optional dependencies to ant, this is needed for the antlr ant target |
rules/annotations/annotations.xml 2022-09-30 11:50:03 +0000 | ||
---|---|---|
263 | 263 |
** element. |
264 | 264 |
** VVT 20220913 OEUnit support: annotations/unit_test_support added. See #6237. |
265 | 265 |
** VVT 20220913 Prevent unsupported legacy annotations from going to Java code. See #6237. |
266 |
** VVT 20220914 Changes in revs. 14243,14241,14239 temporarily reverted until JUnit runtime
|
|
267 |
** support is added to client projects.
|
|
266 |
** VVT 2022xxxx Two more rulesets processed: unit_test_support and legacy_annotations_post.
|
|
267 |
** See #6237.
|
|
268 | 268 |
*/ |
269 | 269 |
--> |
270 | 270 |
|
... | ... | |
678 | 678 |
<rule-set name="annotations/method_defs" /> |
679 | 679 |
<rule-set name="annotations/procedures" /> |
680 | 680 |
<rule-set name="annotations/legacy_services" /> |
681 |
<!-- <rule-set name="annotations/unit_test_support" /> -->
|
|
682 |
<!-- <rule-set name="annotations/legacy_annotations_post" /> -->
|
|
681 |
<rule-set name="annotations/unit_test_support" />
|
|
682 |
<rule-set name="annotations/legacy_annotations_post" />
|
|
683 | 683 |
<rule-set name="annotations/case_statements" /> |
684 | 684 |
<rule-set name="annotations/input_output" /> |
685 | 685 |
<rule-set name="annotations/assignment_style_stmt_rewriting" /> |
rules/annotations/legacy_services.rules 2022-09-30 11:51:48 +0000 | ||
---|---|---|
21 | 21 |
** 005 VVT 20220913 OEUnit support: code removing all annotations removed. See #6237. |
22 | 22 |
** VVT 20220913 Prevent unsupported legacy annotations from going to Java code. See #6237. |
23 | 23 |
** Use new create_java_annotation() function to create Java annotation nodes. |
24 |
** VVT 20220914 Changes in revs. 14243,14241,14239 temporarily reverted until JUnit runtime |
|
25 |
** support is added to client projects. |
|
24 |
** VVT 2022xxxx Changes in revs. 14243,14241,14239 restored. See #6237. |
|
26 | 25 |
*/ |
27 | 26 |
--> |
28 | 27 |
|
... | ... | |
212 | 211 |
<while>iter.hasNext() |
213 | 212 |
<action>prest = iter.next()</action> |
214 | 213 |
|
215 |
<action>ref = createProgressAst(prog.annotation, "@", pref)</action> |
|
216 |
<action>ref.putAnnotation("javaname", "LegacyServiceParameter")</action> |
|
217 |
<action>ref.putAnnotation("name", "LegacyServiceParameter")</action> |
|
214 |
|
|
215 |
<action>ref = execLib("create_java_annotation", pref, "LegacyServiceParameter", -1)</action> |
|
218 | 216 |
|
219 | 217 |
<rule>execLib("assign_field_int", ref, "ordinal", prest.ordinal())</rule> |
220 | 218 |
|
... | ... | |
308 | 306 |
<rule>keep |
309 | 307 |
<action>hasSrvs = true</action> |
310 | 308 |
|
311 |
<action on="false">ref.remove()</action> |
|
309 |
<!-- Do NOT remove unsupported annotations here, they will be removed in legacy_annotations_post.rules --> |
|
310 |
<!-- <action on="false">ref.remove()</action> --> |
|
312 | 311 |
</rule> |
313 | 312 |
</while> |
314 | 313 |
</function> |
... | ... | |
343 | 342 |
|
344 | 343 |
<action>hasSrvs = true</action> |
345 | 344 |
|
346 |
<action>ref = createProgressAst(prog.annotation, "@", copy, 1)</action> |
|
347 |
<action>ref.putAnnotation("javaname", "LegacyService")</action> |
|
348 |
<action>ref.putAnnotation("name", "LegacyService")</action> |
|
345 |
<action>ref = execLib("create_java_annotation", copy, "LegacyService", 1)</action> |
|
349 | 346 |
|
350 | 347 |
<action>execLib("assign_field", ref, "type", "SOAP")</action> |
351 | 348 |
<action>execLib("assign_field", ref, "namespace", soapOp.getNamespace())</action> |
... | ... | |
401 | 398 |
<action>soapOp = iter.next()</action> |
402 | 399 |
<action>hasSrvs = true</action> |
403 | 400 | |
404 |
<action>ref = createProgressAst(prog.annotation, "@", copy, 1)</action> |
|
405 |
<action>ref.putAnnotation("javaname", "LegacyService")</action> |
|
406 |
<action>ref.putAnnotation("name", "LegacyService")</action> |
|
401 |
<action>ref = execLib("create_java_annotation", copy, "LegacyService", 1)</action> |
|
407 | 402 |
|
408 | 403 |
<action>execLib("assign_field", ref, "type", "SOAP")</action> |
409 | 404 |
<action>execLib("assign_field", ref, "namespace", soapOp.getNamespace())</action> |
... | ... | |
419 | 414 |
<rule>this.type == prog.class_def and srv.isWebHandler(oname) |
420 | 415 |
<action>hasSrvs = true</action> |
421 | 416 |
|
422 |
<action>ref = createProgressAst(prog.annotation, "@", copy, 1)</action> |
|
423 |
<action>ref.putAnnotation("javaname", "LegacyService")</action> |
|
424 |
<action>ref.putAnnotation("name", "LegacyService")</action> |
|
417 |
<action>ref = execLib("create_java_annotation", copy, "LegacyService", 1)</action> |
|
425 | 418 |
|
426 | 419 |
<rule>execLib("assign_field", ref, "name", srv.getSection(oname))</rule> |
427 | 420 |
<rule>execLib("assign_field", ref, "type", "WEBHANDLER")</rule> |
... | ... | |
432 | 425 |
<while>iter.hasNext() |
433 | 426 |
<action>path = iter.next()</action> |
434 | 427 | |
435 |
<action>ref = createProgressAst(prog.annotation, "@", pref)</action> |
|
436 |
<action>ref.putAnnotation("javaname", "LegacyWebPath")</action> |
|
437 |
<action>ref.putAnnotation("name", "LegacyWebPath")</action> |
|
428 |
<action>ref = execLib("create_java_annotation", pref, "LegacyWebPath", -1)</action> |
|
438 | 429 | |
439 | 430 |
<action>execLib("assign_field", ref, "path", path.path())</action> |
440 | 431 |
<action>execLib("assign_field_int", ref, "order", path.order())</action> |
rules/annotations/unit_test_support.rules 2022-09-30 11:57:33 +0000 | ||
---|---|---|
9 | 9 |
** _#_ _I_ __Date__ ___________________________Description____________________________ |
10 | 10 |
** 001 VVT 20220913 Initial version |
11 | 11 |
** VVT 20220913 Prevent unsupported legacy annotations from going to Java code. See #6237. |
12 |
** VVT 2022xxxx Custom test engine annotations are now used instead of that |
|
13 |
** from the Jupiter test engine. See #6237. |
|
12 | 14 |
*/ |
13 | 15 |
--> |
14 | 16 |
<!-- |
... | ... | |
65 | 67 |
--> |
66 | 68 |
<rule-set> |
67 | 69 |
<worker class="com.goldencode.p2j.uast.ProgressPatternWorker" namespace="prog" /> |
70 |
<worker class="com.goldencode.p2j.uast.UastHintsWorker" namespace="hints" /> |
|
68 | 71 |
<walk-rules> |
69 | 72 |
<rule>this.type == prog.annotation |
70 | 73 |
and parent.type == prog.method_def |
74 |
|
|
75 |
<!-- Get required unit test legacy type configuration (hints) --> |
|
76 |
<variable name="unitTestType" type="java.lang.String" /> |
|
77 |
<action>unitTestType = hints.getUnitTestType()</action> |
|
78 |
<rule>unitTestType == null |
|
79 |
<action>compileError(223, "No unit test legacy type is configured")</action> |
|
80 |
</rule> |
|
81 |
|
|
82 |
<variable name="isABLUnit" type="java.lang.Boolean" /> |
|
83 |
<action>isABLUnit = unitTestType.equals("ABLUnit")</action> |
|
84 | ||
85 |
<variable name="methodNode" type="com.goldencode.ast.Aast" /> |
|
86 |
<action>methodNode = parent.firstChild</action> |
|
87 | ||
88 |
<!-- FIXME: Add similar support for procedures --> |
|
71 | 89 | |
72 | 90 |
<!-- Get initial annotation name --> |
73 | 91 |
<variable name="annoName" type="java.lang.String" /> |
74 | 92 |
<action>annoName = this.getAnnotation("javaname")</action> |
75 | 93 | |
94 |
<action>printfln("method %s is ABL unit test type %s annoName @%s", methodNode.getAnnotation("name"), isABLUnit, annoName)</action> |
|
95 | ||
76 | 96 |
<variable name="newName" type="java.lang.String" /> |
77 | 97 |
<action>newName = null</action> |
78 | 98 | |
79 |
<!-- Replace OEUnit annotation names (made after JUnit 4) by JUnit 5 names --> |
|
80 |
<rule>annoName.equals("Test") |
|
81 |
<action>newName = "org.junit.jupiter.api.Test"</action> |
|
82 |
<rule on="false">annoName.equals("Before") |
|
83 |
<action>newName = "org.junit.jupiter.api.BeforeEach"</action> |
|
84 |
<rule on="false">annoName.equals("After") |
|
85 |
<action>newName = "org.junit.jupiter.api.AfterEach"</action> |
|
86 |
<rule on="false">annoName.equals("BeforeClass") |
|
87 |
<action>newName = "org.junit.jupiter.api.BeforeAll"</action> |
|
88 |
<rule on="false">annoName.equals("AfterClass") |
|
89 |
<action>newName = "org.junit.jupiter.api.AfterAll"</action> |
|
90 |
<rule on="false">annoName.equals("Ignore") |
|
91 |
<action>newName = "org.junit.jupiter.api.Disabled"</action> |
|
99 |
<!-- Replace OEUnit/ABLUnit annotation names by corresponding JUnit5 names --> |
|
100 |
<rule>annoName.equalsIgnoreCase("Test") |
|
101 |
<action>newName = "com.goldencode.p2j.testengine.api.Test"</action> |
|
102 | ||
103 |
<!-- Note: the meaning of @Before and @After is opposite in ABLUnit and OEUnit --> |
|
104 |
<rule on="false">annoName.equalsIgnoreCase("Before") |
|
105 |
<rule>isABLUnit |
|
106 |
<action>newName = "com.goldencode.p2j.testengine.api.BeforeAll"</action> |
|
107 |
<action on="false">newName = "com.goldencode.p2j.testengine.api.BeforeEach"</action> |
|
108 |
</rule> |
|
109 |
<rule on="false">annoName.equalsIgnoreCase("After") |
|
110 |
<rule>isABLUnit |
|
111 |
<action>newName = "com.goldencode.p2j.testengine.api.AfterAll"</action> |
|
112 |
<action on="false">newName = "com.goldencode.p2j.testengine.api.AfterEach"</action> |
|
113 |
</rule> |
|
114 |
<rule on="false">annoName.equalsIgnoreCase("BeforeClass") |
|
115 |
<action>newName = "com.goldencode.p2j.testengine.api.BeforeAll"</action> |
|
116 |
<rule on="false">annoName.equalsIgnoreCase("AfterClass") |
|
117 |
<action>newName = "com.goldencode.p2j.testengine.api.AfterAll"</action> |
|
118 |
<rule on="false">annoName.equalsIgnoreCase("Ignore") |
|
119 |
<action>newName = "com.goldencode.p2j.testengine.api.Disabled"</action> |
|
120 |
</rule> |
|
121 |
<rule on="false">annoName.equalsIgnoreCase("Setup") |
|
122 |
<action>newName = "com.goldencode.p2j.testengine.api.BeforeEach"</action> |
|
123 |
<rule on="false">annoName.equalsIgnoreCase("TearDown") |
|
124 |
<action>newName = "com.goldencode.p2j.testengine.api.AfterEach"</action> |
|
125 |
</rule> |
|
92 | 126 |
</rule> |
93 | 127 |
</rule> |
94 | 128 |
</rule> |
... | ... | |
97 | 131 |
</rule> |
98 | 132 | |
99 | 133 |
<rule>newName != null |
100 |
<!-- Write it back and mark "our" annotations as preserved --> |
|
101 |
<action>copy.putAnnotation("javaname", newName)</action> |
|
102 |
<action>copy.putAnnotation("fwd", true)</action> |
|
134 |
<action>printfln("newName %s", newName)</action> |
|
135 |
<!-- Write it back... --> |
|
136 |
<action>copy.putAnnotation("javaname", newName)</action> |
|
137 |
<!-- ...and mark "our" annotations as preserved --> |
|
138 |
<action>copy.putAnnotation("fwd", true)</action> |
|
103 | 139 |
</rule> |
104 | 140 |
</rule> |
105 | 141 |
|
rules/convert/core_conversion.xml 2022-09-30 11:59:12 +0000 | ||
---|---|---|
71 | 71 |
** 026 VVT 20220913 OEUnit support: convert/unit_test_support added. See #6237. |
72 | 72 |
** VVT 20220914 Changes in revs. 14243,14241,14239 temporarily reverted until JUnit runtime |
73 | 73 |
** support is added to client projects. |
74 |
** VVT 2022xxxx Changes in revs. 14243,14241,14239 restored. See #6237. |
|
74 | 75 |
*/ |
75 | 76 |
--> |
76 | 77 |
|
... | ... | |
184 | 185 |
Progress source constructs into the equivalent Java constructs |
185 | 186 |
rooted in the Java AST --> |
186 | 187 |
<rule-set honor-hidden="true" input="tree" load-condition="runtime-query"> |
187 |
<!-- <rule-set name="convert/unit_test_support" /> -->
|
|
188 |
<rule-set name="convert/unit_test_support" />
|
|
188 | 189 |
<rule-set name="convert/variable_definitions" /> |
189 | 190 |
<!-- the order of the following rules is important - method_definitions' ascent-rules will |
190 | 191 |
emit the signature's parameter annotations --> |
rules/convert/unit_test_support.rules 2022-09-30 12:00:04 +0000 | ||
---|---|---|
9 | 9 |
** _#_ _I_ __Date__ ___________________________Description____________________________ |
10 | 10 |
** 001 VVT 20220913 Initial version |
11 | 11 |
** VVT 20220913 Prevent unsupported legacy annotations from going to Java code. See #6237. |
12 |
** VVT 2022xxxx Custom test engine annotations are now used instead of that |
|
13 |
** from the Jupiter test engine. See #6237. |
|
12 | 14 |
*/ |
13 | 15 |
--> |
14 | 16 |
<!-- |
... | ... | |
75 | 77 |
<variable name="annoName" type="java.lang.String" /> |
76 | 78 |
<action>annoName = this.getAnnotation("javaname")</action> |
77 | 79 |
<rule> |
78 |
annoName.equals("org.junit.jupiter.api.Test") or
|
|
79 |
annoName.equals("org.junit.jupiter.api.BeforeEach") or
|
|
80 |
annoName.equals("org.junit.jupiter.api.AfterEach") or
|
|
81 |
annoName.equals("org.junit.jupiter.api.BeforeAll") or
|
|
82 |
annoName.equals("org.junit.jupiter.api.AfterAll") or
|
|
83 |
annoName.equals("org.junit.jupiter.api.Disabled")
|
|
80 |
annoName.equals("com.goldencode.p2j.testengine.api.Test") or
|
|
81 |
annoName.equals("com.goldencode.p2j.testengine.api.BeforeEach") or
|
|
82 |
annoName.equals("com.goldencode.p2j.testengine.api.AfterEach") or
|
|
83 |
annoName.equals("com.goldencode.p2j.testengine.api.BeforeAll") or
|
|
84 |
annoName.equals("com.goldencode.p2j.testengine.api.AfterAll") or
|
|
85 |
annoName.equals("com.goldencode.p2j.testengine.api.Disabled")
|
|
84 | 86 |
<!-- Replace fully-qualified name by simple name --> |
85 |
<action>copy.putAnnotation("javaname", annoName.substring(22))</action>
|
|
87 |
<action>copy.putAnnotation("javaname", annoName.substring(34))</action>
|
|
86 | 88 |
<action>hasJUnit5Annotations = true</action> |
87 | 89 |
</rule> |
88 | 90 |
</rule> |
89 | 91 |
</walk-rules> |
90 | 92 |
<post-rules> |
91 | 93 |
<rule>hasJUnit5Annotations == true |
92 |
<action>help.createImport("org.junit.jupiter.api.*")</action>
|
|
94 |
<action>help.createImport("com.goldencode.p2j.testengine.api.*")</action>
|
|
93 | 95 |
<action>hasJUnit5Annotations = false</action> |
94 | 96 |
</rule> |
95 | 97 |
</post-rules> |
src/com/goldencode/p2j/cfg/Configuration.java 2022-09-30 11:47:48 +0000 | ||
---|---|---|
75 | 75 |
** CA 20220412 Added file-set support (either -Z command-line option or p2j.cfg.xml |
76 | 76 |
** configuration). |
77 | 77 |
** OM 20220421 Restored the ability to load the configuration file relative to P2J_HOME folder. |
78 |
** VVT 2022xxxx Constant added: default legacy unit test framework type. See #6237. |
|
78 | 79 |
*/ |
79 | 80 | |
80 | 81 |
/* |
... | ... | |
268 | 269 |
/** Default configuration filename */ |
269 | 270 |
public static final String DEF_CFG_FILE = "p2j.cfg.xml"; |
270 | 271 |
|
272 |
/** Default legacy unit test type */ |
|
273 |
public static final String DEF_UNIT_TEST_TYPE = "ABLUnit"; |
|
274 |
|
|
271 | 275 |
/** Singleton instance. */ |
272 | 276 |
private static volatile Configuration instance; |
273 | 277 |
|
src/com/goldencode/p2j/testengine/FWDClassTestDescriptor.java 2022-09-30 14:33:27 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDClassTestDescriptor.java |
|
3 |
** Abstract : Test descriptor for a Java class. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import java.lang.annotation.*; |
|
65 |
import java.lang.reflect.*; |
|
66 |
import java.util.*; |
|
67 | ||
68 |
import org.junit.platform.commons.support.*; |
|
69 |
import org.junit.platform.commons.util.*; |
|
70 |
import org.junit.platform.engine.*; |
|
71 |
import org.junit.platform.engine.support.descriptor.*; |
|
72 |
import org.junit.platform.engine.support.hierarchical.*; |
|
73 | ||
74 |
import com.goldencode.p2j.testengine.api.*; |
|
75 | ||
76 |
/** |
|
77 |
* Test descriptor for a Java class. |
|
78 |
*/ |
|
79 |
public class FWDClassTestDescriptor |
|
80 |
extends AbstractTestDescriptor |
|
81 |
implements Node<FWDEngineExecutionContext> |
|
82 |
{ |
|
83 | ||
84 |
/** |
|
85 |
* The Java class, referenced by child descriptors. |
|
86 |
*/ |
|
87 |
final Class<?> clazz; |
|
88 | ||
89 |
/** |
|
90 |
* The methods marked as {@link AfterAll}. |
|
91 |
*/ |
|
92 |
private final List<Method> afterAll; |
|
93 | ||
94 |
/** |
|
95 |
* The methods marked as {@link BeforeAll}. |
|
96 |
*/ |
|
97 |
private final List<Method> beforeAll; |
|
98 | ||
99 |
/** |
|
100 |
* Test a Java class candidate for existent tests methods. If found, create a new class |
|
101 |
* test descriptor. |
|
102 |
* |
|
103 |
* @param clazz |
|
104 |
* the class under test |
|
105 |
* @param parentDescriptor |
|
106 |
* the parent descriptor |
|
107 |
* @param explicitMethods |
|
108 |
* the explicit method list or {@code null} to scan the class for all test methods |
|
109 |
* |
|
110 |
* @return the class test descriptor or {@code null} if this class has no test methods. |
|
111 |
*/ |
|
112 |
public static FWDClassTestDescriptor testAndCreate(final Class<?> clazz, |
|
113 |
final TestDescriptor parentDescriptor, List<Method> explicitMethods) |
|
114 |
{ |
|
115 |
// FIXME: find out if the test for abstract classes is really necessary. |
|
116 |
// For example, Eclipse does not run abstract classes as JUnit test |
|
117 |
if (Modifier.isAbstract(clazz.getModifiers())) |
|
118 |
{ |
|
119 |
return null; |
|
120 |
} |
|
121 | ||
122 |
final List<Method> test = explicitMethods != null ? explicitMethods |
|
123 |
: collectAnnotatedMethods(clazz, Test.class); |
|
124 |
|
|
125 |
if (test.isEmpty()) |
|
126 |
{ |
|
127 |
return null; |
|
128 |
} |
|
129 | ||
130 |
return new FWDClassTestDescriptor(clazz, parentDescriptor, test, |
|
131 |
collectAnnotatedMethods(clazz, BeforeEach.class), |
|
132 |
collectAnnotatedMethods(clazz, AfterEach.class), |
|
133 |
collectAnnotatedMethods(clazz, BeforeAll.class), |
|
134 |
collectAnnotatedMethods(clazz, AfterAll.class)); |
|
135 |
} |
|
136 | ||
137 |
/** |
|
138 |
* Collect all methods annotated with the given class, but not annotated as disabled. |
|
139 |
* |
|
140 |
* @param clazz |
|
141 |
* the class to scan for methods |
|
142 |
* @param annoClass |
|
143 |
* the annotation class to match |
|
144 |
* @return |
|
145 |
* the list of methods found; never {@code null} |
|
146 |
*/ |
|
147 |
private static List<Method> collectAnnotatedMethods(final Class<?> clazz, |
|
148 |
final Class<? extends Annotation> annoClass) |
|
149 |
{ |
|
150 |
return ReflectionUtils.findMethods(clazz, m -> AnnotationUtils.isAnnotated(m, annoClass) |
|
151 |
&& !AnnotationUtils.isAnnotated(m, Disabled.class)); |
|
152 |
} |
|
153 | ||
154 |
/** |
|
155 |
* Private constructor. |
|
156 |
* |
|
157 |
* @param clazz |
|
158 |
* the Java class |
|
159 |
* @param parent |
|
160 |
* the parent descriptor |
|
161 |
* @param test |
|
162 |
* class methods marked as tests |
|
163 |
* @param beforeEach |
|
164 |
* class methods marked to execute before each test |
|
165 |
* @param afterEach |
|
166 |
* class methods marked to execute after each test |
|
167 |
* @param beforeAll |
|
168 |
* class methods marked to execute before all tests |
|
169 |
* @param afterAll |
|
170 |
* class methods marked to execute aftger all tests |
|
171 |
*/ |
|
172 |
private FWDClassTestDescriptor(final Class<?> clazz, final TestDescriptor parent, |
|
173 |
List<Method> test, List<Method> beforeEach, List<Method> afterEach, |
|
174 |
List<Method> beforeAll, List<Method> afterAll) |
|
175 |
{ |
|
176 |
super(parent.getUniqueId().append("class", clazz.getName()), clazz.getSimpleName(), |
|
177 |
ClassSource.from(clazz)); |
|
178 | ||
179 |
setParent(parent); |
|
180 | ||
181 |
this.clazz = clazz; |
|
182 |
this.beforeAll = beforeAll; |
|
183 |
this.afterAll = afterAll; |
|
184 |
test.stream().map(m -> new FWDMethodTestDescriptor(this, clazz, m, beforeEach, afterEach)) |
|
185 |
.forEach(this::addChild); |
|
186 |
} |
|
187 | ||
188 |
/** |
|
189 |
* Execute the <em>after</em> behavior of this node. |
|
190 |
* |
|
191 |
* <p>This method will be called once <em>after</em> {@linkplain #execute |
|
192 |
* execution} of this node. |
|
193 |
* |
|
194 |
* <p>The default implementation does nothing. |
|
195 |
* |
|
196 |
* @param context the context to execute in |
|
197 |
*/ |
|
198 |
@Override |
|
199 |
public void after(final FWDEngineExecutionContext context) throws Exception |
|
200 |
{ |
|
201 |
for (Method m : afterAll) |
|
202 |
{ |
|
203 |
// System.err.println("executing after class method " + m); |
|
204 |
ReflectionSupport.invokeMethod(m, null); |
|
205 |
} |
|
206 |
} |
|
207 | ||
208 |
/** |
|
209 |
* Execute the <em>before</em> behavior of this node. |
|
210 |
* |
|
211 |
* <p>This method will be called once <em>before</em> {@linkplain #execute |
|
212 |
* execution} of this node. |
|
213 |
* |
|
214 |
* <p>The default implementation returns the supplied {@code context} unmodified. |
|
215 |
* |
|
216 |
* @param context the context to execute in |
|
217 |
* @return the new context to be used for children of this node; never |
|
218 |
* {@code null} |
|
219 |
*/ |
|
220 |
@Override |
|
221 |
public FWDEngineExecutionContext before(FWDEngineExecutionContext context) throws Exception |
|
222 |
{ |
|
223 |
for (Method m : beforeAll) |
|
224 |
{ |
|
225 |
// System.err.println("executing before class method " + m); |
|
226 |
ReflectionSupport.invokeMethod(m, null); |
|
227 |
} |
|
228 | ||
229 |
return context; |
|
230 |
} |
|
231 | ||
232 |
/** |
|
233 |
* Execute the <em>behavior</em> of this node. |
|
234 |
* |
|
235 |
* <p>Containers typically do not implement this method since the |
|
236 |
* {@link HierarchicalTestEngine} handles execution of their children. |
|
237 |
* |
|
238 |
* <p>The supplied {@code dynamicTestExecutor} may be used to submit |
|
239 |
* additional dynamic tests for immediate execution. |
|
240 |
* |
|
241 |
* <p>The default implementation returns the supplied {@code context} unmodified. |
|
242 |
* |
|
243 |
* @param context the context to execute in |
|
244 |
* @param dynamicTestExecutor the executor to submit dynamic tests to |
|
245 |
* @return the new context to be used for children of this node and for the |
|
246 |
* <em>after</em> behavior of the parent of this node, if any |
|
247 |
*/ |
|
248 |
@Override |
|
249 |
public FWDEngineExecutionContext execute(FWDEngineExecutionContext context, |
|
250 |
DynamicTestExecutor dynamicTestExecutor) throws Exception |
|
251 |
{ |
|
252 |
return context; |
|
253 |
} |
|
254 | ||
255 |
/** |
|
256 |
* Determine the {@link org.junit.platform.engine.TestDescriptor.Type} of this descriptor. |
|
257 |
* |
|
258 |
* @return the descriptor type; never {@code null}. |
|
259 |
* @see #isContainer() |
|
260 |
* @see #isTest() |
|
261 |
*/ |
|
262 |
@Override |
|
263 |
public Type getType() |
|
264 |
{ |
|
265 |
return Type.CONTAINER; |
|
266 |
} |
|
267 | ||
268 |
} |
src/com/goldencode/p2j/testengine/FWDEngineDescriptor.java 2022-09-30 11:31:56 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDEngineDescriptor.java |
|
3 |
** Abstract : Test engine descriptor. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import org.junit.platform.engine.*; |
|
65 |
import org.junit.platform.engine.support.descriptor.*; |
|
66 |
import org.junit.platform.engine.support.hierarchical.*; |
|
67 |
import org.junit.platform.engine.support.hierarchical.Node.*; |
|
68 | ||
69 |
/** |
|
70 |
* Test engine descriptor. Provides this engine unique ID and same thread execution mode. |
|
71 |
*/ |
|
72 |
public class FWDEngineDescriptor |
|
73 |
extends EngineDescriptor |
|
74 |
implements Node<FWDEngineExecutionContext> |
|
75 |
{ |
|
76 | ||
77 |
/** |
|
78 |
* The constructor. |
|
79 |
* |
|
80 |
* @param uniqueId the {@code UniqueId} for the described {@code TestEngine}; |
|
81 |
* never {@code null} |
|
82 |
*/ |
|
83 |
public FWDEngineDescriptor(final UniqueId uniqueId) |
|
84 |
{ |
|
85 |
super(uniqueId, "FWD Test"); |
|
86 |
} |
|
87 | ||
88 |
/** |
|
89 |
* Get the preferred of {@linkplain ExecutionMode execution mode} for |
|
90 |
* parallel execution of this node. |
|
91 |
* |
|
92 |
* @return the preferred execution mode of this node; never {@code null} |
|
93 |
* @see ExecutionMode |
|
94 |
*/ |
|
95 |
@Override |
|
96 |
public ExecutionMode getExecutionMode() { |
|
97 |
// No concurrent execution is planned yet |
|
98 |
return ExecutionMode.SAME_THREAD; |
|
99 |
} |
|
100 | ||
101 |
} |
src/com/goldencode/p2j/testengine/FWDEngineExecutionContext.java 2022-09-30 11:30:15 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDEngineExecutionContext.java |
|
3 |
** Abstract : Test engine execution context. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import org.junit.platform.engine.support.hierarchical.*; |
|
65 | ||
66 |
/** |
|
67 |
* Test engine execution context. |
|
68 |
*/ |
|
69 |
public class FWDEngineExecutionContext |
|
70 |
implements EngineExecutionContext |
|
71 |
{ |
|
72 |
// for now empty |
|
73 |
} |
src/com/goldencode/p2j/testengine/FWDMethodTestDescriptor.java 2022-09-30 14:33:57 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDMethodTestDescriptor.java |
|
3 |
** Abstract : Test descriptor for a Java method. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import java.lang.reflect.*; |
|
65 | ||
66 |
import org.junit.platform.commons.support.*; |
|
67 |
import org.junit.platform.engine.support.descriptor.*; |
|
68 |
import org.junit.platform.engine.support.hierarchical.*; |
|
69 | ||
70 |
/** |
|
71 |
* Test descriptor for a Java method. |
|
72 |
*/ |
|
73 |
public class FWDMethodTestDescriptor |
|
74 |
extends AbstractTestDescriptor |
|
75 |
implements Node<FWDEngineExecutionContext> |
|
76 |
{ |
|
77 |
/** |
|
78 |
* The Java class to create instances of. |
|
79 |
* |
|
80 |
*/ |
|
81 |
final Class<?> clazz; |
|
82 | ||
83 |
/** |
|
84 |
* Methods to execute after the main method, if any |
|
85 |
*/ |
|
86 |
private final Iterable<Method> after; |
|
87 | ||
88 |
/** |
|
89 |
* Methods to execute before the main method, if any |
|
90 |
*/ |
|
91 |
private final Iterable<Method> before; |
|
92 | ||
93 |
/** |
|
94 |
* Main method to execute |
|
95 |
*/ |
|
96 |
private final Method method; |
|
97 | ||
98 |
/** |
|
99 |
* The test class instance. Is created before each test life cycle begins, |
|
100 |
* and dropped after test life cycle ends. |
|
101 |
*/ |
|
102 |
private Object testInstance; |
|
103 | ||
104 |
/** |
|
105 |
* Constructor. |
|
106 |
* @param parent |
|
107 |
* the parent descriptor |
|
108 |
* @param clazz |
|
109 |
* the Java class to create instances |
|
110 |
* @param execute |
|
111 |
* the method to execute |
|
112 |
* @param beforeMethods |
|
113 |
* methods to execute before the execute method |
|
114 |
* @param afterMethods |
|
115 |
* methods to execute after the execute method |
|
116 |
*/ |
|
117 |
FWDMethodTestDescriptor(final FWDClassTestDescriptor parent, |
|
118 |
final Class<?> clazz, |
|
119 |
final Method execute, |
|
120 |
final Iterable<Method> beforeMethods, |
|
121 |
final Iterable<Method> afterMethods) |
|
122 |
{ |
|
123 |
super(parent.getUniqueId().append("method", execute.getName()), execute.getName(), |
|
124 |
new FWDMethodTestSource()); |
|
125 | ||
126 |
this.clazz = clazz; |
|
127 |
this.method = execute; |
|
128 |
this.before = beforeMethods; |
|
129 |
this.after = afterMethods; |
|
130 | ||
131 |
setParent(parent); |
|
132 |
} |
|
133 | ||
134 |
/** |
|
135 |
* Execute the <em>after</em> behavior of this node. |
|
136 |
* |
|
137 |
* <p>This method will be called once <em>after</em> {@linkplain #execute |
|
138 |
* execution} of this node. |
|
139 |
* |
|
140 |
* @param context |
|
141 |
* the context to execute in |
|
142 |
* |
|
143 |
*/ |
|
144 |
@Override |
|
145 |
public void after(final FWDEngineExecutionContext context) throws Exception |
|
146 |
{ |
|
147 |
for (final Method m : after) |
|
148 |
{ |
|
149 |
ReflectionSupport.invokeMethod(m, testInstance); |
|
150 |
} |
|
151 |
} |
|
152 | ||
153 |
/** |
|
154 |
* Execute the <em>before</em> behavior of this node. |
|
155 |
* |
|
156 |
* <p>This method will be called once <em>before</em> {@linkplain #execute |
|
157 |
* execution} of this node. |
|
158 |
* |
|
159 |
* @param context |
|
160 |
* the context to execute in |
|
161 |
* @return the new context to be used for children of this node; never |
|
162 |
* {@code null} |
|
163 |
*/ |
|
164 |
@Override |
|
165 |
public FWDEngineExecutionContext before(FWDEngineExecutionContext context) throws Exception |
|
166 |
{ |
|
167 |
for (final Method m : before) |
|
168 |
{ |
|
169 |
ReflectionSupport.invokeMethod(m, testInstance); |
|
170 |
} |
|
171 | ||
172 |
return context; |
|
173 |
} |
|
174 | ||
175 |
/** |
|
176 |
* Clean up the supplied {@code context} after execution. |
|
177 |
* |
|
178 |
* Reset the test class instance. |
|
179 |
* |
|
180 |
* @param context |
|
181 |
* the context to execute in |
|
182 |
|
|
183 |
* @see #prepare |
|
184 |
*/ |
|
185 |
@Override |
|
186 |
public void cleanUp(final FWDEngineExecutionContext context) throws Exception |
|
187 |
{ |
|
188 |
testInstance = null; |
|
189 |
} |
|
190 | ||
191 |
/** |
|
192 |
* Execute the <em>behavior</em> of this node. |
|
193 |
* |
|
194 |
* <p>Containers typically do not implement this method since the |
|
195 |
* {@link HierarchicalTestEngine} handles execution of their children. |
|
196 |
* |
|
197 |
* <p>The supplied {@code dynamicTestExecutor} may be used to submit |
|
198 |
* additional dynamic tests for immediate execution. |
|
199 |
* |
|
200 |
* @param context |
|
201 |
* the context to execute in |
|
202 |
* @param dynamicTestExecutor |
|
203 |
* the executor to submit dynamic tests to |
|
204 |
* |
|
205 |
* @return the new context to be used for children of this node and for the |
|
206 |
* <em>after</em> behavior of the parent of this node, if any |
|
207 |
*/ |
|
208 |
@Override |
|
209 |
public FWDEngineExecutionContext execute(final FWDEngineExecutionContext context, |
|
210 |
DynamicTestExecutor dynamicTestExecutor) throws Exception |
|
211 |
{ |
|
212 |
// System.err.println("executing method " + method + " on " + testInstance); |
|
213 |
ReflectionSupport.invokeMethod(method, testInstance); |
|
214 | ||
215 |
return context; |
|
216 |
} |
|
217 | ||
218 |
/** |
|
219 |
* Determine the {@link org.junit.platform.engine.TestDescriptor.Type} of this descriptor. |
|
220 |
* |
|
221 |
* @return the descriptor type; never {@code null}. |
|
222 |
* @see #isContainer() |
|
223 |
* @see #isTest() |
|
224 |
*/ |
|
225 |
@Override |
|
226 |
public Type getType() |
|
227 |
{ |
|
228 |
return Type.TEST; |
|
229 |
} |
|
230 | ||
231 |
/** |
|
232 |
* Prepare the supplied {@code context} prior to execution. |
|
233 |
* |
|
234 |
* Create test class instance. |
|
235 |
* |
|
236 |
* @see #cleanUp |
|
237 |
*/ |
|
238 |
@Override |
|
239 |
public FWDEngineExecutionContext prepare(FWDEngineExecutionContext context) throws Exception |
|
240 |
{ |
|
241 |
testInstance = ReflectionSupport.newInstance(clazz); |
|
242 | ||
243 |
return context; |
|
244 |
} |
|
245 | ||
246 |
/** |
|
247 |
* Get the method. |
|
248 |
* |
|
249 |
* @return the method, never {@code null} |
|
250 |
*/ |
|
251 |
final Method getMethod() |
|
252 |
{ |
|
253 |
return method; |
|
254 |
} |
|
255 |
} |
src/com/goldencode/p2j/testengine/FWDMethodTestSource.java 2022-09-30 11:29:12 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDMethodTestSource.java |
|
3 |
** Abstract : Test method source data. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import org.junit.platform.engine.*; |
|
65 | ||
66 |
/** |
|
67 |
* Test method source data. Currently empty. |
|
68 |
* |
|
69 |
* FIXME: probably, will need either to use the |
|
70 |
* {@link org.junit.platform.engine.support.descriptor.MethodSource} |
|
71 |
* or inherit from it. |
|
72 |
*/ |
|
73 |
public class FWDMethodTestSource |
|
74 |
implements TestSource |
|
75 |
{ |
|
76 |
private static final long serialVersionUID = 1L; |
|
77 |
} |
src/com/goldencode/p2j/testengine/FWDTestEngine.java 2022-09-30 14:17:51 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : FWDTestEngine.java |
|
3 |
** Abstract : Test engine. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine; |
|
63 | ||
64 |
import java.lang.reflect.*; |
|
65 |
import java.util.*; |
|
66 | ||
67 |
import org.junit.platform.commons.support.*; |
|
68 |
import org.junit.platform.engine.*; |
|
69 |
import org.junit.platform.engine.discovery.*; |
|
70 |
import org.junit.platform.engine.support.hierarchical.*; |
|
71 | ||
72 |
import com.goldencode.p2j.testengine.api.*; |
|
73 | ||
74 |
/** |
|
75 |
* Test engine. |
|
76 |
* |
|
77 |
*/ |
|
78 |
public class FWDTestEngine |
|
79 |
extends HierarchicalTestEngine<FWDEngineExecutionContext> |
|
80 |
implements Node<FWDEngineExecutionContext> |
|
81 |
{ |
|
82 | ||
83 |
/** |
|
84 |
* Scan a class for test methods, declared in the class. |
|
85 |
* |
|
86 |
* @param engineDescriptor |
|
87 |
* the engine descriptor to register found test descriptors in |
|
88 |
* @param javaClass |
|
89 |
* the Java class to scan |
|
90 |
* @param explicitMethods |
|
91 |
* optional list of explicit test methods to execute, can be {@code null} |
|
92 |
*/ |
|
93 |
private final static void addOptionally(final TestDescriptor engineDescriptor, |
|
94 |
final Class<?> javaClass, final List<Method> explicitMethods) |
|
95 |
{ |
|
96 |
final FWDClassTestDescriptor instance = FWDClassTestDescriptor.testAndCreate(javaClass, |
|
97 |
engineDescriptor, explicitMethods); |
|
98 |
if (instance != null) |
|
99 |
{ |
|
100 |
engineDescriptor.addChild(instance); |
|
101 |
} |
|
102 |
} |
|
103 | ||
104 |
/** |
|
105 |
* Scan a class for all test methods, including whose defined in the class and referenced classes, |
|
106 |
* if the class is marked as test suite. |
|
107 |
* |
|
108 |
* @param engineDescriptor |
|
109 |
* the engine descriptor to register found test descriptors in |
|
110 |
* @param javaClass |
|
111 |
* the Java class to scan |
|
112 |
*/ |
|
113 |
private static void scanClass(final TestDescriptor engineDescriptor, final Class<?> javaClass) |
|
114 |
{ |
|
115 |
addOptionally(engineDescriptor, javaClass, null); |
|
116 |
// Add suites |
|
117 |
if (AnnotationSupport.isAnnotated(javaClass, Suite.class)) |
|
118 |
{ |
|
119 |
for (final Class<?> referencedClass : javaClass.getAnnotation(SelectClasses.class).value()) |
|
120 |
{ |
|
121 |
addOptionally(engineDescriptor, referencedClass, null); |
|
122 |
} |
|
123 | ||
124 |
// TODO: implement all other suite selectors if ever required... |
|
125 |
} |
|
126 |
} |
|
127 | ||
128 |
/** |
|
129 |
* Discover tests according to the supplied {@link EngineDiscoveryRequest}. |
|
130 |
* |
|
131 |
* <p>The supplied {@link UniqueId} must be used as the unique ID of the |
|
132 |
* returned root {@link TestDescriptor}. In addition, the {@code UniqueId} |
|
133 |
* must be used to create unique IDs for children of the root's descriptor |
|
134 |
* by calling {@link UniqueId#append}. |
|
135 |
* |
|
136 |
* @param discoveryRequest the discovery request; never {@code null} |
|
137 |
* @param uniqueId the unique ID to be used for this test engine's |
|
138 |
* {@code TestDescriptor}; never {@code null} |
|
139 |
* @return the root {@code TestDescriptor} of this engine, typically an |
|
140 |
* instance of {@code EngineDescriptor} |
|
141 |
* @see org.junit.platform.engine.support.descriptor.EngineDescriptor |
|
142 |
*/ |
|
143 |
@Override |
|
144 |
public TestDescriptor discover(final EngineDiscoveryRequest discoveryRequest, final UniqueId uniqueId) |
|
145 |
{ |
|
146 |
final TestDescriptor engineDescriptor = new FWDEngineDescriptor(uniqueId); |
|
147 | ||
148 |
discoveryRequest.getSelectorsByType(MethodSelector.class).forEach(selector -> { |
|
149 |
addOptionally(engineDescriptor, selector.getJavaClass(), Collections.singletonList(selector.getJavaMethod())); |
|
150 |
}); |
|
151 | ||
152 |
discoveryRequest.getSelectorsByType(ClassSelector.class).forEach(selector -> { |
|
153 |
scanClass(engineDescriptor, selector.getJavaClass()); |
|
154 |
}); |
|
155 | ||
156 |
discoveryRequest.getSelectorsByType(PackageSelector.class).forEach(selector -> { |
|
157 |
final List<Class<?>> classes = ReflectionSupport.findAllClassesInPackage( |
|
158 |
selector.getPackageName(), (Class<?> c) -> true, name -> true); |
|
159 |
for(Class<?> javaClass : classes) |
|
160 |
{ |
|
161 |
scanClass(engineDescriptor, javaClass); |
|
162 |
} |
|
163 |
}); |
|
164 | ||
165 |
return engineDescriptor; |
|
166 |
} |
|
167 | ||
168 |
/** |
|
169 |
* Get the ID that uniquely identifies this test engine. |
|
170 |
* |
|
171 |
* <p>Each test engine must provide a unique ID. For example, JUnit Vintage |
|
172 |
* and JUnit Jupiter use {@code "junit-vintage"} and {@code "junit-jupiter"}, |
|
173 |
* respectively. When in doubt, you may use the fully qualified name of your |
|
174 |
* custom {@code TestEngine} implementation class. |
|
175 |
*/ |
|
176 |
@Override |
|
177 |
public String getId() |
|
178 |
{ |
|
179 |
// Note: "junit-fwd" would be more natural, but the "junit-" prefix |
|
180 |
// is reserved by JUnit5 |
|
181 |
return "fwd-junit"; |
|
182 |
} |
|
183 | ||
184 |
/** |
|
185 |
* Create the initial execution context for executing the supplied |
|
186 |
* {@linkplain ExecutionRequest request}. |
|
187 |
* |
|
188 |
* @param request the request about to be executed |
|
189 |
* @return the initial context that will be passed to nodes in the hierarchy |
|
190 |
*/ |
|
191 |
@Override |
|
192 |
protected FWDEngineExecutionContext createExecutionContext(ExecutionRequest request) |
|
193 |
{ |
|
194 |
return new FWDEngineExecutionContext(); |
|
195 |
} |
|
196 | ||
197 |
} |
src/com/goldencode/p2j/testengine/api/AfterAll.java 2022-09-30 12:24:40 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : AfterAll.java |
|
3 |
** Abstract : Mark methods, which should be run after all @Test methods in the class. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine.api; |
|
63 | ||
64 |
import java.lang.annotation.*; |
|
65 | ||
66 |
/** |
|
67 |
* {@link AfterAll} is used to mark methods, which should be run after all {@link Test} methods in the class. |
|
68 |
*/ |
|
69 |
@Target(ElementType.METHOD) |
|
70 |
@Retention(RetentionPolicy.RUNTIME) |
|
71 |
public @interface AfterAll |
|
72 |
{ |
|
73 |
// no-op |
|
74 |
} |
src/com/goldencode/p2j/testengine/api/AfterEach.java 2022-09-30 12:24:46 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : AfterEach.java |
|
3 |
** Abstract : Mark methods, which should be run after each @Test method. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- ----------------Description---------------------- |
|
8 |
** 001 VVT 2022xxxx Created initial version. |
|
9 |
*/ |
|
10 |
/* |
|
11 |
** This program is free software: you can redistribute it and/or modify |
|
12 |
** it under the terms of the GNU Affero General Public License as |
|
13 |
** published by the Free Software Foundation, either version 3 of the |
|
14 |
** License, or (at your option) any later version. |
|
15 |
** |
|
16 |
** This program is distributed in the hope that it will be useful, |
|
17 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
** GNU Affero General Public License for more details. |
|
20 |
** |
|
21 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
22 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
23 |
** |
|
24 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
25 |
** |
|
26 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
27 |
** terms apply to the works covered under the License. These additional terms |
|
28 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
29 |
** Affero GPL version 3 and may not be removed by you. |
|
30 |
** |
|
31 |
** 0. Attribution Requirement. |
|
32 |
** |
|
33 |
** You must preserve all legal notices or author attributions in the covered |
|
34 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
35 |
** work. You may not remove from the covered work any author or developer |
|
36 |
** credit already included within the covered work. |
|
37 |
** |
|
38 |
** 1. No License To Use Trademarks. |
|
39 |
** |
|
40 |
** This license does not grant any license or rights to use the trademarks |
|
41 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
42 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
43 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
44 |
** publicity purposes without written authorization. |
|
45 |
** |
|
46 |
** 2. No Misrepresentation of Affiliation. |
|
47 |
** |
|
48 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
49 |
** |
|
50 |
** You may not represent yourself for publicity purposes as associated with |
|
51 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
52 |
** the covered work, without written authorization. |
|
53 |
** |
|
54 |
** 3. No Misrepresentation of Source or Origin. |
|
55 |
** |
|
56 |
** You may not represent the covered work as solely your work. All modified |
|
57 |
** versions of the covered work must be marked in a reasonable way to make it |
|
58 |
** clear that the modified work is not originating from Golden Code Development |
|
59 |
** Corporation or FWD. All modified versions must contain the notices of |
|
60 |
** attribution required in this license. |
|
61 |
*/ |
|
62 |
package com.goldencode.p2j.testengine.api; |
|
63 | ||
64 |
import java.lang.annotation.*; |
|
65 | ||
66 |
/** |
|
67 |
* {@link AfterEach} is used to mark methods, which should be run after each {@link Test} method. |
|
68 |
*/ |
|
69 |
@Target(ElementType.METHOD) |
|
70 |
@Retention(RetentionPolicy.RUNTIME) |
|
71 |
public @interface AfterEach |
|
72 |
{ |
|
73 |
// no-op |
|
74 |
} |
src/com/goldencode/p2j/testengine/api/BeforeAll.java 2022-09-30 12:24:50 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : BeforeAll.java |
|
3 |
** Abstract : Mark methods, which should be run before all @Test methods in the class. |
|
4 |
** |
|
5 |
** Copyright (c) 2022, Golden Code Development Corporation. |