summaryrefslogtreecommitdiffstats
path: root/ms/sanity-test
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2024-07-03 09:31:01 -0400
committerDan Timoney <dtimoney@att.com>2024-07-17 10:21:28 -0400
commit1cd99ed17a0d034ef8e54a7ac3dc059871dc7a1a (patch)
tree4654defdb1459041925568be88081ca224a181b3 /ms/sanity-test
parent3f9e2b6c2bcbaa0b3804e6a9b96e8f7f37ea952a (diff)
Resolve build issuesmontreal
Build was failing due to issues missed in port to java 17. Updated sdnc/apps to change dependencies from javax.* to jakarta.* - required for Java 17. Also, latest version of snakeyaml cannot handle size of yaml based SDNC swagger, so replaced that with JSON based version. Issue-ID: SDNC-1843 Change-Id: I4df872481c56aea496de0d2b9cc349799ff6b60c Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/sanity-test')
-rw-r--r--ms/sanity-test/sanity-test-app/pom.xml14
-rw-r--r--ms/sanity-test/sanity-test-app/src/main/java/org/onap/sdnc/apps/ms/sanitytest/controllers/SanityTestOperationsApi.java4
-rw-r--r--ms/sanity-test/sanity-test-app/src/main/templates/api.mustache57
-rw-r--r--ms/sanity-test/sanity-test-app/src/main/templates/apiOriginFilter.mustache38
4 files changed, 73 insertions, 40 deletions
diff --git a/ms/sanity-test/sanity-test-app/pom.xml b/ms/sanity-test/sanity-test-app/pom.xml
index e627b23..6937541 100644
--- a/ms/sanity-test/sanity-test-app/pom.xml
+++ b/ms/sanity-test/sanity-test-app/pom.xml
@@ -154,12 +154,6 @@
<version>${ccsdk.sli.plugins.version}</version>
</dependency>
- <dependency>
- <groupId>org.liquibase</groupId>
- <artifactId>liquibase-core</artifactId>
- <version>4.3.0</version>
- </dependency>
-
<!-- this jersey jar is needed for rest api call node to function properly -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
@@ -217,7 +211,7 @@
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
+ <version>2.4.32</version>
<executions>
<execution>
<phase>generate-sources</phase>
@@ -237,8 +231,10 @@
<withXml>true</withXml>
<templateDirectory>${project.basedir}/src/main/templates</templateDirectory>
<configOptions>
- <java8>true</java8>
- <springBootVersion>2.2.4-RELEASE</springBootVersion>
+ <java11>true</java11>
+ <springBootVersion>3.0.3</springBootVersion>
+ <jakarta>true</jakarta>
+ <dateLibrary>java11</dateLibrary>
</configOptions>
</configuration>
</execution>
diff --git a/ms/sanity-test/sanity-test-app/src/main/java/org/onap/sdnc/apps/ms/sanitytest/controllers/SanityTestOperationsApi.java b/ms/sanity-test/sanity-test-app/src/main/java/org/onap/sdnc/apps/ms/sanitytest/controllers/SanityTestOperationsApi.java
index d1b7233..2343e48 100644
--- a/ms/sanity-test/sanity-test-app/src/main/java/org/onap/sdnc/apps/ms/sanitytest/controllers/SanityTestOperationsApi.java
+++ b/ms/sanity-test/sanity-test-app/src/main/java/org/onap/sdnc/apps/ms/sanitytest/controllers/SanityTestOperationsApi.java
@@ -9,8 +9,8 @@ import java.util.Optional;
import java.util.Properties;
import java.util.TimeZone;
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.validation.Valid;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/ms/sanity-test/sanity-test-app/src/main/templates/api.mustache b/ms/sanity-test/sanity-test-app/src/main/templates/api.mustache
index c28642c..91483ed 100644
--- a/ms/sanity-test/sanity-test-app/src/main/templates/api.mustache
+++ b/ms/sanity-test/sanity-test-app/src/main/templates/api.mustache
@@ -7,15 +7,11 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
-{{#jdk8-no-delegate}}
- import com.fasterxml.jackson.databind.ObjectMapper;
-{{/jdk8-no-delegate}}
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
-{{#jdk8-no-delegate}}
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.http.HttpStatus;
-{{/jdk8-no-delegate}}
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
@@ -30,33 +26,37 @@ import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.onap.ccsdk.apps.services.RestException;
-{{#jdk8-no-delegate}}
- import javax.servlet.http.HttpServletRequest;
-{{/jdk8-no-delegate}}
+
+{{#jakarta}}
+import jakarta.servlet.*;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+{{/jakarta}}
+{{^jakarta}}
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+{{/jakarta}}
{{#useBeanValidation}}
- import javax.validation.Valid;
- import javax.validation.constraints.*;
+{{#jakarta}}
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.*;
+{{/jakarta}}
+{{^jakarta}}
+import javax.validation.Valid;
+import javax.validation.constraints.*;
+{{/jakarta}}
{{/useBeanValidation}}
-{{#jdk8-no-delegate}}
- import java.io.IOException;
-{{/jdk8-no-delegate}}
+import java.io.IOException;
import java.util.List;
-{{#jdk8-no-delegate}}
- import java.util.Optional;
-{{/jdk8-no-delegate}}
-{{^jdk8-no-delegate}}
- {{#useOptional}}
- import java.util.Optional;
- {{/useOptional}}
-{{/jdk8-no-delegate}}
+import java.util.Optional;
{{#async}}
- import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
+import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
{{/async}}
{{>generatedAnnotation}}
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
{{#operations}}
public interface {{classname}} {
- {{#jdk8}}
{{^isDelegate}}
Logger log = LoggerFactory.getLogger({{classname}}.class);
@@ -76,7 +76,6 @@ import java.util.List;
{{#isDelegate}}
{{classname}}Delegate getDelegate();
{{/isDelegate}}
- {{/jdk8}}
{{#operation}}
@ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
@@ -101,7 +100,7 @@ import java.util.List;
produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}}
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}}
method = RequestMethod.{{httpMethod}})
- {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} throws RestException {
+ default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) throws RestException {
{{#delegate-method}}
return {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
}
@@ -129,7 +128,7 @@ import java.util.List;
{{#isDelegate}}
return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/isDelegate}}
- }{{/jdk8}}
+ }
{{/operation}}
}
diff --git a/ms/sanity-test/sanity-test-app/src/main/templates/apiOriginFilter.mustache b/ms/sanity-test/sanity-test-app/src/main/templates/apiOriginFilter.mustache
new file mode 100644
index 0000000..3910a6b
--- /dev/null
+++ b/ms/sanity-test/sanity-test-app/src/main/templates/apiOriginFilter.mustache
@@ -0,0 +1,38 @@
+package {{apiPackage}};
+
+import java.io.IOException;
+
+{{#jakarta}}
+import jakarta.servlet.*;
+import jakarta.servlet.http.HttpServletResponse;
+{{/jakarta}}
+{{^jakarta}}
+import javax.servlet.*;
+import javax.servlet.http.HttpServletResponse;
+{{/jakarta}}
+
+{{>generatedAnnotation}}
+{{#jakarta}}
+public class ApiOriginFilter implements jakarta.servlet.Filter {
+{{/jakarta}}
+{{^jakarta}}
+public class ApiOriginFilter implements javax.servlet.Filter {
+{{/jakarta}}
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ HttpServletResponse res = (HttpServletResponse) response;
+ res.addHeader("Access-Control-Allow-Origin", "*");
+ res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
+ res.addHeader("Access-Control-Allow-Headers", "Content-Type");
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+}