diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | docs/conf.py | 175 | ||||
-rw-r--r-- | docs/development/devtools/devtools.rst | 93 | ||||
-rw-r--r-- | docs/xacml/swagger.json | 4 | ||||
-rw-r--r-- | docs/xacml/xacml.rst | 13 | ||||
-rw-r--r-- | integration/pom.xml | 166 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | resources/pom.xml | 32 | ||||
-rw-r--r-- | resources/src/main/resources/asciidoc/swagger.adoc | 4 | ||||
-rw-r--r-- | resources/src/main/resources/assemblies/swagger-docs.xml | 40 |
10 files changed, 521 insertions, 10 deletions
@@ -2,6 +2,7 @@ .project .settings .classpath +.checkstyle .jupiter .pydevproject target @@ -9,7 +10,6 @@ target /bin/ .idea **/*.iml -docs/conf.py docs/conf.pyc docs/html/ docs/_static/ diff --git a/docs/conf.py b/docs/conf.py index 87611ec9..11918233 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,21 +1,182 @@ +from docutils.parsers.rst import directives from docs_conf.conf import * branch = 'latest' +doc_url = 'https://docs.onap.org/projects' master_doc = 'index' -extensions = [ - 'sphinx.ext.autosectionlabel', - 'sphinxcontrib.swaggerdoc' - ] + +intersphinx_mapping = {} + +# Latest (change to branch) +intersphinx_mapping['onap-aai-aai-common'] = ('{}/onap-aai-aai-common/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-aai-sparky-be'] = ('{}/onap-aai-sparky-be/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-cds'] = ('{}/onap-ccsdk-cds/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-features'] = ('{}/onap-ccsdk-features/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-distribution'] = ('{}/onap-ccsdk-distribution/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-oran'] = ('{}/onap-ccsdk-oran/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-cli'] = ('{}/onap-cli/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-cps'] = ('{}/onap-cps/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-dcaegen2'] = ('{}/onap-dcaegen2/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-dmaap-messagerouter-messageservice'] = ( + '{}/onap-dmaap-messagerouter-messageservice/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-dmaap-buscontroller'] = ('{}/onap-dmaap-buscontroller/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-dmaap-datarouter'] = ('{}/onap-dmaap-datarouter/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-dmaap-dbcapi'] = ('{}/onap-dmaap-dbcapi/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-externalapi-nbi'] = ('{}/onap-externalapi-nbi/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-holmes-engine-management'] = ( + '{}/onap-holmes-engine-management/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-holmes-rule-management'] = ( + '{}/onap-holmes-rule-management/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-integration'] = ('{}/onap-integration/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-modeling-etsicatalog'] = ('{}/onap-modeling-etsicatalog/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-modeling-modelspec'] = ('{}/onap-modeling-modelspec/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-multicloud-framework'] = ('{}/onap-multicloud-framework/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-msb-apigateway'] = ('{}/onap-msb-apigateway/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-oom'] = ('{}/onap-oom/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-oom-offline-installer'] = ('{}/onap-oom-offline-installer/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-oom-platform-cert-service'] = ( + '{}/onap-oom-platform-cert-service/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-optf-cmso'] = ('{}/onap-optf-cmso/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-optf-osdf'] = ('{}/onap-optf-osdf/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-optf-has'] = ('{}/onap-optf-has/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-policy-clamp'] = ('{}/onap-policy-clamp/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-policy-parent'] = ('{}/onap-policy-parent/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdc'] = ('{}/onap-sdc/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdnc-oam'] = ('{}/onap-sdnc-oam/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-so'] = ('{}/onap-so/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-usecase-ui'] = ('{}/onap-usecase-ui/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vfc-nfvo-lcm'] = ('{}/onap-vfc-nfvo-lcm/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vid'] = ('{}/onap-vid/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vnfrqts-guidelines'] = ('{}/onap-vnfrqts-guidelines/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vnfrqts-requirements'] = ('{}/onap-vnfrqts-requirements/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vnfrqts-testcases'] = ('{}/onap-vnfrqts-testcases/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vnfrqts-usecases'] = ('{}/onap-vnfrqts-usecases/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vnfsdk-model'] = ('{}/onap-vnfsdk-model/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vvp-documentation'] = ('{}/onap-vvp-documentation/en/%s'.format(doc_url) % branch, None) + +# Guilin +branch = 'guilin' +intersphinx_mapping['onap-portal'] = ('{}/onap-portal/en/%s'.format(doc_url) % branch, None) + +# Frankfurt +branch = 'frankfurt' +intersphinx_mapping['onap-appc'] = ('{}/onap-appc/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-appc-deployment'] = ('{}/onap-appc-deployment/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-music'] = ('{}/onap-music/en/%s'.format(doc_url) % branch, None) + +# Latest +branch = 'latest' +intersphinx_mapping['onap-aaf-authz'] = ('{}/onap-aaf-authz/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-aaf-sms'] = ('{}/onap-aaf-sms/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-aai-event-client'] = ('{}/onap-aai-event-client/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-aai-esr-gui'] = ('{}/onap-aai-esr-gui/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-aai-esr-server'] = ('{}/onap-aai-esr-server/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-apps'] = ('{}/onap-ccsdk-apps/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-dashboard'] = ('{}/onap-ccsdk-dashboard/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-ccsdk-platform-plugins'] = ( + '{}/onap-ccsdk-platform-plugins/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-logging-analytics'] = ('{}/onap-logging-analytics/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-logging-analytics-pomba-pomba-audit-common'] = ( + '{}/onap-logging-analytics-pomba-pomba-audit-common/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-modeling-toscaparsers'] = ( + '{}/onap-modeling-toscaparsers/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-msb-discovery'] = ('{}/onap-msb-discovery/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-msb-java-sdk'] = ('{}/onap-msb-java-sdk/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-msb-swagger-sdk'] = ('{}/onap-msb-swagger-sdk/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-multicloud-azure'] = ('{}/onap-multicloud-azure/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-multicloud-k8s'] = ('{}/onap-multicloud-k8s/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-music-distributed-kv-store'] = ( + '{}/onap-music-distributed-kv-store/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-oparent-cia'] = ('{}/onap-oparent-cia/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-osa'] = ('{}/onap-osa/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdc-sdc-distribution-client'] = ( + '{}/onap-sdc-sdc-distribution-client/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdc-sdc-workflow-designer'] = ( + '{}/onap-sdc-sdc-workflow-designer/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdc-sdc-tosca'] = ('{}/onap-sdc-sdc-tosca/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-sdc-sdc-docker-base'] = ('{}/onap-sdc-sdc-docker-base/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-so-libs'] = ('{}/onap-so-libs/en/%s'.format(doc_url) % branch, None) +intersphinx_mapping['onap-vfc-nfvo-driver-vnfm-svnfm'] = ( + '{}/onap-vfc-nfvo-driver-vnfm-svnfm/en/%s'.format(doc_url) % branch, None) linkcheck_ignore = [ 'http://localhost', + 'https://example.com', + 'about:config', + # this URL is not directly reachable and must be configured in the system hosts file. + 'https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm', + # anchor issues + 'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases_release.html#.*', + 'https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#.*', + 'https://docs.onap.org/projects/onap-integration/en/latest/docs_robot.html#docs-robot', + 'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases_release.html#docs-usecases-release', + 'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases.html#docs-usecases', + 'https://docs.onap.org/projects/onap-integration/en/latest/usecases/release_non_functional_requirements.html#release-non-functional-requirements', ] -intersphinx_mapping = {} html_last_updated_fmt = '%d-%b-%y %H:%M' -autosectionlabel_maxdepth = 2 def setup(app): - app.add_stylesheet("css/ribbon.css") + app.add_css_file("css/ribbon.css") + + +needs_extra_options = { + "target": directives.unchanged, + "keyword": directives.unchanged, + "introduced": directives.unchanged, + "updated": directives.unchanged, + "impacts": directives.unchanged, + "validation_mode": directives.unchanged, + "validated_by": directives.unchanged, + "test": directives.unchanged, + "test_case": directives.unchanged, + "test_file": directives.unchanged, + "notes": directives.unchanged, +} + +needs_id_regex = "^[A-Z0-9]+-[A-Z0-9]+" +needs_id_required = True +needs_title_optional = True + +needs_template_collapse = """ +.. _{{id}}: + +{% if hide == false -%} +.. role:: needs_tag +.. role:: needs_status +.. role:: needs_type +.. role:: needs_id +.. role:: needs_title + +.. rst-class:: need +.. rst-class:: need_{{type_name}} + +.. container:: need + + `{{id}}` - {{content|indent(4)}} + + .. container:: toggle + + .. container:: header + + Details + +{% if status and status|upper != "NONE" and not hide_status %} | status: :needs_status:`{{status}}`{% endif %} +{% if tags and not hide_tags %} | tags: :needs_tag:`{{tags|join("` :needs_tag:`")}}`{% endif %} +{% if keyword %} | keyword: `{{keyword}}` {% endif %} +{% if target %} | target: `{{target}}` {% endif %} +{% if introduced %} | introduced: `{{introduced}}` {% endif %} +{% if updated %} | updated: `{{updated}}` {% endif %} +{% if impacts %} | impacts: `{{impacts}}` {% endif %} +{% if validation_mode %} | validation mode: `{{validation_mode}}` {% endif %} +{% if validated_by %} | validated by: `{{validated_by}}` {% endif %} +{% if test %} | test: `{{test}}` {% endif %} +{% if test_case %} | test case: {{test_case}} {% endif %} +{% if test_file %} | test file: `{{test_file}}` {% endif %} +{% if notes %} | notes: `{{notes}}` {% endif %} + | children: :need_incoming:`{{id}}` + | parents: :need_outgoing:`{{id}}` +{% endif -%} +""" diff --git a/docs/development/devtools/devtools.rst b/docs/development/devtools/devtools.rst index 1e2fd49f..fac06ac6 100644 --- a/docs/development/devtools/devtools.rst +++ b/docs/development/devtools/devtools.rst @@ -283,3 +283,96 @@ familiar with the Policy Framework components and test any local changes. xacml-s3p.rst distribution-s3p.rst +Generating Swagger Documentation +******************************** +The `Policy Parent Integration POM <https://github.com/onap/policy-parent/blob/master/integration/pom.xml>`_ contains a *generateSwaggerDocs* profile. This +profile can be activated on any module that has a Swagger endopint. When active, this profile creates a tarball in Nexus with the name +*<project-artifactId>-swagger-docs.tar.gz*. The tarball contains the fillowing files: + +.. code-block:: bash + + swagger/swagger.html + swagger/swagger.json + swagger/swagger.pdf + +The profile is activated when: + +1. The following property is defined at the top of the *pom.xml* file for a module + + .. code-block:: bash + + <!-- This property triggers generation of the Swagger documents --> + <swagger.generation.phase>post-integration-test</swagger.generation.phase> + + See the `CLAMP runtime POM <https://github.com/onap/policy-clamp/blob/master/runtime/pom.xml>`_ for an example of the usage of this property. + +2. Unit tests are being executed in the build, in other wirds when the *skipTests* flag is *false*. + +You **must** create a unit test in your module that generates the following file: + +.. code-block:: bash + + src/test/resources/swagger/swagger.json + +Typically, you do this by starting your REST endpoint in a unit test, issuing a REST call to get the Swagger API documentation. The test case below is an example +of such a test case. + +.. code-block:: java + + @Test + public void testSwaggerJson() throws Exception { + ResponseEntity<String> httpsEntity = getRestTemplate() + .getForEntity("https://localhost:" + this.httpsPort + "/restservices/clds/api-doc", String.class); + assertThat(httpsEntity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(httpsEntity.getBody()).contains("swagger"); + FileUtils.writeStringToFile(new File("target/swagger/swagger.json"), httpsEntity.getBody(), + Charset.defaultCharset()); + } + +See `this unit test case <https://github.com/onap/policy-clamp/blob/master/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java>`_ +for the full example. + +Running the DMaaP Simulator during Development +********************************************** +It is sometimes convenient to run the DMaaP simulator during development. You can run it from the command line using Maven or from within your IDE. + +Running on the Command Line ++++++++++++++++++++++++++++ +1. Check out the policy models repository +2. Go to the *models-sim/policy-models-simulators* subdirectory in the policy-models repo +3. Run the following Maven command: + + .. code-block:: bash + + mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/simParameters.json" + +Running in Eclipse +++++++++++++++++++ +1. Check out the policy models repository +2. Go to the *models-sim/policy-models-simulators* module in the policy-models repo +3. Specify a run configuration using the class *org.onap.policy.models.simulators.Main* as the main class +4. Specify an argument of *src/test/resources/simParameters.json* to the run configuration +5. Run the configuration + +Specifying a local configuration file ++++++++++++++++++++++++++++++++++++++ + +You may specify a local configuration file instead of *src/test/resources/simParameters.json* on the command line or as an arument in the run configuration in eclipse: + +.. code-block:: json + + { + "dmaapProvider": { + "name": "DMaaP simulator", + "topicSweepSec": 900 + }, + "restServers": [ + { + "name": "DMaaP simulator", + "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", + "host": "localhost", + "port": 3904, + "https": false + } + ] + } diff --git a/docs/xacml/swagger.json b/docs/xacml/swagger.json index 0bb133b9..1588765d 100644 --- a/docs/xacml/swagger.json +++ b/docs/xacml/swagger.json @@ -3,7 +3,7 @@ "info" : { "description" : "Policy Xacml PDP Service", "version" : "Swagger Server", - "title" : "", + "title" : "Policy Xacml PDP Service", "x-component" : "Policy Framework", "x-planned-retirement-date" : "tbd" }, @@ -1105,4 +1105,4 @@ } } } -}
\ No newline at end of file +} diff --git a/docs/xacml/xacml.rst b/docs/xacml/xacml.rst index 1b5b5114..7ccd2934 100644 --- a/docs/xacml/xacml.rst +++ b/docs/xacml/xacml.rst @@ -285,6 +285,19 @@ Which would render the following decision response: .. literalinclude:: decision.match.response.json :language: JSON +Overriding or Extending the ONAP XACML PDP Supported Policy Types +***************************************************************** + +It is possible to extend or replace one or more of the existing ONAP application implementations with your own. Since the XACML application loader uses the java.util.Service class to search the classpath to find and load applications, it may be necessary via the configuration file to exclude the ONAP packaged applications in order for your custom application to be loaded. This can be done via the configuration file by adding an **exclusions** property with a list of the Java class names you wish to exclude. + +`A configuration file example is located here <https://github.com/onap/policy-xacml-pdp/blob/7711185bb36b387e3596653ca170262f919ff474/main/src/test/resources/parameters/XacmlPdpConfigParameters_Exclusions.json#L19>`_ + +A coding example is available in the JUnit test for the Application Manager called `testXacmlPdpApplicationManagerSimple <https://github.com/onap/policy-xacml-pdp/blob/7711185bb36b387e3596653ca170262f919ff474/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java#L143>`_. This example demonstrates how to exclude the Match and Guard applications while verifying a custom `TestGuardOverrideApplication <https://github.com/onap/policy-xacml-pdp/blob/master/main/src/test/java/org/onap/policy/pdpx/main/rest/TestGuardOverrideApplication.java>`_ class is loaded and associated with the **guard** action. Thus, replacing and extending the guard application. + +Note that this XACML PDP feature is exclusive to the XACML PDP and is secondary to the ability of the PAP to group PDP's and declare which Policy Types are supported by a PDP group. For example, even if a PDP group excludes a Policy Type for a XACML PDP, this simply prevents policies being deployed to that group using the PAP Deployment API. If there is no **exclusions** in the configuration file, then any application will be loaded that it is in the classpath. If needed, one could use both PDP group Policy Type supported feature **and** the exclusions configuration to completely restrict which Policy Types as well as which applications are loaded at runtime. + +For more information on PDP groups and setting supported Policy Types, please refer to the :ref:`PAP Documentation <pap-label>` + Supporting Your Own Policy Types and Translators ************************************************ diff --git a/integration/pom.xml b/integration/pom.xml index d823045e..c082e685 100644 --- a/integration/pom.xml +++ b/integration/pom.xml @@ -36,6 +36,8 @@ <properties> <java.version>11</java.version> + <!-- NOTE: For RELEASE/SNAPSHOT always set to the project version --> + <version.parent.resources>3.4.0-SNAPSHOT</version.parent.resources> <version.logback>1.2.3</version.logback> <version.dmaap>1.1.12</version.dmaap> <version.powermock>2.0.9</version.powermock> @@ -58,6 +60,8 @@ <version.jakarta-api>2.0.2</version.jakarta-api> <jacoco.dataFile>${project.basedir}/../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> <repo.npm>https://nexus3.onap.org/repository/npm.public/npm/-/</repo.npm> + <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry> + <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> </properties> <distributionManagement> @@ -70,6 +74,12 @@ <dependencyManagement> <dependencies> <dependency> + <groupId>org.onap.policy.parent</groupId> + <artifactId>policy-parent-resources</artifactId> + <version>${version.parent.resources}</version> + </dependency> + + <dependency> <groupId>jakarta.validation</groupId> <artifactId>jakarta.validation-api</artifactId> <version>${version.jakarta-api}</version> @@ -855,6 +865,162 @@ </pluginManagement> </build> </profile> + <profile> + <id>generateSwaggerDocs</id> + <activation> + <property> + <name>!skipTests</name> + </property> + </activation> + <build> + <plugins> + <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate + a list of .adoc files containing the APIs info in more structured way --> + <plugin> + <groupId>io.github.swagger2markup</groupId> + <artifactId>swagger2markup-maven-plugin</artifactId> + <version>1.3.3</version> + <dependencies> + <dependency> + <groupId>io.github.swagger2markup</groupId> + <artifactId>swagger2markup-import-files-ext</artifactId> + <version>1.3.3</version> + </dependency> + <dependency> + <groupId>io.github.swagger2markup</groupId> + <artifactId>swagger2markup-spring-restdocs-ext</artifactId> + <version>1.3.3</version> + </dependency> + </dependencies> + <configuration> + <swaggerInput>${project.build.directory}/swagger/swagger.json</swaggerInput> + <outputDir>${project.build.directory}/asciidoc/generated</outputDir> + <config> + <swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage> + </config> + </configuration> + <executions> + <execution> + <phase>${swagger.generation.phase}</phase> + <goals> + <goal>convertSwagger2markup</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack-swagger-asciidoc</id> + <phase>${swagger.generation.phase}</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.onap.policy.parent</groupId> + <artifactId>policy-parent-resources</artifactId> + <type>jar</type> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}</outputDirectory> + </artifactItem> + </artifactItems> + <includes>asciidoc/**</includes> + <outputDirectory>${project.build.directory}</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!-- Run the generated asciidoc through Asciidoctor to generate other documentation + types, such as PDFs or HTML5 --> + <plugin> + <groupId>org.asciidoctor</groupId> + <artifactId>asciidoctor-maven-plugin</artifactId> + <version>1.5.7.1</version> + <dependencies> + <dependency> + <groupId>org.asciidoctor</groupId> + <artifactId>asciidoctorj-pdf</artifactId> + <version>1.5.0-alpha.10.1</version> + </dependency> + </dependencies> + <configuration> + <sourceDirectory>${project.build.directory}/asciidoc</sourceDirectory> + <sourceDocumentName>swagger.adoc</sourceDocumentName> + <attributes> + <doctype>book</doctype> + <toc>left</toc> + <toclevels>3</toclevels> + <numbered /> + <hardbreaks /> + <sectlinks /> + <sectanchors /> + <generated>${project.build.directory}/asciidoc/generated</generated> + </attributes> + </configuration> + + <executions> + <execution> + <id>output-html</id> + <phase>${swagger.generation.phase}</phase> + <goals> + <goal>process-asciidoc</goal> + </goals> + <configuration> + <backend>html5</backend> + <outputDirectory>${project.build.directory}/swagger</outputDirectory> + </configuration> + </execution> + <execution> + <id>output-pdf</id> + <phase>${swagger.generation.phase}</phase> + <goals> + <goal>process-asciidoc</goal> + </goals> + <configuration> + <backend>pdf</backend> + <outputDirectory>${project.build.directory}/swagger</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!-- Create a tarball for Swagger documents --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.onap.policy.parent</groupId> + <artifactId>policy-parent-resources</artifactId> + <version>${version.parent.resources}</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>generate-swagger-tar</id> + <phase>${swagger.generation.phase}</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptorRefs> + <descriptorRef>swagger-docs</descriptorRef> + </descriptorRefs> + <finalName>${project.artifactId}</finalName> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> + </profile> </profiles> <build> @@ -2,6 +2,7 @@ ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. Modifications Copyright (C) 2020-2021 AT&T. All rights reserved. + Modifications Copyright (C) 2021 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -36,6 +37,7 @@ </properties> <modules> + <module>resources</module> <module>integration</module> </modules> diff --git a/resources/pom.xml b/resources/pom.xml new file mode 100644 index 00000000..802e93fd --- /dev/null +++ b/resources/pom.xml @@ -0,0 +1,32 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2021 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.parent</groupId> + <artifactId>policy-parent</artifactId> + <version>3.4.0-SNAPSHOT</version> + </parent> + + <artifactId>policy-parent-resources</artifactId> + <description>Resources used in builds</description> + <packaging>jar</packaging> +</project> diff --git a/resources/src/main/resources/asciidoc/swagger.adoc b/resources/src/main/resources/asciidoc/swagger.adoc new file mode 100644 index 00000000..e2543364 --- /dev/null +++ b/resources/src/main/resources/asciidoc/swagger.adoc @@ -0,0 +1,4 @@ +include::{generated}/overview.adoc[] +include::{generated}/paths.adoc[] +include::{generated}/security.adoc[] +include::{generated}/definitions.adoc[] diff --git a/resources/src/main/resources/assemblies/swagger-docs.xml b/resources/src/main/resources/assemblies/swagger-docs.xml new file mode 100644 index 00000000..1a1934f3 --- /dev/null +++ b/resources/src/main/resources/assemblies/swagger-docs.xml @@ -0,0 +1,40 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2021 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<assembly> + <id>swagger-docs</id> + <formats> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>${project.build.directory}/swagger + </directory> + <includes> + <include>*.json</include> + <include>*.html</include> + <include>*.pdf</include> + </includes> + <outputDirectory>${file.separator}swagger</outputDirectory> + <lineEnding>unix</lineEnding> + </fileSet> + </fileSets> +</assembly> |