diff options
8 files changed, 375 insertions, 2 deletions
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java index d80436ef3..28b62c2c5 100644 --- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java @@ -24,15 +24,20 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; +import java.io.IOException; import java.util.Map; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.Spy; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler; +import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest; import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData; import org.onap.policy.clamp.controlloop.participant.http.utils.ToscaUtils; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; @@ -64,6 +69,30 @@ class ClElementHandlerTest { } @Test + void test_controlLoopElementeStateChange() throws IOException { + var controlLoopId = commonTestData.getControlLoopId(); + var element = commonTestData.getControlLoopElement(); + var controlLoopElementId = element.getId(); + + var config = Mockito.mock(ConfigRequest.class); + assertDoesNotThrow(() -> controlLoopElementHandler.invokeHttpClient(config)); + + assertDoesNotThrow(() -> controlLoopElementHandler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE)); + + assertDoesNotThrow(() -> controlLoopElementHandler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED)); + + assertDoesNotThrow(() -> controlLoopElementHandler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING)); + + controlLoopElementHandler.close(); + } + + @Test void test_ControlLoopElementUpdate() { doNothing().when(controlLoopElementHandler).invokeHttpClient(any()); ControlLoopElement element = commonTestData.getControlLoopElement(); diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java index 1f8e76952..d7f09705b 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java @@ -27,6 +27,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; @@ -106,6 +107,10 @@ class ControlLoopElementHandlerTest { .uninstallChart(charts.get(0)); assertDoesNotThrow(() -> controlLoopElementHandler + .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1, + ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE)); + + assertDoesNotThrow(() -> controlLoopElementHandler .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED)); @@ -141,4 +146,18 @@ class ControlLoopElementHandlerTest { assertThat(controlLoopElementHandler.getChartMap().containsKey(elementId2)).isFalse(); } + + @Test + void test_handleStatistics() throws PfModelException { + UUID elementId1 = UUID.randomUUID(); + controlLoopElementHandler.getChartMap().put(elementId1, charts.get(0)); + when(participantIntermediaryApi.getControlLoopElement(elementId1)).thenReturn(new ControlLoopElement()); + assertDoesNotThrow(() -> controlLoopElementHandler.handleStatistics(elementId1)); + } + + @Test + void test_checkPodStatus() { + var chartInfo = charts.get(0); + assertDoesNotThrow(() -> controlLoopElementHandler.checkPodStatus(chartInfo, 1, 1)); + } } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java index 41b1fbeb5..335dbcb21 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java @@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; @@ -46,6 +47,7 @@ import org.mockito.Spy; import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException; import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo; import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList; +import org.onap.policy.clamp.controlloop.participant.kubernetes.models.HelmRepository; import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartStore; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; @@ -68,6 +70,9 @@ class HelmClientTest { @Mock ChartStore chartStore; + @Mock + HelmRepository repo; + private static MockedStatic<HelmClient> mockedClient; @BeforeAll @@ -90,9 +95,27 @@ class HelmClientTest { doReturn(new File("/target/tmp/override.yaml")).when(chartStore) .getOverrideFile(any()); var chartinfo = charts.get(0); + assertDoesNotThrow(() -> helmClient.installChart(chartinfo)); chartinfo.setNamespace(""); assertDoesNotThrow(() -> helmClient.installChart(chartinfo)); + + mockedClient.when(() -> HelmClient.executeCommand(any())) + .thenReturn(new String()); + assertDoesNotThrow(() -> helmClient.installChart(chartinfo)); + + } + + @Test + void test_addRepository() throws IOException { + mockedClient.when(() -> HelmClient.executeCommand(any())) + .thenReturn(new String()); + when(repo.getRepoName()).thenReturn("RepoName"); + assertDoesNotThrow(() -> helmClient.addRepository(repo)); + + mockedClient.when(() -> HelmClient.executeCommand(any())) + .thenReturn("failed"); + assertDoesNotThrow(() -> helmClient.addRepository(repo)); } @Test diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java new file mode 100644 index 000000000..b5c5e19cb --- /dev/null +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.participant.policy.main.handler; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.Mockito.when; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient; +import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient; +import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; + +class ControlLoopElementHandlerTest { + + private static final String ID_NAME = "org.onap.PM_CDS_Blueprint"; + private static final String ID_VERSION = "1.0.1"; + private static final UUID controlLoopElementId = UUID.randomUUID(); + private static final ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(ID_NAME, ID_VERSION); + + @Test + void testHandlerExceptions() throws PfModelException { + ControlLoopElementHandler handler = getTestingHandler(); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.UNINITIALISED, + ControlLoopOrderedState.PASSIVE)); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.RUNNING, + ControlLoopOrderedState.UNINITIALISED)); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.PASSIVE, + ControlLoopOrderedState.RUNNING)); + var element = getTestingClElement(); + var clElementDefinition = Mockito.mock(ToscaNodeTemplate.class); + + assertDoesNotThrow(() -> handler + .controlLoopElementUpdate(controlLoopId, element, clElementDefinition)); + + assertDoesNotThrow(() -> handler + .handleStatistics(controlLoopElementId)); + } + + ControlLoopElementHandler getTestingHandler() { + var api = Mockito.mock(PolicyApiHttpClient.class); + var pap = Mockito.mock(PolicyPapHttpClient.class); + var handler = new ControlLoopElementHandler(api, pap); + var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class); + var element = getTestingClElement(); + when(intermediaryApi.getControlLoopElement(controlLoopElementId)).thenReturn(element); + handler.setIntermediaryApi(intermediaryApi); + return handler; + } + + ControlLoopElement getTestingClElement() { + var element = new ControlLoopElement(); + element.setDefinition(controlLoopId); + element.setDescription("Description"); + element.setId(controlLoopElementId); + element.setOrderedState(ControlLoopOrderedState.UNINITIALISED); + element.setParticipantId(controlLoopId); + element.setState(ControlLoopState.UNINITIALISED); + var template = Mockito.mock(ToscaServiceTemplate.class); + element.setToscaServiceTemplateFragment(template); + return element; + } + +} diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java new file mode 100644 index 000000000..b38adbc5c --- /dev/null +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/handler/ControlLoopElementHandlerTest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.participant.simulator.main.handler; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.Mockito.when; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; + +class ControlLoopElementHandlerTest { + + private static final String ID_NAME = "org.onap.PM_CDS_Blueprint"; + private static final String ID_VERSION = "1.0.1"; + private static final UUID controlLoopElementId = UUID.randomUUID(); + private static final ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(ID_NAME, ID_VERSION); + + @Test + void testSimulatorHandlerExceptions() throws PfModelException { + ControlLoopElementHandler handler = getTestingHandler(); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.UNINITIALISED, + ControlLoopOrderedState.PASSIVE)); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.RUNNING, + ControlLoopOrderedState.UNINITIALISED)); + + assertDoesNotThrow(() -> handler + .controlLoopElementStateChange(controlLoopId, + controlLoopElementId, + ControlLoopState.PASSIVE, + ControlLoopOrderedState.RUNNING)); + var element = getTestingClElement(); + var clElementDefinition = Mockito.mock(ToscaNodeTemplate.class); + + assertDoesNotThrow(() -> handler + .controlLoopElementUpdate(controlLoopId, element, clElementDefinition)); + + assertDoesNotThrow(() -> handler + .handleStatistics(controlLoopElementId)); + } + + ControlLoopElementHandler getTestingHandler() { + var handler = new ControlLoopElementHandler(); + var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class); + var element = getTestingClElement(); + when(intermediaryApi.getControlLoopElement(controlLoopElementId)).thenReturn(element); + handler.setIntermediaryApi(intermediaryApi); + return handler; + } + + ControlLoopElement getTestingClElement() { + var element = new ControlLoopElement(); + element.setDefinition(controlLoopId); + element.setDescription("Description"); + element.setId(controlLoopElementId); + element.setOrderedState(ControlLoopOrderedState.UNINITIALISED); + element.setParticipantId(controlLoopId); + element.setState(ControlLoopState.UNINITIALISED); + var template = Mockito.mock(ToscaServiceTemplate.class); + element.setToscaServiceTemplateFragment(template); + return element; + } + +} diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml index ac83ffd7a..200eac780 100644 --- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml @@ -98,10 +98,16 @@ <setHeader name="Content-Type"> <constant>application/json</constant> </setHeader> + <setProperty name="name"> + <simple>${header.name}</simple> + </setProperty> + <setProperty name="version"> + <simple>${header.version}</simple> + </setProperty> <log loggingLevel="INFO" message="Endpoint to get Tosca Instantiation: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation"></log> <toD - uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.controlloop.runtime.userName}}&authPassword={{clamp.config.controlloop.runtime.password}}&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instantiation?name=${exchangeProperty[name]}&version=${exchangeProperty[version]}&bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.controlloop.runtime.userName}}&authPassword={{clamp.config.controlloop.runtime.password}}&authenticationPreemptive=true&connectionClose=true"/> <convertBodyTo type="java.lang.String"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java new file mode 100644 index 000000000..ae80d0498 --- /dev/null +++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java @@ -0,0 +1,96 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.runtime; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.ExchangeBuilder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.policy.clamp.clds.Application; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class RuntimeInstantiationResponseItTestCase { + @Autowired + CamelContext camelContext; + + private static final String DIRECT_GET_TOSCA_INSTANTIATION = "direct:get-tosca-instantiation"; + + private static final String SERVICE_TEMPLATE_NAME = "name"; + + private static final String SERVICE_TEMPLATE_VERSION = "version"; + + private static final String RAISE_HTTP_EXCEPTION_FLAG = "raiseHttpExceptionFlag"; + + private static final String SAMPLE_CONTROL_LOOP_LIST = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\"," + + "\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\"," + + "\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}"; + + @Test + public void testToscaServiceTemplateStatus() { + ProducerTemplate prodTemplate = camelContext.createProducerTemplate(); + + Exchange exchangeResponse = + prodTemplate.send(DIRECT_GET_TOSCA_INSTANTIATION, ExchangeBuilder.anExchange(camelContext) + .withProperty(SERVICE_TEMPLATE_NAME, "ToscaServiceTemplate") + .withProperty(SERVICE_TEMPLATE_VERSION, "1.0.0") + .withProperty(RAISE_HTTP_EXCEPTION_FLAG, "true") + .build()); + + assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE)) + .is2xxSuccessful()).isTrue(); + } + + @Test + public void testToscaInstantiationGetResponseBody() { + ProducerTemplate prodTemplate = camelContext.createProducerTemplate(); + + Exchange exchangeResponse = + prodTemplate.send(DIRECT_GET_TOSCA_INSTANTIATION, ExchangeBuilder.anExchange(camelContext) + .withProperty(SERVICE_TEMPLATE_NAME, "ToscaServiceTemplate") + .withProperty(SERVICE_TEMPLATE_VERSION, "1.0.0") + .withProperty(RAISE_HTTP_EXCEPTION_FLAG, "true") + .build()); + + assertThat(exchangeResponse.getIn().getBody()).hasToString(SAMPLE_CONTROL_LOOP_LIST); + } + + @Test + public void testToscaInstantiationStatus() { + ProducerTemplate prodTemplate = camelContext.createProducerTemplate(); + + Exchange exchangeResponse = + prodTemplate.send(DIRECT_GET_TOSCA_INSTANTIATION, ExchangeBuilder.anExchange(camelContext) + .withBody(SAMPLE_CONTROL_LOOP_LIST) + .withProperty(RAISE_HTTP_EXCEPTION_FLAG, "true") + .build()); + + assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE)) + .is2xxSuccessful()).isTrue(); + } +} diff --git a/runtime/src/test/resources/http-cache/third_party_proxy.py b/runtime/src/test/resources/http-cache/third_party_proxy.py index d6628535d..5c80cdda4 100644 --- a/runtime/src/test/resources/http-cache/third_party_proxy.py +++ b/runtime/src/test/resources/http-cache/third_party_proxy.py @@ -328,7 +328,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): return True elif (self.path.startswith("/onap/controlloop/v2/instantiation")) and http_type == "GET": print("self.path start with /instantiation Retrieving Instantiation, generating response json...") - jsonGenerated = "{\"errorDetails\": null,\"affectedControlLoopDefinitions\": [{ \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\" }]}" + jsonGenerated = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\",\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\",\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}"; self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content) return True else: |