[NETCONF-1040] OpenApi: Rework unit test infrastructure Created: 25/May/23  Updated: 31/May/23  Resolved: 31/May/23

Status: Resolved
Project: netconf
Component/s: restconf-openapi
Affects Version/s: None
Fix Version/s: 6.0.0

Type: Task Priority: Medium
Reporter: Ivan Hrasko Assignee: Oleksandr Zharov
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Currently all unit test in restconf-openapi are using common parent AbstractOpenApiTest. This class creates effective model context from all YANG models under yang folder.

  1. Enhance AbstractOpenApiTest to make it possible to configure which models/folders are used to generate effective model context.
  2. Investigate and make reorganization of unit tests using this new feature.


 Comments   
Comment by Ivan Hrasko [ 30/May/23 ]

IMO this is over-engineered. We can just remove AbstractOpenApiTest logic which create effective model context and move it to @BeforeClass of each test class as follows:

    private static EffectiveModelContext context;
    
    @BeforeClass
    public static void beforeClass() {
        context = YangParserTestUtils.parseYangResourceDirectory("/yang");
        when(SCHEMA_SERVICE.getGlobalContext()).thenReturn(context);
    } 

Then we do not to do part #2 of this task.

Comment by Ivan Hrasko [ 30/May/23 ]

In addition, we can remove AbstractOpenApiTest completelly and make OpenApiTestUtils instead.

Generated at Wed Feb 07 20:16:31 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.