diff options
author | Patrick Brady <pb071s@att.com> | 2017-06-01 10:45:37 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-06-02 13:05:15 -0700 |
commit | c7d0075d223eab9f89fd28853c4b138792059be9 (patch) | |
tree | 40aa3e41e598ea7a59bcf6899a2004c1abab11c2 /appc-asdc-listener/appc-asdc-listener-bundle | |
parent | 8aac2df744820304ee29354333661699e9695939 (diff) |
Merge of new rebased code
Change-Id: I9b8d1f69eb3e0af1935ed8304fea4bf54c1aac47
Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-asdc-listener/appc-asdc-listener-bundle')
6 files changed, 70 insertions, 61 deletions
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/pom.xml b/appc-asdc-listener/appc-asdc-listener-bundle/pom.xml index 1c5e7dd75..607ab7745 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/pom.xml +++ b/appc-asdc-listener/appc-asdc-listener-bundle/pom.xml @@ -1,7 +1,7 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <parent> <artifactId>appc-asdc-listener</artifactId> <groupId>org.openecomp.appc</groupId> @@ -31,12 +31,12 @@ <dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>sdc-distribution-client</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.openecomp.appc</groupId> - <artifactId>appc-dmaap-adapter-bundle</artifactId> + <artifactId>appc-message-adapter-api</artifactId> <version>${project.version}</version> </dependency> @@ -98,6 +98,35 @@ <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> + + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-tosca-lib</artifactId> + <version>${toscalib.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-parser-impl</artifactId> + <version>${odl.yangtools.version}</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> </dependencies> @@ -128,35 +157,15 @@ <Export-Package>org.openecomp.appc.sdc.listener</Export-Package> <Import-Package> org.openecomp.appc.licmgr, - org.openecomp.appc.adapter.dmaap, - !ch.qos.*, - !com.att.*, - !fj.*, - !groovy.lang, - !javax.jms, - !javax.mail.*, - !org.apache.log4j.*, - !org.codehaus.commons.compiler, - !org.codehaus.groovy.*, - !org.codehaus.janino, - !org.jasypt.*, - !org.yaml.snakeyaml.*, - !com.ibm.icu.text, - !org.apache.log, - !com.sun.faces.spi, + org.openecomp.appc.adapter.messaging.*, + com.att.eelf.*, *;resolution:=optional </Import-Package> <Embed-Dependency> - sdc-distribution-client, appc-common, - appc-dmaap-adapter-bundle, appc-license-manager-api, - snakeyaml, - logback-core, - logback-classic, eelf-core, - saClientLibrary, - cambriaClient, - functionaljava, - httpcore,httpclient, - gson;scope=compile|runtime;inline=false + sdc-distribution-client,snakeyaml, + saClientLibrary,cambriaClient,saToolkit, + functionaljava,httpcore,httpclient,gson; + scope=compile|runtime;inline=false </Embed-Dependency> <Embed-Transitive>true</Embed-Transitive> </instructions> diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java index 651ea282c..5084771f1 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java +++ b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java @@ -21,26 +21,25 @@ package org.openecomp.appc.sdc.listener; -import java.net.URI; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.openecomp.appc.adapter.dmaap.EventSender; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.openecomp.appc.adapter.message.EventSender; import org.openecomp.sdc.api.IDistributionClient; import org.openecomp.sdc.api.consumer.INotificationCallback; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; +import java.net.URI; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + public class AsdcCallback implements INotificationCallback { private final EELFLogger logger = EELFManager.getInstance().getLogger(AsdcCallback.class); diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java index e73b90695..f415e2ef1 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java +++ b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java @@ -21,17 +21,12 @@ package org.openecomp.appc.sdc.listener; -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.openecomp.sdc.api.consumer.IConfiguration; -import org.openecomp.sdc.utils.ArtifactTypeEnum; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import org.openecomp.sdc.api.consumer.IConfiguration; + +import java.net.URI; +import java.util.*; public class AsdcConfig implements IConfiguration { @@ -106,6 +101,11 @@ public class AsdcConfig implements IConfiguration { return false; } + //@Override + public boolean isFilterInEmptyResources() { + return false; + } + @Override public String getAsdcAddress() { return host; diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java index 2d6192749..762ec18eb 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java +++ b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java @@ -20,6 +20,8 @@ */ package org.openecomp.appc.sdc.listener; +import org.openecomp.sdc.impl.DistributionClientFactory; +import org.openecomp.sdc.utils.DistributionActionResultEnum; import java.net.URL; import java.util.HashMap; @@ -37,7 +39,6 @@ import org.openecomp.sdc.utils.DistributionActionResultEnum; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; - public class AsdcListener { /** @@ -111,7 +112,7 @@ public class AsdcListener { Map<String, String> headers = new HashMap<>(); // TODO - Replace the header below to sdc's requirements. What should the new value be - headers.put("HTTP_CSP_ID", "test"); + headers.put("USER_ID", "test"); // TODO - How to format the url. Always same endpoint or ports? String host = config.getAsdcAddress(); diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/DownloadAndStoreOp.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/DownloadAndStoreOp.java index fcc5e7dda..a5a786f62 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/DownloadAndStoreOp.java +++ b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/DownloadAndStoreOp.java @@ -21,11 +21,11 @@ package org.openecomp.appc.sdc.listener; -import org.openecomp.appc.adapter.dmaap.EventSender; -import org.openecomp.appc.adapter.dmaap.DmaapDestination; -import org.openecomp.appc.adapter.dmaap.event.EventHeader; -import org.openecomp.appc.adapter.dmaap.event.EventMessage; -import org.openecomp.appc.adapter.dmaap.event.EventStatus; +import org.openecomp.appc.adapter.message.EventSender; +import org.openecomp.appc.adapter.message.MessageDestination; +import org.openecomp.appc.adapter.message.event.EventHeader; +import org.openecomp.appc.adapter.message.event.EventMessage; +import org.openecomp.appc.adapter.message.event.EventStatus; import org.openecomp.appc.exceptions.APPCException; import org.openecomp.appc.licmgr.Constants; import org.openecomp.appc.licmgr.LicenseManager; @@ -136,11 +136,10 @@ public class DownloadAndStoreOp implements Runnable { String vnfType = artifactPayload.get(RESOURCE_NAME.name()); String version = artifactPayload.get(RESOURCE_VERSION.name()); String packageArtifactID = artifactPayload.get(ARTIFACT_UUID.name()); - String packageArtifactVersion = artifactPayload.get(INTERNAL_VERSION.name()); try { - if (null == vnfType || null == version || null == packageArtifactID || null == packageArtifactVersion || vnfType.isEmpty() || version.isEmpty() || packageArtifactID.isEmpty() || packageArtifactVersion.isEmpty()) { - throw new APPCException(String.format("Missing information in ASDC request. Details: resource_type='%s', resource_version='%s', artifactID='%s', artifactVersion='%s'", vnfType, version, packageArtifactID, packageArtifactVersion)); + if (null == vnfType || null == version || null == packageArtifactID || vnfType.isEmpty() || version.isEmpty() || packageArtifactID.isEmpty()) { + throw new APPCException(String.format("Missing information in ASDC request. Details: resource_type='%s', resource_version='%s', artifactID='%s'", vnfType, version, packageArtifactID)); } Map<String, String> existingArtifactPayload = licenseService.retrieveLicenseModelData(vnfType, version); @@ -221,7 +220,7 @@ public class DownloadAndStoreOp implements Runnable { new EventHeader((new java.util.Date()).toString(), serviceVersion, distributionID), new EventStatus(401, errorDescription)); - eventSender.sendEvent(DmaapDestination.DCAE, eventMessage); + eventSender.sendEvent(MessageDestination.DCAE, eventMessage); } } diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java index 46efba438..87045b3e5 100644 --- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java +++ b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java @@ -20,6 +20,7 @@ */ package org.openecomp.appc.sdc.listener; +import org.openecomp.sdc.utils.DistributionStatusEnum; import org.json.JSONException; import org.json.JSONObject; |