diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 09:52:32 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 09:53:04 -0400 |
commit | fc6b48f9d2a2df77dcb9327d645d2bb262285d90 (patch) | |
tree | 62949ceec925d3f30f66198fc23aaf1ae17d710e /adapters/mso-openstack-adapters/src/test/java | |
parent | e757e801c665a1758cf4c976b24df13adda38b2b (diff) |
Query param to pull back nested stack information
Add Query param to pull back nested stack information
Change-Id: Idf83291107e2ef7e86bb2de914469b0401eda0ac
Issue-ID: SO-1760
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
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(){ |