From 297209b45b403e9b314ebeb1140886e00ffd3f6d Mon Sep 17 00:00:00 2001 From: sheetalm Date: Tue, 20 Feb 2018 19:06:27 +0530 Subject: Activity Spec Service - Implementation Correcting error message. InternalEmptyObject not required to be serializable. Fixed review comments on Patch Set 10. Not all fixed Adding services profile in main sdc pom.Moving Static imports at end. Patch Set 7 changes Patch Set 6 - Removing javax.inject. Remove user from interface and Changing scope to be singleton. Correcting error message Patch Set 4 Not fixing Spring related review comments in this patch set Patch Set 4 Fixed review comments related to unused dependency Fixed review comments for plugin version. Corrected License Adding Activity Spec Service Implementation Not adding to main sdc pom as of now Change-Id: I5285c0ab3b71b492d18ca442ebd52b59ab0eabdc Issue-ID: SDC-1048 Signed-off-by: sheetalm --- .../activity-spec-web/activity-spec-war/pom.xml | 78 +++++++++++++++ .../src/main/webapp/WEB-INF/beans-services.xml | 46 +++++++++ .../src/main/webapp/WEB-INF/jetty-web.xml | 8 ++ .../main/webapp/WEB-INF/spring-mapper-servlet.xml | 13 +++ .../src/main/webapp/WEB-INF/web.xml | 77 +++++++++++++++ .../activity-spec-war/templates/markdown.hbs | 105 +++++++++++++++++++++ .../activity-spec-war/templates/operation.hbs | 73 ++++++++++++++ .../activity-spec-war/templates/security.hbs | 88 +++++++++++++++++ .../activity-spec-war/templates/strapdown.html.hbs | 11 +++ 9 files changed, 499 insertions(+) create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/pom.xml create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs create mode 100644 services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs (limited to 'services/activity-spec/activity-spec-web/activity-spec-war') diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml b/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml new file mode 100644 index 0000000000..dba32097a8 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/pom.xml @@ -0,0 +1,78 @@ + + 4.0.0 + + activityspec-war + activityspec-war + war + + + org.openecomp.activityspec + activity-spec-web + 1.2.0-SNAPSHOT + ../ + + + + + org.openecomp.activityspec + activity-spec-service + ${project.version} + + + + + + + maven-war-plugin + ${mvn.war.version} + + true + + + + ${basedir}/target/generated/swagger-ui + + + + + + com.github.kongchen + swagger-maven-plugin + ${mvn.swagger.version} + + + + false + org.openecomp.activityspec + http + /activityspec-api + + Rest API + v1.0, build #${buildNumber} + Rest API Documentation + + http://www.github.com/kongchen/swagger-maven-plugin + + + ${basedir}/templates/strapdown.html.hbs + ${basedir}/target/generated/api.html + ${basedir}/target/generated/swagger-ui + + + + + + + compile + + generate + + + + + + + + \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml new file mode 100644 index 0000000000..3d79d1e305 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/beans-services.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml new file mode 100644 index 0000000000..9426b13ccc --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/jetty-web.xml @@ -0,0 +1,8 @@ + + + + + /activityspec-api + diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml new file mode 100644 index 0000000000..5a32dd432a --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..e6be3b0a11 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,77 @@ + + + + + + contextConfigLocation + WEB-INF/beans-services.xml + + + + org.openecomp.activityspec.api.server.listeners.ActivitySpecAppStartupListener + + + + + LoggingServletFilter + org.openecomp.sdc.logging.servlet.LoggingFilter + + + + LoggingServletFilter + /* + + + SessionContextFilter + org.openecomp.activityspec.api.server.filters.ActivitySpecSessionContextFilter + + + SessionContextFilter + /* + + + + spring-mapper + + org.springframework.web.servlet.DispatcherServlet + + 1 + + + + CXFServlet + CXF Servlet + + org.apache.cxf.transport.servlet.CXFServlet + + + redirects-list + + /docs/(\S)+\.json + + + + redirect-attributes + + javax.servlet.include.request_uri + + + + redirect-servlet-name + default + + 1 + + + spring-mapper + /ws/* + + + CXFServlet + /* + + diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs new file mode 100644 index 0000000000..cc87c38244 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/markdown.hbs @@ -0,0 +1,105 @@ +#{{#info}}{{title}} + + +## {{join schemes " | "}}://{{host}}{{basePath}} + + +{{description}} + +{{#contact}} +[**Contact the developer**](mailto:{{email}}) +{{/contact}} + +**Version** {{version}} + +{{#license}}[**{{name}}**]({{url}}){{/license}} + +{{/info}} + +{{#if consumes}}**Consumes:** {{join consumes ", "}}{{/if}} + +{{#if produces}}**Produces:** {{join produces ", "}}{{/if}} + +{{#if securityDefinitions}} +# Security Definitions +{{/if}} +{{> security}} + +# APIs + +{{#each paths}} +## {{@key}} +{{#this}} +{{#get}} +### GET +{{> operation}} +{{/get}} + +{{#put}} +### PUT +{{> operation}} +{{/put}} + +{{#post}} +### POST + +{{> operation}} + +{{/post}} + +{{#delete}} +### DELETE +{{> operation}} +{{/delete}} + +{{#option}} +### OPTION +{{> operation}} +{{/option}} + +{{#patch}} +### PATCH +{{> operation}} +{{/patch}} + +{{#head}} +### HEAD +{{> operation}} +{{/head}} + +{{/this}} +{{/each}} + +# Definitions +{{#each definitions}} +## {{@key}} + + + + + + + + + + {{#each this.properties}} + + + + + + + + {{/each}} +
nametyperequireddescriptionexample
{{@key}} + {{#ifeq type "array"}} + {{#items.$ref}} + {{type}}[{{basename items.$ref}}] + {{/items.$ref}} + {{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}} + {{else}} + {{#$ref}}{{basename $ref}}{{/$ref}} + {{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}} + {{/ifeq}} + {{#required}}required{{/required}}{{^required}}optional{{/required}}{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}{{example}}
+{{/each}} \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs new file mode 100644 index 0000000000..375d4f7701 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/operation.hbs @@ -0,0 +1,73 @@ +{{#deprecated}}-deprecated-{{/deprecated}} +{{summary}} + +{{description}} + +{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}}) +{{/if}} + +{{#if security}} +#### Security +{{/if}} + +{{#security}} +{{#each this}} +* {{@key}} +{{#this}} * {{this}} +{{/this}} +{{/each}} +{{/security}} + +#### Request + +{{#if consumes}} +**Content-Type: ** {{join consumes ", "}}{{/if}} + +##### Parameters +{{#if parameters}} + + + + + + + + + +{{/if}} + +{{#parameters}} + + + + + + +{{#ifeq in "body"}} + +{{else}} + {{#ifeq type "array"}} + + {{else}} + + {{/ifeq}} +{{/ifeq}} + +{{/parameters}} +{{#if parameters}} +
NameLocated inRequiredDescriptionDefaultSchema
{{name}}{{in}}{{#if required}}yes{{else}}no{{/if}}{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}{{#if defaultValue}}{{defaultValue}}{{else}} - {{/if}} + {{#ifeq schema.type "array"}}Array[{{basename schema.items.$ref}}]{{/ifeq}} + {{#schema.$ref}}{{basename schema.$ref}} {{/schema.$ref}} + Array[{{items.type}}] ({{collectionFormat}}){{type}} {{#format}}({{format}}){{/format}}
+{{/if}} + + +#### Response + +{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}} + + +| Status Code | Reason | Response Model | +|-------------|-------------|----------------| +{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}{{basename schema.$ref}}{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[{{basename schema.items.$ref}}]{{/ifeq}}{{^schema}} - {{/schema}}| +{{/each}} \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs new file mode 100644 index 0000000000..04f86e8380 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/security.hbs @@ -0,0 +1,88 @@ +{{#each securityDefinitions}} +### {{@key}} +{{#this}} +{{#ifeq type "oauth2"}} + + + + + +{{#if description}} + + + + +{{/if}} +{{#if authorizationUrl}} + + + + +{{/if}} +{{#if flow}} + + + + +{{/if}} +{{#if tokenUrl}} + + + + +{{/if}} +{{#if scopes}} + + +{{#each scopes}} + + + + +{{/each}} + +{{/if}} +
type{{type}}
description{{description}}
authorizationUrl{{authorizationUrl}}
flow{{flow}}
tokenUrl{{tokenUrl}}
scopes{{@key}}{{this}}
+{{/ifeq}} +{{#ifeq type "apiKey"}} + + + + + +{{#if description}} + + + + +{{/if}} +{{#if name}} + + + + +{{/if}} +{{#if in}} + + + + +{{/if}} +
type{{type}}
description{{description}}
name{{name}}
in{{in}}
+{{/ifeq}} +{{#ifeq type "basic"}} + + + + + +{{#if description}} + + + + +{{/if}} +
type{{type}}
description{{description}}
+{{/ifeq}} +{{/this}} +{{/each}} \ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs b/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs new file mode 100644 index 0000000000..fe722ab6f1 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-war/templates/strapdown.html.hbs @@ -0,0 +1,11 @@ + + +API Document + + + +{{>markdown}} + + + + \ No newline at end of file -- cgit