From f9b1d0f1b2f5c955279a87c5e8799f9a8022331d Mon Sep 17 00:00:00 2001 From: Hao Kuang Date: Fri, 13 Oct 2017 11:16:57 -0400 Subject: Add junit test for VnfSdnUtilTest (1) add junit test for vnfSdnUtilTest (2) format VnfSdnUtil.java via using ONAP java code formatter (3) fix some sonar lint issues Issue-Id: SDNC-123 Change-Id: I0e1cd55f67b238d70514a2caf02f4ead7809de31 Signed-off-by: Hao Kuang --- vnfapi/provider/pom.xml | 15 ++ .../main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java | 248 +++++++++++++-------- .../java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java | 21 ++ .../openecomp/sdnc/vnfapi/TestPropertyList.java | 102 --------- 4 files changed, 195 insertions(+), 191 deletions(-) create mode 100644 vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java delete mode 100644 vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java (limited to 'vnfapi/provider') diff --git a/vnfapi/provider/pom.xml b/vnfapi/provider/pom.xml index 50ceb45e..e373b69f 100644 --- a/vnfapi/provider/pom.xml +++ b/vnfapi/provider/pom.xml @@ -66,5 +66,20 @@ ${junit.version} test + + org.mockito + mockito-core + test + + + org.powermock + powermock-api-mockito + test + + + org.powermock + powermock-module-junit4 + test + diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java index 522ee7f9..64b13bd4 100644 --- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java +++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java @@ -32,194 +32,264 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class VnfSdnUtil extends MdsalHelper { - private static final Logger LOG = LoggerFactory.getLogger(VnfSdnUtil.class); - private static File ODLHOME = null; - + private static File odlHomePath = null; private static Properties properties; - public static void loadProperties() { + if (odlHomePath == null) { + odlHomePath = new File("/opt/opendaylight/current"); - if (ODLHOME == null) { - ODLHOME = new File("/opt/opendaylight/current"); - - if (!ODLHOME.isDirectory()) { - ODLHOME = new File("/opt/bvc/controller"); + if (!odlHomePath.isDirectory()) { + odlHomePath = new File("/opt/bvc/controller"); } } - File propFile = new File(ODLHOME.getAbsolutePath() + "/configuration/vnfapi.properties"); + File propFile = new File(odlHomePath.getAbsolutePath() + "/configuration/vnfapi.properties"); String propFileName = propFile.getAbsolutePath(); properties = new Properties(); if (propFile.isFile() && propFile.canRead()) { try (InputStream input = new FileInputStream(propFile)) { properties.load(input); - LOG.info("Loaded properties from " + propFileName ); + LOG.info("Loaded properties from " + propFileName); setYangMappingProperties(properties); } catch (IOException e) { - LOG.error("Failed to close properties file " + propFileName +"\n",e); + LOG.error("Failed to close properties file " + propFileName + "\n", e); } catch (Exception e) { - LOG.error("Failed to load properties " + propFileName +"\n",e); + LOG.error("Failed to load properties " + propFileName + "\n", e); } } } static { - // Trick class loader into loading builders. Some of // these will be needed later by Reflection classes, but need // to explicitly "new" them here to get class loader to load them. - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder u1 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder + u1 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder u2 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder + u2 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder u3 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder + u3 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder u4 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder + u4 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder u5 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder + u5 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder u6 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder + u6 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder u7 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder + u7 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder u8 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder + u8 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder u9 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder + u9 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder u10 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder + u10 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder u11 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder + u11 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder u12 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder + u12 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder u13 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder + u13 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder u14 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder + u14 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder u15 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder + u15 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder u16 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder + u16 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder u17 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder + u17 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder u18 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder + u18 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder u19 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder + u19 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder u20 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder + u20 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder u21 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder + u21 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder u22 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder + u22 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder u23 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder + u23 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder u24 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder + u24 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder u25 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder + u25 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder u26 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder + u26 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder u27 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder + u27 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder u28 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder + u28 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder u29 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder + u29 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder u30 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder + u30 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder u31 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder + u31 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.subnets.SubnetsBuilder u32 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.subnets.SubnetsBuilder + u32 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.subnets.SubnetsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder u33 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder + u33 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder u34 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder + u34 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder u35 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder + u35 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder u36 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder + u36 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder u37 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder + u37 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder u38 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder + u38 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder u39 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder + u39 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder u40 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder + u40 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder u41 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder + u41 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder u42 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder + u42 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder u43 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder + u43 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder u44 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder + u44 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder u45 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder + u45 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder u46 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder + u46 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder u47 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder + u47 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder u48 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder + u48 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder u49 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder + u49 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder u50 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder + u50 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder u51 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder + u51 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder u52 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder + u52 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder u53 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder + u53 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder u54 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder + u54 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder u55 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder + u55 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder u56 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder + u56 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder u57 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder + u57 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder u58 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder + u58 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder u59 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder + u59 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder u60 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder + u60 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder u61 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder + u61 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder u62 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder + u62 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder u63 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder + u63 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder u64 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder + u64 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder u65 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder + u65 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder u66 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder + u66 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder u67 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder + u67 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder u68 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder + u68 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder u69 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder + u69 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder u70 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder + u70 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder u71 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder + u71 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder u72 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder + u72 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder u73 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder + u73 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder u74 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder + u74 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder(); - org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder u75 = + org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder + u75 = new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder(); } } diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java new file mode 100644 index 00000000..dbfca074 --- /dev/null +++ b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java @@ -0,0 +1,21 @@ +package org.onap.sdnc.vnfapi; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.powermock.reflect.Whitebox; + +public class VnfSdnUtilTest { + + private VnfSdnUtil vnfSdnUtil; + + @Before public void setUp() throws Exception { + vnfSdnUtil = new VnfSdnUtil(); + } + + @Test public void loadProperties() throws Exception { + vnfSdnUtil.loadProperties(); + Object properties = Whitebox.getInternalState(VnfSdnUtil.class, "properties"); + Assert.assertNotNull(properties); + } +} diff --git a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java deleted file mode 100644 index 04c30ab9..00000000 --- a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdnc.vnfapi; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.PrintStream; -import java.util.Date; -import java.util.Properties; - -import junit.framework.TestCase; - -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInput; -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder; -import org.onap.sdnc.vnfapi.VnfSdnUtil; -import org.onap.sdnc.vnfapi.vnfapiProvider; -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput; -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestPropertyList extends TestCase { - - - private final Logger log = LoggerFactory.getLogger( vnfapiProvider.class ); - public void testPrintPropertyList() { - InputStream propStr = getClass().getResourceAsStream("/proplist.properties"); - - Properties props = new Properties(); - - try - { - props.load(propStr); - } catch (Exception e) - { - fail("Could not load proplist.properties"); - } - - String aptFile = props.getProperty("proplist.aptFile"); - - if ((aptFile == null) || (aptFile.length() == 0)) - { - fail("proplist.aptFile unset"); - } - - PrintStream outStr = null; - - try { - outStr = new PrintStream(new FileOutputStream(aptFile)); - } catch (FileNotFoundException e) { - fail("Cannot open apt file "+aptFile); - } - - Date now = new Date(); - - outStr.print(" ---"); - outStr.print("\n Service Logic Variables"); - outStr.print("\n ---"); - outStr.print("\n System generated"); - outStr.print("\n ---"); - outStr.print("\n "+now.toString()); - outStr.print("\n\nSupported service logic variables"); - outStr.print("\n\n Config/operational tree data for VNF SDN service is passed to the service logic in the following variables"); - outStr.print("\n"); - VnfSdnUtil.printPropertyList(outStr, "", ServiceDataBuilder.class); - VnfSdnUtil.printPropertyList(outStr, "", PreloadDataBuilder.class); - outStr.print("\n"); - outStr.print("\n\n Input parameters to the vnf-topology-operation RPC are passed to the service logic in the following variables"); - outStr.print("\n"); - VnfSdnUtil.printPropertyList(outStr, "", VnfTopologyOperationInputBuilder.class); - outStr.print("\n"); - outStr.print("\n\n Input parameters to the preload-vnf-topology-operation -operation RPC are passed to the service logic in the following variables"); - outStr.print("\n"); - VnfSdnUtil.printPropertyList(outStr, "", PreloadVnfTopologyOperationInputBuilder.class); - outStr.print("\n"); - outStr.flush(); - outStr.close(); - } - -} -- cgit 1.2.3-korg