diff options
Diffstat (limited to 'adapters')
23 files changed, 159 insertions, 70 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java index 46cfbf1bb8..c438d0a277 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java @@ -1436,7 +1436,7 @@ public class MsoHeatUtils extends MsoCommonUtils { if (inputs == null) { LOGGER.debug("convertInputMap - inputs is null - nothing to do here"); - return new HashMap<String, Object>(); + return new HashMap<>(); } LOGGER.debug("convertInputMap in MsoHeatUtils called, with " + inputs.size() + " inputs, and template " + template.getArtifactUuid()); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java index 0e0b9cb70d..f7e67d87f8 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -230,7 +230,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { if (haveFiles && haveHeatFiles) { // Let's do this here - not in the bean LOGGER.debug ("Found files AND heatFiles - combine and add!"); - Map <String, Object> combinedFiles = new HashMap <String, Object> (); + Map <String, Object> combinedFiles = new HashMap<>(); for (String keyString : files.keySet ()) { combinedFiles.put (keyString, files.get (keyString)); } @@ -358,7 +358,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { sb.append("(outputs is empty)"); return sb; } - Map<String, Object> outputs = new HashMap<String,Object>(); + Map<String, Object> outputs = new HashMap<>(); for (Output outputItem : outputList) { outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java index 714684aba6..3b710032c1 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java @@ -209,7 +209,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return null; } - Map <String, String> metadata = new HashMap <String, String> (); + Map <String, String> metadata = new HashMap<>(); if (cloudSite.getIdentityService ().hasTenantMetadata ()) { OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps); @@ -255,7 +255,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return null; } - Map <String, String> metadata = new HashMap <String, String> (); + Map <String, String> metadata = new HashMap<>(); if (cloudSite.getIdentityService ().hasTenantMetadata ()) { OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java index c65a715b66..9eba799e18 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java @@ -63,7 +63,7 @@ public class MsoNeutronUtils extends MsoCommonUtils // token will be used until it expires. // // The cache key is "tenantId:cloudId" - private static Map<String,NeutronCacheEntry> neutronClientCache = new HashMap<String,NeutronCacheEntry>(); + private static Map<String,NeutronCacheEntry> neutronClientCache = new HashMap<>(); // Fetch cloud configuration each time (may be cached in CloudConfig class) private CloudConfig cloudConfig; @@ -129,7 +129,7 @@ public class MsoNeutronUtils extends MsoCommonUtils } } else if (type == NetworkType.MULTI_PROVIDER) { if (provider != null && vlans != null && vlans.size() > 0) { - List<Segment> segments = new ArrayList<Segment>(vlans.size()); + List<Segment> segments = new ArrayList<>(vlans.size()); for (int vlan : vlans) { Segment segment = new Segment(); segment.setProviderPhysicalNetwork (provider); @@ -297,7 +297,7 @@ public class MsoNeutronUtils extends MsoCommonUtils } } else if (type == NetworkType.MULTI_PROVIDER) { if (provider != null && vlans != null && vlans.size() > 0) { - List<Segment> segments = new ArrayList<Segment>(vlans.size()); + List<Segment> segments = new ArrayList<>(vlans.size()); for (int vlan : vlans) { Segment segment = new Segment(); segment.setProviderPhysicalNetwork (provider); diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java index 6fd95d5948..c2d4f9ba60 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java @@ -60,7 +60,7 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { public final void testCreateStackBadCloudConfig() throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { - msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<String, Object>(), + msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10); } catch (MsoCloudSiteNotFound e) { @@ -74,7 +74,7 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { public final void testCreateStackFailedConnectionHeatClient() throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10); } catch (MsoIOException e) { @@ -86,7 +86,7 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { public final void testCreateStackFailedConnection() throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10); } catch (MsoIOException e) { @@ -97,7 +97,7 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { @Test public final void createStackSuccessWithEnvironment() throws MsoException { try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, "environment"); } catch (MsoIOException e) { @@ -108,8 +108,8 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { @Test public final void createStackSuccessWithFiles() throws MsoException { try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, - "environment", new HashMap<String, Object>()); + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, + "environment", new HashMap<>()); } catch (MsoIOException e) { } @@ -119,8 +119,8 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { @Test public final void createStackSuccessWithHeatFiles() throws MsoException { try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<String, Object>(), Boolean.TRUE, 10, - "environment", new HashMap<String, Object>(), new HashMap<String, Object>()); + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, + "environment", new HashMap<>(), new HashMap<>()); } catch (MsoIOException e) { } @@ -131,7 +131,7 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { CreateStackParam param = new CreateStackParam(); param.setDisableRollback(false); param.setEnvironment("environment"); - param.setFiles(new HashMap<String, Object>()); + param.setFiles(new HashMap<>()); param.setParameters(new HashMap<>()); param.setStackName("stackName"); param.setTemplate("template"); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java index 31a58329d6..31594905fd 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java @@ -70,7 +70,7 @@ public class CatalogDbAdapterRestClassTest { * */ // set up mock return value - paramList = new ArrayList<VnfResourceCustomization>(); + paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); d1.setModelInstanceName("ciVFOnboarded-FNAT-aab06c41 1"); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java index 33f5553115..ae5e663777 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java @@ -114,7 +114,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<VnfResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<VnfResourceCustomization>(); + paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); d1.setModelInstanceName("RG_6-26_mog11 0"); @@ -154,7 +154,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<VnfResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<VnfResourceCustomization>(); + paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setVnfResourceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); d1.setModelInstanceName("RG_6-26_mog11 0"); @@ -198,7 +198,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<VnfResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<VnfResourceCustomization>(); + paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); d1.setModelInstanceName("RG_6-26_mog11 0"); @@ -242,7 +242,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<NetworkResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<NetworkResourceCustomization>(); + paramList = new ArrayList<>(); NetworkResourceCustomization d1 = new NetworkResourceCustomization(); d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); @@ -282,7 +282,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<NetworkResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<NetworkResourceCustomization>(); + paramList = new ArrayList<>(); NetworkResourceCustomization d1 = new NetworkResourceCustomization(); d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); @@ -322,7 +322,7 @@ public class CatalogDbAdapterRestHttpTest { try { ArrayList<NetworkResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<NetworkResourceCustomization>(); + paramList = new ArrayList<>(); NetworkResourceCustomization d1 = new NetworkResourceCustomization(); d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); @@ -367,7 +367,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<AllottedResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<AllottedResourceCustomization>(); + paramList = new ArrayList<>(); AllottedResourceCustomization d1 = new AllottedResourceCustomization(); d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); @@ -409,7 +409,7 @@ public class CatalogDbAdapterRestHttpTest { try { List<AllottedResourceCustomization> paramList; // set up mock return value - paramList = new ArrayList<AllottedResourceCustomization>(); + paramList = new ArrayList<>(); AllottedResourceCustomization d1 = new AllottedResourceCustomization(); d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java index 31e828d19a..ee2c8db577 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java @@ -49,7 +49,7 @@ public class CatalogQueryTest { CatalogQuery mockCatalogQuery = Mockito.mock(CatalogQuery.class); Mockito.doCallRealMethod().when(mockCatalogQuery).setTemplate(Mockito.anyString(), Mockito.anyMapOf(String.class, String.class)); - Map<String,String> valueMap = new HashMap<String,String>(); + Map<String,String> valueMap = new HashMap<>(); valueMap.put("somekey", "somevalue"); String ret = mockCatalogQuery.setTemplate("<somekey>", valueMap); @@ -60,7 +60,7 @@ public class CatalogQueryTest { @Test public void smartToJson_Test() { - List<VnfResourceCustomization> paramList = new ArrayList<VnfResourceCustomization>(); + List<VnfResourceCustomization> paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); d1.setModelInstanceName("RG_6-26_mog11 0"); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java index 71352b5272..0d86a6cf10 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java @@ -43,7 +43,7 @@ public class QueryAllottedResourceCustomizationTest { public void JSON2_Test() { List<AllottedResourceCustomization> paramList; - paramList = new ArrayList<AllottedResourceCustomization>(); + paramList = new ArrayList<>(); AllottedResourceCustomization d1 = new AllottedResourceCustomization(); d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9"); d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java index dfbc2dc384..3a767a8609 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java @@ -47,7 +47,7 @@ public class QueryServiceMarcoHolderTest { svc.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9"); svc.setModelName("Testing Model One"); ArrayList<NetworkResourceCustomization> paramList; - paramList = new ArrayList<NetworkResourceCustomization>(); + paramList = new ArrayList<>(); NetworkResourceCustomization d1 = new NetworkResourceCustomization(); d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java index b237dbe0a8..1c855eaa72 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java @@ -45,7 +45,7 @@ public class QueryServiceNetworksTest { public void JSON2_Test() { ArrayList<NetworkResourceCustomization> paramList; - paramList = new ArrayList<NetworkResourceCustomization>(); + paramList = new ArrayList<>(); NetworkResourceCustomization d1 = new NetworkResourceCustomization(); d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9"); paramList.add(d1); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java index 262fe06988..8c8fc967da 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java @@ -44,7 +44,7 @@ public class QueryServiceVnfsTest { public void JSON2_Test() { List<VnfResourceCustomization> paramList; - paramList = new ArrayList<VnfResourceCustomization>(); + paramList = new ArrayList<>(); VnfResourceCustomization d1 = new VnfResourceCustomization(); d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9"); d1.setVnfResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9"); diff --git a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkBeansTest.java b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkBeansTest.java index e96e416d65..ae198142bd 100644 --- a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkBeansTest.java +++ b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkBeansTest.java @@ -71,7 +71,7 @@ public class NetworkBeansTest { contrailSubnet.setAddrFromStart(true);
contrailSubnet.setDefaultGateway("defaultGateway");
contrailSubnet.setEnableDhcp(true);
- contrailSubnet.setPools(new ArrayList<ContrailSubnetPool>());
+ contrailSubnet.setPools(new ArrayList<>());
contrailSubnet.setSubnet(new ContrailSubnetIp());
contrailSubnet.setSubnetName("subnetName");
contrailSubnet.getAllocationPools();
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java index 5d0752a3af..2a33ebc50c 100644 --- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java +++ b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java @@ -39,11 +39,11 @@ public class TenantTest { MsoTenantAdapter tenantAdapter = new MsoTenantAdapterImpl(); - Holder<String> tenantId = new Holder<String>(); - Holder<String> tenantName = new Holder<String>(); - Holder<Map<String,String>> tenantMetadata = new Holder<Map<String,String>>(); - Holder<Boolean> tenantDeleted = new Holder<Boolean>(); - Holder<TenantRollback> rollback = new Holder<TenantRollback>(); + Holder<String> tenantId = new Holder<>(); + Holder<String> tenantName = new Holder<>(); + Holder<Map<String,String>> tenantMetadata = new Holder<>(); + Holder<Boolean> tenantDeleted = new Holder<>(); + Holder<TenantRollback> rollback = new Holder<>(); try { tenantAdapter.queryTenant (cloudId, "934a4ac9c4bd4b8d9d8ab3ef900281b0", null, tenantId, tenantName, tenantMetadata); diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index 9131309ab5..001b6fb4ec 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -295,7 +295,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vnfExists.value = Boolean.FALSE; status.value = VnfStatus.NOTFOUND; vnfId.value = null; - outputs.value = new HashMap <String, String> (); // Return as an empty map + outputs.value = new HashMap<>(); // Return as an empty map LOGGER.debug ("VNF " + vnfName + " not found"); } else { @@ -548,7 +548,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (objectMap == null) { return null; } - Map<String, String> stringMap = new HashMap<String, String>(); + Map<String, String> stringMap = new HashMap<>(); for (String key : objectMap.keySet()) { if (!stringMap.containsKey(key)) { Object obj = objectMap.get(key); diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduInfo.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduInfo.java index 53300c9453..3646b292c5 100755 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduInfo.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduInfo.java @@ -35,8 +35,8 @@ public class VduInfo { private String vduInstanceId = ""; private String vduInstanceName = ""; private VduStatus status = VduStatus.NOTFOUND; - private Map<String,Object> outputs = new HashMap<String,Object>(); - private Map<String,Object> inputs = new HashMap<String,Object>(); + private Map<String,Object> outputs = new HashMap<>(); + private Map<String,Object> inputs = new HashMap<>(); private String lastAction; private String actionStatus; private String errorMessage; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java index a045b00699..acde3153ab 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterAsyncImplTest.java @@ -44,7 +44,7 @@ public class MsoVnfAdapterAsyncImplTest { try {
instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, "messageId",
+ "volumeGroupHeatStackId|1", new HashMap<>(), Boolean.FALSE, Boolean.TRUE, "messageId",
null, "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
} catch (Exception e) {
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java index 6f01954db3..eec2257c7f 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/MsoVnfAdapterImplTest.java @@ -48,8 +48,8 @@ public class MsoVnfAdapterImplTest { try {
instance.createVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
- new Holder<VnfRollback>());
+ Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
+ new Holder<>());
} catch (Exception e) {
}
@@ -67,8 +67,8 @@ public class MsoVnfAdapterImplTest { try {
instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
- new Holder<VnfRollback>());
+ "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
+ new Holder<>());
} catch (Exception e) {
}
@@ -82,7 +82,7 @@ public class MsoVnfAdapterImplTest { msoRequest.setServiceInstanceId("12345");
try {
instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<Map<String, String>>());
+ new Holder<>());
} catch (Exception e) {
}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java index f6e79e12a0..d898a6547e 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/QueryTest.java @@ -55,10 +55,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); @@ -82,10 +82,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); @@ -101,10 +101,10 @@ public class QueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java index 52e1797531..000ed8aef3 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfCreateTest.java @@ -42,16 +42,16 @@ public class VnfCreateTest { String tenantName = "John_Test"; String vnfType = "ApacheDemo"; String vnfName = "AdapterTest"; - Map<String,String> inputs = new HashMap<String,String>(); + Map<String,String> inputs = new HashMap<>(); inputs.put("vnf_id", "abc"); inputs.put("extra", "whocares"); inputs.put("private_subnet_gateway", "10.4.1.1"); inputs.put("private_subnet_cidr", "10.4.1.0/29"); // Web Service Outputs - Holder<String> vnfId = new Holder<String>(); - Holder<Map<String,String>> outputs = new Holder<Map<String,String>>(); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>(); + Holder<String> vnfId = new Holder<>(); + Holder<Map<String,String>> outputs = new Holder<>(); + Holder<VnfRollback> vnfRollback = new Holder<>(); try { vnfAdapter.createVnf(cloudId, tenantName, vnfType,null, vnfName, null, null, inputs, false, true, null, diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java index 84f2f2ff57..bbffddfd15 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/test/VnfQueryTest.java @@ -39,10 +39,10 @@ public class VnfQueryTest { String cloudId = "MT"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vnfId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String,String>> outputs = new Holder<Map<String,String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String,String>> outputs = new Holder<>(); try { vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java index 21a71ccf61..019ae1e3f9 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java @@ -60,7 +60,7 @@ public class VduBlueprintTest { @Test public void testGetTemplateFiles() { byte[] templateFileData = "some template file data".getBytes(); - templateFiles = new HashMap<String, byte[]>(); + templateFiles = new HashMap<>(); templateFiles.put("templateKey1", templateFileData); vduBlueprint.setTemplateFiles(templateFiles); Assert.assertNotNull(vduBlueprint.getTemplateFiles()); @@ -71,7 +71,7 @@ public class VduBlueprintTest { @Test public void testGetAttachedFiles() { byte[] attachedFileData = "some file data".getBytes(); - attachedFiles = new HashMap<String, byte[]>(); + attachedFiles = new HashMap<>(); attachedFiles.put("attachedKey1", attachedFileData); vduBlueprint.setAttachedFiles(attachedFiles); Assert.assertNotNull(vduBlueprint.getAttachedFiles()); diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java new file mode 100644 index 0000000000..4a29c32e28 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * 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.openecomp.mso.vdu.utils; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class VduInfoTest { + + private VduInfo vduInfo; + private VduStatus status = VduStatus.NOTFOUND; + private Map<String, Object> outputs; + private Map<String, Object> inputs; + + @Before + public void setUp() { + vduInfo = new VduInfo(); + } + + @Test + public void testGetVnfInstanceId() { + String vnfInstanceId = "vnfInstanceId"; + vduInfo.setVnfInstanceId(vnfInstanceId); + Assert.assertNotNull(vduInfo.getVnfInstanceId()); + Assert.assertEquals(vduInfo.getVnfInstanceId(), "vnfInstanceId"); + } + + @Test + public void testGetVnfInstanceName() { + String vnfInstanceName = "vnfInstanceName"; + vduInfo.setVnfInstanceName(vnfInstanceName); + Assert.assertNotNull(vduInfo.getVnfInstanceName()); + Assert.assertEquals(vduInfo.getVnfInstanceName(), "vnfInstanceName"); + } + + @Test + public void testGetStatus() { + vduInfo.setStatus(status); + Assert.assertNotNull(vduInfo.getStatus()); + Assert.assertEquals(status, vduInfo.getStatus()); + } + + @Test + public void testGetOutputs() { + Object obj = new Object(); + String str = "some text"; + outputs = new HashMap<String, Object>(); + outputs.put(str, obj); + vduInfo.setOutputs(outputs); + Assert.assertNotNull(vduInfo.getOutputs()); + Assert.assertTrue(vduInfo.getOutputs().containsKey(str)); + Assert.assertTrue(vduInfo.getOutputs().containsValue(obj)); + } + + @Test + public void testGetInputs() { + Object obj = new Object(); + String str = "some text"; + inputs = new HashMap<String, Object>(); + inputs.put(str, obj); + vduInfo.setInputs(inputs); + Assert.assertNotNull(vduInfo.getInputs()); + Assert.assertTrue(vduInfo.getInputs().containsKey(str)); + Assert.assertTrue(vduInfo.getInputs().containsValue(obj)); + } + +} |