summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md2
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/api/ValidationController.java1
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/config/DocsConfiguration.java2
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/config/LoggerConfig.java9
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java9
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/validation/FileManager.java3
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java4
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java6
8 files changed, 19 insertions, 17 deletions
diff --git a/Changelog.md b/Changelog.md
index 8db90ee..3127917 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -7,10 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.2.0] - 21/04/2021
- Add a configuration of logging level by 'LOG_LEVEL' system environment variable
+- Add Swagger with OpenAPI description
- Supported Helm Versions:
- Helm v3: 3.5.2, 3.4.1, 3.3.4
-
## [1.1.0] - 12/04/2021
- Remove mapping to helm v2 when version desired is not provided
diff --git a/src/main/java/org/onap/sdc/helmvalidator/api/ValidationController.java b/src/main/java/org/onap/sdc/helmvalidator/api/ValidationController.java
index 7fe57fb..b766a09 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/api/ValidationController.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/api/ValidationController.java
@@ -38,7 +38,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
diff --git a/src/main/java/org/onap/sdc/helmvalidator/config/DocsConfiguration.java b/src/main/java/org/onap/sdc/helmvalidator/config/DocsConfiguration.java
index dbf97af..c2c572f 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/config/DocsConfiguration.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/config/DocsConfiguration.java
@@ -55,7 +55,7 @@ public class DocsConfiguration {
}
private ArraySchema getArraySchema() {
- ArraySchema arraySchema = new ArraySchema();
+ var arraySchema = new ArraySchema();
arraySchema.setItems(new StringSchema());
return arraySchema;
}
diff --git a/src/main/java/org/onap/sdc/helmvalidator/config/LoggerConfig.java b/src/main/java/org/onap/sdc/helmvalidator/config/LoggerConfig.java
index dc27800..065e642 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/config/LoggerConfig.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/config/LoggerConfig.java
@@ -40,9 +40,14 @@ public class LoggerConfig {
this.envProvider = envProvider;
}
+ /**
+ * Get logger properties.
+ *
+ * @return Logger properties with values from envs
+ */
public Properties getLoggerProperties() {
- String level = getLogLevel();
- Properties loggerProperties = new Properties();
+ var level = getLogLevel();
+ var loggerProperties = new Properties();
loggerProperties.setProperty("logging.level.web", level);
loggerProperties.setProperty("logging.level.org.springframework", level);
loggerProperties.setProperty("logging.level.org.apache.catalina.core", level);
diff --git a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java
index e30659b..79b7c47 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java
@@ -22,7 +22,6 @@ package org.onap.sdc.helmvalidator.helm.validation;
import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.stream.Collectors;
@@ -41,10 +40,10 @@ public class BashExecutor {
BashOutput execute(String helmCommand) {
try {
- ProcessBuilder pb = new ProcessBuilder("/bin/bash", "-c", helmCommand);
- pb.redirectErrorStream(true);
+ var processBuilder = new ProcessBuilder("/bin/bash", "-c", helmCommand);
+ processBuilder.redirectErrorStream(true);
LOGGER.debug("Start process");
- Process process = pb.start();
+ var process = processBuilder.start();
List<String> processOutput = readOutputAndCloseProcess(process);
return new BashOutput(process.exitValue(), processOutput);
@@ -58,7 +57,7 @@ public class BashExecutor {
private List<String> readOutputAndCloseProcess(Process process) throws IOException, InterruptedException {
- final InputStream inputStream = process.getInputStream();
+ final var inputStream = process.getInputStream();
final List<String> lines = new BufferedReader(new InputStreamReader(inputStream))
.lines().collect(Collectors.toList());
diff --git a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/FileManager.java b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/FileManager.java
index ab1d186..a47fc35 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/FileManager.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/FileManager.java
@@ -22,7 +22,6 @@ package org.onap.sdc.helmvalidator.helm.validation;
import java.io.IOException;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import org.onap.sdc.helmvalidator.helm.validation.exception.SaveFileException;
@@ -47,7 +46,7 @@ public class FileManager {
String saveFile(MultipartFile file) {
LOGGER.debug("Base PATH: {}", basePath);
try {
- final Path tmpFilePath = Files.createTempFile(Paths.get(basePath), "chart-", ".tgz");
+ final var tmpFilePath = Files.createTempFile(Paths.get(basePath), "chart-", ".tgz");
LOGGER.info("Attempt to save file : {}", tmpFilePath);
Files.copy(file.getInputStream(), tmpFilePath, StandardCopyOption.REPLACE_EXISTING);
return tmpFilePath.toString();
diff --git a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java
index ef2470a..037e604 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java
@@ -108,7 +108,7 @@ public class ValidationService {
}
if (desiredVersion.startsWith("v")) {
- String helmMajorVersion = desiredVersion.substring(1);
+ var helmMajorVersion = desiredVersion.substring(1);
return supportedVersionsProvider.getLatestVersion(helmMajorVersion);
}
@@ -213,7 +213,7 @@ public class ValidationService {
}
private boolean isNotHelmSummaryMessage(String line) {
- Pattern pattern = Pattern.compile(HELM_SUMMARY_MESSAGE_PATTERN);
+ var pattern = Pattern.compile(HELM_SUMMARY_MESSAGE_PATTERN);
return !pattern.matcher(line).matches();
}
}
diff --git a/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java b/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java
index 1c48d20..3a6c81c 100644
--- a/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java
+++ b/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java
@@ -46,7 +46,7 @@ public class ApiVersionsReader {
}
private Optional<String> tryReadVersionFromChart(String chartPath) {
- try (TarArchiveInputStream tarInput = new TarArchiveInputStream(
+ try (var tarInput = new TarArchiveInputStream(
new GzipCompressorInputStream(new FileInputStream(chartPath)))) {
return readVersionFromChart(tarInput);
} catch (IOException e) {
@@ -58,7 +58,7 @@ public class ApiVersionsReader {
TarArchiveEntry currentEntry;
while ((currentEntry = tarInput.getNextTarEntry()) != null) {
if (isMainChartYaml(currentEntry)) {
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(tarInput));
+ var bufferedReader = new BufferedReader(new InputStreamReader(tarInput));
return bufferedReader.lines()
.filter(chartLine -> chartLine.contains(API_VERSION_PREFIX))
.map(apiVersionLine -> apiVersionLine.replace(API_VERSION_PREFIX, ""))
@@ -70,7 +70,7 @@ public class ApiVersionsReader {
}
private boolean isMainChartYaml(TarArchiveEntry currentEntry) {
- Path entryPath = Path.of(currentEntry.getName());
+ var entryPath = Path.of(currentEntry.getName());
return currentEntry.isFile()
&& CHART_FILE_NAME.equals(entryPath.getFileName())
&& (entryPath.getNameCount() == MAIN_CHART_DIR_DEPTH);