aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2024-06-20 17:48:47 +0100
committersourabh_sourabh <sourabh.sourabh@est.tech>2024-07-03 16:52:49 +0100
commitd6f0977a25cf0896227ae6cc5abd7866af80e237 (patch)
treeece0f193d5fcefdb18b34da406ef8b252485c369 /cps-ncmp-service/src/test
parent37e328eeaa3e79416e70f348da79cff3ad2e547b (diff)
CPS NCMP: Resolved high cardinality of prometheus metrics for dmi service url
- Used autoconfigured web client builder for http_client_requests_* prometheus metrics. - Refactored dmi service url builder to create url template and its variables. - Web client is modified to use uri(urlTemplate, urlvars) version. - Deleted InvalidDmiResourceUrlException that no longer needed. - Used DmiServiceUrlBuilder to build dmi health check service url. - Created a new pkg url.builder into utils to have all related classes and record. Issue-ID: CPS-2121 Change-Id: Id67e0f0d4e640bb8f9eea0b6c2db1dba3468e1d7 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy46
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy13
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/DmiServiceUrlBuilderSpec.groovy86
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/url/builder/DmiServiceUrlTemplateBuilderSpec.groovy63
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/DmiOperationsBaseSpec.groovy2
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy61
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperationsSpec.groovy19
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDogSpec.groovy8
8 files changed, 143 insertions, 155 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
index 9798040a67..a935d70ce6 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
@@ -26,12 +26,14 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import org.onap.cps.ncmp.api.impl.config.DmiProperties
import org.onap.cps.ncmp.api.impl.exception.DmiClientRequestException
-import org.onap.cps.ncmp.api.impl.exception.InvalidDmiResourceUrlException
+import org.onap.cps.ncmp.api.impl.utils.url.builder.UrlTemplateParameters
import org.onap.cps.ncmp.utils.TestUtils
import org.onap.cps.utils.JsonObjectMapper
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
+import org.springframework.http.HttpStatusCode
import org.springframework.http.ResponseEntity
+import org.springframework.web.client.HttpServerErrorException
import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.reactive.function.client.WebClientRequestException
import org.springframework.web.reactive.function.client.WebClientResponseException
@@ -41,8 +43,6 @@ import spock.lang.Specification
import static org.onap.cps.ncmp.api.NcmpResponseStatus.DMI_SERVICE_NOT_RESPONDING
import static org.onap.cps.ncmp.api.NcmpResponseStatus.UNABLE_TO_READ_RESOURCE_DATA
import static org.onap.cps.ncmp.api.NcmpResponseStatus.UNKNOWN_ERROR
-import static org.onap.cps.ncmp.api.data.models.OperationType.CREATE
-import static org.onap.cps.ncmp.api.data.models.OperationType.PATCH
import static org.onap.cps.ncmp.api.data.models.OperationType.READ
import static org.onap.cps.ncmp.impl.models.RequiredDmiService.DATA
import static org.onap.cps.ncmp.impl.models.RequiredDmiService.MODEL
@@ -52,6 +52,7 @@ class DmiRestClientSpec extends Specification {
static final NO_AUTH_HEADER = null
static final BASIC_AUTH_HEADER = 'Basic c29tZSB1c2VyOnNvbWUgcGFzc3dvcmQ='
static final BEARER_AUTH_HEADER = 'Bearer my-bearer-token'
+ static final urlTemplateParameters = new UrlTemplateParameters('/{pathParam1}/{pathParam2}', ['pathParam1': 'my', 'pathParam2': 'url'])
def mockDataServicesWebClient = Mock(WebClient)
def mockModelServicesWebClient = Mock(WebClient)
@@ -67,7 +68,7 @@ class DmiRestClientSpec extends Specification {
DmiRestClient objectUnderTest = new DmiRestClient(mockDmiProperties, jsonObjectMapper, mockDataServicesWebClient, mockModelServicesWebClient, mockHealthChecksWebClient)
def setup() {
- mockRequestBody.uri(_) >> mockRequestBody
+ mockRequestBody.uri(_,_) >> mockRequestBody
mockRequestBody.headers(_) >> mockRequestBody
mockRequestBody.body(_) >> mockRequestBody
mockRequestBody.retrieve() >> mockResponse
@@ -78,7 +79,7 @@ class DmiRestClientSpec extends Specification {
mockDataServicesWebClient.post() >> mockRequestBody
mockResponse.toEntity(Object.class) >> Mono.just(new ResponseEntity<>('from Data service', HttpStatus.I_AM_A_TEAPOT))
when: 'POST operation is invoked fro Data Service'
- def response = objectUnderTest.synchronousPostOperationWithJsonData(DATA, '/my/url', 'some json', READ, NO_AUTH_HEADER)
+ def response = objectUnderTest.synchronousPostOperationWithJsonData(DATA, urlTemplateParameters, 'some json', READ, NO_AUTH_HEADER)
then: 'the output of the method is equal to the output from the test template'
assert response.statusCode == HttpStatus.I_AM_A_TEAPOT
assert response.body == 'from Data service'
@@ -89,30 +90,18 @@ class DmiRestClientSpec extends Specification {
mockModelServicesWebClient.post() >> mockRequestBody
mockResponse.toEntity(Object.class) >> Mono.just(new ResponseEntity<>('from Model service', HttpStatus.I_AM_A_TEAPOT))
when: 'POST operation is invoked for Model Service'
- def response = objectUnderTest.synchronousPostOperationWithJsonData(MODEL, '/my/url', 'some json', READ, NO_AUTH_HEADER)
+ def response = objectUnderTest.synchronousPostOperationWithJsonData(MODEL, urlTemplateParameters, 'some json', READ, NO_AUTH_HEADER)
then: 'the output of the method is equal to the output from the test template'
assert response.statusCode == HttpStatus.I_AM_A_TEAPOT
assert response.body == 'from Model service'
}
- def 'Failing DMI POST operation due to invalid dmi resource url.'() {
- when: 'POST operation is invoked with invalid dmi resource url'
- objectUnderTest.synchronousPostOperationWithJsonData(DATA, '/invalid dmi url', null, null, NO_AUTH_HEADER)
- then: 'invalid dmi resource url exception is thrown'
- def thrown = thrown(InvalidDmiResourceUrlException)
- and: 'the exception has the relevant details from the error response'
- thrown.httpStatus == 400
- thrown.message == 'Invalid dmi resource url: /invalid dmi url'
- where: 'the following operations are executed'
- operation << [CREATE, READ, PATCH]
- }
-
def 'Dmi service sends client error response when #scenario'() {
given: 'the web client unable to return response entity but error'
mockDataServicesWebClient.post() >> mockRequestBody
mockResponse.toEntity(Object.class) >> Mono.error(exceptionType)
when: 'POST operation is invoked'
- objectUnderTest.synchronousPostOperationWithJsonData(DATA, '/my/url', 'some json', READ, NO_AUTH_HEADER)
+ objectUnderTest.synchronousPostOperationWithJsonData(DATA, urlTemplateParameters, 'some json', READ, NO_AUTH_HEADER)
then: 'a http client exception is thrown'
def thrown = thrown(DmiClientRequestException)
and: 'the exception has the relevant details from the error response'
@@ -123,6 +112,7 @@ class DmiRestClientSpec extends Specification {
'dmi service unavailable' | 503 | new WebClientRequestException(new RuntimeException('some-error'), null, null, new HttpHeaders()) || DMI_SERVICE_NOT_RESPONDING
'dmi request timeout' | 408 | new WebClientResponseException('message', httpStatusCode, 'statusText', null, null, null) || DMI_SERVICE_NOT_RESPONDING
'dmi server error' | 500 | new WebClientResponseException('message', httpStatusCode, 'statusText', null, null, null) || UNABLE_TO_READ_RESOURCE_DATA
+ 'dmi service unavailable' | 503 | new HttpServerErrorException(HttpStatusCode.valueOf(503)) || DMI_SERVICE_NOT_RESPONDING
'unknown error' | 500 | new Throwable('message') || UNKNOWN_ERROR
}
@@ -132,25 +122,29 @@ class DmiRestClientSpec extends Specification {
def jsonNode = jsonObjectMapper.convertJsonString(dmiPluginHealthCheckResponseJsonData, JsonNode.class)
((ObjectNode) jsonNode).put('status', 'my status')
mockHealthChecksWebClient.get() >> mockRequestBody
+ mockResponse.onStatus(_,_)>> mockResponse
mockResponse.bodyToMono(JsonNode.class) >> Mono.just(jsonNode)
when: 'get trust level of the dmi plugin'
- def result = objectUnderTest.getDmiHealthStatus('some/url')
+ def urlTemplateParameters = new UrlTemplateParameters('some url', [:])
+ def result = objectUnderTest.getDmiHealthStatus(urlTemplateParameters).block()
then: 'the status value from the json is returned'
assert result == 'my status'
}
def 'Failing to get dmi plugin health status #scenario'() {
- given: 'rest template with #scenario'
+ given: 'web client instance with #scenario'
mockHealthChecksWebClient.get() >> mockRequestBody
- mockResponse.bodyToMono(_) >> healthStatusResponse
+ mockResponse.onStatus(_, _) >> mockResponse
+ mockResponse.bodyToMono(_) >> Mono.error(exceptionType)
when: 'attempt to get health status of the dmi plugin'
- def result = objectUnderTest.getDmiHealthStatus('some url')
+ def urlTemplateParameters = new UrlTemplateParameters('some url', [:])
+ def result = objectUnderTest.getDmiHealthStatus(urlTemplateParameters).block()
then: 'result will be empty'
assert result == ''
where: 'the following responses are used'
- scenario | healthStatusResponse
- 'null' | null
- 'exception' | { throw new Exception() }
+ scenario | exceptionType
+ 'dmi request timeout' | new WebClientResponseException('some-message', 408, 'some-text', null, null, null)
+ 'dmi service unavailable' | new HttpServerErrorException(HttpStatus.SERVICE_UNAVAILABLE)
}
def 'DMI auth header #scenario'() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
index 05ecaa11b1..fa995aa7c3 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
@@ -33,6 +33,13 @@ import spock.lang.Specification
@EnableConfigurationProperties
class DmiWebClientConfigurationSpec extends Specification {
+ def webClientBuilder = Mock(WebClient.Builder) {
+ defaultHeaders(_) >> it
+ clientConnector(_) >> it
+ codecs(_) >> it
+ build() >> Mock(WebClient)
+ }
+
def httpClientConfiguration = Spy(HttpClientConfiguration.class)
def objectUnderTest = new DmiWebClientConfiguration(httpClientConfiguration)
@@ -44,7 +51,7 @@ class DmiWebClientConfigurationSpec extends Specification {
def 'Creating a web client instance data service.'() {
given: 'Web client configuration is invoked'
- def dataServicesWebClient = objectUnderTest.dataServicesWebClient()
+ def dataServicesWebClient = objectUnderTest.dataServicesWebClient(webClientBuilder)
expect: 'the system can create an instance for data service'
assert dataServicesWebClient != null
assert dataServicesWebClient instanceof WebClient
@@ -52,7 +59,7 @@ class DmiWebClientConfigurationSpec extends Specification {
def 'Creating a web client instance model service.'() {
given: 'Web client configuration invoked'
- def modelServicesWebClient = objectUnderTest.modelServicesWebClient()
+ def modelServicesWebClient = objectUnderTest.modelServicesWebClient(webClientBuilder)
expect: 'the system can create an instance for model service'
assert modelServicesWebClient != null
assert modelServicesWebClient instanceof WebClient
@@ -60,7 +67,7 @@ class DmiWebClientConfigurationSpec extends Specification {
def 'Creating a web client instance health service.'() {
given: 'Web client configuration invoked'
- def healthChecksWebClient = objectUnderTest.healthChecksWebClient()
+ def healthChecksWebClient = objectUnderTest.healthChecksWebClient(webClientBuilder)
expect: 'the system can create an instance for health service'
assert healthChecksWebClient != null
assert healthChecksWebClient instanceof WebClient
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/DmiServiceUrlBuilderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/DmiServiceUrlBuilderSpec.groovy
deleted file mode 100644
index 69d08e3de6..0000000000
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/DmiServiceUrlBuilderSpec.groovy
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022-2024 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.cps.ncmp.api.impl.utils
-
-import spock.lang.Specification
-
-class DmiServiceUrlBuilderSpec extends Specification {
-
- def objectUnderTest = new DmiServiceUrlBuilder()
-
- def 'Build URI with (variable) path segments and parameters.'() {
- given: 'the URI details are given to the builder'
- objectUnderTest.pathSegment(segment1)
- objectUnderTest.variablePathSegment('myVariableSegment','someValue')
- objectUnderTest.pathSegment(segment2)
- objectUnderTest.queryParameter('param1', paramValue1)
- objectUnderTest.queryParameter('param2', paramValue2)
- objectUnderTest.queryParameter('param3', null)
- objectUnderTest.queryParameter('param4', '')
- when: 'the URI (string) is build'
- def result = objectUnderTest.build('myDmiServer', 'myBasePath')
- then: 'the URI is correct (segments are in correct order) '
- assert result == expectedUri
- where: 'following URI details are used'
- segment1 | segment2 | paramValue1 | paramValue2 || expectedUri
- 'segment1' | 'segment2' | '123' | 'abc' || 'myDmiServer/myBasePath/v1/segment1/someValue/segment2?param1=123&param2=abc'
- 'segment2' | 'segment1' | 'abc' | '123' || 'myDmiServer/myBasePath/v1/segment2/someValue/segment1?param1=abc&param2=123'
- }
-
- def 'Build URI with special characters in path segments.'() {
- given: 'the path segments are given to the builder'
- objectUnderTest.pathSegment(segment)
- objectUnderTest.variablePathSegment('myVariableSegment', variableSegmentValue)
- when: 'the URI (string) is build'
- def result = objectUnderTest.build('myDmiServer', 'myBasePath')
- then: 'Only teh characters that cause issues in path segments issues are encoded'
- assert result == expectedUri
- where: 'following variable path segments are used'
- segment | variableSegmentValue || expectedUri
- 'some/special?characters=are\\encoded' | 'my/variable/segment' || 'myDmiServer/myBasePath/v1/some%2Fspecial%3Fcharacters=are%5Cencoded/my%2Fvariable%2Fsegment'
- 'but=some&are:not-!' | 'my&variable:segment' || 'myDmiServer/myBasePath/v1/but=some&are:not-!/my&variable:segment'
- }
-
- def 'Build URI with special characters in query parameters.'() {
- given: 'the query parameter is given to the builder'
- objectUnderTest.queryParameter(paramName, value)
- when: 'the URI (string) is build'
- def result = objectUnderTest.build('myDmiServer', 'myBasePath')
- then: 'Only the characters (in the name and value) that cause issues in query parameters are encoded'
- assert result == expectedUri
- where: 'the following query parameters are used'
- paramName | value || expectedUri
- 'my&param' | 'some?special&characters=are\\encoded' || 'myDmiServer/myBasePath/v1?my%26param=some?special%26characters%3Dare%5Cencoded'
- 'my-param' | 'but/some:are-not-!' || 'myDmiServer/myBasePath/v1?my-param=but/some:are-not-!'
- }
-
- def 'Build URI with empty query parameters.'() {
- when: 'the query parameter is given to the builder'
- objectUnderTest.queryParameter('param', value)
- and: 'the URI (string) is build'
- def result = objectUnderTest.build('myDmiServer', 'myBasePath')
- then: 'no parameter gets added'
- assert result == 'myDmiServer/myBasePath/v1'
- where: 'the following parameter values are used'
- value << [ null, '', ' ' ]
- }
-
-}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/url/builder/DmiServiceUrlTemplateBuilderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/url/builder/DmiServiceUrlTemplateBuilderSpec.groovy
new file mode 100644
index 0000000000..6d56f432d3
--- /dev/null
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/url/builder/DmiServiceUrlTemplateBuilderSpec.groovy
@@ -0,0 +1,63 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022-2024 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.cps.ncmp.api.impl.utils.url.builder
+
+import spock.lang.Specification
+
+class DmiServiceUrlTemplateBuilderSpec extends Specification {
+
+ def objectUnderTest = new DmiServiceUrlTemplateBuilder()
+
+ def 'Build URL template parameters with (variable) path segments and query parameters.'() {
+ given: 'the URL details are given to the builder'
+ objectUnderTest.fixedPathSegment('segment')
+ objectUnderTest.variablePathSegment('myVariableSegment','someValue')
+ objectUnderTest.fixedPathSegment('segment?with:special&characters')
+ objectUnderTest.queryParameter('param1', 'abc')
+ objectUnderTest.queryParameter('param2', 'value?with#special:characters')
+ when: 'the URL template parameters are created'
+ def result = objectUnderTest.createUrlTemplateParameters('myDmiServer', 'myBasePath')
+ then: 'the URL template contains variable names instead of value and un-encoded fixed segment'
+ assert result.urlTemplate == 'myDmiServer/myBasePath/v1/segment/{myVariableSegment}/segment?with:special&characters?param1={param1}&param2={param2}'
+ and: 'URL variables contains name and un-encoded value pairs'
+ assert result.urlVariables == ['myVariableSegment': 'someValue', 'param1': 'abc', 'param2': 'value?with#special:characters']
+ }
+
+ def 'Build URL template parameters with special characters in query parameters.'() {
+ given: 'the query parameter is given to the builder'
+ objectUnderTest.queryParameter('my&param', 'special&characters=are?not\\encoded')
+ when: 'the URL template parameters are created'
+ def result = objectUnderTest.createUrlTemplateParameters('myDmiServer', 'myBasePath')
+ then: 'Special characters are not encoded'
+ assert result.urlVariables == ['my&param': 'special&characters=are?not\\encoded']
+ }
+
+ def 'Build URL template parameters with empty query parameters.'() {
+ when: 'the query parameter is given to the builder'
+ objectUnderTest.queryParameter('param', value)
+ and: 'the URL template parameters are create'
+ def result = objectUnderTest.createUrlTemplateParameters('myDmiServer', 'myBasePath')
+ then: 'no parameter gets added'
+ assert result.urlVariables.isEmpty()
+ where: 'the following parameter values are used'
+ value << [ null, '', ' ' ]
+ }
+}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/DmiOperationsBaseSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/DmiOperationsBaseSpec.groovy
index f2d2ab0a19..050932f654 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/DmiOperationsBaseSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/DmiOperationsBaseSpec.groovy
@@ -45,7 +45,7 @@ abstract class DmiOperationsBaseSpec extends Specification {
ObjectMapper spyObjectMapper = Spy()
def yangModelCmHandle = new YangModelCmHandle()
- def static dmiServiceName = 'someServiceName'
+ def static dmiServiceName = 'myServiceName'
def static cmHandleId = 'some-cm-handle'
def static resourceIdentifier = 'parent/child'
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
index 65d3100d1e..3a199ff417 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
@@ -28,6 +28,7 @@ import org.onap.cps.ncmp.api.data.models.DataOperationRequest
import org.onap.cps.ncmp.api.impl.config.DmiProperties
import org.onap.cps.ncmp.api.impl.exception.DmiClientRequestException
import org.onap.cps.ncmp.api.impl.utils.context.CpsApplicationContext
+import org.onap.cps.ncmp.api.impl.utils.url.builder.UrlTemplateParameters
import org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent
import org.onap.cps.ncmp.impl.DmiOperationsBaseSpec
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
@@ -55,7 +56,6 @@ import static org.onap.cps.ncmp.utils.events.CloudEventMapper.toTargetEvent
@ContextConfiguration(classes = [EventsPublisher, CpsApplicationContext, DmiProperties, DmiDataOperations])
class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
- def dmiServiceBaseUrl = "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/data/ds/ncmp-datastore:"
def NO_TOPIC = null
def NO_REQUEST_ID = null
def NO_AUTH_HEADER = null
@@ -72,28 +72,28 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
@SpringBean
EventsPublisher eventsPublisher = Stub()
- def 'call get resource data for #expectedDatastoreInUrl from DMI without topic #scenario.'() {
+ def 'call get resource data for #expectedDataStore from DMI without topic #scenario.'() {
given: 'a cm handle for #cmHandleId'
mockYangModelCmHandleRetrieval(dmiProperties)
and: 'a positive response from DMI service when it is called with the expected parameters'
def responseFromDmi = Mono.just(new ResponseEntity<Object>('{some-key:some-value}', HttpStatus.OK))
- def expectedUrl = "${dmiServiceBaseUrl}${expectedDatastoreInUrl}?resourceIdentifier=${DmiOperationsBaseSpec.resourceIdentifier}${expectedOptionsInUrl}"
+ def expectedUrlTemplateWithVariables = getExpectedUrlTemplateWithVariables(expectedOptions, expectedDataStore)
def expectedJson = '{"operation":"read","cmHandleProperties":' + expectedProperties + ',"moduleSetTag":""}'
- mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedUrl, expectedJson, READ, NO_AUTH_HEADER) >> responseFromDmi
+ mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedUrlTemplateWithVariables, expectedJson, READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get resource data is invoked'
- def cmResourceAddress = new CmResourceAddress(dataStore.datastoreName, DmiOperationsBaseSpec.cmHandleId, DmiOperationsBaseSpec.resourceIdentifier)
- def result = objectUnderTest.getResourceDataFromDmi(cmResourceAddress, options, NO_TOPIC, NO_REQUEST_ID, NO_AUTH_HEADER).block()
+ def cmResourceAddress = new CmResourceAddress(expectedDataStore.datastoreName, cmHandleId, resourceIdentifier)
+ def result = objectUnderTest.getResourceDataFromDmi(cmResourceAddress, expectedOptions, NO_TOPIC, NO_REQUEST_ID, NO_AUTH_HEADER).block()
then: 'the result is the response from the DMI service'
assert result.body == '{some-key:some-value}'
assert result.statusCode.'2xxSuccessful'
where: 'the following parameters are used'
- scenario | dmiProperties | dataStore | options || expectedProperties | expectedDatastoreInUrl | expectedOptionsInUrl
- 'without properties' | [] | PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM || '{}' | 'passthrough-operational' | '&options=(a%3D1,b%3D2)'
- 'with properties' | [yangModelCmHandleProperty] | PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM || '{"prop1":"val1"}' | 'passthrough-operational' | '&options=(a%3D1,b%3D2)'
- 'null options' | [yangModelCmHandleProperty] | PASSTHROUGH_OPERATIONAL | null || '{"prop1":"val1"}' | 'passthrough-operational' | ''
- 'empty options' | [yangModelCmHandleProperty] | PASSTHROUGH_OPERATIONAL | '' || '{"prop1":"val1"}' | 'passthrough-operational' | ''
- 'datastore running without properties' | [] | PASSTHROUGH_RUNNING | OPTIONS_PARAM || '{}' | 'passthrough-running' | '&options=(a%3D1,b%3D2)'
- 'datastore running with properties' | [yangModelCmHandleProperty] | PASSTHROUGH_RUNNING | OPTIONS_PARAM || '{"prop1":"val1"}' | 'passthrough-running' | '&options=(a%3D1,b%3D2)'
+ scenario | dmiProperties || expectedDataStore | expectedOptions | expectedProperties
+ 'without properties' | [] || PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM | '{}'
+ 'with properties' | [yangModelCmHandleProperty] || PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM | '{"prop1":"val1"}'
+ 'null options' | [yangModelCmHandleProperty] || PASSTHROUGH_OPERATIONAL | null | '{"prop1":"val1"}'
+ 'empty options' | [yangModelCmHandleProperty] || PASSTHROUGH_OPERATIONAL | '' | '{"prop1":"val1"}'
+ 'datastore running without properties' | [] || PASSTHROUGH_RUNNING | OPTIONS_PARAM | '{}'
+ 'datastore running with properties' | [yangModelCmHandleProperty] || PASSTHROUGH_RUNNING | OPTIONS_PARAM | '{"prop1":"val1"}'
}
def 'Execute (async) data operation from DMI service.'() {
@@ -101,16 +101,16 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleCollectionRetrieval([yangModelCmHandleProperty])
def dataOperationBatchRequestJsonData = TestUtils.getResourceFileContent('dataOperationRequest.json')
def dataOperationRequest = spiedJsonObjectMapper.convertJsonString(dataOperationBatchRequestJsonData, DataOperationRequest.class)
- dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [DmiOperationsBaseSpec.cmHandleId]
+ dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [cmHandleId]
and: 'a positive response from DMI service when it is called with valid request parameters'
def responseFromDmi = Mono.just(new ResponseEntity<Object>(HttpStatus.ACCEPTED))
- def expectedDmiBatchResourceDataUrl = "someServiceName/dmi/v1/data?requestId=requestId&topic=my-topic-name"
+ def expectedUrlTemplateWithVariables = new UrlTemplateParameters('myServiceName/dmi/v1/data?requestId={requestId}&topic={topic}', ['requestId': 'requestId', 'topic': 'my-topic-name'])
def expectedBatchRequestAsJson = '{"operations":[{"operation":"read","operationId":"operational-14","datastore":"ncmp-datastore:passthrough-operational","options":"some option","resourceIdentifier":"some resource identifier","cmHandles":[{"id":"some-cm-handle","moduleSetTag":"","cmHandleProperties":{"prop1":"val1"}}]}]}'
- mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedDmiBatchResourceDataUrl, _, READ, NO_AUTH_HEADER) >> responseFromDmi
+ mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedUrlTemplateWithVariables, _, READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get resource data for group of cm handles is invoked'
objectUnderTest.requestResourceDataFromDmi('my-topic-name', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
then: 'the post operation was called with the expected URL and JSON request body'
- 1 * mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedDmiBatchResourceDataUrl, expectedBatchRequestAsJson, READ, NO_AUTH_HEADER)
+ 1 * mockDmiRestClient.asynchronousPostOperationWithJsonData(DATA, expectedUrlTemplateWithVariables, expectedBatchRequestAsJson, READ, NO_AUTH_HEADER)
}
def 'Execute (async) data operation from DMI service with Exception.'() {
@@ -118,7 +118,7 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleCollectionRetrieval([yangModelCmHandleProperty])
def dataOperationBatchRequestJsonData = TestUtils.getResourceFileContent('dataOperationRequest.json')
def dataOperationRequest = spiedJsonObjectMapper.convertJsonString(dataOperationBatchRequestJsonData, DataOperationRequest.class)
- dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [DmiOperationsBaseSpec.cmHandleId]
+ dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [cmHandleId]
and: 'the published cloud event will be captured'
def actualDataOperationCloudEvent = null
eventsPublisher.publishCloudEvent('my-topic-name', 'my-request-id', _) >> { args -> actualDataOperationCloudEvent = args[2] }
@@ -140,11 +140,11 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleRetrieval([yangModelCmHandleProperty], 'my-module-set-tag')
and: 'a positive response from DMI service when it is called with the expected parameters'
def responseFromDmi = new ResponseEntity<Object>(HttpStatus.OK)
- def expectedUrl = dmiServiceBaseUrl + "passthrough-operational?resourceIdentifier=/"
+ def expectedTemplateWithVariables = new UrlTemplateParameters('myServiceName/dmi/v1/ch/{cmHandleId}/data/ds/{datastore}?resourceIdentifier={resourceIdentifier}', ['resourceIdentifier': '/', 'datastore': 'ncmp-datastore:passthrough-operational', 'cmHandleId': cmHandleId])
def expectedJson = '{"operation":"read","cmHandleProperties":{"prop1":"val1"},"moduleSetTag":"my-module-set-tag"}'
- mockDmiRestClient.synchronousPostOperationWithJsonData(DATA, expectedUrl, expectedJson, READ, null) >> responseFromDmi
+ mockDmiRestClient.synchronousPostOperationWithJsonData(DATA, expectedTemplateWithVariables, expectedJson, READ, null) >> responseFromDmi
when: 'get resource data is invoked'
- def result = objectUnderTest.getAllResourceDataFromDmi(DmiOperationsBaseSpec.cmHandleId, NO_REQUEST_ID)
+ def result = objectUnderTest.getAllResourceDataFromDmi(cmHandleId, NO_REQUEST_ID)
then: 'the result is the response from the DMI service'
assert result == responseFromDmi
}
@@ -153,12 +153,12 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
given: 'a cm handle for #cmHandleId'
mockYangModelCmHandleRetrieval([yangModelCmHandleProperty])
and: 'a positive response from DMI service when it is called with the expected parameters'
- def expectedUrl = "${dmiServiceBaseUrl}passthrough-running?resourceIdentifier=${DmiOperationsBaseSpec.resourceIdentifier}"
+ def expectedUrlTemplateParameters = new UrlTemplateParameters('myServiceName/dmi/v1/ch/{cmHandleId}/data/ds/{datastore}?resourceIdentifier={resourceIdentifier}', ['resourceIdentifier': resourceIdentifier, 'datastore': 'ncmp-datastore:passthrough-running', 'cmHandleId': cmHandleId])
def expectedJson = '{"operation":"' + expectedOperationInUrl + '","dataType":"some data type","data":"requestData","cmHandleProperties":{"prop1":"val1"},"moduleSetTag":""}'
def responseFromDmi = new ResponseEntity<Object>(HttpStatus.OK)
- mockDmiRestClient.synchronousPostOperationWithJsonData(DATA, expectedUrl, expectedJson, operation, NO_AUTH_HEADER) >> responseFromDmi
+ mockDmiRestClient.synchronousPostOperationWithJsonData(DATA, expectedUrlTemplateParameters, expectedJson, operation, NO_AUTH_HEADER) >> responseFromDmi
when: 'write resource method is invoked'
- def result = objectUnderTest.writeResourceDataPassThroughRunningFromDmi(DmiOperationsBaseSpec.cmHandleId, 'parent/child', operation, 'requestData', 'some data type', NO_AUTH_HEADER)
+ def result = objectUnderTest.writeResourceDataPassThroughRunningFromDmi(cmHandleId, 'parent/child', operation, 'requestData', 'some data type', NO_AUTH_HEADER)
then: 'the result is the response from the DMI service'
assert result == responseFromDmi
where: 'the following operation is performed'
@@ -168,7 +168,7 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
}
def 'State Ready validation'() {
- given: ' a yang model cm handle'
+ given: 'a yang model cm handle'
populateYangModelCmHandle([] ,'')
when: 'Validating State of #cmHandleState'
def caughtException = null
@@ -177,13 +177,13 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
} catch (Exception e) {
caughtException = e
}
- then: 'only when not ready a exception is thrown'
+ then: 'only when not ready a exception is thrown'
if (expecteException) {
assert caughtException.details.contains('not in READY state')
} else {
assert caughtException == null
}
- where: ' the following states are used'
+ where: 'the following states are used'
cmHandleState || expecteException
CmHandleState.READY || false
CmHandleState.ADVISED || true
@@ -192,4 +192,11 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
def extractDataValue(actualDataOperationCloudEvent) {
return toTargetEvent(actualDataOperationCloudEvent, DataOperationEvent).data.responses[0]
}
+
+ def getExpectedUrlTemplateWithVariables(expectedOptions, expectedDataStore) {
+ def includeOptions = !(expectedOptions == null || expectedOptions.trim().isEmpty())
+ def expectedUrlTemplate = 'myServiceName/dmi/v1/ch/{cmHandleId}/data/ds/{datastore}?resourceIdentifier={resourceIdentifier}' + (includeOptions ? '&options={options}' : '')
+ def urlVariables = ['resourceIdentifier': resourceIdentifier, 'datastore': expectedDataStore.datastoreName, 'cmHandleId': cmHandleId] + (includeOptions ? ['options': expectedOptions] : [:])
+ return new UrlTemplateParameters(expectedUrlTemplate, urlVariables)
+ }
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperationsSpec.groovy
index bae87d94c8..1268bc7683 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperationsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/DmiModelOperationsSpec.groovy
@@ -27,6 +27,7 @@ import org.onap.cps.ncmp.api.impl.config.DmiProperties
import org.onap.cps.ncmp.impl.DmiOperationsBaseSpec
import org.onap.cps.spi.model.ModuleReference
import org.onap.cps.utils.JsonObjectMapper
+import org.onap.cps.ncmp.api.impl.utils.url.builder.UrlTemplateParameters
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
@@ -42,6 +43,9 @@ import static org.onap.cps.ncmp.impl.models.RequiredDmiService.MODEL
@ContextConfiguration(classes = [DmiProperties, DmiModelOperations])
class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
+ def expectedModulesUrlTemplateWithVariables = new UrlTemplateParameters('myServiceName/dmi/v1/ch/{cmHandleId}/modules', ['cmHandleId': cmHandleId])
+ def expectedModuleResourcesUrlTemplateWithVariables = new UrlTemplateParameters('myServiceName/dmi/v1/ch/{cmHandleId}/moduleResources', ['cmHandleId': cmHandleId])
+
@Shared
def newModuleReferences = [new ModuleReference('mod1','A'), new ModuleReference('mod2','X')]
@@ -58,9 +62,8 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleRetrieval([])
and: 'a positive response from DMI service when it is called with the expected parameters'
def moduleReferencesAsLisOfMaps = [[moduleName: 'mod1', revision: 'A'], [moduleName: 'mod2', revision: 'X']]
- def expectedUrl = "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/modules"
def responseFromDmi = new ResponseEntity([schemas: moduleReferencesAsLisOfMaps], HttpStatus.OK)
- mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedUrl, '{"cmHandleProperties":{},"moduleSetTag":""}', READ, NO_AUTH_HEADER) >> responseFromDmi
+ mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModulesUrlTemplateWithVariables, '{"cmHandleProperties":{},"moduleSetTag":""}', READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get module references is called'
def result = objectUnderTest.getModuleReferences(yangModelCmHandle)
then: 'the result consists of expected module references'
@@ -91,7 +94,7 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleRetrieval(dmiProperties)
and: 'a positive response from DMI service when it is called with tha expected parameters'
def responseFromDmi = new ResponseEntity<String>(HttpStatus.OK)
- mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/modules",
+ mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModulesUrlTemplateWithVariables,
'{"cmHandleProperties":' + expectedAdditionalPropertiesInRequest + ',"moduleSetTag":""}', READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'a get module references is called'
def result = objectUnderTest.getModuleReferences(yangModelCmHandle)
@@ -110,7 +113,7 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
def responseFromDmi = new ResponseEntity([[moduleName: 'mod1', revision: 'A', yangSource: 'some yang source'],
[moduleName: 'mod2', revision: 'C', yangSource: 'other yang source']], HttpStatus.OK)
def expectedModuleReferencesInRequest = '{"name":"mod1","revision":"A"},{"name":"mod2","revision":"X"}'
- mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/moduleResources",
+ mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModuleResourcesUrlTemplateWithVariables,
'{"data":{"modules":[' + expectedModuleReferencesInRequest + ']},"cmHandleProperties":{}}', READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get new yang resources from DMI service'
def result = objectUnderTest.getNewYangResourcesFromDmi(yangModelCmHandle, newModuleReferences)
@@ -142,7 +145,7 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleRetrieval(dmiProperties)
and: 'a positive response from DMI service when it is called with the expected moduleSetTag, modules and properties'
def responseFromDmi = new ResponseEntity<>([[moduleName: 'mod1', revision: 'A', yangSource: 'some yang source']], HttpStatus.OK)
- mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/moduleResources",
+ mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModuleResourcesUrlTemplateWithVariables,
'{"data":{"modules":[{"name":"mod1","revision":"A"},{"name":"mod2","revision":"X"}]},"cmHandleProperties":' + expectedAdditionalPropertiesInRequest + '}',
READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get new yang resources from DMI service'
@@ -160,9 +163,8 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
mockYangModelCmHandleRetrieval([], moduleSetTag)
and: 'a positive response from DMI service when it is called with the expected moduleSetTag'
def responseFromDmi = new ResponseEntity<>([[moduleName: 'mod1', revision: 'A', yangSource: 'some yang source']], HttpStatus.OK)
- mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, "${DmiOperationsBaseSpec.dmiServiceName}/dmi/v1/ch/${DmiOperationsBaseSpec.cmHandleId}/moduleResources",
- '{' + expectedModuleSetTagInRequest + '"data":{"modules":[{"name":"mod1","revision":"A"},{"name":"mod2","revision":"X"}]},"cmHandleProperties":{}}',
- READ, NO_AUTH_HEADER) >> responseFromDmi
+ mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModuleResourcesUrlTemplateWithVariables,
+ '{' + expectedModuleSetTagInRequest + '"data":{"modules":[{"name":"mod1","revision":"A"},{"name":"mod2","revision":"X"}]},"cmHandleProperties":{}}', READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'get new yang resources from DMI service'
def result = objectUnderTest.getNewYangResourcesFromDmi(yangModelCmHandle, newModuleReferences)
then: 'the result is the response from DMI service'
@@ -205,5 +207,4 @@ class DmiModelOperationsSpec extends DmiOperationsBaseSpec {
and: 'the message indicates a parsing error'
exceptionThrown.message.toLowerCase().contains('parsing error')
}
-
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDogSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDogSpec.groovy
index 7fa8b2cce9..f975d23ba2 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDogSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDogSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,10 @@
package org.onap.cps.ncmp.impl.inventory.trustlevel
import org.onap.cps.ncmp.api.impl.client.DmiRestClient
+import org.onap.cps.ncmp.api.impl.utils.url.builder.UrlTemplateParameters
import org.onap.cps.ncmp.api.inventory.models.TrustLevel
import org.onap.cps.ncmp.impl.inventory.CmHandleQueryService
+import reactor.core.publisher.Mono
import spock.lang.Specification
class DmiPluginTrustLevelWatchDogSpec extends Specification {
@@ -39,7 +41,8 @@ class DmiPluginTrustLevelWatchDogSpec extends Specification {
given: 'the cache has been initialised and "knows" about dmi-1'
trustLevelPerDmiPlugin.put('dmi-1', dmiOldTrustLevel)
and: 'dmi client returns health status #dmiHealhStatus'
- mockDmiRestClient.getDmiHealthStatus('dmi-1') >> dmiHealhStatus
+ def urlTemplateParameters = new UrlTemplateParameters('dmi-1/actuator/health', [:])
+ mockDmiRestClient.getDmiHealthStatus(urlTemplateParameters) >> Mono.just(dmiHealhStatus)
when: 'dmi watch dog method runs'
objectUnderTest.checkDmiAvailability()
then: 'the update delegated to manager'
@@ -52,5 +55,4 @@ class DmiPluginTrustLevelWatchDogSpec extends Specification {
'UP' | TrustLevel.NONE | TrustLevel.COMPLETE || 1
'' | TrustLevel.COMPLETE | TrustLevel.NONE || 1
}
-
}