diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
-rw-r--r-- | adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java index a7744a2ea7..e728cfd0d4 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java @@ -169,19 +169,34 @@ public class HeatStackAuditTest extends HeatStackAudit { String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); String expectedValue = getJson("ExpectedVserversToAudit.json"); - System.out.println(actualValue); JSONAssert.assertEquals(expectedValue, actualValue, false); } @Test public void auditHeatStackNoServers_Test() throws Exception{ Resources getResource = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class); - doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName"); + doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3); Optional<AAIObjectAuditList> actual = heatStackAudit.auditHeatStack(cloudRegion, "cloudOwner", tenantId, "heatStackName"); assertEquals(true, actual.get().getAuditList().isEmpty()); } + @Test + public void auditHeatStackNestedServers_Test() throws Exception{ + Resources getResource = objectMapper.readValue(new File("src/test/resources/GetNestedResources.json"), Resources.class); + List<Resource> novaResources = getResource.getList().stream() + .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); + List<Resource> resourceGroups = getResource.getList().stream() + .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList()); + + doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3); + Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources,portList); + Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit); + String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); + String expectedValue = getJson("NestedExpectedValue.json"); + JSONAssert.assertEquals(expectedValue, actualValue, false); + } + @Test public void findInterfaceInformation_Test(){ |