From 3274b39fef63c43c6eeb202e98b71b01e0f714ff Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Sun, 8 Oct 2017 15:04:04 +0300 Subject: Improve SONAR coverage Change-Id: I02e9535f96040cd038ef064ee5881c4c3e5e7bca Issue-ID: VID-72 Signed-off-by: Ofir Sonsino --- .../main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java | 5 +++++ .../java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java | 2 +- .../main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java | 2 +- .../src/main/java/org/openecomp/vid/model/ServiceModel.java | 4 ++-- vid-app-common/src/main/resources/sdcservices.json | 8 ++++---- 5 files changed, 13 insertions(+), 8 deletions(-) (limited to 'vid-app-common/src/main') diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java index d73c75b3..696e1890 100644 --- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java @@ -328,9 +328,14 @@ public class LocalAsdcClient implements AsdcClient { JSONObject jsonServiceObject = categoryJsonArray.getJSONObject(i); if (jsonServiceObject.get("uuid").equals(serviceUuid.toString())) { toscaModelURL = jsonServiceObject.getString("toscaModelURL"); + break; } } + if (toscaModelURL==null){ + return null; + } + final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL); ClassLoader classLoader = getClass().getClassLoader(); diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java index 123cc578..2b783d45 100755 --- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java @@ -114,7 +114,7 @@ public class InMemoryAsdcClient implements AsdcClient { * * @param builder the builder */ - private InMemoryAsdcClient(Builder builder) { + InMemoryAsdcClient(Builder builder) { catalog = builder.catalog; mapper = builder.mapper; } diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java index e2b32fa8..f364d0b3 100644 --- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java @@ -47,7 +47,7 @@ public class ToscaParserImpl2 { public ServiceModel makeServiceModel(Path path, Service asdcServiceMetadata) throws Exception { ServiceModel serviceModel = new ServiceModel(); SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath()); + ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath()); //, false); serviceModel.setService(extractServiceFromCsar(asdcServiceMetadata, sdcCsarHelper)); serviceModel.setVolumeGroups(extractVolumeGroups(sdcCsarHelper)); serviceModel.setVfModules(extractVfModuleFromCsar(sdcCsarHelper)); diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java index 8742931c..e879fd47 100755 --- a/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java @@ -171,8 +171,8 @@ public class ServiceModel { service.setInputs(serviceToscaModel.gettopology_template().getInputs()); //FIXME: SDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702 //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME - //service.setVersion(serviceToscaModel.getMetadata().getVersion()); - service.setVersion(asdcServiceMetadata.getVersion()); + service.setVersion(serviceToscaModel.getMetadata().getVersion()); + //service.setVersion(asdcServiceMetadata.getVersion()); return service; } diff --git a/vid-app-common/src/main/resources/sdcservices.json b/vid-app-common/src/main/resources/sdcservices.json index e80caa66..81a08d93 100644 --- a/vid-app-common/src/main/resources/sdcservices.json +++ b/vid-app-common/src/main/resources/sdcservices.json @@ -4,7 +4,7 @@ "uuid": "48a52540-8772-4368-9cdb-1f124ea5c931", "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef", "name": "4-27_vMME_Service", - "version": "1.0", + "version": "0.1", "toscaModelURL": "./service-vf-csar.zip", "category": "Mobility", "lifecycleState": "CERTIFIED", @@ -15,10 +15,10 @@ "resources": null }, { - "uuid": "cb49608f-5a24-4789-b0f7-2595473cb997", + "uuid": "68101369-6f08-4e99-9a28-fa6327d344f3", "invariantUUID": "0311f998-9268-4fd6-bbba-afff15087b72", "name": "4-27_vMME_Service", - "version": "1.0", + "version": "0.1", "toscaModelURL": "./service-vl-csar.zip", "category": "Mobility", "lifecycleState": "CERTIFIED", @@ -32,7 +32,7 @@ "uuid": "73e1322a-8a9a-49dc-9558-b0c5c5770e4a", "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef", "name": "4-27_vMME_Service", - "version": "1.0", + "version": "0.1", "toscaModelURL": "./pnf.csar", "category": "Mobility", "lifecycleState": "CERTIFIED", -- cgit 1.2.3-korg