From b5fe8a69e90b950c07dc11af481eab7e9bab52c6 Mon Sep 17 00:00:00 2001 From: "Dunietz, Irwin" Date: Thu, 16 Jan 2020 15:13:14 -0500 Subject: Change code in appc dispatcher for new LCMs in R6 Also introduce some minor improvements to robustness, efficiency, & formatting. Issue-ID: APPC-1789 Signed-off-by: Dunietz, Irwin Change-Id: I82d970c2f7cde6c8dab1222af86ea70ce93b7e50 --- .../appc/licmgr/impl/LicenseManagerImplTest.java | 20 +++++++++++--------- .../licmgr/impl/XmlToLicenseModelConverterTest.java | 12 +++++++----- .../src/test/resources/test-vf-license-model.xml | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'appc-dispatcher/appc-license-manager/appc-license-manager-core') diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/LicenseManagerImplTest.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/LicenseManagerImplTest.java index 9d2fb87b4..ad924ca0a 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/LicenseManagerImplTest.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/LicenseManagerImplTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Modifications Copyright (C) 2018 Nokia * ================================================================================ + * Modifications Copyright (C) 2019 AT&T Intellectual Property + * ================================================================================ * 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 @@ -61,15 +63,15 @@ public class LicenseManagerImplTest { public void retrieveLicenseModel_shouldThrowException_whenRetrieveLicenseModelDataIsEmpty() { // GIVEN - String expectedMessage = String - .format("License model not found for vnfType='%s' and vnfVersion='%s'", VNF_TYPE, VNF_VERSION); + String expectedMessage = + String.format("License model not found for vnfType='%s' and vnfVersion='%s'", VNF_TYPE, VNF_VERSION); given(licenseDataAccessService.retrieveLicenseModelData(VNF_TYPE, VNF_VERSION)) - .willReturn(Collections.emptyMap()); + .willReturn(Collections.emptyMap()); // WHEN THEN assertThatExceptionOfType(DataAccessException.class) - .isThrownBy(() -> licenseManager.retrieveLicenseModel(VNF_TYPE, VNF_VERSION)) - .withMessage(expectedMessage); + .isThrownBy(() -> licenseManager.retrieveLicenseModel(VNF_TYPE, VNF_VERSION)) + .withMessage(expectedMessage); } @Test @@ -81,11 +83,11 @@ public class LicenseManagerImplTest { Map licenseModelData = new HashMap<>(); licenseModelData.put(ARTIFACT_CONTENT.name(), malformedXml); given(licenseDataAccessService.retrieveLicenseModelData(VNF_TYPE, VNF_VERSION)) - .willReturn(licenseModelData); + .willReturn(licenseModelData); // WHEN THEN assertThatExceptionOfType(DataAccessException.class) - .isThrownBy(() -> licenseManager.retrieveLicenseModel(VNF_TYPE, VNF_VERSION)); + .isThrownBy(() -> licenseManager.retrieveLicenseModel(VNF_TYPE, VNF_VERSION)); } @Test @@ -102,7 +104,7 @@ public class LicenseManagerImplTest { Map licenseModelData = new HashMap<>(); licenseModelData.put(ARTIFACT_CONTENT.name(), correctlyFormedXml); given(licenseDataAccessService.retrieveLicenseModelData(VNF_TYPE, VNF_VERSION)) - .willReturn(licenseModelData); + .willReturn(licenseModelData); // WHEN LicenseModel licenseModel = licenseManager.retrieveLicenseModel(VNF_TYPE, VNF_VERSION); @@ -111,4 +113,4 @@ public class LicenseManagerImplTest { assertEquals(expectedEntitlementPool, licenseModel.getEntitlementPoolUuid()); assertEquals(expectedKeyGroup, licenseModel.getLicenseKeyGroupUuid()); } -} \ No newline at end of file +} diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/XmlToLicenseModelConverterTest.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/XmlToLicenseModelConverterTest.java index d0c48cc93..2dd3fde51 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/XmlToLicenseModelConverterTest.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/java/org/onap/appc/licmgr/impl/XmlToLicenseModelConverterTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Nokia * ============================================================================= + * Modifications Copyright (C) 2019 AT&T Intellectual Property + * ================================================================================ * 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 @@ -57,7 +59,7 @@ public class XmlToLicenseModelConverterTest { // WHEN converter.convert((a, b) -> { - }, anyString(), null); + }, anyString(), null); // THEN then(xmlStreamReader).should().close(); @@ -72,9 +74,9 @@ public class XmlToLicenseModelConverterTest { // WHEN THEN assertThatExceptionOfType(XMLStreamException.class) - .isThrownBy(() -> converter.convert((a, b) -> { - throw new XMLStreamException(); - }, anyString(), null)); + .isThrownBy(() -> converter.convert((a, b) -> { + throw new XMLStreamException(); + }, anyString(), null)); then(xmlStreamReader).should().close(); } -} \ No newline at end of file +} diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/resources/test-vf-license-model.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/resources/test-vf-license-model.xml index 6f32f50b8..9f0b2b6ed 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/resources/test-vf-license-model.xml +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/test/resources/test-vf-license-model.xml @@ -60,4 +60,4 @@ - \ No newline at end of file + -- cgit 1.2.3-korg