Merge changes from topic 'bugfix/sdc-controller'
authorSébastien Determe <sd378r@intl.att.com>
Fri, 23 Mar 2018 14:00:47 +0000 (14:00 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 23 Mar 2018 14:00:47 +0000 (14:00 +0000)
* changes:
  Rework the SDC test
  Naming convention
  Sonar fixes

pom.xml
src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java [new file with mode: 0644]
src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
src/test/resources/application.properties
src/test/resources/example/dao/template-doc-content.json

diff --git a/pom.xml b/pom.xml
index 76a2214..3b2ebe1 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,7 @@
                                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 
                                <docker.mariadb.port.host>3306</docker.mariadb.port.host>
-                               <docker.http-cache.port.host>2080</docker.http-cache.port.host>
+                               <docker.http-cache.port.host>8085</docker.http-cache.port.host>
                                <project.scm.id>git-server</project.scm.id>
                                <java.version>1.8</java.version>
 
index c4abebd..d501504 100644 (file)
@@ -30,13 +30,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;\r
 \r
 import java.io.IOException;\r
-import java.security.GeneralSecurityException;\r
 import java.util.Date;\r
 import java.util.List;\r
 \r
 import javax.ws.rs.BadRequestException;\r
 \r
-import org.apache.commons.codec.DecoderException;\r
 import org.json.simple.JSONArray;\r
 import org.json.simple.JSONObject;\r
 import org.json.simple.parser.JSONParser;\r
@@ -46,6 +44,7 @@ import org.onap.clamp.clds.dao.CldsDao;
 import org.onap.clamp.clds.model.CldsEvent;\r
 import org.onap.clamp.clds.model.CldsModel;\r
 import org.onap.clamp.clds.model.DcaeEvent;\r
+import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse;\r
 import org.onap.clamp.clds.model.properties.Global;\r
 import org.onap.clamp.clds.model.properties.ModelProperties;\r
 import org.onap.clamp.clds.util.LoggingUtils;\r
@@ -61,7 +60,9 @@ public class DcaeInventoryServices {
     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);\r
     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();\r
     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();\r
-    private static final String DCAE_INVENTORY_URL = "dcae.inventory.url";\r
+    public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";\r
+    public static final String DCAE_TYPE_NAME = "typeName";\r
+    public static final String DCAE_TYPE_ID = "typeId";\r
     @Autowired\r
     private ClampProperties refProp;\r
     @Autowired\r
@@ -74,18 +75,13 @@ public class DcaeInventoryServices {
      *            The CldsModel\r
      * @param userId\r
      *            The user ID\r
-     * @throws GeneralSecurityException\r
-     *             In case of issue when decryting the DCAE password\r
      * @throws ParseException\r
      *             In case of DCAE Json parse exception\r
-     * @throws DecoderException\r
-     *             In case of issues with HexString decoding\r
      */\r
-    public void setEventInventory(CldsModel cldsModel, String userId)\r
-            throws GeneralSecurityException, ParseException, DecoderException {\r
+    public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException {\r
         String artifactName = cldsModel.getControlName();\r
         DcaeEvent dcaeEvent = new DcaeEvent();\r
-        String isDcaeInfoAvailable = null;\r
+        DcaeInventoryResponse dcaeResponse = null;\r
         Date startTime = new Date();\r
         LoggingUtils.setTargetContext("DCAE", "setEventInventory");\r
         if (artifactName != null) {\r
@@ -103,7 +99,7 @@ public class DcaeInventoryServices {
                 resourceUuid = resourceUuidList.get(0);\r
             }\r
             /* Inventory service url is called in this method */\r
-            isDcaeInfoAvailable = getDcaeInformation(artifactName, invariantServiceUuid, resourceUuid);\r
+            dcaeResponse = getDcaeInformation(artifactName, invariantServiceUuid, resourceUuid);\r
             /* set dcae events */\r
             dcaeEvent.setArtifactName(artifactName);\r
             dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION);\r
@@ -120,22 +116,21 @@ public class DcaeInventoryServices {
             LoggingUtils.setTimeContext(startTime, new Date());\r
             metricsLogger.info("setEventInventory complete");\r
         }\r
-        /* Null whether the DCAE has items lenght or not */\r
-        if (isDcaeInfoAvailable != null) {\r
-            /* Inserting Event in to DB */\r
-            logger.info(isDcaeInfoAvailable);\r
-            JSONParser parser = new JSONParser();\r
-            Object obj0 = parser.parse(isDcaeInfoAvailable);\r
-            JSONObject jsonObj = (JSONObject) obj0;\r
+        this.analyzeAndSaveDcaeResponse(dcaeResponse, cldsModel, dcaeEvent, userId);\r
+    }\r
+\r
+    private void analyzeAndSaveDcaeResponse(DcaeInventoryResponse dcaeResponse, CldsModel cldsModel,\r
+            DcaeEvent dcaeEvent, String userId) throws ParseException {\r
+        if (dcaeResponse != null) {\r
+            logger.info("Dcae Response for query on inventory: " + dcaeResponse);\r
             String oldTypeId = cldsModel.getTypeId();\r
             String newTypeId = "";\r
-            if (jsonObj.get("typeId") != null) {\r
-                newTypeId = jsonObj.get("typeId").toString();\r
-                cldsModel.setTypeId(jsonObj.get("typeId").toString());\r
+            if (dcaeResponse.getTypeId() != null) {\r
+                newTypeId = dcaeResponse.getTypeId();\r
+                cldsModel.setTypeId(dcaeResponse.getTypeId());\r
             }\r
-            // cldsModel.setTypeName(cldsModel.getControlName().toString()+".yml");\r
-            if (jsonObj.get("typeName") != null) {\r
-                cldsModel.setTypeName(jsonObj.get("typeName").toString());\r
+            if (dcaeResponse.getTypeName() != null) {\r
+                cldsModel.setTypeName(dcaeResponse.getTypeName());\r
             }\r
             if (oldTypeId == null || !oldTypeId.equalsIgnoreCase(newTypeId)\r
                     || cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {\r
@@ -157,13 +152,13 @@ public class DcaeInventoryServices {
      *            The service UUID\r
      * @param resourceUuid\r
      *            The resource UUID\r
-     * @return The DCAE inventory for the artifact\r
+     * @return The DCAE inventory for the artifact in DcaeInventoryResponse\r
      * @throws IOException\r
      *             In case of issues with the stream\r
      * @throws ParseException\r
      *             In case of issues with the Json parsing\r
      */\r
-    public String getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)\r
+    public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)\r
             throws IOException, ParseException {\r
         Date startTime = new Date();\r
         LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");\r
@@ -171,25 +166,23 @@ public class DcaeInventoryServices {
                 + artifactName;\r
         String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types" + queryString;\r
         logger.info("Dcae Inventory Service full url - " + fullUrl);\r
-        String daceInventoryResponse = null;\r
+        String dcaeInventoryResponse = null;\r
         String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);\r
         JSONParser parser = new JSONParser();\r
         Object obj0 = parser.parse(responseStr);\r
         JSONObject jsonObj = (JSONObject) obj0;\r
         Long totalCount = (Long) jsonObj.get("totalCount");\r
         int numServices = totalCount.intValue();\r
-        if (numServices == 0) {\r
-            daceInventoryResponse = null;\r
-        } else if (numServices > 0) {\r
+        if (numServices > 0) {\r
             JSONArray itemsArray = (JSONArray) jsonObj.get("items");\r
             JSONObject dcaeServiceType0 = (JSONObject) itemsArray.get(0);\r
-            daceInventoryResponse = dcaeServiceType0.toString();\r
-            logger.info(daceInventoryResponse);\r
+            dcaeInventoryResponse = dcaeServiceType0.toString();\r
+            logger.info("getDcaeInformation, answer from DCAE inventory:" + dcaeInventoryResponse);\r
         }\r
         LoggingUtils.setResponseContext("0", "Get Dcae Information success", this.getClass().getName());\r
         LoggingUtils.setTimeContext(startTime, new Date());\r
         metricsLogger.info("getDcaeInformation complete: number services returned=" + numServices);\r
-        return daceInventoryResponse;\r
+        return new ObjectMapper().readValue(dcaeInventoryResponse, DcaeInventoryResponse.class);\r
     }\r
 \r
     /**\r
diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
new file mode 100644 (file)
index 0000000..b0a784c
--- /dev/null
@@ -0,0 +1,53 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.model.dcae;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * This class maps the DCAE inventory answer to a nice pojo.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class DcaeInventoryResponse {
+
+    private String typeName;
+    private String typeId;
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    public String getTypeId() {
+        return typeId;
+    }
+
+    public void setTypeId(String typeId) {
+        this.typeId = typeId;
+    }
+}
index f8fef39..c02edbb 100644 (file)
@@ -56,20 +56,24 @@ import org.openecomp.sdc.utils.DistributionStatusEnum;
 public class SdcSingleController {\r
 \r
     private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSingleController.class);\r
-    protected boolean isAsdcClientAutoManaged = false;\r
-    protected CsarInstaller csarInstaller;\r
-    protected ClampProperties refProp;\r
+    private boolean isSdcClientAutoManaged = false;\r
+    private CsarInstaller csarInstaller;\r
+    private ClampProperties refProp;\r
     public static final String CONFIG_SDC_FOLDER = "sdc.csarFolder";\r
+    private int nbOfNotificationsOngoing = 0;\r
+    private SdcSingleControllerStatus controllerStatus = SdcSingleControllerStatus.STOPPED;\r
+    private SdcSingleControllerConfiguration sdcConfig;\r
+    private IDistributionClient distributionClient;\r
 \r
     /**\r
      * Inner class for Notification callback\r
      */\r
-    private final class ASDCNotificationCallBack implements INotificationCallback {\r
+    private final class SdcNotificationCallBack implements INotificationCallback {\r
 \r
-        private SdcSingleController asdcController;\r
+        private SdcSingleController sdcController;\r
 \r
-        ASDCNotificationCallBack(SdcSingleController controller) {\r
-            asdcController = controller;\r
+        SdcNotificationCallBack(SdcSingleController controller) {\r
+            sdcController = controller;\r
         }\r
 \r
         /**\r
@@ -79,23 +83,27 @@ public class SdcSingleController {
         @Override\r
         public void activateCallback(INotificationData iNotif) {\r
             Date startTime = new Date();\r
-            String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources().size();\r
+            String event = "Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size();\r
             logger.debug(event);\r
-            asdcController.treatNotification(iNotif);\r
+            sdcController.treatNotification(iNotif);\r
             LoggingUtils.setTimeContext(startTime, new Date());\r
             LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",\r
                     this.getClass().getName());\r
         }\r
     }\r
 \r
-    // ***** Controller STATUS code\r
-    protected int nbOfNotificationsOngoing = 0;\r
-\r
     public int getNbOfNotificationsOngoing() {\r
         return nbOfNotificationsOngoing;\r
     }\r
 \r
-    private SdcSingleControllerStatus controllerStatus = SdcSingleControllerStatus.STOPPED;\r
+    private void changeControllerStatusIdle() {\r
+        if (this.nbOfNotificationsOngoing > 1) {\r
+            --this.nbOfNotificationsOngoing;\r
+        } else {\r
+            this.nbOfNotificationsOngoing = 0;\r
+            this.controllerStatus = SdcSingleControllerStatus.IDLE;\r
+        }\r
+    }\r
 \r
     protected final synchronized void changeControllerStatus(SdcSingleControllerStatus newControllerStatus) {\r
         switch (newControllerStatus) {\r
@@ -104,12 +112,7 @@ public class SdcSingleController {
                 this.controllerStatus = newControllerStatus;\r
                 break;\r
             case IDLE:\r
-                if (this.nbOfNotificationsOngoing > 1) {\r
-                    --this.nbOfNotificationsOngoing;\r
-                } else {\r
-                    this.nbOfNotificationsOngoing = 0;\r
-                    this.controllerStatus = newControllerStatus;\r
-                }\r
+                this.changeControllerStatusIdle();\r
                 break;\r
             default:\r
                 this.controllerStatus = newControllerStatus;\r
@@ -121,13 +124,9 @@ public class SdcSingleController {
         return this.controllerStatus;\r
     }\r
 \r
-    // ***** END of Controller STATUS code\r
-    protected SdcSingleControllerConfiguration sdcConfig;\r
-    private IDistributionClient distributionClient;\r
-\r
     public SdcSingleController(ClampProperties clampProp, CsarInstaller csarInstaller,\r
             SdcSingleControllerConfiguration sdcSingleConfig, boolean isClientAutoManaged) {\r
-        this.isAsdcClientAutoManaged = isClientAutoManaged;\r
+        this.isSdcClientAutoManaged = isClientAutoManaged;\r
         this.sdcConfig = sdcSingleConfig;\r
         this.refProp = clampProp;\r
         this.csarInstaller = csarInstaller;\r
@@ -151,9 +150,9 @@ public class SdcSingleController {
         if (this.distributionClient == null) {\r
             distributionClient = DistributionClientFactory.createDistributionClient();\r
         }\r
-        IDistributionClientResult result = this.distributionClient.init(sdcConfig, new ASDCNotificationCallBack(this));\r
+        IDistributionClientResult result = this.distributionClient.init(sdcConfig, new SdcNotificationCallBack(this));\r
         if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {\r
-            logger.error("ASDC distribution client init failed with reason:" + result.getDistributionMessageResult());\r
+            logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult());\r
             this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);\r
             throw new SdcControllerException("Initialization of the SDC Controller failed with reason: "\r
                     + result.getDistributionMessageResult());\r
@@ -177,15 +176,15 @@ public class SdcSingleController {
      */\r
     public void closeSdc() throws SdcControllerException {\r
         if (this.getControllerStatus() == SdcSingleControllerStatus.BUSY) {\r
-            throw new SdcControllerException("Cannot close the ASDC controller as it's currently in BUSY state");\r
+            throw new SdcControllerException("Cannot close the SDC controller as it's currently in BUSY state");\r
         }\r
         if (this.distributionClient != null) {\r
             this.distributionClient.stop();\r
             // If auto managed we can set it to Null, SdcController controls it.\r
             // In the other case the client of this class has specified it, so\r
             // we can't reset it\r
-            if (isAsdcClientAutoManaged) {\r
-                // Next init will initialize it with a new Sdc Client\r
+            if (isSdcClientAutoManaged) {\r
+                // Next init will initialize it with a new SDC Client\r
                 this.distributionClient = null;\r
             }\r
         }\r
@@ -207,38 +206,39 @@ public class SdcSingleController {
                     refProp.getStringValue(CONFIG_SDC_FOLDER));\r
             if (csarInstaller.isCsarAlreadyDeployed(csar)) {\r
                 csar.save(downloadTheArtifact(csar.getArtifactElement()));\r
-                this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
+                this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
                         sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_OK, null,\r
                         System.currentTimeMillis());\r
                 csarInstaller.installTheCsar(csar);\r
-                this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
+                this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
                         sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_OK, null,\r
                         System.currentTimeMillis());\r
             } else {\r
-                this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
+                this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
                         sdcConfig.getConsumerID(), iNotif.getDistributionID(),\r
                         DistributionStatusEnum.ALREADY_DOWNLOADED, null, System.currentTimeMillis());\r
-                this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
+                this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
                         sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.ALREADY_DEPLOYED,\r
                         null, System.currentTimeMillis());\r
             }\r
         } catch (SdcArtifactInstallerException e) {\r
             logger.error("SdcArtifactInstallerException exception caught during the notification processing", e);\r
-            this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
+            this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
                     sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,\r
                     e.getMessage(), System.currentTimeMillis());\r
         } catch (SdcDownloadException e) {\r
             logger.error("SdcDownloadException exception caught during the notification processing", e);\r
-            this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
+            this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
                     sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR,\r
                     e.getMessage(), System.currentTimeMillis());\r
         } catch (CsarHandlerException e) {\r
             logger.error("CsarHandlerException exception caught during the notification processing", e);\r
-            this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),\r
-                    sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR,\r
-                    e.getMessage(), System.currentTimeMillis());\r
+            this.sendSdcNotification(NotificationType.DOWNLOAD, null, sdcConfig.getConsumerID(),\r
+                    iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage(),\r
+                    System.currentTimeMillis());\r
         } catch (SdcToscaParserException e) {\r
-            this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
+            logger.error("SdcToscaParserException exception caught during the notification processing", e);\r
+            this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
                     sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,\r
                     e.getMessage(), System.currentTimeMillis());\r
         } catch (RuntimeException e) {\r
@@ -270,17 +270,17 @@ public class SdcSingleController {
                     + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);\r
         } else {\r
             throw new SdcDownloadException("Artifact " + artifact.getArtifactName()\r
-                    + " could not be downloaded from ASDC URL " + artifact.getArtifactURL() + " UUID "\r
+                    + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID "\r
                     + artifact.getArtifactUUID() + ")" + System.lineSeparator() + "Error message is "\r
                     + downloadResult.getDistributionMessageResult() + System.lineSeparator());\r
         }\r
         return downloadResult;\r
     }\r
 \r
-    private void sendASDCNotification(NotificationType notificationType, String artifactURL, String consumerID,\r
+    private void sendSdcNotification(NotificationType notificationType, String artifactURL, String consumerID,\r
             String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {\r
         String event = "Sending " + notificationType.name() + "(" + status.name() + ")"\r
-                + " notification to ASDC for artifact:" + artifactURL;\r
+                + " notification to SDC for artifact:" + artifactURL;\r
         if (errorReason != null) {\r
             event = event + "(" + errorReason + ")";\r
         }\r
@@ -291,27 +291,35 @@ public class SdcSingleController {
                     status, timestamp);\r
             switch (notificationType) {\r
                 case DOWNLOAD:\r
-                    if (errorReason != null) {\r
-                        this.distributionClient.sendDownloadStatus(message, errorReason);\r
-                    } else {\r
-                        this.distributionClient.sendDownloadStatus(message);\r
-                    }\r
+                    this.sendDownloadStatus(message, errorReason);\r
                     action = "sendDownloadStatus";\r
                     break;\r
                 case DEPLOY:\r
-                    if (errorReason != null) {\r
-                        this.distributionClient.sendDeploymentStatus(message, errorReason);\r
-                    } else {\r
-                        this.distributionClient.sendDeploymentStatus(message);\r
-                    }\r
+                    this.sendDeploymentStatus(message, errorReason);\r
                     action = "sendDeploymentdStatus";\r
                     break;\r
                 default:\r
                     break;\r
             }\r
         } catch (RuntimeException e) {\r
-            logger.warn("Unable to send the Sdc Notification (" + action + ") due to an exception", e);\r
+            logger.warn("Unable to send the SDC Notification (" + action + ") due to an exception", e);\r
+        }\r
+        logger.info("SDC Notification sent successfully(" + action + ")");\r
+    }\r
+\r
+    private void sendDownloadStatus(IDistributionStatusMessage message, String errorReason) {\r
+        if (errorReason != null) {\r
+            this.distributionClient.sendDownloadStatus(message, errorReason);\r
+        } else {\r
+            this.distributionClient.sendDownloadStatus(message);\r
+        }\r
+    }\r
+\r
+    private void sendDeploymentStatus(IDistributionStatusMessage message, String errorReason) {\r
+        if (errorReason != null) {\r
+            this.distributionClient.sendDeploymentStatus(message, errorReason);\r
+        } else {\r
+            this.distributionClient.sendDeploymentStatus(message);\r
         }\r
-        logger.info("Sdc Notification sent successfully(" + action + ")");\r
     }\r
 }\r
index b113852..97ab058 100644 (file)
@@ -66,6 +66,7 @@ public class CsarHandler {
     private String blueprintInvariantResourceUuid;
     private String blueprintInvariantServiceUuid;
     public static final String CSAR_TYPE = "TOSCA_CSAR";
+    public static final String BLUEPRINT_TYPE = "DCAE_INVENTORY_BLUEPRINT";
     private INotificationData sdcNotification;
 
     public CsarHandler(INotificationData iNotif, String controller, String clampCsarPath) throws CsarHandlerException {
@@ -114,7 +115,7 @@ public class CsarHandler {
         for (IResourceInstance resource : this.getSdcNotification().getResources()) {
             if ("VF".equals(resource.getResourceType())) {
                 for (IArtifactInfo artifact : resource.getArtifacts()) {
-                    if ("DCAE_INVENTORY_BLUEPRINT".equals(artifact.getArtifactType())) {
+                    if (BLUEPRINT_TYPE.equals(artifact.getArtifactType())) {
                         blueprintArtifactName = artifact.getArtifactName();
                         blueprintInvariantResourceUuid = resource.getResourceInvariantUUID();
                     }
@@ -129,7 +130,7 @@ public class CsarHandler {
             Enumeration<? extends ZipEntry> entries = zipFile.entries();
             while (entries.hasMoreElements()) {
                 ZipEntry entry = entries.nextElement();
-                if (entry.getName().contains("DCAE_INVENTORY_BLUEPRINT")) {
+                if (entry.getName().contains(BLUEPRINT_TYPE)) {
                     listEntries.add(entry);
                 }
             }
index cb10072..4c6ed7f 100644 (file)
@@ -24,8 +24,6 @@
 package org.onap.clamp.clds.sdc.controller.installer;
 
 import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -57,7 +55,6 @@ import org.yaml.snakeyaml.Yaml;
  */
 public class CsarInstallerImpl implements CsarInstaller {
 
-    private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstallerImpl.class);
     private Map<String, BlueprintParserFilesConfiguration> bpmnMapping = new HashMap<>();
     public static final String TEMPLATE_NAME_PREFIX = "DCAE-Designer-ClosedLoopTemplate-";
     public static final String MODEL_NAME_PREFIX = "ClosedLoop-";
@@ -153,11 +150,11 @@ public class CsarInstallerImpl implements CsarInstaller {
 
     private String queryDcaeToGetServiceTypeId(CsarHandler csar) throws IOException, ParseException {
         return dcaeInventoryService.getDcaeInformation(csar.getBlueprintArtifactName(),
-                csar.getBlueprintInvariantServiceUuid(), csar.getBlueprintInvariantResourceUuid());
+                csar.getBlueprintInvariantServiceUuid(), csar.getBlueprintInvariantResourceUuid()).getTypeId();
     }
 
     private CldsTemplate createFakeCldsTemplate(CsarHandler csar, BlueprintParserFilesConfiguration configFiles)
-            throws IOException, SdcArtifactInstallerException {
+            throws IOException {
         CldsTemplate template = new CldsTemplate();
         template.setBpmnId("Sdc-Generated");
         template.setBpmnText(
@@ -184,9 +181,8 @@ public class CsarInstallerImpl implements CsarInstaller {
         cldsModel.setBlueprintText(csar.getDcaeBlueprint());
         cldsModel.setTemplateName(cldsTemplate.getName());
         cldsModel.setTemplateId(cldsTemplate.getId());
-        // cldsModel.setDocText(cldsTemplate.getPropText());
         cldsModel.setPropText("{\"global\":[{\"name\":\"service\",\"value\":[\""
-                + csar.getSdcNotification().getServiceInvariantUUID() + "\"]},{\"name\":\"vf\",\"value\":[\""
+                + csar.getBlueprintInvariantServiceUuid() + "\"]},{\"name\":\"vf\",\"value\":[\""
                 + csar.getBlueprintInvariantResourceUuid()
                 + "\"]},{\"name\":\"actionSet\",\"value\":[\"vnfRecipe\"]},{\"name\":\"location\",\"value\":[\"DC1\"]}]}");
         cldsModel.setBpmnText(cldsTemplate.getBpmnText());
index b64e6a0..40dffcd 100644 (file)
@@ -25,6 +25,7 @@ package org.onap.clamp.clds.it.sdc.controller.installer;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
@@ -47,28 +48,22 @@ import org.onap.clamp.clds.util.ResourceFileUtil;
 import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
 import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
 import org.openecomp.sdc.toscaparser.api.elements.Metadata;
-import org.skyscreamer.jsonassert.JSONAssert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.util.ReflectionTestUtils;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
 public class CsarInstallerItCase {
 
-    private static final String sdcFolder = "/tmp/csar-handler-tests";
-    private static final String csarArtifactName = "testArtifact.csar";
+    private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
+    private static final String SERVICE_UUID = "serviceUUID";
+    private static final String RESOURCE1_UUID = "resource1UUID";
     @Autowired
     private CsarInstaller csarInstaller;
     @Autowired
     private CldsDao cldsDao;
 
-    private void loadFile(String fileName) throws IOException {
-        ReflectionTestUtils.setField(csarInstaller, "blueprintMappingFile", fileName);
-        ((CsarInstallerImpl) csarInstaller).loadConfiguration();
-    }
-
     @Test(expected = SdcArtifactInstallerException.class)
     public void testInstallTheCsarFail()
             throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
@@ -79,10 +74,7 @@ public class CsarInstallerItCase {
         fail("Should have raised an SdcArtifactInstallerException");
     }
 
-    @Test(expected = SdcArtifactInstallerException.class)
-    public void testInstallTheCsarTca()
-            throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
-        String generatedName = RandomStringUtils.randomAlphanumeric(5);
+    private CsarHandler buildFakeCsarHandler(String generatedName) throws IOException {
         CsarHandler csarHandler = Mockito.mock(CsarHandler.class);
         Mockito.when(csarHandler.getDcaeBlueprint())
                 .thenReturn(ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml"));
@@ -91,7 +83,26 @@ public class CsarInstallerItCase {
         Mockito.when(data.getValue("name")).thenReturn(generatedName);
         Mockito.when(csarHelper.getServiceMetadata()).thenReturn(data);
         Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper);
+        Mockito.when(csarHandler.getBlueprintArtifactName()).thenReturn(CSAR_ARTIFACT_NAME);
+        Mockito.when(csarHandler.getBlueprintInvariantServiceUuid()).thenReturn(SERVICE_UUID);
+        Mockito.when(csarHandler.getBlueprintInvariantResourceUuid()).thenReturn(RESOURCE1_UUID);
+        return csarHandler;
+    }
+
+    @Test
+    public void testIsCsarAlreadyDeployedTca()
+            throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+        String generatedName = RandomStringUtils.randomAlphanumeric(5);
+        CsarHandler csarHandler = buildFakeCsarHandler(generatedName);
         csarInstaller.installTheCsar(csarHandler);
+        assertTrue(csarInstaller.isCsarAlreadyDeployed(csarHandler));
+    }
+
+    @Test
+    public void testInstallTheCsarTca()
+            throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+        String generatedName = RandomStringUtils.randomAlphanumeric(5);
+        csarInstaller.installTheCsar(buildFakeCsarHandler(generatedName));
         // Get the template back from DB
         CldsTemplate templateFromDB = CldsTemplate.retrieve(cldsDao,
                 CsarInstallerImpl.TEMPLATE_NAME_PREFIX + generatedName, false);
@@ -99,15 +110,16 @@ public class CsarInstallerItCase {
         assertNotNull(templateFromDB.getBpmnText());
         assertNotNull(templateFromDB.getImageText());
         assertNotNull(templateFromDB.getPropText());
+        assertTrue(templateFromDB.getPropText().contains("global")
+                && templateFromDB.getPropText().contains("node_templates:"));
         assertEquals(templateFromDB.getName(), CsarInstallerImpl.TEMPLATE_NAME_PREFIX + generatedName);
-        JSONAssert.assertEquals(templateFromDB.getPropText(),
-                ResourceFileUtil.getResourceAsString("example/dao/template-doc-content.json"), true);
         // Get the Model back from DB
-        CldsModel modelFromDB = CldsModel.retrieve(cldsDao, generatedName, false);
+        CldsModel modelFromDB = CldsModel.retrieve(cldsDao, generatedName, true);
         assertNotNull(modelFromDB);
         assertNotNull(modelFromDB.getBpmnText());
         assertNotNull(modelFromDB.getImageText());
         assertNotNull(modelFromDB.getPropText());
         assertEquals(modelFromDB.getName(), generatedName);
+        assertEquals(CsarInstallerImpl.MODEL_NAME_PREFIX, modelFromDB.getControlNamePrefix());
     }
 }
index 34805d8..c842068 100644 (file)
@@ -45,25 +45,29 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerExceptio
 import org.onap.clamp.clds.util.ResourceFileUtil;
 import org.openecomp.sdc.api.notification.IArtifactInfo;
 import org.openecomp.sdc.api.notification.INotificationData;
+import org.openecomp.sdc.api.notification.IResourceInstance;
 import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
 import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
 
 public class CsarHandlerTest {
 
-    private static final String sdcFolder = "/tmp/csar-handler-tests";
-    private static final String csarArtifactName = "testArtifact.csar";
+    private static final String SDC_FOLDER = "/tmp/csar-handler-tests";
+    private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
+    private static final String SERVICE_UUID = "serviceUUID";
+    private static final String RESOURCE1_UUID = "resource1UUID";
+    private static final String BLUEPRINT1_NAME = "blueprint1-name";
 
     @Test
     public void testConstructor() throws CsarHandlerException {
         IArtifactInfo serviceArtifact = Mockito.mock(IArtifactInfo.class);
         Mockito.when(serviceArtifact.getArtifactType()).thenReturn(CsarHandler.CSAR_TYPE);
-        Mockito.when(serviceArtifact.getArtifactName()).thenReturn(csarArtifactName);
+        Mockito.when(serviceArtifact.getArtifactName()).thenReturn(CSAR_ARTIFACT_NAME);
         List<IArtifactInfo> servicesList = new ArrayList<>();
         servicesList.add(serviceArtifact);
         INotificationData notifData = Mockito.mock(INotificationData.class);
         Mockito.when(notifData.getServiceArtifacts()).thenReturn(servicesList);
-        CsarHandler csar = new CsarHandler(notifData, "test-controller", sdcFolder);
-        assertEquals(sdcFolder + "/test-controller" + "/" + csarArtifactName, csar.getFilePath());
+        CsarHandler csar = new CsarHandler(notifData, "test-controller", SDC_FOLDER);
+        assertEquals(SDC_FOLDER + "/test-controller" + "/" + CSAR_ARTIFACT_NAME, csar.getFilePath());
     }
 
     @Test(expected = CsarHandlerException.class)
@@ -74,32 +78,61 @@ public class CsarHandlerTest {
         fail("Exception should have been raised");
     }
 
-    @Test
-    public void testSave()
-            throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+    private INotificationData buildFakeSdcNotification() {
+        // BUild what is needed for CSAR
         IArtifactInfo serviceArtifact = Mockito.mock(IArtifactInfo.class);
         Mockito.when(serviceArtifact.getArtifactType()).thenReturn(CsarHandler.CSAR_TYPE);
-        Mockito.when(serviceArtifact.getArtifactName()).thenReturn(csarArtifactName);
+        Mockito.when(serviceArtifact.getArtifactName()).thenReturn(CSAR_ARTIFACT_NAME);
         List<IArtifactInfo> servicesList = new ArrayList<>();
         servicesList.add(serviceArtifact);
         INotificationData notifData = Mockito.mock(INotificationData.class);
         Mockito.when(notifData.getServiceArtifacts()).thenReturn(servicesList);
-        CsarHandler csar = new CsarHandler(notifData, "test-controller", "/tmp/csar-handler-tests");
+        // Build what is needed for UUID
+        Mockito.when(notifData.getServiceInvariantUUID()).thenReturn(SERVICE_UUID);
+        // Build fake resource with one artifact BLUEPRINT
+        List<IResourceInstance> resourcesList = new ArrayList<>();
+        List<IArtifactInfo> artifactsListForResource = new ArrayList<>();
+        IResourceInstance resource1 = Mockito.mock(IResourceInstance.class);
+        Mockito.when(resource1.getResourceType()).thenReturn("VF");
+        Mockito.when(resource1.getResourceInvariantUUID()).thenReturn(RESOURCE1_UUID);
+        // Create a fake artifact for resource
+        IArtifactInfo blueprintArtifact = Mockito.mock(IArtifactInfo.class);
+        Mockito.when(blueprintArtifact.getArtifactType()).thenReturn(CsarHandler.BLUEPRINT_TYPE);
+        Mockito.when(blueprintArtifact.getArtifactName()).thenReturn(BLUEPRINT1_NAME);
+        artifactsListForResource.add(blueprintArtifact);
+        Mockito.when(resource1.getArtifacts()).thenReturn(artifactsListForResource);
+        resourcesList.add(resource1);
+        Mockito.when(notifData.getResources()).thenReturn(resourcesList);
+        return notifData;
+    }
+
+    private IDistributionClientDownloadResult buildFakeSdcResut() throws IOException {
         IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
         Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
                 IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
+        return resultArtifact;
+    }
+
+    @Test
+    public void testSave()
+            throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+        CsarHandler csar = new CsarHandler(buildFakeSdcNotification(), "test-controller", "/tmp/csar-handler-tests");
         // Test the save
-        csar.save(resultArtifact);
-        assertTrue((new File(sdcFolder + "/test-controller/" + csarArtifactName)).exists());
-        assertEquals(csarArtifactName, csar.getArtifactElement().getArtifactName());
+        csar.save(buildFakeSdcResut());
+        assertTrue((new File(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME)).exists());
+        assertEquals(CSAR_ARTIFACT_NAME, csar.getArtifactElement().getArtifactName());
         assertNotNull(csar.getSdcCsarHelper());
         // Test dcaeBlueprint
         String blueprint = csar.getDcaeBlueprint();
         assertNotNull(blueprint);
         assertTrue(!blueprint.isEmpty());
         assertTrue(blueprint.contains("DCAE-VES-PM-EVENT-v1"));
+        // Test additional properties from Sdc notif
+        assertEquals(BLUEPRINT1_NAME, csar.getBlueprintArtifactName());
+        assertEquals(RESOURCE1_UUID, csar.getBlueprintInvariantResourceUuid());
+        assertEquals(SERVICE_UUID, csar.getBlueprintInvariantServiceUuid());
         // Do some cleanup
-        Path path = Paths.get(sdcFolder + "/test-controller/" + csarArtifactName);
+        Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME);
         Files.deleteIfExists(path);
     }
 }
index 55666e5..37f9bd7 100644 (file)
@@ -190,10 +190,10 @@ clamp.config.action.insert.test.event=false
 clamp.config.clds.service.cache.invalidate.after.seconds=120\r
 \r
 #DCAE Inventory Url Properties\r
-clamp.config.dcae.inventory.url=http://dcae.api.simpledemo.onap.org:8080\r
+clamp.config.dcae.inventory.url=http://localhost:${docker.http-cache.port.host}\r
 \r
 #DCAE Dispatcher Url Properties\r
-clamp.config.dcae.dispatcher.url=http://dcae.api.simpledemo.onap.org:8080\r
+clamp.config.dcae.dispatcher.url=http://localhost:${docker.http-cache.port.host}\r
 clamp.config.dcae.header.requestId = X-ECOMP-RequestID\r
 \r
 #Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !\r
index 3b7e2df..0ee7122 100644 (file)
@@ -1 +1,104 @@
-{"global":[{"name":"service","value":["tosca_definitions_version: cloudify_dsl_1_3\r\nimports:\r\n- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\r\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml\r\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml\r\n- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml\r\ninputs:\r\n  location_id:\r\n    type: string\r\n  service_id:\r\n    type: string\r\n  policy_id:\r\n    type: string\r\nnode_templates:\r\n  policy_0:\r\n    type: dcae.nodes.policy\r\n    properties:\r\n      policy_id: \r\n        get_input: policy_id\r\n  cdap_host_host:\r\n    type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure\r\n    properties:\r\n      location_id:\r\n        get_input: location_id\r\n      scn_override: cdap_broker.solutioning-central.dcae.onap.org\r\n    interfaces:\r\n      cloudify.interfaces.lifecycle: {\r\n        }\r\n  tca_tca:\r\n    type: dcae.nodes.MicroService.cdap\r\n    properties:\r\n      app_config:\r\n        appDescription: DCAE Analytics Threshold Crossing Alert Application\r\n        appName: dcae-tca\r\n        tcaSubscriberOutputStreamName: TCASubscriberOutputStream\r\n        tcaVESAlertsTableName: TCAVESAlertsTable\r\n        tcaVESAlertsTableTTLSeconds: '1728000'\r\n        tcaVESMessageStatusTableName: TCAVESMessageStatusTable\r\n        tcaVESMessageStatusTableTTLSeconds: '86400'\r\n        thresholdCalculatorFlowletInstances: '2'\r\n      app_preferences:\r\n        publisherContentType: application/json\r\n        publisherHostName: mrlocal-mtnjftle01.onap.org\r\n        publisherHostPort: '3905'\r\n        publisherMaxBatchSize: '10'\r\n        publisherMaxRecoveryQueueSize: '100000'\r\n        publisherPollingInterval: '20000'\r\n        publisherProtocol: https\r\n        publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub\r\n        publisherUserName: m00502@tca.af.dcae.onap.org\r\n        publisherUserPassword: Te5021abc\r\n        subscriberConsumerGroup: OpenDCAE-c12\r\n        subscriberConsumerId: c12\r\n        subscriberContentType: application/json\r\n        subscriberHostName: mrlocal-mtnjftle01.onap.org\r\n        subscriberHostPort: '3905'\r\n        subscriberMessageLimit: '-1'\r\n        subscriberPollingInterval: '20000'\r\n        subscriberProtocol: https\r\n        subscriberTimeoutMS: '-1'\r\n        subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub\r\n        subscriberUserName: m00502@tca.af.dcae.onap.org\r\n        subscriberUserPassword: Te5021abc\r\n        tca_policy: null\r\n      artifact_name: dcae-analytics-tca\r\n      artifact_version: 1.0.0\r\n      connections:\r\n        streams_publishes: [\r\n          ]\r\n        streams_subscribes: [\r\n          ]\r\n      jar_url: http://somejar\r\n      location_id:\r\n        get_input: location_id\r\n      namespace: cdap_tca_hi_lo\r\n      programs:\r\n      - program_id: TCAVESCollectorFlow\r\n        program_type: flows\r\n      - program_id: TCADMaaPMRSubscriberWorker\r\n        program_type: workers\r\n      - program_id: TCADMaaPMRPublisherWorker\r\n        program_type: workers\r\n      service_component_type: cdap_app_tca\r\n      service_id:\r\n        get_input: service_id\r\n      streamname: TCASubscriberOutputStream\r\n    relationships:\r\n    - target: topic0\r\n      type: dcae.relationships.subscribe_to_events\r\n    - target: topic1\r\n      type: dcae.relationships.publish_events\r\n    - target: cdap_host_host\r\n      type: dcae.relationships.component_contained_in\r\n    - target: policy_0\r\n      type: dcae.relationships.depends_on\r\n  topic0:\r\n    type: dcae.nodes.Topic\r\n    properties:\r\n      topic_name: ''\r\n  topic1:\r\n    type: dcae.nodes.Topic\r\n    properties:\r\n      topic_name: ''\r\n"]}]}
\ No newline at end of file
+{"global":[{"name":"service","value":["tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml
+- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml
+- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml
+inputs:
+  location_id:
+    type: string
+  service_id:
+    type: string
+  policy_id:
+    type: string
+node_templates:
+  policy_0:
+    type: dcae.nodes.policy
+    properties:
+      policy_id: 
+        get_input: policy_id
+  cdap_host_host:
+    type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure
+    properties:
+      location_id:
+        get_input: location_id
+      scn_override: cdap_broker.solutioning-central.dcae.onap.org
+    interfaces:
+      cloudify.interfaces.lifecycle: {
+        }
+  tca_tca:
+    type: dcae.nodes.MicroService.cdap
+    properties:
+      app_config:
+        appDescription: DCAE Analytics Threshold Crossing Alert Application
+        appName: dcae-tca
+        tcaSubscriberOutputStreamName: TCASubscriberOutputStream
+        tcaVESAlertsTableName: TCAVESAlertsTable
+        tcaVESAlertsTableTTLSeconds: '1728000'
+        tcaVESMessageStatusTableName: TCAVESMessageStatusTable
+        tcaVESMessageStatusTableTTLSeconds: '86400'
+        thresholdCalculatorFlowletInstances: '2'
+      app_preferences:
+        publisherContentType: application/json
+        publisherHostName: mrlocal-mtnjftle01.onap.org
+        publisherHostPort: '3905'
+        publisherMaxBatchSize: '10'
+        publisherMaxRecoveryQueueSize: '100000'
+        publisherPollingInterval: '20000'
+        publisherProtocol: https
+        publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub
+        publisherUserName: m00502@tca.af.dcae.onap.org
+        publisherUserPassword: Te5021abc
+        subscriberConsumerGroup: OpenDCAE-c12
+        subscriberConsumerId: c12
+        subscriberContentType: application/json
+        subscriberHostName: mrlocal-mtnjftle01.onap.org
+        subscriberHostPort: '3905'
+        subscriberMessageLimit: '-1'
+        subscriberPollingInterval: '20000'
+        subscriberProtocol: https
+        subscriberTimeoutMS: '-1'
+        subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub
+        subscriberUserName: m00502@tca.af.dcae.onap.org
+        subscriberUserPassword: Te5021abc
+        tca_policy: null
+      artifact_name: dcae-analytics-tca
+      artifact_version: 1.0.0
+      connections:
+        streams_publishes: [
+          ]
+        streams_subscribes: [
+          ]
+      jar_url: http://somejar
+      location_id:
+        get_input: location_id
+      namespace: cdap_tca_hi_lo
+      programs:
+      - program_id: TCAVESCollectorFlow
+        program_type: flows
+      - program_id: TCADMaaPMRSubscriberWorker
+        program_type: workers
+      - program_id: TCADMaaPMRPublisherWorker
+        program_type: workers
+      service_component_type: cdap_app_tca
+      service_id:
+        get_input: service_id
+      streamname: TCASubscriberOutputStream
+    relationships:
+    - target: topic0
+      type: dcae.relationships.subscribe_to_events
+    - target: topic1
+      type: dcae.relationships.publish_events
+    - target: cdap_host_host
+      type: dcae.relationships.component_contained_in
+    - target: policy_0
+      type: dcae.relationships.depends_on
+  topic0:
+    type: dcae.nodes.Topic
+    properties:
+      topic_name: ''
+  topic1:
+    type: dcae.nodes.Topic
+    properties:
+      topic_name: ''
+      "]}]}
\ No newline at end of file