summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java')
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java
index 4118d6822..0b8aa5f81 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -137,7 +139,6 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
JSONObject requestInfo = (JSONObject) postDataJson.get(REQUEST_INFORMATION);
JSONObject documentInfo = (JSONObject) postDataJson.get(DOCUMENT_PARAMETERS);
String artifactName = documentInfo.getString(ARTIFACT_NAME);
-
if (artifactName != null) {
updateStoreArtifacts(requestInfo, documentInfo);
if (artifactName.toLowerCase().startsWith(REFERENCE)) {
@@ -165,7 +166,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
String fn = "ArtifactHandlerNode.createReferenceDataForPD";
String artifactName = documentInfo.getString(ARTIFACT_NAME);
- log.info(fn + "Received PD File Name: " + artifactName + " and suffix lenght "
+ log.info(fn + "Received PD File Name: " + artifactName + " and suffix length "
+ PD.length());
try {
@@ -190,7 +191,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
// Tosca generation
OutputStream toscaStream = new ByteArrayOutputStream();
String toscaContents;
- ArtifactProcessorImpl toscaGenerator = new ArtifactProcessorImpl();
+ ArtifactProcessorImpl toscaGenerator = getArtifactProcessorImpl();
toscaGenerator.generateArtifact(pdFileContents, toscaStream);
toscaContents = toscaStream.toString();
log.info("Generated Tosca File : " + toscaContents);
@@ -242,7 +243,6 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
protected boolean updateStoreArtifacts(JSONObject requestInfo, JSONObject documentInfo)
throws SvcLogicException {
log.info("UpdateStoreArtifactsStarted storing of SDC Artifacs ");
-
SvcLogicContext context = new SvcLogicContext();
DBService dbservice = DBService.initialise();
ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil();
@@ -277,6 +277,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
public boolean storeReferenceData(JSONObject requestInfo, JSONObject documentInfo)
throws ArtifactHandlerInternalException {
+
log.info("Started storing of SDC Artifacs into Handler");
try {
DBService dbservice = DBService.initialise();
@@ -297,7 +298,6 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
JSONObject contentObject = new JSONObject(contentString);
JSONArray contentArray = contentObject.getJSONArray("reference_data");
boolean storeCapabilityArtifact = true;
-
for (int a = 0; a < contentArray.length(); a++) {
JSONObject content = (JSONObject) contentArray.get(a);
log.info("contentString =" + content.toString());
@@ -460,10 +460,10 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
log.info("artifact is " + artifact);
//Get Model details
- if (null != templateIdList && i>0 && i%2==0) {//Should this be changed to 3 to account for 3 artifacts
+ if (null != templateIdList && i>0 && i%2 == 0) {//Should this be changed to 3 to account for 3 artifacts
modelInd++;
}
- if (null != vnfcTypeList && i>0 && i%3==0) {
+ if (null != vnfcTypeList && i>0 && i%3 == 0) {
//TDP 517180 - CD tool has made changes to send 3 artifacts instead of 2
vnfcRefInd++;
}
@@ -482,18 +482,18 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
if (null != templateIdList && modelInd < templateIdList.length()) {
model = templateIdList.getString(modelInd);
- log.info("Model is ::: "+model+" ,modelInd = "+modelInd);
+ log.info("Model is ::: "+model+" ,modelInd = " + modelInd);
}
if (null != vnfcTypeList && vnfcRefInd < vnfcTypeList.length() ) {
String vnfcType = vnfcTypeList.getString(vnfcRefInd);
if (StringUtils.isNotBlank(vnfcType)) {
context.setAttribute(VNFC_TYPE, vnfcType);
}
- log.info("Setting vnfc type from vnfc-type-list ::"+vnfcType);
+ log.info("Setting vnfc type from vnfc-type-list ::" + vnfcType);
}
if (StringUtils.isNotBlank(model)) {
dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context,
- DB_SDC_REFERENCE, model),model);
+ DB_SDC_REFERENCE, model), model);
}
else {
dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context,
@@ -505,7 +505,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
if (pdFile) {
log.info("Sending information related to pdfile Artifact");
tryUpdateContext(dbservice, context, pdFile, suffix, model);
- pdFile=false;//set to false afterprocessing yang and Tosca
+ pdFile = false;//set to false afterprocessing yang and Tosca
}
}
@@ -754,4 +754,8 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
}
return null;
}
+
+ protected ArtifactProcessorImpl getArtifactProcessorImpl() {
+ return new ArtifactProcessorImpl();
+ }
}