Release version 1.13.7
[sdc.git] / common / onap-generic-artifact-browser / README.md
1 ## Library for parsing yaml files
2
3 ###### Requirements specified under the SDC jira ticket: [SDC-2094](https://jira.onap.org/browse/SDC-2094) - R4 5G U/C SDC: FM Meta Data GUI Display from PNF Onboarded Package
4
5 #### GAB Controller
6
7 ##### Introduction
8 GABController is a tool for searching inside the [Yaml](https://yaml.org/) file content. At this moment is completely independent from any ONAPs component and can be used in any case where searching full json-path format keywords is needed. To use it, two things are required from the user: yaml document and list of fields to filter the results and nothing more. 
9
10 ##### Usage
11 GABController is provided as a standard JAVA archive and can be imported in any application by adding its JAR name into the classpath or using maven dependency management:
12 ```
13 <dependency>
14         <groupId>org.onap.sdc.common</groupId>
15         <artifactId>onap-generic-artifact-browser-service</artifactId>
16         <version>${project.version}</version>
17         <scope>compile</scope>
18 </dependency>
19 ```
20 The most usable class is GABServiceImpl implements GABService and expose single method for searching paths inside the [Yaml](https://yaml.org/) file.
21
22 GABService operates on 2 different types: GABQuery as an input and GABResults as an output model.
23 ###### Example 1 - searching for multiple keywords:
24 ```
25 /* First You need to create GABService */
26 GABService gabService = new GABServiceImpl();
27
28 /* Next step is to prepare your query model.
29  *  In this example we will use file: 
30  *      '/root/test.yml' 
31  *  and will search for keywords: 
32  *      'event.structure.commonEventHeader' and 'event.presence' 
33  */
34 GABQuery gabQuery = new GABQuery(Arrays.asList(
35   "event.structure.commonEventHeader","event.presence"), "/root/test.yml", GABQueryType.PATH);    
36
37 /* And at last ask for the results */
38 GABResults gabResults = gabService.searchFor(gabQuery); 
39
40 /* And thats it. Please notice that IOException can be thrown in some cases.
41  * For more info please follow specification inside the JavaDocs. 
42  */    
43 ``` 
44
45 ##### Dependencies
46
47 ###### Runtime:
48 - lombok: 1.16.16 - [Doc](https://projectlombok.org/features/all)
49 - snakeyaml: 1.21 - [Doc](https://bitbucket.org/asomov/snakeyaml)
50 - gson: 2.8.5 - [Doc](https://github.com/google/gson)
51 - jsurfer: 1.4.3 - [Doc](https://github.com/jsurfer/JsonSurfer)
52 - guava: 18.0 - [Doc](https://github.com/google/guava/wiki/Release18)
53 - commons-io: 2.6 - [Doc](https://commons.apache.org/proper/commons-io/)
54
55 ###### Testing:    
56 - junit: 5.4.0 - [Doc](https://junit.org/junit5/docs/current/api/)
57
58 #### Tests structure
59 Generic Artifact Browser has got two independent layers of tests:
60 1. Unit testing using JUnit 5 (integrated in every component)
61 2. Component testing using Cucumber 2.3 (component-tests module) 
62
63 All layers are currently executed during the maven build of the main project.
64
65 ##### Dependencies
66
67 ###### Util:
68 - guava: 18.0 - [Doc](https://github.com/google/guava/wiki/Release18)
69
70 ###### Testing:    
71 - junit: 5.4.0 - [Doc](https://junit.org/junit5/docs/current/api/)
72 - cucumber: 2.3.1 - [Doc](https://docs.cucumber.io/)