diff options
author | 2020-11-19 18:10:56 -0500 | |
---|---|---|
committer | 2021-01-05 10:38:41 -0500 | |
commit | 8bc7057f9b23555ba78c9f656743c57fa3d62a64 (patch) | |
tree | c0ee0e9e8043c22d4a7d9778645b621b43603a4b /adapters/mso-adapter-utils/src/test/java/org/onap | |
parent | e036ebd43a0b58eda96b2546290bba2189bb3824 (diff) |
Use the timeout from the heat templates for
Use the timeout from the heat templates for polling
Removed unused imports and code from base
Added to get timeout from the rest client
Fixed unit test for polling to account for changes
Issue-ID: SO-3397
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: If633f4f49d88eb797020b7d72c6edd0fbee0926c
Diffstat (limited to 'adapters/mso-adapter-utils/src/test/java/org/onap')
-rw-r--r-- | adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 5bd7c29313..f20f6f1448 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -46,6 +46,12 @@ import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.NetworkResource; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -103,6 +109,9 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { @Mock private CreateStack mockCreateStack; + @Mock + private CatalogDbClient catalogDbClient; + private String cloudSiteId = "cloudSiteId"; private String tenantId = "tenantId"; @@ -564,4 +573,38 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { Mockito.verify(heatUtils, times(0)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId); } + @Test + public void testGetVfHeatTimeoutValue() { + + VfModuleCustomization vfmc = new VfModuleCustomization(); + VfModule vf = new VfModule(); + HeatTemplate heat = new HeatTemplate(); + heat.setTimeoutMinutes(110); + vf.setModuleHeatTemplate(heat); + vfmc.setVfModule(vf); + + Mockito.when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("uuid")).thenReturn(vfmc); + + int timeout = heatUtils.getVfHeatTimeoutValue("uuid", false); + assertEquals(110, timeout); + Mockito.verify(catalogDbClient, times(1)).getVfModuleCustomizationByModelCuztomizationUUID("uuid"); + } + + @Test + public void testGetNetworkHeatTimeoutValue() { + + NetworkResourceCustomization mc = new NetworkResourceCustomization(); + NetworkResource nr = new NetworkResource(); + HeatTemplate heat = new HeatTemplate(); + heat.setTimeoutMinutes(110); + nr.setHeatTemplate(heat); + mc.setNetworkResource(nr); + + Mockito.when(catalogDbClient.getNetworkResourceCustomizationByModelCustomizationUUID("uuid")).thenReturn(mc); + + int timeout = heatUtils.getNetworkHeatTimeoutValue("uuid", "type"); + assertEquals(110, timeout); + Mockito.verify(catalogDbClient, times(1)).getNetworkResourceCustomizationByModelCustomizationUUID("uuid"); + } + } |