summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/validation/BashExecutor.java2
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/validation/ValidationService.java2
-rw-r--r--src/main/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReader.java2
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/api/SupportedVersionsControllerTest.java7
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/api/ValidationControllerTest.java26
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java4
6 files changed, 23 insertions, 20 deletions
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 0bebc0a..066e731 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
@@ -36,7 +36,7 @@ import org.springframework.stereotype.Service;
public class BashExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(
- ValidationService.class);
+ BashExecutor.class);
BashOutput execute(String helmCommand) {
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 1e6cedb..02f28a3 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
@@ -155,7 +155,7 @@ public class ValidationService {
LOGGER.debug("Command executions: {} ", helmCommand);
BashOutput chartTemplateResult = executor.execute(helmCommand);
- LOGGER.debug("Status code: " + chartTemplateResult.getExitValue());
+ LOGGER.debug("Status code: {}", chartTemplateResult.getExitValue());
if (chartTemplateResult.getExitValue() != 0) {
List<String> renderingErrors = parseTemplateError(chartTemplateResult.getOutputLines());
return new TemplateValidationResult(false, renderingErrors);
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 e5c1a2e..1c48d20 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
@@ -61,7 +61,7 @@ public class ApiVersionsReader {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(tarInput));
return bufferedReader.lines()
.filter(chartLine -> chartLine.contains(API_VERSION_PREFIX))
- .map(apiVersionLine -> apiVersionLine.replaceAll(API_VERSION_PREFIX, ""))
+ .map(apiVersionLine -> apiVersionLine.replace(API_VERSION_PREFIX, ""))
.map(String::trim)
.findFirst();
}
diff --git a/src/test/java/org/onap/sdc/helmvalidator/api/SupportedVersionsControllerTest.java b/src/test/java/org/onap/sdc/helmvalidator/api/SupportedVersionsControllerTest.java
index ef93a90..4b653b0 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/api/SupportedVersionsControllerTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/api/SupportedVersionsControllerTest.java
@@ -60,8 +60,9 @@ class SupportedVersionsControllerTest {
.supportedVersions();
List<String> supportedVersions = supportedVersionsResponse.getBody().get(VERSIONS);
- assertThat(supportedVersions).isNotNull();
- assertThat(supportedVersions).hasSize(EXPECTED_SIZE);
- assertThat(supportedVersions).contains(SAMPLE_VERSION1, SAMPLE_VERSION2, SAMPLE_VERSION3);
+ assertThat(supportedVersions)
+ .isNotNull()
+ .hasSize(EXPECTED_SIZE)
+ .containsExactly(SAMPLE_VERSION1, SAMPLE_VERSION2, SAMPLE_VERSION3);
}
}
diff --git a/src/test/java/org/onap/sdc/helmvalidator/api/ValidationControllerTest.java b/src/test/java/org/onap/sdc/helmvalidator/api/ValidationControllerTest.java
index 03f976a..3c87d7a 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/api/ValidationControllerTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/api/ValidationControllerTest.java
@@ -156,12 +156,13 @@ class ValidationControllerTest {
.andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString();
- assertThat(contentAsString).contains(VALID);
- assertThat(contentAsString).contains(DEPLOYABLE);
- assertThat(contentAsString).contains(RENDER_ERRORS);
- assertThat(contentAsString).contains(LINT_WARNING);
- assertThat(contentAsString).contains(LINT_ERROR);
- assertThat(contentAsString).contains(VERSION_USED);
+ assertThat(contentAsString)
+ .contains(VALID)
+ .contains(DEPLOYABLE)
+ .contains(RENDER_ERRORS)
+ .contains(LINT_WARNING)
+ .contains(LINT_ERROR)
+ .contains(VERSION_USED);
assertThat(mvcResult.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
}
@@ -184,12 +185,13 @@ class ValidationControllerTest {
.andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString();
- assertThat(contentAsString).doesNotContain(VALID);
- assertThat(contentAsString).contains(DEPLOYABLE);
- assertThat(contentAsString).contains(RENDER_ERRORS);
- assertThat(contentAsString).doesNotContain(LINT_WARNING);
- assertThat(contentAsString).doesNotContain(LINT_ERROR);
- assertThat(contentAsString).contains(VERSION_USED);
+ assertThat(contentAsString)
+ .doesNotContain(VALID)
+ .contains(DEPLOYABLE)
+ .contains(RENDER_ERRORS)
+ .doesNotContain(LINT_WARNING)
+ .doesNotContain(LINT_ERROR)
+ .contains(VERSION_USED);
assertThat(mvcResult.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value());
}
}
diff --git a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
index 7343e59..79ea56a 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
@@ -68,9 +68,9 @@ class ApiVersionsReaderTest {
@Test
void shouldThrowExceptionWhenApiVersionIsNotProvided() throws IOException {
prepareTestTar(null);
-
+ final String chartPath = TEST_TAR_PATH.toString();
Exception exception = assertThrows(ApiVersionNotFoundException.class,
- () -> apiVersionsReader.readVersion(TEST_TAR_PATH.toString()));
+ () -> apiVersionsReader.readVersion(chartPath));
assertThat(exception).hasMessageContaining("Cannot find apiVersion value in a main chart");
}