aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kubernetes/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/java/org')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java9
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java7
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java6
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java26
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java6
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java15
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java15
11 files changed, 58 insertions, 70 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
index 6124060cb..41d9b845d 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
@@ -75,7 +75,7 @@ class AutomationCompositionElementHandlerTest {
private static ToscaServiceTemplate toscaServiceTemplate;
private static final String K8S_AUTOMATION_COMPOSITION_ELEMENT =
"org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement";
- private CommonTestData commonTestData = new CommonTestData();
+ private final CommonTestData commonTestData = new CommonTestData();
@InjectMocks
@Spy
@@ -160,7 +160,7 @@ class AutomationCompositionElementHandlerTest {
}
@Test
- void test_handleStatistics() throws PfModelException {
+ void test_handleStatistics() {
UUID elementId1 = UUID.randomUUID();
automationCompositionElementHandler.getChartMap().put(elementId1, charts.get(0));
when(participantIntermediaryApi.getAutomationCompositionElement(elementId1))
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
index d85ab6d9f..f5826bf3b 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
@@ -23,9 +23,10 @@ package org.onap.policy.clamp.acm.participant.kubernetes.helm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mockStatic;
@@ -89,7 +90,7 @@ class HelmClientTest {
}
@Test
- void test_installChart() throws IOException {
+ void test_installChart() {
mockedClient.when(() -> HelmClient.executeCommand(any()))
.thenReturn("success");
doReturn(new File("/target/tmp/override.yaml")).when(chartStore)
@@ -100,16 +101,14 @@ class HelmClientTest {
chartinfo.setNamespace("");
assertDoesNotThrow(() -> helmClient.installChart(chartinfo));
- mockedClient.when(() -> HelmClient.executeCommand(any()))
- .thenReturn(new String());
+ mockedClient.when(() -> HelmClient.executeCommand(any())).thenReturn("");
assertDoesNotThrow(() -> helmClient.installChart(chartinfo));
}
@Test
- void test_addRepository() throws IOException {
- mockedClient.when(() -> HelmClient.executeCommand(any()))
- .thenReturn(new String());
+ void test_addRepository() {
+ mockedClient.when(() -> HelmClient.executeCommand(any())).thenReturn("");
when(repo.getRepoName()).thenReturn("RepoName");
when(repo.getAddress()).thenReturn("http://localhost:8080");
assertDoesNotThrow(() -> helmClient.addRepository(repo));
@@ -129,7 +128,10 @@ class HelmClientTest {
assertThat(configuredRepo).isEqualTo("nginx-stable");
File tmpFile = new File(tmpPath + charts.get(1).getChartId().getName());
- tmpFile.mkdirs();
+ if (!tmpFile.mkdirs()) {
+ fail("Couldn't create dirs");
+ }
+
doReturn(Path.of(tmpPath)).when(chartStore).getAppPath(charts.get(1).getChartId());
doReturn(null).when(helmClient).verifyConfiguredRepo(charts.get(1));
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java
index 89b077044..fbddf8b28 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/PodStatusValidatorTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,24 +49,21 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
class PodStatusValidatorTest {
-
private static final Coder CODER = new StandardCoder();
private static final String CHART_INFO_YAML = "src/test/resources/ChartList.json";
private static List<ChartInfo> charts;
- private static int timeout = 60;
- private static int statusCheckInterval = 30;
-
@InjectMocks
private static PodStatusValidator podStatusValidator;
private static MockedStatic<HelmClient> mockedClient;
-
@BeforeAll
static void init() throws CoderException {
charts = CODER.decode(new File(CHART_INFO_YAML), ChartList.class).getCharts();
mockedClient = mockStatic(HelmClient.class);
+ int timeout = 60;
+ int statusCheckInterval = 30;
podStatusValidator = new PodStatusValidator(charts.get(0), timeout, statusCheckInterval);
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
index 13f8edc15..7ffd68812 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,6 @@
package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -36,7 +35,7 @@ public class CommonTestData {
public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup";
public static final String DESCRIPTION = "Participant description";
public static final long TIME_INTERVAL = 2000;
- public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams());
+ public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams());
public static final Coder CODER = new StandardCoder();
@@ -147,7 +146,7 @@ public class CommonTestData {
final TopicParameters topicParams = new TopicParameters();
topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT");
topicParams.setTopicCommInfrastructure("dmaap");
- topicParams.setServers(Arrays.asList("localhost"));
+ topicParams.setServers(List.of("localhost"));
return topicParams;
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
index 09ea74afe..2e17be06b 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,8 +31,8 @@ import org.junit.jupiter.api.Test;
class ParticipantK8sParametersTest {
- private CommonTestData commonTestData = new CommonTestData();
- private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
+ private final CommonTestData commonTestData = new CommonTestData();
+ private final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
@Test
void testParticipantPolicyParameters() {
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
index 8d05d2bf6..997a227cb 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,13 +32,13 @@ import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigure
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@AutoConfigureMetrics
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@TestPropertySource(locations = {"classpath:application_test.properties"})
+@ActiveProfiles("test")
class ActuatorControllerTest extends CommonActuatorController {
private static final String HEALTH_ENDPOINT = "health";
@@ -54,36 +54,36 @@ class ActuatorControllerTest extends CommonActuatorController {
}
@Test
- void testGetHealth_Unauthorized() throws Exception {
+ void testGetHealth_Unauthorized() {
assertUnauthorizedActGet(HEALTH_ENDPOINT);
}
@Test
- void testGetMetrics_Unauthorized() throws Exception {
+ void testGetMetrics_Unauthorized() {
assertUnauthorizedActGet(METRICS_ENDPOINT);
}
@Test
- void testGetPrometheus_Unauthorized() throws Exception {
+ void testGetPrometheus_Unauthorized() {
assertUnauthorizedActGet(PROMETHEUS_ENDPOINT);
}
@Test
- void testGetHealth() throws Exception {
+ void testGetHealth() {
Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
@Test
- void testGetMetrics() throws Exception {
+ void testGetMetrics() {
Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
@Test
- void testGePrometheus() throws Exception {
+ void testGePrometheus() {
Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
Response rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
index 7105c2327..c57684fd7 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
@@ -70,12 +70,12 @@ class ChartControllerTest {
private static final Coder CODER = new StandardCoder();
private static final String CHART_INFO_YAML = "src/test/resources/ChartList.json";
private static List<ChartInfo> charts;
- private static String RETRIEVE_CHART_URL = "/helm/charts";
- private static String INSTALL_CHART_URL = "/helm/install";
- private static String UNINSTALL_CHART_URL = "/helm/uninstall/";
- private static String ONBOARD_CHART_URL = "/helm/onboard/chart";
- private static String DELETE_CHART_URL = "/helm/chart";
- private static String CONFIGURE_REPO_URL = "/helm/repo";
+ private static final String RETRIEVE_CHART_URL = "/helm/charts";
+ private static final String INSTALL_CHART_URL = "/helm/install";
+ private static final String UNINSTALL_CHART_URL = "/helm/uninstall/";
+ private static final String ONBOARD_CHART_URL = "/helm/onboard/chart";
+ private static final String DELETE_CHART_URL = "/helm/chart";
+ private static final String CONFIGURE_REPO_URL = "/helm/repo";
@Autowired
private MockMvc mockMvc;
@@ -88,7 +88,7 @@ class ChartControllerTest {
/**
* Read input chart info json.
- * @throws Exception incase of error.
+ * @throws CoderException in case of error.
*/
@BeforeAll
static void setupParams() throws CoderException {
@@ -97,7 +97,6 @@ class ChartControllerTest {
/**
* Mock service layer in Controller.
- * @throws Exception incase of error.
*/
@BeforeEach
void mockServiceClass() {
@@ -110,7 +109,7 @@ class ChartControllerTest {
/**
* Test endpoint for retrieving all charts.
- * @throws Exception incase of error.
+ * @throws Exception in case of error.
*/
@Test
void retrieveAllCharts() throws Exception {
@@ -124,7 +123,7 @@ class ChartControllerTest {
/**
* Test endpoint for installing a chart.
- * @throws Exception incase of error.
+ * @throws Exception in case of error.
*/
@Test
void installChart() throws Exception {
@@ -149,7 +148,7 @@ class ChartControllerTest {
/**
* Test endpoint for uninstalling a chart.
- * @throws Exception incase of error.
+ * @throws Exception in case of error.
*/
@Test
void uninstallChart() throws Exception {
@@ -174,7 +173,7 @@ class ChartControllerTest {
/**
* Test endpoint for chart onboarding.
- * @throws Exception incase of error.
+ * @throws Exception in case of error.
*/
@Test
void onboardChart() throws Exception {
@@ -196,7 +195,7 @@ class ChartControllerTest {
/**
* Test endpoint for deleting a chart.
- * @throws Exception incase of error.
+ * @throws Exception in case of error.
*/
@Test
void deleteChart() throws Exception {
@@ -250,7 +249,6 @@ class ChartControllerTest {
}
-
private String getInstallationJson(String name, String version) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("name", name);
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java
index 4fc045d48..d83d43f20 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartServiceTest.java
@@ -23,10 +23,10 @@ package org.onap.policy.clamp.acm.participant.kubernetes.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java
index 180861bae..029db9994 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,8 +23,8 @@ package org.onap.policy.clamp.acm.participant.kubernetes.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import java.io.IOException;
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java
index e5a5be9fa..8b716a5fd 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,9 +50,8 @@ public class CommonActuatorController {
*
* @param endpoint the target endpoint
* @return a request builder
- * @throws Exception if an error occurs
*/
- protected Invocation.Builder sendActRequest(final String endpoint) throws Exception {
+ protected Invocation.Builder sendActRequest(final String endpoint) {
return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
}
@@ -61,9 +60,8 @@ public class CommonActuatorController {
*
* @param endpoint the target endpoint
* @return a request builder
- * @throws Exception if an error occurs
*/
- protected Invocation.Builder sendNoAuthActRequest(final String endpoint) throws Exception {
+ protected Invocation.Builder sendNoAuthActRequest(final String endpoint) {
return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
}
@@ -73,10 +71,8 @@ public class CommonActuatorController {
* @param fullyQualifiedEndpoint the fully qualified target endpoint
* @param includeAuth if authorization header should be included
* @return a request builder
- * @throws Exception if an error occurs
*/
- protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth)
- throws Exception {
+ protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth) {
final Client client = ClientBuilder.newBuilder().build();
client.property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, "true");
@@ -95,9 +91,8 @@ public class CommonActuatorController {
* Assert that GET call to actuator endpoint is Unauthorized.
*
* @param endPoint the endpoint
- * @throws Exception if an error occurs
*/
- protected void assertUnauthorizedActGet(final String endPoint) throws Exception {
+ protected void assertUnauthorizedActGet(final String endPoint) {
Response rawresp = sendNoAuthActRequest(endPoint).buildGet().invoke();
assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java
index 8f4969a9b..c9b616fa0 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,17 +31,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
public final class TestUtils {
private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
- private static final String TOSCA_TEMPLATE_YAML = "src/test/resources/servicetemplates/KubernetesHelm.yaml";
+ private static final String TOSCA_TEMPLATE_YAML = "clamp/acm/test/participant-kubernetes-helm.yaml";
public static ToscaServiceTemplate testAutomationCompositionRead() {
- return testAutomationCompositionYamlSerialization(TOSCA_TEMPLATE_YAML);
+ return testAutomationCompositionYamlSerialization();
}
- private static ToscaServiceTemplate testAutomationCompositionYamlSerialization(
- String automationCompositionFilePath) {
- String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
- ToscaServiceTemplate serviceTemplate =
- yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
- return serviceTemplate;
+ private static ToscaServiceTemplate testAutomationCompositionYamlSerialization() {
+ String automationCompositionString = ResourceUtils.getResourceAsString(TestUtils.TOSCA_TEMPLATE_YAML);
+ return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
}
}