c08dbb641724ef38706d1687f63128d3bda12332
[policy/engine.git] / docs / platform / modAmsterTemplate.rst
1
2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 ******************************
6 Modifying the Release Template
7 ******************************
8
9 .. contents::
10     :depth: 3
11
12
13 This tutorial is intended for Policy Drools Applications developers who would like to test their code using the PDP-D in Eclipse instead of installing in a lab. The example for this tutorial will walk through making a change to the Amsterdam Control Loop Template, building the archetype project, and instantiating a controller with the PDP-D.
14
15 Installing the Archetype Project in Eclipse
16 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
17
18 **STEP 1:** First, open the drools-pdp project in Eclipse and navigate to File → New → Project...
19
20     .. image:: mat_new_project.JPG
21
22 **STEP 2:** Navigate to Maven → Maven Project
23
24     .. image:: mat_maven_project.JPG
25
26 **STEP 3:** For demo purposes, the location of the project will be put in Documents/demo. Hit next to proceed.
27
28     .. image:: mat_project_location.JPG
29
30 **STEP 4:** Click  "Configure" near the top right.
31
32     .. image:: mat_configure.JPG
33
34 **STEP 5:** Click "Add Remote Catalog..."
35
36     .. image:: mat_add_local_catalog.JPG
37
38 **STEP 6:** Add the ONAP Staging repository archetype-catalog.xml with a description if desired. Click "OK" then "Apply", then "OK".
39
40     .. image:: mat_nexus_catalog.JPG
41
42 **STEP 7:** The ONAP staging archetypes are now an option:
43
44     .. image:: mat_archetypes.JPG
45
46 **STEP 8:** Highlight the option with the Artifact Id "archetype-cl-amsterdam" and hit next. The following screen allows the user to modify some of the configurable parameters of the control loop. For this demo the default parameters that are already populated will be used. Fill out the Groud Id, Artifact Id, Version, and Package and hit "Finish". For the demo the following is used:
47
48     .. image:: mat_archetype_params.JPG
49
50 **STEP 9:** Depending on the IDE in use, an error may be generated about handling the kie-maven-plugin:6.5.0.Final:build plugin. This can be ignored, click "Finish" and then "OK" if a warning pops up about having build errors.
51
52     .. image:: mat_error.JPG
53
54 **STEP 10:** Amsterdam can now be seen in the Project Explorer:
55
56     .. image:: mat_amsterdam_project.JPG
57
58
59 Modifying the Amsterdam Template
60 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
61
62 **STEP 1:** Expand the amsterdam project and "src/main/resources". The drl generated from the archetype will be present as follows:
63
64     .. image:: mat_amsterdam_drl.JPG
65
66 **STEP 2:** Now a change will be added to the drl from above. For this tutorial, a new logging statement will be added that will show in the console of Eclipse when the changes are tested. We'll add this in the SETUP rule.
67
68     .. image:: mat_hello_world.JPG
69
70 **STEP 3:** Right click on the Amsterdam project, hover over "Run As", then click "Maven build".
71
72     .. image:: mat_maven_build.JPG
73
74 **STEP 4:** For the goals type "clean install", click "Apply" and then click "Run".
75
76     .. image:: mat_clean_install.JPG
77
78     .. image:: mat_build_success.JPG
79
80 Running the PDP-D with the Amsterdam Controller
81 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
82
83 **STEP 1:** Copy the controller properties file that was generated from the archetype in amsterdam/src/main/config into policy-management/src/main/config
84
85     .. image:: mat_amsterdam_controller.JPG
86
87 **STEP 2:** Go src/main/java and expand the package "org.onap.policy.drools.system". Right click on "Main.java", then hover over "Run As..." and click "Java Application".
88
89     .. image:: mat_run_as.JPG
90
91 **STEP 3:** Search through the console for the logging statement "\***** HELLO WORLD \*****". This indicates that the template change worked. Modifications can continue to be made and the Telemetry API can be used to interact with the PDP-D that is running in Eclipse and to test control loop flows.
92
93     .. image:: mat_console_output.JPG
94
95
96
97 End of Document
98
99
100 .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Modifying+the+Amsterdam+release+template
101
102