From 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 31 Dec 2018 17:21:27 +0200 Subject: Merge from ECOMP's repository Main Features -------------- - Async-Instantiation jobs mechanism major update; still WIP (package `org.onap.vid.job`) - New features in View/Edit: Activate fabric configuration; show related networks; soft delete - Support AAI service-tree traversal (`AAIServiceTree`) - In-memory cache for SDC models and certain A&AI queries (`CacheProviderWithLoadingCache`) - Upgrade TOSCA Parser and add parsing options; fix malformed TOSCA models - Resolve Cloud-Owner values for MSO - Pass X-ONAP headers to MSO Infrastructure -------------- - Remove codehaus' jackson mapper; use soley fasterxml 2.9.7 - Surefire invokes both TestNG and JUnit tests - Support Kotlin source files - AaiController2 which handles errors in a "Spring manner" - Inline generated-sources and remove jsonschema2pojo Quality -------- - Cumulative bug fixes (A&AI API, UI timeouts, and many more) - Many Sonar issues cleaned-up - Some unused classes removed - Minor changes in vid-automation project, allowing some API verification to run Hard Merges ------------ - HTTP Clients (MSO, A&AI, WebConfig, OutgoingRequestHeadersTest) - Moved `package org.onap.vid.controllers` to `controller`, without plural -- just to keep semantic sync with ECOMP. Reference commit in ECOMP: 3d1141625 Issue-ID: VID-378 Change-Id: I9c8d1e74caa41815891d441fc0760bb5f29c5788 Signed-off-by: Ittay Stern --- .../org/onap/vid/asdc/local/LocalAsdcClient.java | 60 ++-------------------- 1 file changed, 4 insertions(+), 56 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java index 108d9c06a..bcb201d2e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java @@ -1,31 +1,22 @@ package org.onap.vid.asdc.local; -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.json.JSONArray; import org.json.JSONObject; import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.AsdcClient; import org.onap.vid.asdc.beans.Service; -import org.onap.vid.asdc.beans.tosca.ToscaCsar; -import org.onap.vid.asdc.beans.tosca.ToscaMeta; -import org.onap.vid.asdc.beans.tosca.ToscaModel; import org.onap.vid.exceptions.GenericUncheckedException; -import org.yaml.snakeyaml.Yaml; import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.Map; import java.util.UUID; -import java.util.zip.ZipFile; /** * The Class LocalAsdcClient. @@ -117,7 +108,7 @@ public class LocalAsdcClient implements AsdcClient { /* (non-Javadoc) * @see org.onap.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID) */ - public Path getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException { + public Path getServiceToscaModel(UUID serviceUuid) { String toscaModelURL = null; @@ -145,49 +136,6 @@ public class LocalAsdcClient implements AsdcClient { } } - /** - * Gets the tosca model. - * - * @param csarInputStream the csar input stream - * @return the tosca model - * @throws AsdcCatalogException the asdc catalog exception - */ - private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException { - final Path csarFile; - - try { - csarFile = Files.createTempFile("csar", ".zip"); - Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING); - } catch (IOException e) { - throw new AsdcCatalogException("Caught IOException while creating CSAR", e); - } - - try (final ZipFile csar = new ZipFile(csarFile.toFile())) { - - final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta")); - final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build(); - final String entryDefinitions = toscaMeta.get("Entry-Definitions"); - final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions)); - - final Yaml yaml = new Yaml(); - final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class); - - final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel); - - for (Map> imports : parentModel.getImports()) { - for (Map.Entry> entry : imports.entrySet()) { - final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file"))); - final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class); - csarBuilder.addVnf(childModel); - } - } - - return csarBuilder.build(); - } catch (IOException e) { - throw new AsdcCatalogException("Caught IOException while processing CSAR", e); - } - } - /** * The Class Builder. */ -- cgit 1.2.3-korg