diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-08 16:44:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-08 16:44:32 +0000 |
commit | e1f8849de4ca1395d33f4a5275f597cbfca25e90 (patch) | |
tree | d949f412db6472b56084f0377b4e9af66d30743d /adapters/mso-openstack-adapters/src/test/java/org/onap | |
parent | 4f6cbb2fc0ce3cbac0604eb5c795b28c0117a38d (diff) | |
parent | fc6b48f9d2a2df77dcb9327d645d2bb262285d90 (diff) |
Merge "Query param to pull back nested stack information"
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java/org/onap')
-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(){ |