summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2017-02-07 14:21:32 -0500
committerDR695H <dr695h@att.com>2017-02-07 14:21:40 -0500
commitab9f3f111118a9ef5ca9cf302b690128023d6fce (patch)
tree8cf63d32159746ed4765677988ca21508642d02e
parentad79e6eed1a1497ddf3a6d252d77301f6122a0b8 (diff)
Initial OpenECOMP VID ASDC Client commit
Change-Id: I7ce3f07829106a386240325a67ab533f85332d42 Signed-off-by: DR695H <dr695h@att.com>
-rw-r--r--.gitreview4
-rw-r--r--pom.xml141
-rw-r--r--src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java58
-rw-r--r--src/main/java/org/openecomp/vid/asdc/AsdcClient.java128
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/Artifact.java277
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/Resource.java407
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/Service.java351
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/SubResource.java175
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java140
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java135
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java48
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java125
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java113
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java157
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java120
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java53
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java101
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java124
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java101
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java122
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java390
-rw-r--r--src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java166
-rw-r--r--src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java372
-rw-r--r--src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java450
-rw-r--r--src/test/java/org/openecomp/vid/asdc/Base64Encoder.java42
-rw-r--r--src/test/java/org/openecomp/vid/asdc/BaseClientTest.java323
-rw-r--r--src/test/java/org/openecomp/vid/asdc/FindServices.java127
-rw-r--r--src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java80
-rw-r--r--src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java107
-rw-r--r--src/test/resources/CI2-DEV30_DEMO.postman_collection.json228
-rw-r--r--src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json158
-rw-r--r--src/test/resources/asdc.properties4
-rw-r--r--src/test/resources/catalog.json174
-rw-r--r--src/test/resources/sampleTosca.csarbin0 -> 6177 bytes
34 files changed, 5501 insertions, 0 deletions
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..0d14df2
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.openecomp.org
+port=29418
+project=vid/asdcclient.git
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..18da850
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,141 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.vid</groupId>
+ <artifactId>asdcclient</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.2-SNAPSHOT</version>
+ <name>ASDC Client</name>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>2.8.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160212</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>3.1.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.16</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>att-external</id>
+
+ <distributionManagement>
+ <repository>
+ <id>vid-releases</id>
+ <name>VID Release Repository</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases</url>
+ </repository>
+ <snapshotRepository>
+ <id>vid-snapshots</id>
+ <name>VID Snapshot Repository</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots</url>
+ </snapshotRepository>
+ <!-- added for javadoc -->
+ <site>
+ <id>vid-javadoc</id>
+ <url>dav:https://ecomp-nexus:8443/repository/vid-javadoc/${project.version}</url>
+ </site>
+ </distributionManagement>
+ </profile>
+
+ <profile>
+ <id>jenkins</id>
+
+ <activation>
+ <property>
+ <name>env.BUILD_NUMBER</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <formats>
+ <format>xml</format>
+ </formats>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>cobertura</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- added for javadoc -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+ </profiles>
+ <!-- added for javadoc -->
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
diff --git a/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java b/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
new file mode 100644
index 0000000..6a8ab91
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+/**
+ * The Class AsdcCatalogException.
+ */
+public class AsdcCatalogException extends Exception {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Instantiates a new asdc catalog exception.
+ *
+ * @param msg the msg
+ */
+ public AsdcCatalogException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Instantiates a new asdc catalog exception.
+ *
+ * @param cause the cause
+ */
+ public AsdcCatalogException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new asdc catalog exception.
+ *
+ * @param msg the msg
+ * @param t the t
+ */
+ public AsdcCatalogException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/AsdcClient.java b/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
new file mode 100644
index 0000000..ec5ba78
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.UUID;
+
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+
+/**
+ * The Interface AsdcClient.
+ */
+public interface AsdcClient {
+
+ /**
+ * Gets the resource.
+ *
+ * @param uuid the uuid
+ * @return the resource
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException;
+
+ /**
+ * Gets the resources.
+ *
+ * @param filter the filter
+ * @return the resources
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException;
+
+ /**
+ * Gets the resource artifact.
+ *
+ * @param resourceUuid the resource uuid
+ * @param artifactUuid the artifact uuid
+ * @return the resource artifact
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the resource tosca model.
+ *
+ * @param uuid the uuid
+ * @return the resource tosca model
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public ToscaCsar getResourceToscaModel(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the service.
+ *
+ * @param uuid the uuid
+ * @return the service
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the services.
+ *
+ * @return the services
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException;
+
+ /**
+ * Gets the services.
+ *
+ * @param filter the filter
+ * @return the services
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException;
+
+ /**
+ * Gets the service artifact.
+ *
+ * @param serviceUuid the service uuid
+ * @param artifactUuid the artifact uuid
+ * @return the service artifact
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the service tosca model.
+ *
+ * @param uuid the uuid
+ * @return the service tosca model
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public ToscaCsar getServiceToscaModel(UUID uuid) throws AsdcCatalogException;
+
+ //TODO: Collect TOSCA information from CSAR
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java b/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
new file mode 100644
index 0000000..b260abb
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
@@ -0,0 +1,277 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.UUID;
+
+/**
+ * The Class Artifact.
+ */
+public class Artifact {
+
+/*
+ * ASDC has widened this to a String type for 1610.
+ public enum Type {
+ HEAT,
+ HEAT_ENV,
+ HEAT_VOL,
+ HEAT_NET,
+ HEAT_NESTED,
+ HEAT_ARTIFACT,
+ YANG_XML,
+ VNF_CATALOG,
+ VF_LICENSE,
+ VENDOR_LICENSE,
+ ASSET_INVENTORY_PROFILE,
+ ASSET_QUERY_SPEC,
+ APPC_CONFIG,
+ VF_MODULES_METADATA,
+ DCAE_TOSCA,
+ DCAE_JSON,
+ DCAE_EMF,
+ DCAE_DOC,
+ DCAE_BLUEPRINT,
+ DCAE_EVENT,
+ DCAE_INVENTORY_TOSCA,
+ DCAE_INVENTORY_JSON,
+ DCAE_INVENTORY_EMF,
+ DCAE_INVENTORY_DOC,
+ DCAE_INVENTORY_BLUEPRINT,
+ DCAE_INVENTORY_EVENT,
+ OTHER,
+ AAI_SERVICE_MODEL //HEY! READ ME! YES, YOU! I AM A TEMPORARY FIX, PLEASE REMOVE ME BECAUSE I AM A FRAUD. I DON'T BELONG HERE.
+ //Warm Regards,
+ // *The* Artifact.Type.AAI_SERVICE_MODEL Constant
+ }
+ */
+
+ /** The artifact name. */
+private String artifactName;
+
+ /** The artifact type. */
+ private String artifactType;
+
+ /** The artifact URL. */
+ private String artifactURL;
+
+ /** The artifact description. */
+ private String artifactDescription;
+
+ /** The artifact timeout. */
+ private int artifactTimeout;
+
+ /** The artifact checksum. */
+ private String artifactChecksum;
+
+ /** The artifact UUID. */
+ private String artifactUUID;
+
+ /** The artifact version. */
+ private String artifactVersion;
+
+ /** The generated from UUID. */
+ private String generatedFromUUID;
+
+ /**
+ * Gets the artifact name.
+ *
+ * @return the artifact name
+ */
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ /**
+ * Gets the artifact type.
+ *
+ * @return the artifact type
+ */
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ /**
+ * Gets the artifact URL.
+ *
+ * @return the artifact URL
+ */
+ public String getArtifactURL() {
+ return artifactURL;
+ }
+
+ /**
+ * Gets the artifact description.
+ *
+ * @return the artifact description
+ */
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ /**
+ * Gets the artifact timeout.
+ *
+ * @return the artifact timeout
+ */
+ public int getArtifactTimeout() {
+ return artifactTimeout;
+ }
+
+ /**
+ * Gets the artifact checksum.
+ *
+ * @return the artifact checksum
+ */
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ /**
+ * Gets the artifact UUID.
+ *
+ * @return the artifact UUID
+ */
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ /**
+ * Gets the artifact version.
+ *
+ * @return the artifact version
+ */
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ /**
+ * Gets the generated from UUID.
+ *
+ * @return the generated from UUID
+ */
+ public String getGeneratedFromUUID() {
+ return generatedFromUUID;
+ }
+
+ /**
+ * Sets the artifact name.
+ *
+ * @param artifactName the new artifact name
+ */
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ /**
+ * Sets the artifact type.
+ *
+ * @param artifactType the new artifact type
+ */
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ /**
+ * Sets the artifact URL.
+ *
+ * @param artifactURL the new artifact URL
+ */
+ public void setArtifactURL(String artifactURL) {
+ this.artifactURL = artifactURL;
+ }
+
+ /**
+ * Sets the artifact description.
+ *
+ * @param artifactDescription the new artifact description
+ */
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ /**
+ * Sets the artifact timeout.
+ *
+ * @param artifactTimeout the new artifact timeout
+ */
+ public void setArtifactTimeout(int artifactTimeout) {
+ this.artifactTimeout = artifactTimeout;
+ }
+
+ /**
+ * Sets the artifact checksum.
+ *
+ * @param artifactChecksum the new artifact checksum
+ */
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ /**
+ * Sets the artifact UUID.
+ *
+ * @param artifactUUID the new artifact UUID
+ */
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ /**
+ * Sets the artifact version.
+ *
+ * @param artifactVersion the new artifact version
+ */
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ /**
+ * Sets the generated from UUID.
+ *
+ * @param generatedFromUUID the new generated from UUID
+ */
+ public void setGeneratedFromUUID(String generatedFromUUID) {
+ this.generatedFromUUID = generatedFromUUID;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getArtifactUUID());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Artifact)) return false;
+
+ final Artifact artifact = (Artifact) o;
+
+ return (artifact.getArtifactUUID().equals(getArtifactUUID()));
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/Resource.java b/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
new file mode 100644
index 0000000..94804a5
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
@@ -0,0 +1,407 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+import java.util.UUID;
+
+/**
+ * The Class Resource.
+ */
+public class Resource {
+
+ /**
+ * The Enum Type.
+ */
+ public enum Type {
+
+ /** The vf. */
+ VF,
+
+ /** The vfc. */
+ VFC,
+
+ /** The cp. */
+ CP,
+
+ /** The vl. */
+ VL
+ }
+
+ /**
+ * The Enum LifecycleState.
+ */
+ public enum LifecycleState {
+
+ /** The not certified checkout. */
+ NOT_CERTIFIED_CHECKOUT,
+
+ /** The not certified checkin. */
+ NOT_CERTIFIED_CHECKIN,
+
+ /** The ready for certification. */
+ READY_FOR_CERTIFICATION,
+
+ /** The certification in progress. */
+ CERTIFICATION_IN_PROGRESS,
+
+ /** The certified. */
+ CERTIFIED
+ }
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The sub category. */
+ private String subCategory;
+
+ /** The resource type. */
+ private Resource.Type resourceType;
+
+ /** The lifecycle state. */
+ private Resource.LifecycleState lifecycleState;
+
+ /** The last updater user uid. */
+ private String lastUpdaterUserId;
+
+ /** The last updater full name. */
+ private String lastUpdaterFullName;
+
+ /** The tosca model. */
+ private String toscaModel;
+
+ /** The tosca resource name. */
+ private String toscaResourceName;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /** The resources. */
+ private Collection<SubResource> resources;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the sub category.
+ *
+ * @return the sub category
+ */
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ /**
+ * Gets the resource type.
+ *
+ * @return the resource type
+ */
+ public Resource.Type getResourceType() {
+ return resourceType;
+ }
+
+ /**
+ * Gets the lifecycle state.
+ *
+ * @return the lifecycle state
+ */
+ public Resource.LifecycleState getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Gets the last updater user uid.
+ *
+ * @return the last updater user uid
+ */
+ public String getLastUpdaterUserId() {
+ return lastUpdaterUserId;
+ }
+
+ /**
+ * Gets the last updater full name.
+ *
+ * @return the last updater full name
+ */
+ public String getLastUpdaterFullName() {
+ return lastUpdaterFullName;
+ }
+
+ /**
+ * Gets the tosca model.
+ *
+ * @return the tosca model
+ */
+ public String getToscaModel() {
+ return toscaModel;
+ }
+
+ /**
+ * Gets the tosca resource name.
+ *
+ * @return the tosca resource name
+ */
+ public String getToscaResourceName() {
+ return toscaResourceName;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ */
+ public Collection<SubResource> getResources() {
+ return resources;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the sub category.
+ *
+ * @param subCategory the new sub category
+ */
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ /**
+ * Sets the resource type.
+ *
+ * @param resourceType the new resource type
+ */
+ public void setResourceType(Resource.Type resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * Sets the lifecycle state.
+ *
+ * @param lifecycleState the new lifecycle state
+ */
+ public void setLifecycleState(Resource.LifecycleState lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ /**
+ * Sets the last updater user uid.
+ *
+ * @param lastUpdaterUserId the new last updater user uid
+ */
+ public void setLastUpdaterUserId(String lastUpdaterUserId) {
+ this.lastUpdaterUserId = lastUpdaterUserId;
+ }
+
+ /**
+ * Sets the last updater full name.
+ *
+ * @param lastUpdaterFullName the new last updater full name
+ */
+ public void setLastUpdaterFullName(String lastUpdaterFullName) {
+ this.lastUpdaterFullName = lastUpdaterFullName;
+ }
+
+ /**
+ * Sets the tosca model.
+ *
+ * @param toscaModel the new tosca model
+ */
+ public void setToscaModel(String toscaModel) {
+ this.toscaModel = toscaModel;
+ }
+
+ /**
+ * Sets the tosca resource name.
+ *
+ * @param toscaResourceName the new tosca resource name
+ */
+ public void setToscaResourceName(String toscaResourceName) {
+ this.toscaResourceName = toscaResourceName;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * Sets the resources.
+ *
+ * @param resources the new resources
+ */
+ public void setResources(Collection<SubResource> resources) {
+ this.resources = resources;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Resource)) return false;
+
+ final Resource resource = (Resource) o;
+
+ return (resource.getUuid().equals(getUuid()));
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/Service.java b/src/main/java/org/openecomp/vid/asdc/beans/Service.java
new file mode 100644
index 0000000..da3d42d
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/Service.java
@@ -0,0 +1,351 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+import java.util.UUID;
+/**
+ * The Class Service.
+ */
+public class Service {
+
+ /**
+ * The Enum DistributionStatus.
+ */
+ public enum DistributionStatus {
+
+ /** The distribution not approved. */
+ DISTRIBUTION_NOT_APPROVED,
+
+ /** The distribution approved. */
+ DISTRIBUTION_APPROVED,
+
+ /** The distributed. */
+ DISTRIBUTED,
+
+ /** The distribution rejected. */
+ DISTRIBUTION_REJECTED
+ }
+
+ /**
+ * The Enum LifecycleState.
+ */
+ public enum LifecycleState {
+
+ /** The not certified checkout. */
+ NOT_CERTIFIED_CHECKOUT,
+
+ /** The not certified checkin. */
+ NOT_CERTIFIED_CHECKIN,
+
+ /** The ready for certification. */
+ READY_FOR_CERTIFICATION,
+
+ /** The certification in progress. */
+ CERTIFICATION_IN_PROGRESS,
+
+ /** The certified. */
+ CERTIFIED
+ }
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The lifecycle state. */
+ private Service.LifecycleState lifecycleState;
+
+ /** The last updater user uid. */
+ private String lastUpdaterUserId;
+
+ /** The last updater full name. */
+ private String lastUpdaterFullName;
+
+ /** The distribution status. */
+ private Service.DistributionStatus distributionStatus;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /** The resources. */
+ private Collection<SubResource> resources;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the lifecycle state.
+ *
+ * @return the lifecycle state
+ */
+ public Service.LifecycleState getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Gets the last updater user uid.
+ *
+ * @return the last updater user uid
+ */
+ public String getLastUpdaterUserId() {
+ return lastUpdaterUserId;
+ }
+
+ /**
+ * Gets the last updater full name.
+ *
+ * @return the last updater full name
+ */
+ public String getLastUpdaterFullName() {
+ return lastUpdaterFullName;
+ }
+
+ /**
+ * Gets the distribution status.
+ *
+ * @return the distribution status
+ */
+ public Service.DistributionStatus getDistributionStatus() {
+ return distributionStatus;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ */
+ public Collection<SubResource> getResources() {
+ return resources;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the lifecycle state.
+ *
+ * @param lifecycleState the new lifecycle state
+ */
+ public void setLifecycleState(Service.LifecycleState lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ /**
+ * Sets the last updater user uid.
+ *
+ * @param lastUpdaterUserId the new last updater user uid
+ */
+ public void setLastUpdaterUserId(String lastUpdaterUserId) {
+ this.lastUpdaterUserId = lastUpdaterUserId;
+ }
+
+ /**
+ * Sets the last updater full name.
+ *
+ * @param lastUpdaterFullName the new last updater full name
+ */
+ public void setLastUpdaterFullName(String lastUpdaterFullName) {
+ this.lastUpdaterFullName = lastUpdaterFullName;
+ }
+
+ /**
+ * Sets the distribution status.
+ *
+ * @param distributionStatus the new distribution status
+ */
+ public void setDistributionStatus(Service.DistributionStatus distributionStatus) {
+ this.distributionStatus = distributionStatus;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * Sets the resources.
+ *
+ * @param resources the new resources
+ */
+ public void setResources(Collection<SubResource> resources) {
+ this.resources = resources;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Service)) return false;
+
+ final Service service = (Service) o;
+
+ return (service.getUuid().equals(getUuid()));
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java b/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
new file mode 100644
index 0000000..2031e27
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+/**
+ * The Class SubResource.
+ */
+public class SubResource {
+
+ /** The resource instance name. */
+ private String resourceInstanceName;
+
+ /** The resource name. */
+ private String resourceName;
+
+ /** The resource invariant UUID. */
+ private String resourceInvariantUUID;
+
+ /** The resource version. */
+ private String resourceVersion;
+
+ /** The resource type. */
+ private String resourceType;
+
+ /** The resource UUID. */
+ private String resourceUUID;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /**
+ * Gets the resource instance name.
+ *
+ * @return the resource instance name
+ */
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+ /**
+ * Gets the resource name.
+ *
+ * @return the resource name
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * Gets the resource invariant UUID.
+ *
+ * @return the resource invariant UUID
+ */
+ public String getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
+
+ /**
+ * Gets the resource version.
+ *
+ * @return the resource version
+ */
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ /**
+ * Gets the resoucre type.
+ *
+ * @return the resoucre type
+ */
+ public String getResoucreType() {
+ return resourceType;
+ }
+
+ /**
+ * Gets the resource UUID.
+ *
+ * @return the resource UUID
+ */
+ public String getResourceUUID() {
+ return resourceUUID;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Sets the resource instance name.
+ *
+ * @param resourceInstanceName the new resource instance name
+ */
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+ /**
+ * Sets the resource name.
+ *
+ * @param resourceName the new resource name
+ */
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Sets the resource invariant UUID.
+ *
+ * @param resourceInvariantUUID the new resource invariant UUID
+ */
+ public void setResourceInvariantUUID(String resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
+
+ /**
+ * Sets the resource version.
+ *
+ * @param resourceVersion the new resource version
+ */
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ /**
+ * Sets the resoucre type.
+ *
+ * @param resourceType the new resoucre type
+ */
+ public void setResoucreType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * Sets the resource UUID.
+ *
+ * @param resourceUUID the new resource UUID
+ */
+ public void setResourceUUID(String resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
new file mode 100644
index 0000000..11e53ec
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The Class Capability.
+ */
+public class Capability {
+
+ /** The type. */
+ private String type; //FIXME: Make an enumeration?
+
+ /** The description. */
+ private String description;
+
+ /** The occurrences. */
+ private Collection<String> occurrences; //FIXME: Make an enumeration?
+
+ /** The properties. */
+ private Map<String, Property> properties;
+
+ /** The valid source types. */
+ private Collection<String> valid_source_types; //FIXME: Make an enumeration?
+
+ /**
+ * Instantiates a new capability.
+ */
+ public Capability() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the occurrences.
+ *
+ * @return the occurrences
+ */
+ public Collection<String> getOccurrences() {
+ return occurrences;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, Property> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Gets the valid source types.
+ *
+ * @return the valid source types
+ */
+ public Collection<String> getValid_source_types() {
+ return valid_source_types;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the occurrences.
+ *
+ * @param occurrences the new occurrences
+ */
+ public void setOccurrences(Collection<String> occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Property> properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Sets the valid source types.
+ *
+ * @param valid_source_types the new valid source types
+ */
+ public void setValid_source_types(Collection<String> valid_source_types) {
+ this.valid_source_types = valid_source_types;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
new file mode 100644
index 0000000..25db4d4
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The Class Group.
+ */
+public class Group {
+
+ /** The type. */
+ private String type;
+
+ /** The members. */
+ private Collection<String> members;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The vf module type. */
+ private String vf_module_type;
+
+ /** The properties. */
+ private Map<String, String> properties;
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the members.
+ *
+ * @return the members
+ */
+ public Collection<String> getMembers() {
+ return members;
+ }
+
+ /**
+ * Sets the members.
+ *
+ * @param members the new members
+ */
+ public void setMembers(Collection<String> members) {
+ this.members = members;
+ }
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the vf module type.
+ *
+ * @return the vf module type
+ */
+ public String getvf_module_type() {
+ return vf_module_type;
+ }
+
+ /**
+ * Sets the vf module type.
+ *
+ * @param vf_module_type the new vf module type
+ */
+ public void setvf_module_type(String vf_module_type) {
+ this.vf_module_type = vf_module_type;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
new file mode 100644
index 0000000..8fcd7e1
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Import.
+ */
+public class Import {
+
+ /** The file. */
+ private String file;
+
+ /**
+ * Gets the file.
+ *
+ * @return the file
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * Sets the file.
+ *
+ * @param file the new file
+ */
+ public void setFile(String file) {
+ this.file = file;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
new file mode 100644
index 0000000..8612181
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Input.
+ */
+public class Input {
+
+ /** The type. */
+ private String type;
+
+ /** The description. */
+ private String description;
+
+ /** The default. */
+ private Object _default;
+
+ /** The entry schema. */
+ private Input entry_schema;
+
+ /**
+ * Instantiates a new input.
+ */
+ public Input() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public Object getDefault() {
+ return _default;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void setDefault(Object _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Gets the entry schema.
+ *
+ * @return the entry schema
+ */
+ public Input getentry_schema() {
+ return entry_schema;
+ }
+
+ /**
+ * Sets the entry schema.
+ *
+ * @param entry_schema the new entry schema
+ */
+ public void setentry_schema(Input entry_schema) {
+ this.entry_schema = entry_schema;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "type=" + type + ",description=" + description + ",default=" + _default;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
new file mode 100644
index 0000000..89fac61
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Map;
+
+/**
+ * The Class NodeTemplate.
+ */
+public class NodeTemplate {
+
+ /** The type. */
+ private String type;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The properties. */
+ private Map<String, Object> properties; //HEAT?
+
+ /** The requirements. */
+ private Object requirements;
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Gets the requirements.
+ *
+ * @return the requirements
+ */
+ public Object getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * Sets the requirements.
+ *
+ * @param requirements the new requirements
+ */
+ public void setRequirements(Object requirements) {
+ this.requirements = requirements;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
new file mode 100644
index 0000000..171d0fd
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Property.
+ */
+public class Property {
+
+ /** The type. */
+ private String type;
+
+ /** The description. */
+ private String description;
+
+ /** The entry schema. */
+ private Schema entry_schema;
+
+ /** The default. */
+ private String _default;
+
+ /** The required. */
+ private boolean required;
+
+ /**
+ * Instantiates a new property.
+ */
+ private Property() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the entry schema.
+ *
+ * @return the entry schema
+ */
+ public Schema getEntry_schema() {
+ return entry_schema;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public String get_default() {
+ return _default;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the entry schema.
+ *
+ * @param entry_schema the new entry schema
+ */
+ public void setEntry_schema(Schema entry_schema) {
+ this.entry_schema = entry_schema;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void set_default(String _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public String getDefault() {
+ return _default;
+ }
+
+ /**
+ * Checks if is required.
+ *
+ * @return true, if is required
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void setDefault(String _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Sets the required.
+ *
+ * @param required the new required
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
new file mode 100644
index 0000000..c6089a4
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+
+/**
+ * The Class Requirement.
+ */
+public class Requirement {
+
+ /** The occurrences. */
+ private Collection<String> occurrences;
+
+ /** The capability. */
+ private String capability;
+
+ /** The node. */
+ private String node;
+
+ /** The relationship. */
+ private String relationship;
+
+ /**
+ * Instantiates a new requirement.
+ */
+ private Requirement() {}
+
+ /**
+ * Gets the occurrences.
+ *
+ * @return the occurrences
+ */
+ public Collection<String> getOccurrences() {
+ return occurrences;
+ }
+
+ /**
+ * Gets the capability.
+ *
+ * @return the capability
+ */
+ public String getCapability() {
+ return capability;
+ }
+
+ /**
+ * Gets the node.
+ *
+ * @return the node
+ */
+ public String getNode() {
+ return node;
+ }
+
+ /**
+ * Gets the relationship.
+ *
+ * @return the relationship
+ */
+ public String getRelationship() {
+ return relationship;
+ }
+
+ /**
+ * Sets the occurrences.
+ *
+ * @param occurrences the new occurrences
+ */
+ public void setOccurrences(Collection<String> occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ /**
+ * Sets the capability.
+ *
+ * @param capability the new capability
+ */
+ public void setCapability(String capability) {
+ this.capability = capability;
+ }
+
+ /**
+ * Sets the node.
+ *
+ * @param node the new node
+ */
+ public void setNode(String node) {
+ this.node = node;
+ }
+
+ /**
+ * Sets the relationship.
+ *
+ * @param relationship the new relationship
+ */
+ public void setRelationship(String relationship) {
+ this.relationship = relationship;
+ }
+
+
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
new file mode 100644
index 0000000..6eccfdf
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Schema.
+ */
+public class Schema {
+
+ /** The type. */
+ public String type;
+
+ /**
+ * Instantiates a new schema.
+ */
+ public Schema() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
new file mode 100644
index 0000000..2f2db43
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The Class SubstitutionMappings.
+ */
+public class SubstitutionMappings {
+
+ /** The node type. */
+ private String node_type;
+
+ /** The capabilities. */
+ private Map<String, Capability> capabilities;
+
+ /** The requirements. */
+ private Map<String, Requirement> requirements;
+
+ /**
+ * Instantiates a new substitution mappings.
+ */
+ public SubstitutionMappings() {
+ capabilities = new HashMap<String, Capability> ();
+ requirements = new HashMap<String, Requirement> ();
+ }
+
+ /**
+ * Gets the node type.
+ *
+ * @return the node type
+ */
+ public String getnode_type() {
+ return node_type;
+ }
+
+ /**
+ * Sets the node type.
+ *
+ * @param node_type the new node type
+ */
+ public void setnode_type(String node_type) {
+ this.node_type = node_type;
+ }
+
+ /**
+ * Gets the capabilities.
+ *
+ * @return the capabilities
+ */
+ public Map<String, Capability> getCapabilities() {
+ return capabilities;
+ }
+
+ /**
+ * Sets the capabilities.
+ *
+ * @param capabilities the capabilities
+ */
+ public void setCapabilities(Map<String, Capability> capabilities) {
+ this.capabilities = capabilities;
+ }
+
+ /**
+ * Gets the requirements.
+ *
+ * @return the requirements
+ */
+ public Map<String, Requirement> getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * Sets the requirements.
+ *
+ * @param requirements the requirements
+ */
+ public void setRequirements(Map<String, Requirement> requirements) {
+ this.requirements = requirements;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
new file mode 100644
index 0000000..efa2847
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The Class TopologyTemplate.
+ */
+public class TopologyTemplate {
+
+ /** The substitution mappings. */
+ private SubstitutionMappings substitution_mappings;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /** The node templates. */
+ private Map<String, NodeTemplate> node_templates;
+
+ /** The groups. */
+ private Map<String, Group> groups;
+
+ /**
+ * Instantiates a new topology template.
+ */
+ public TopologyTemplate() {
+ substitution_mappings = new SubstitutionMappings();
+ inputs = new HashMap<String, Input> ();
+ node_templates = new HashMap<String, NodeTemplate> ();
+ groups = new HashMap<String, Group> ();
+ }
+
+ /**
+ * Gets the substitution mappings.
+ *
+ * @return the substitution mappings
+ */
+ public SubstitutionMappings getsubstitution_mappings() {
+ return this.substitution_mappings;
+ }
+
+ /**
+ * Sets the substitution mappings.
+ *
+ * @param substitution_mappings the new substitution mappings
+ */
+ public void setsubstitution_mappings(SubstitutionMappings substitution_mappings) {
+ this.substitution_mappings = substitution_mappings;
+ }
+
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+
+ /**
+ * Gets the node templates.
+ *
+ * @return the node templates
+ */
+ public Map<String, NodeTemplate> getnode_templates() {
+ return node_templates;
+ }
+
+ /**
+ * Setnode templates.
+ *
+ * @param node_templates the node templates
+ */
+ public void setnode_templates(Map<String, NodeTemplate> node_templates) {
+ this.node_templates = node_templates;
+ }
+
+ /**
+ * Gets the groups.
+ *
+ * @return the groups
+ */
+ public Map<String, Group> getGroups() {
+ return groups;
+ }
+
+ /**
+ * Sets the groups.
+ *
+ * @param groups the groups
+ */
+ public void setGroups(Map<String, Group> groups) {
+ this.groups = groups;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
new file mode 100644
index 0000000..a294b19
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * The Class ToscaCsar.
+ */
+public class ToscaCsar {
+
+ /** The parent. */
+ private final ToscaModel parent;
+
+ /** The children. */
+ private final Collection<ToscaModel> children;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The parent. */
+ private final ToscaModel parent;
+
+ /** The children. */
+ private Collection<ToscaModel> children = new LinkedList<ToscaModel> ();
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param parent the parent
+ */
+ public Builder(ToscaModel parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Adds the vnf.
+ *
+ * @param child the child
+ * @return the builder
+ */
+ public Builder addVnf(ToscaModel child) {
+ children.add(child);
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the tosca csar
+ */
+ public ToscaCsar build() {
+ return new ToscaCsar(this);
+ }
+ }
+
+ /**
+ * Instantiates a new tosca csar.
+ *
+ * @param builder the builder
+ */
+ public ToscaCsar(Builder builder) {
+ this.parent = builder.parent;
+ this.children = builder.children;
+ }
+
+ /**
+ * Gets the parent.
+ *
+ * @return the parent
+ */
+ public ToscaModel getParent() { return parent; }
+
+ /**
+ * Gets the children.
+ *
+ * @return the children
+ */
+ public Collection<ToscaModel> getChildren() { return children; }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
new file mode 100644
index 0000000..5e74750
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+
+/**
+ * The Class ToscaMeta.
+ */
+public class ToscaMeta {
+
+ /** The metadata. */
+ private final Map<String, String> metadata;
+
+ /**
+ * Instantiates a new tosca meta.
+ *
+ * @param builder the builder
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private ToscaMeta(Builder builder) throws IOException, AsdcCatalogException {
+ metadata = new HashMap<String, String> ();
+
+ read(builder.inputStream);
+ }
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The input stream. */
+ private final InputStream inputStream;
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param inputStream the input stream
+ */
+ public Builder(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the tosca meta
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public ToscaMeta build() throws IOException, AsdcCatalogException {
+ return new ToscaMeta(this);
+ }
+ }
+
+ /**
+ * Gets the.
+ *
+ * @param property the property
+ * @return the string
+ */
+ public String get(String property) {
+ return metadata.get(property);
+ }
+
+ /**
+ * Read.
+ *
+ * @param inputStream the input stream
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private void read(InputStream inputStream) throws IOException, AsdcCatalogException {
+
+ final BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line;
+
+ try {
+ while ((line = br.readLine()) != null) {
+ final String[] entry = line.split(":");
+
+ if (entry.length != 2) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (more than 1 colon found on a single line");
+ if (!entry[1].startsWith(" ")) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (: not immediately followed by ' ')");
+
+ metadata.put(entry[0], entry[1].substring(1));
+ }
+ } catch (IOException e) {
+ metadata.clear();
+ throw e;
+ } catch (AsdcCatalogException e) {
+ metadata.clear();
+ throw e;
+ }
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
new file mode 100644
index 0000000..a48d676
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
@@ -0,0 +1,390 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class ToscaMetadata.
+ */
+public class ToscaMetadata {
+
+ /** The template name. */
+ private String template_name;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The version. */
+ private String version;
+
+ /** The name. */
+ private String name;
+
+ /** The description. */
+ private String description;
+
+ /** The category. */
+ private String category;
+
+ /** The subcategory. */
+ private String subcategory;
+
+ /** The type. */
+ private String type;
+
+ /** The resource vendor. */
+ private String resourceVendor;
+
+ /** The resource vendor release. */
+ private String resourceVendorRelease;
+
+ /** The service ecomp naming. */
+ private boolean serviceEcompNaming;
+
+ /** The service homing. */
+ private boolean serviceHoming;
+
+ /** The vf module model name. */
+ //ToscaMetadata for VF Modules
+ private String vfModuleModelName;
+
+ /** The vf module model invariant UUID. */
+ private String vfModuleModelInvariantUUID;
+
+ /** The vf module model UUID. */
+ private String vfModuleModelUUID;
+
+ /** The vf module model version. */
+ private String vfModuleModelVersion;
+
+ /**
+ * Instantiates a new tosca metadata.
+ */
+ public ToscaMetadata() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUUID() {
+ return uuid;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the subcategory.
+ *
+ * @return the subcategory
+ */
+ public String getSubcategory() {
+ return subcategory;
+ }
+
+ /**
+ * Gets the resource vendor.
+ *
+ * @return the resource vendor
+ */
+ public String getResourceVendor() {
+ return resourceVendor;
+ }
+
+ /**
+ * Gets the resource vendor release.
+ *
+ * @return the resource vendor release
+ */
+ public String getResourceVendorRelease() {
+ return resourceVendorRelease;
+ }
+
+ /**
+ * Checks if is service ecomp naming.
+ *
+ * @return true, if is service ecomp naming
+ */
+ public boolean isServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+
+ /**
+ * Checks if is service homing.
+ *
+ * @return true, if is service homing
+ */
+ public boolean isServiceHoming() {
+ return serviceHoming;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUUID(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the service ecomp naming.
+ *
+ * @param serviceEcompNaming the new service ecomp naming
+ */
+ public void setServiceEcompNaming(boolean serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+
+ /**
+ * Sets the service homing.
+ *
+ * @param serviceHoming the new service homing
+ */
+ public void setServiceHoming(boolean serviceHoming) {
+ this.serviceHoming = serviceHoming;
+ }
+
+ /**
+ * Gets the template name.
+ *
+ * @return the template name
+ */
+ public String gettemplate_name() {
+ return template_name;
+ }
+
+ /**
+ * Sets the template name.
+ *
+ * @param template_name the new template name
+ */
+ public void settemplate_name(String template_name) {
+ this.template_name = template_name;
+ }
+
+ /**
+ * Sets the subcategory.
+ *
+ * @param subcategory the new subcategory
+ */
+ public void setSubcategory(String subcategory) {
+ this.subcategory = subcategory;
+ }
+
+ /**
+ * Sets the resource vendor.
+ *
+ * @param resourceVendor the new resource vendor
+ */
+ public void setResourceVendor(String resourceVendor) {
+ this.resourceVendor = resourceVendor;
+ }
+
+ /**
+ * Sets the resource vendor release.
+ *
+ * @param resourceVendorRelease the new resource vendor release
+ */
+ public void setResourceVendorRelease(String resourceVendorRelease) {
+ this.resourceVendorRelease = resourceVendorRelease;
+ }
+
+ /**
+ * Gets the vf module model name.
+ *
+ * @return the vf module model name
+ */
+ public String getVfModuleModelName() {
+ return vfModuleModelName;
+ }
+
+ /**
+ * Sets the vf module model name.
+ *
+ * @param vfModuleModelName the new vf module model name
+ */
+ public void setVfModuleModelName(String vfModuleModelName) {
+ this.vfModuleModelName = vfModuleModelName;
+ }
+
+ /**
+ * Gets the vf module model invariant UUID.
+ *
+ * @return the vf module model invariant UUID
+ */
+ public String getVfModuleModelInvariantUUID() {
+ return vfModuleModelInvariantUUID;
+ }
+
+ /**
+ * Sets the vf module model invariant UUID.
+ *
+ * @param vfModuleModelInvariantUUID the new vf module model invariant UUID
+ */
+ public void setVfModuleModelInvariantUUID(String vfModuleModelInvariantUUID) {
+ this.vfModuleModelInvariantUUID = vfModuleModelInvariantUUID;
+ }
+
+ /**
+ * Gets the vf module model UUID.
+ *
+ * @return the vf module model UUID
+ */
+ public String getVfModuleModelUUID() {
+ return vfModuleModelUUID;
+ }
+
+ /**
+ * Sets the vf module model UUID.
+ *
+ * @param vfModuleModelUUID the new vf module model UUID
+ */
+ public void setVfModuleModelUUID(String vfModuleModelUUID) {
+ this.vfModuleModelUUID = vfModuleModelUUID;
+ }
+
+ /**
+ * Gets the vf module model version.
+ *
+ * @return the vf module model version
+ */
+ public String getVfModuleModelVersion() {
+ return vfModuleModelVersion;
+ }
+
+ /**
+ * Sets the vf module model version.
+ *
+ * @param vfModuleModelVersion the new vf module model version
+ */
+ public void setVfModuleModelVersion(String vfModuleModelVersion) {
+ this.vfModuleModelVersion = vfModuleModelVersion;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
new file mode 100644
index 0000000..f01f469
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * The Class ToscaModel.
+ */
+public class ToscaModel {
+
+ /** The tosca definitions version. */
+ private String tosca_definitions_version;
+
+ /** The description. */
+ private String description;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The topology template. */
+ private TopologyTemplate topology_template;
+
+ /** The imports. */
+ private Collection<Map<String, Map<String, String>>> imports;
+
+ /** The node types. */
+ private Map<String, Object> node_types;
+
+ /**
+ * Instantiates a new tosca model.
+ */
+ public ToscaModel() {
+ metadata = new ToscaMetadata();
+ topology_template = new TopologyTemplate();
+ imports = new LinkedList<Map<String, Map<String, String>>> ();
+ }
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the tosca definitions version.
+ *
+ * @return the tosca definitions version
+ */
+ public String gettosca_definitions_version() {
+ return tosca_definitions_version;
+ }
+
+ /**
+ * Sets the tosca definitions version.
+ *
+ * @param tosca_definitions_version the new tosca definitions version
+ */
+ public void settosca_definitions_version(String tosca_definitions_version) {
+ this.tosca_definitions_version = tosca_definitions_version;
+ }
+
+ /**
+ * Gets the topology template.
+ *
+ * @return the topology template
+ */
+ public TopologyTemplate gettopology_template() {
+ return topology_template;
+ }
+
+ /**
+ * Sets the topology template.
+ *
+ * @param topology_template the new topology template
+ */
+ public void settopology_template(TopologyTemplate topology_template) {
+ this.topology_template = topology_template;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the imports.
+ *
+ * @return the imports
+ */
+ public Collection<Map<String, Map<String, String>>> getImports() {
+ return imports;
+ }
+
+ /**
+ * Sets the imports.
+ *
+ * @param imports the imports
+ */
+ public void setImports(Collection<Map<String, Map<String, String>>> imports) {
+ this.imports = imports;
+ }
+
+ /**
+ * Gets the node types.
+ *
+ * @return the node types
+ */
+ public Map<String, Object> getnode_types() {
+ return node_types;
+ }
+
+ /**
+ * Setnode types.
+ *
+ * @param node_types the node types
+ */
+ public void setnode_types(Map<String, Object> node_types) {
+ this.node_types = node_types;
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java b/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
new file mode 100644
index 0000000..085eea8
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
@@ -0,0 +1,372 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.memory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.zip.ZipFile;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.yaml.snakeyaml.Yaml;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+
+/**
+ * The Class InMemoryAsdcClient.
+ */
+public class InMemoryAsdcClient implements AsdcClient {
+
+ /** The catalog. */
+ private final JSONObject catalog;
+
+ /** The mapper. */
+ private final ObjectMapper mapper;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The catalog. */
+ private JSONObject catalog = new JSONObject()
+ .put("resources", new JSONObject())
+ .put("services", new JSONObject());
+
+ /** The mapper. */
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {}
+
+ /**
+ * Catalog.
+ *
+ * @param catalog the catalog
+ * @return the builder
+ */
+ public Builder catalog(JSONObject catalog) {
+ this.catalog = catalog;
+ return this;
+ }
+
+ /**
+ * Mapper.
+ *
+ * @param mapper the mapper
+ * @return the builder
+ */
+ public Builder mapper(ObjectMapper mapper) {
+ this.mapper = mapper;
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the in memory asdc client
+ */
+ public InMemoryAsdcClient build() {
+ return new InMemoryAsdcClient(this);
+ }
+ }
+
+ /**
+ * Instantiates a new in memory asdc client.
+ *
+ * @param builder the builder
+ */
+ private InMemoryAsdcClient(Builder builder) {
+ catalog = builder.catalog;
+ mapper = builder.mapper;
+ }
+
+ /**
+ * Gets the catalog.
+ *
+ * @return the catalog
+ */
+ private JSONObject getCatalog() {
+ return catalog;
+ }
+
+ /**
+ * Gets the mapper.
+ *
+ * @return the mapper
+ */
+ private ObjectMapper getMapper() {
+ return mapper;
+ }
+
+ /**
+ * Convert.
+ *
+ * @param <T> the generic type
+ * @param json the json
+ * @param clazz the clazz
+ * @return the t
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private <T> T convert(JSONObject json, Class<T> clazz) throws AsdcCatalogException {
+ try {
+ return getMapper().readValue(json.toString(), clazz);
+ } catch (JsonParseException e) {
+ throw new AsdcCatalogException("Failed to parse ASDC response (bad data)", e);
+ } catch (JsonMappingException e) {
+ throw new AsdcCatalogException("Failed to map ASDC response to internal VID data structure(s)", e);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Failed to get a response from ASDC", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException {
+ final JSONObject resource = getCatalog().getJSONObject("resources")
+ .getJSONObject(uuid.toString());
+ return convert(resource, Resource.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources()
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException {
+ final Collection<Resource> resources = new LinkedList<Resource> ();
+
+ for (String key : getCatalog().getJSONObject("resources").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
+ final Resource resource = convert(json, Resource.class);
+ resources.add(resource);
+ }
+
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
+ final Collection<Resource> resources = new LinkedList<Resource> ();
+
+ for (String key : getCatalog().getJSONObject("resources").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
+
+ boolean filterMatch = true;
+
+ for (Entry<String, String[]> entry : filter.entrySet()) {
+ for (int i = 0; i < entry.getValue().length; i++) {
+ if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
+ filterMatch = false;
+ break;
+ }
+ }
+ }
+
+ if (filterMatch) resources.add(convert(json, Resource.class));
+ }
+
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException {
+ final JSONObject service = getCatalog().getJSONObject("services")
+ .getJSONObject(uuid.toString());
+ return convert(service, Service.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices()
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException {
+ final Collection<Service> services = new LinkedList<Service> ();
+
+ for (String key : getCatalog().getJSONObject("services").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
+ final Service service = convert(json, Service.class);
+ services.add(service);
+ }
+
+ return services;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecompt.vid.asdc.AsdcClient#getServices(java.util.Map)
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
+ final Collection<Service> services = new LinkedList<Service> ();
+
+ for (String key : getCatalog().getJSONObject("services").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
+
+ boolean filterMatch = true;
+
+ for (Entry<String, String[]> entry : filter.entrySet()) {
+ for (int i = 0; i < entry.getValue().length; i++) {
+ if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
+ filterMatch = false;
+ break;
+ }
+ }
+ }
+
+ if (filterMatch) services.add(convert(json, Service.class));
+ }
+
+ return services;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ final JSONArray artifacts = getCatalog().getJSONObject("resources")
+ .getJSONObject(resourceUuid.toString())
+ .getJSONArray("artifacts");
+
+ for (int i = 0; i < artifacts.length(); i++) {
+ final JSONObject artifact = artifacts.getJSONObject(i);
+
+ if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
+ return convert(artifact, Artifact.class);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ final JSONArray artifacts = getCatalog().getJSONObject("services")
+ .getJSONObject(serviceUuid.toString())
+ .getJSONArray("artifacts");
+
+ for (int i = 0; i < artifacts.length(); i++) {
+ final JSONObject artifact = artifacts.getJSONObject(i);
+
+ if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
+ return convert(artifact, Artifact.class);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
+ final String toscaModelURL = getCatalog().getJSONObject("resources")
+ .getJSONObject(resourceUuid.toString())
+ .getString("toscaModelURL");
+
+
+ final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
+
+ if (toscaModelStream == null) return null;
+
+ return getToscaModel(toscaModelStream);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
+ final String toscaModelURL = getCatalog().getJSONObject("services")
+ .getJSONObject(serviceUuid.toString())
+ .getString("toscaModelURL");
+
+ final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
+
+ if (toscaModelStream == null) return null;
+
+ return getToscaModel(toscaModelStream);
+ }
+
+ /**
+ * 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<String, Map<String, String>> imports : parentModel.getImports()) {
+ for (Entry<String, Map<String, String>> 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);
+ }
+ }
+}
diff --git a/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java b/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
new file mode 100644
index 0000000..49c24e9
--- /dev/null
+++ b/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
@@ -0,0 +1,450 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc.rest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.logging.Logger;
+import java.util.zip.ZipFile;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.ProcessingException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.error.YAMLException;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+/**
+ * The Class RestfulAsdcClient.
+ */
+public class RestfulAsdcClient implements AsdcClient {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = Logger.getLogger(RestfulAsdcClient.class.getName());
+
+ /** The client. */
+ private final Client client;
+
+ /** The uri. */
+ private final URI uri;
+
+ /** The common headers. */
+ private final MultivaluedHashMap<String, Object> commonHeaders;
+
+ /** The auth. */
+ private final String auth;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The client. */
+ private final Client client;
+
+ /** The uri. */
+ private final URI uri;
+
+ /** The auth. */
+ private String auth = null;
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param client the client
+ * @param uri the uri
+ */
+ public Builder(Client client, URI uri) {
+ this.client = client;
+ this.client.register(JacksonJsonProvider.class);
+ this.uri = uri;
+ }
+
+ /**
+ * Auth.
+ *
+ * @param auth the auth
+ * @return the builder
+ */
+ public Builder auth(String auth) {
+ this.auth = auth;
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the restful asdc client
+ */
+ public RestfulAsdcClient build() {
+ return new RestfulAsdcClient(this);
+ }
+ }
+
+ /**
+ * Instantiates a new restful asdc client.
+ *
+ * @param builder the builder
+ */
+ private RestfulAsdcClient(Builder builder) {
+ client = builder.client;
+ uri = builder.uri;
+ auth = builder.auth;
+
+ commonHeaders = new MultivaluedHashMap<String, Object> ();
+ commonHeaders.put("X-ECOMP-InstanceID", Collections.singletonList((Object) "VID"));
+ commonHeaders.put("Authorization", Collections.singletonList((Object) (auth)));
+ }
+
+ /**
+ * Gets the client.
+ *
+ * @return the client
+ */
+ private Client getClient() { return client; }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException {
+ try {
+ return getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/resources/" + uuid.toString() + "/metadata")
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Resource.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources()
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException {
+
+ try {
+ return getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/resources")
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Resource>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
+ WebTarget target = getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/resources");
+
+ for (Entry<String, String[]> filterEntry : filter.entrySet()) {
+ target = target.queryParam(filterEntry.getKey(), (Object []) filterEntry.getValue());
+ }
+
+ try {
+ return target.request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Resource>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (NotFoundException e) {
+ throw e;
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
+
+ try {
+ return getClient()
+ .target(uri)
+ .path("/asdc/v1/catalog/resources/" + resourceUuid + "/artifacts/" + artifactUuid)
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Artifact.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException {
+ try {
+ return getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/services/" + uuid.toString() + "/metadata")
+ .request(MediaType.APPLICATION_JSON)
+ .headers(commonHeaders)
+ .get(Service.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices()
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException {
+ try {
+ return getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/services")
+ .request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Service>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices(java.util.Map)
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
+ WebTarget target = getClient()
+ .target(uri)
+ .path("asdc/v1/catalog/services");
+
+
+ for (Entry<String, String[]> filterEntry : filter.entrySet()) {
+ target = target.queryParam(filterEntry.getKey(), (Object []) filterEntry.getValue());
+ }
+
+ try {
+ return target.request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Service>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (NotFoundException e) {
+ throw e;
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ try {
+ return getClient()
+ .target(uri)
+ .path("/asdc/v1/catalog/services/" + serviceUuid + "/artifacts/" + artifactUuid)
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Artifact.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
+ try (final InputStream csarInputStream = (InputStream) getClient()
+ .target(uri)
+ .path("/asdc/v1/catalog/resources/" + resourceUuid + "/toscaModel")
+ .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
+ .get(InputStream.class)) {
+
+ return getToscaModel(csarInputStream);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Failed to retrieve resource TOSCA model from ASDC", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
+ try {
+ final InputStream csarInputStream = (InputStream) getClient()
+ .target(uri)
+ .path("/asdc/v1/catalog/services/" + serviceUuid + "/toscaModel")
+ .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
+ .get(InputStream.class);
+
+ return getToscaModel(csarInputStream);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /**
+ * 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));
+
+ try {
+ final Yaml yaml = new Yaml();
+ final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
+
+ final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
+
+ for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
+ for (Entry<String, Map<String, String>> 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 (YAMLException e) {
+ throw new AsdcCatalogException("Caught exception while processing TOSCA YAML", e);
+ }
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
+ }
+ }
+}
diff --git a/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java b/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java
new file mode 100644
index 0000000..4c945d2
--- /dev/null
+++ b/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.util.Base64;
+
+/**
+ * The Class Base64Encoder.
+ */
+public class Base64Encoder {
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(String[] args) {
+ if (args.length != 2) throw new RuntimeException("Usage: Base64Encoder <user> <pass>");
+
+ final String user = args[0];
+ final String pass = args[1];
+ System.out.println(Base64.getEncoder().encodeToString((user + ":" + pass).getBytes()));
+ }
+}
diff --git a/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java b/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java
new file mode 100644
index 0000000..f564544
--- /dev/null
+++ b/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java
@@ -0,0 +1,323 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.NotFoundException;
+
+import org.hamcrest.core.IsEqual;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ErrorCollector;
+
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.Service.DistributionStatus;
+import org.openecomp.vid.asdc.beans.tosca.Group;
+import org.openecomp.vid.asdc.beans.tosca.Input;
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+
+/**
+ * The Class BaseClientTest.
+ */
+public class BaseClientTest {
+
+ /** The collector. */
+ @Rule
+ public ErrorCollector collector = new ErrorCollector();
+
+ /**
+ * Run resource tests.
+ *
+ * @param client the client
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ protected void runResourceTests(AsdcClient client) throws AsdcCatalogException {
+ final Collection<Resource> resources = client.getResources();
+
+ collector.checkThat("getResources() returned nothing", resources.isEmpty(), IsEqual.equalTo(false));
+
+ final Resource resource = resources.iterator().next();
+
+ testResource(resource);
+
+ final Resource thisResource = client.getResource(UUID.fromString(resource.getUuid()));
+
+ collector.checkThat(thisResource, IsEqual.equalTo(resource));
+
+ for (Resource aResource : resources) {
+ if (aResource.getArtifacts() != null && !aResource.getArtifacts().isEmpty()) {
+
+ final Artifact artifact = aResource.getArtifacts().iterator().next();
+
+ testArtifact(artifact);
+
+ final UUID resourceUuid = UUID.fromString(aResource.getUuid());
+ final UUID artifactUuid = UUID.fromString(artifact.getArtifactUUID());
+ final Artifact thisArtifact = client.getResourceArtifact(resourceUuid, artifactUuid);
+
+ collector.checkThat(artifact, IsEqual.equalTo(thisArtifact));
+ }
+ }
+
+ try {
+ final Collection<Resource> badResources = client.getResources(Collections.singletonMap("category", new String[] {"Bad Resources"}));
+
+ for (Resource badResource : badResources) {
+ collector.checkThat(badResource.getCategory(), IsEqual.equalTo("Bad Resources"));
+ }
+ } catch (NotFoundException e) {
+ //No resources of this category were found
+ }
+
+ try {
+ final Collection<Resource> reallyBadResources = client.getResources(Collections.singletonMap("subCategory", new String[] {"Really Bad Resources"}));
+
+ for (Resource reallyBadResource : reallyBadResources) {
+ collector.checkThat(reallyBadResource.getSubCategory(), IsEqual.equalTo("Really Bad Resources"));
+ }
+ } catch (NotFoundException e) {
+ //No resources of this subcategory were found
+ }
+
+ final ToscaCsar toscaCsar = client.getResourceToscaModel(UUID.fromString(resource.getUuid()));
+
+ testToscaCsar(toscaCsar);
+ }
+
+ /**
+ * Run service tests.
+ *
+ * @param client the client
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ protected void runServiceTests(AsdcClient client) throws AsdcCatalogException {
+ final Collection<Service> services = client.getServices();
+
+ collector.checkThat("getServices() returned nothing", services.isEmpty(), IsEqual.equalTo(false));
+
+ final Service service = services.iterator().next();
+
+ testService(service);
+
+ final Service thisService = client.getService(UUID.fromString(service.getUuid()));
+
+ collector.checkThat(thisService, IsEqual.equalTo(service));
+
+ for (Service aService : services) {
+ if (aService.getArtifacts() != null && ! aService.getArtifacts().isEmpty()) {
+ final Artifact artifact = aService.getArtifacts().iterator().next();
+
+ testArtifact(artifact);
+
+ final UUID serviceUuid = UUID.fromString(aService.getUuid());
+ final UUID artifactUuid = UUID.fromString(artifact.getArtifactUUID());
+ final Artifact thisArtifact = client.getServiceArtifact(serviceUuid, artifactUuid);
+
+ collector.checkThat(artifact, IsEqual.equalTo(thisArtifact));
+ break;
+ }
+ }
+
+ try {
+ final Collection<Service> distributedServices = client.getServices(Collections.singletonMap("distributionStatus", new String[] {"DISTRIBUTED"}));
+
+ for (Service distributedService : distributedServices) {
+ collector.checkThat(distributedService.getDistributionStatus(), IsEqual.equalTo(DistributionStatus.DISTRIBUTED));
+ }
+ } catch (NotFoundException e) {
+ //No services of this distributionStatus were found
+ }
+
+ try {
+ final Collection<Service> badServices = client.getServices(Collections.singletonMap("category", new String[] {"Bad Services"}));
+
+ for (Service badService : badServices) {
+ collector.checkThat(badService.getCategory(), IsEqual.equalTo("Bad Services"));
+ }
+ } catch (NotFoundException e) {
+ //No services of this category were found
+ }
+
+ final ToscaCsar toscaCsar = client.getServiceToscaModel(UUID.fromString(service.getUuid()));
+
+ testToscaCsar(toscaCsar);
+ }
+
+ /**
+ * Test service.
+ *
+ * @param service the service
+ */
+ private void testService(Service service) {
+ service.getArtifacts();
+ service.getCategory();
+ service.getDistributionStatus();
+ service.getInvariantUUID();
+ service.getLastUpdaterUserId();
+ service.getLastUpdaterFullName();
+ service.getLifecycleState();
+ service.getName();
+ service.getResources();
+ service.getToscaModelURL();
+ service.getUuid();
+ service.getVersion();
+ }
+
+ /**
+ * Test resource.
+ *
+ * @param resource the resource
+ */
+ private void testResource(Resource resource) {
+ resource.getArtifacts();
+ resource.getCategory();
+ resource.getInvariantUUID();
+ resource.getLastUpdaterUserId();
+ resource.getLastUpdaterFullName();
+ resource.getLifecycleState();
+ resource.getName();
+ resource.getResources();
+ resource.getResourceType();
+ resource.getSubCategory();
+ resource.getToscaModel();
+ resource.getToscaModelURL();
+ resource.getToscaResourceName();
+ resource.getUuid();
+ resource.getVersion();
+ }
+
+ /**
+ * Test artifact.
+ *
+ * @param artifact the artifact
+ */
+ private void testArtifact(Artifact artifact) {
+ artifact.getArtifactChecksum();
+ artifact.getArtifactDescription();
+ artifact.getArtifactName();
+ artifact.getArtifactTimeout();
+ artifact.getArtifactType();
+ artifact.getArtifactURL();
+ artifact.getArtifactUUID();
+ artifact.getArtifactVersion();
+ artifact.getGeneratedFromUUID();
+ }
+
+ /**
+ * Test tosca csar.
+ *
+ * @param toscaCsar the tosca csar
+ */
+ private void testToscaCsar(ToscaCsar toscaCsar) {
+ testToscaModel(toscaCsar.getParent());
+
+ for (ToscaModel childModel : toscaCsar.getChildren()) {
+ testToscaModel(childModel);
+ }
+ }
+
+ /**
+ * Test tosca model.
+ *
+ * @param toscaModel the tosca model
+ */
+ private void testToscaModel(ToscaModel toscaModel) {
+
+ toscaModel.getDescription();
+ toscaModel.getMetadata().getCategory();
+ toscaModel.getMetadata().getDescription();
+ toscaModel.getMetadata().getInvariantUUID();
+ toscaModel.getMetadata().getName();
+ toscaModel.getMetadata().getType();
+ toscaModel.getMetadata().gettemplate_name();
+ toscaModel.getMetadata().getUUID();
+ toscaModel.getMetadata().getVersion();
+ toscaModel.getMetadata().isServiceEcompNaming();
+ toscaModel.getMetadata().isServiceHoming();
+
+ if (!toscaModel.gettopology_template().getInputs().isEmpty()) {
+ final Input input = toscaModel.gettopology_template().getInputs().values().iterator().next();
+ input.getDefault();
+ input.getDescription();
+ input.getType();
+ input.toString();
+ }
+
+ if (!toscaModel.gettopology_template().getnode_templates().isEmpty()) {
+ final NodeTemplate nodeTemplate = toscaModel.gettopology_template().getnode_templates().values().iterator().next();
+ nodeTemplate.getMetadata();
+ nodeTemplate.getProperties();
+ nodeTemplate.getRequirements();
+ nodeTemplate.getType();
+ }
+
+ if (!toscaModel.gettopology_template().getGroups().isEmpty()) {
+ final Group group = toscaModel.gettopology_template().getGroups().values().iterator().next();
+ group.getMembers();
+ group.getMetadata();
+ group.getType();
+ }
+
+ if (!toscaModel.getImports().isEmpty()) {
+ for (Map<String, Map<String, String>> imports : toscaModel.getImports()) {
+ imports.values().iterator().next().get("file");
+ }
+ }
+
+ toscaModel.gettopology_template().getsubstitution_mappings().getnode_type();
+
+ if (!toscaModel.gettopology_template().getsubstitution_mappings().getCapabilities().isEmpty()) {
+ toscaModel.gettopology_template().getsubstitution_mappings().getCapabilities();
+ }
+
+ toscaModel.gettosca_definitions_version();
+ }
+
+ /**
+ * Test try catch asdc catalog exception.
+ */
+ @Test
+ public void testTryCatchAsdcCatalogException() {
+ try {
+ throw new AsdcCatalogException("testing");
+ } catch (AsdcCatalogException e) {
+ Assert.assertEquals("testing", e.getMessage());
+ }
+
+ final Exception cause = new Exception();
+
+ try {
+ throw new AsdcCatalogException("testing", cause);
+ } catch (AsdcCatalogException e) {
+ Assert.assertEquals("testing", e.getMessage());
+ Assert.assertEquals(cause, e.getCause());
+ }
+ }
+}
diff --git a/src/test/java/org/openecomp/vid/asdc/FindServices.java b/src/test/java/org/openecomp/vid/asdc/FindServices.java
new file mode 100644
index 0000000..2eb325a
--- /dev/null
+++ b/src/test/java/org/openecomp/vid/asdc/FindServices.java
@@ -0,0 +1,127 @@
+package org.openecomp.vid.asdc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.Group;
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.vid.asdc.rest.RestfulAsdcClient;
+
+/**
+ * The Class FindServices.
+ */
+public class FindServices {
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws URISyntaxException the URI syntax exception
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public static void main(String[] args) throws IOException, URISyntaxException, AsdcCatalogException {
+
+ final InputStream propertiesFile = FindServices.class.getClassLoader().getResourceAsStream("asdc.properties");
+
+ final Properties properties = new Properties();
+ properties.load(propertiesFile);
+
+ final String protocol = properties.getProperty("protocol", "http");
+
+ final Client restClient = ClientBuilder.newClient();
+ final URI uri = new URI(protocol + "://" + properties.getProperty("host", "localhost") + ":" + properties.getProperty("port", "80") + "/");
+ final String auth = properties.getProperty("auth");
+
+ final AsdcClient client = new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build();
+
+ try {
+ final Collection<Service> services = client.getServices(Collections.singletonMap("distributionStatus", new String[] {"DISTRIBUTED"}));
+
+ for (Service service : services) {
+
+ final ToscaCsar toscaCsar;
+
+ try {
+ toscaCsar = client.getServiceToscaModel(UUID.fromString(service.getUuid()));
+ } catch (NullPointerException e) {
+ //System.out.println(service.getUuid() + " has a bad tosca metadata entry");
+ continue;
+ } catch (Throwable t) {
+ System.out.println(t.getMessage());
+ continue;
+ }
+
+ System.out.println(service.getUuid() + ", " + service.getName());
+
+ if (checkToscaModelForVnf(toscaCsar.getParent())) {
+ for (ToscaModel vnfModel : toscaCsar.getChildren()) {
+ if (checkToscaModelForVfModule(vnfModel)) {
+ System.out.println("******" + service);
+ }
+ }
+ }
+ }
+ } catch (AsdcCatalogException e) {
+ throw e;
+ }
+ }
+
+ /**
+ * Check tosca model for vf module.
+ *
+ * @param model the model
+ * @return true, if successful
+ */
+ private static boolean checkToscaModelForVfModule(ToscaModel model) {
+
+ for (Entry<String, Group> component : model.gettopology_template().getGroups().entrySet()) {
+ final Group group = component.getValue();
+ final String type = group.getType();
+
+ if (type.startsWith("com.att.d2.groups.VfModule")) {
+ final String rawValue = group.getProperties().get("volume_group");
+ if (Boolean.valueOf(rawValue)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check tosca model for vnf.
+ *
+ * @param model the model
+ * @return true, if successful
+ */
+ private static boolean checkToscaModelForVnf(ToscaModel model) {
+
+ for (Entry<String, NodeTemplate> component: model.gettopology_template().getnode_templates().entrySet()) {
+ final NodeTemplate nodeTemplate = component.getValue();
+ final String type = nodeTemplate.getType();
+
+ if (type.startsWith("com.att.d2.resource.vf")) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java b/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java
new file mode 100644
index 0000000..c083934
--- /dev/null
+++ b/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.openecomp.vid.asdc.memory.InMemoryAsdcClient;
+
+/**
+ * The Class InMemoryClientTest.
+ */
+public class InMemoryClientTest extends BaseClientTest {
+
+ /** The catalog. */
+ private JSONObject catalog;
+
+ /**
+ * Sets the up.
+ *
+ * @throws URISyntaxException the URI syntax exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @Before
+ public void setUp() throws URISyntaxException, IOException {
+ final InputStream asdcCatalogFile = getClass().getClassLoader().getResourceAsStream("catalog.json");
+
+ final JSONTokener tokener = new JSONTokener(asdcCatalogFile);
+
+ catalog = new JSONObject(tokener);
+ }
+
+ /**
+ * Test resources.
+ *
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ @Test
+ public void testResources() throws AsdcCatalogException {
+
+ runResourceTests(new InMemoryAsdcClient.Builder().catalog(catalog).mapper(new ObjectMapper()).build());
+ }
+
+ /**
+ * Test services.
+ *
+ * @throws AsdcCatalogException the asdc catalog exception
+ * @throws URISyntaxException the URI syntax exception
+ */
+ @Test
+ public void testServices() throws AsdcCatalogException, URISyntaxException {
+
+ runServiceTests(new InMemoryAsdcClient.Builder().catalog(catalog).build());
+ }
+}
diff --git a/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java b/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java
new file mode 100644
index 0000000..b51dd4e
--- /dev/null
+++ b/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID ASDC Client
+ * ================================================================================
+ * Copyright (C) 2017 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=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Properties;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.vid.asdc.rest.RestfulAsdcClient;
+
+/**
+ * The Class RestfulClientTest.
+ */
+@Ignore
+public class RestfulClientTest extends BaseClientTest {
+
+ /** The rest client. */
+ private Client restClient;
+
+ /** The uri. */
+ private URI uri;
+
+ /** The properties. */
+ private Properties properties;
+
+ /** The auth. */
+ private String auth;
+
+ /**
+ * Sets the up.
+ *
+ * @throws URISyntaxException the URI syntax exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @Before
+ public void setUp() throws URISyntaxException, IOException {
+ final InputStream propertiesFile = getClass().getClassLoader().getResourceAsStream("asdc.properties");
+
+ properties = new Properties();
+ properties.load(propertiesFile);
+
+ final String protocol = properties.getProperty("protocol", "http");
+
+ restClient = ClientBuilder.newBuilder()
+ .hostnameVerifier(new HostnameVerifier() {
+
+ @Override
+ public boolean verify(String arg0, SSLSession arg1) {
+ return true;
+ }
+ })
+ .build();
+ uri = new URI(protocol + "://" + properties.getProperty("host", "localhost") + ":" + properties.getProperty("port", "80") + "/");
+ auth = properties.getProperty("auth");
+ }
+
+ /**
+ * Test resources.
+ *
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ @Test
+ public void testResources() throws AsdcCatalogException {
+
+ runResourceTests(new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build());
+ }
+
+ /**
+ * Test services.
+ *
+ * @throws AsdcCatalogException the asdc catalog exception
+ * @throws URISyntaxException the URI syntax exception
+ */
+ @Test
+ public void testServices() throws AsdcCatalogException, URISyntaxException {
+
+ runServiceTests(new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build());
+ }
+}
diff --git a/src/test/resources/CI2-DEV30_DEMO.postman_collection.json b/src/test/resources/CI2-DEV30_DEMO.postman_collection.json
new file mode 100644
index 0000000..1a625b5
--- /dev/null
+++ b/src/test/resources/CI2-DEV30_DEMO.postman_collection.json
@@ -0,0 +1,228 @@
+{
+ "id": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "name": "CI2-DEV30/DEMO ",
+ "description": "",
+ "order": [
+ "4d0583bc-1fc8-d609-a5bc-12402bcdf8b1"
+ ],
+ "folders": [
+ {
+ "id": "ad4a6141-7100-c011-8edf-16af405196e1",
+ "name": "AssetDataServlet GET Specific Asset copy",
+ "description": "",
+ "order": [
+ "5e52a321-afbf-09f5-0b32-7b0fba79ac7c",
+ "998cdf3e-f569-ba24-5430-8134a07c138f"
+ ],
+ "owner": "395001"
+ },
+ {
+ "id": "e01ed772-c26e-9a6f-030d-2481f530013d",
+ "name": "AssetsDataServlet GET by AssetType copy",
+ "description": "",
+ "order": [
+ "e8b3af1a-d384-801a-4959-70f7bcbe7b20",
+ "c6c184ce-ed95-830a-4103-214b3b6d07d8"
+ ],
+ "owner": "395001",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554"
+ },
+ {
+ "id": "6e37e3ba-1962-201d-f21a-745cd50d6481",
+ "name": "Auth copy",
+ "description": "",
+ "order": [
+ "bd5b959a-bc21-3e32-1f67-e56658cf362d",
+ "5333b52a-24d0-ffb5-8a3d-57376805f7dc",
+ "09678fbb-2aad-c01f-f131-d0e2a8170041",
+ "1654e686-5e0c-b5bb-9ef7-28880fe5fcf7"
+ ],
+ "owner": "395001",
+ "collectionId": "378f0077-151f-2a55-e7aa-a3e52ca7037c"
+ }
+ ],
+ "timestamp": 1472571436940,
+ "owner": "395001",
+ "public": false,
+ "published": false,
+ "requests": [
+ {
+ "id": "09678fbb-2aad-c01f-f131-d0e2a8170041",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n",
+ "url": "http://behost:8080/sdc2/rest/v1/consumers/Test",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1467800804647,
+ "name": "Get consumer",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": [],
+ "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481"
+ },
+ {
+ "id": "1654e686-5e0c-b5bb-9ef7-28880fe5fcf7",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/octet-stream\nAuthorization: Basic dGVzdDoxMjM0NTY=\nX-ECOMP-InstanceID: demo\n",
+ "url": "http://behost:8080/asdc/v1/catalog/services/Demo/0.1/artifacts/heat.yaml",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "GET",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "data": [],
+ "dataMode": "params",
+ "name": "Download service artifact - Distribution API copy",
+ "description": "",
+ "descriptionFormat": "html",
+ "time": 1448881625181,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481",
+ "isFromCollection": true
+ },
+ {
+ "id": "4d0583bc-1fc8-d609-a5bc-12402bcdf8b1",
+ "headers": "Accept: application/octet-stream\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.36:8080/asdc/v1/catalog/services/39c4b59c-8a3f-4c5c-b9b8-cefb86547561/toscaModel ",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473685576046,
+ "name": "GET /{assetType}/{uuid}/toscaModel <-- Download CSAR-Volume",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": []
+ },
+ {
+ "id": "5333b52a-24d0-ffb5-8a3d-57376805f7dc",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n",
+ "url": "http://behost:8080/sdc2/rest/v1/consumers/test",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "DELETE",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "data": [],
+ "dataMode": "params",
+ "name": "Delete consumer",
+ "description": "",
+ "descriptionFormat": "html",
+ "time": 1448881916175,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481"
+ },
+ {
+ "id": "5e52a321-afbf-09f5-0b32-7b0fba79ac7c",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.36:8080/asdc/v1/catalog/resources/3e3773b0-8526-4236-8a93-8660660fc047/metadata",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473678716020,
+ "name": "GET /v1/catalog/{assetType} (resources)<-- getAssetList ",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": []
+ },
+ {
+ "id": "998cdf3e-f569-ba24-5430-8134a07c138f",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.36:8080/asdc/v1/catalog/services/39c4b59c-8a3f-4c5c-b9b8-cefb86547561/metadata",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473678822013,
+ "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": []
+ },
+ {
+ "id": "bd5b959a-bc21-3e32-1f67-e56658cf362d",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\nAccept: application/json; charset=UTF-8\n",
+ "url": "http://135.21.125.36:8080/sdc2/rest/v1/consumers",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "POST",
+ "data": [],
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473678594153,
+ "name": "Create consumer",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": [],
+ "rawModeData": "{\r\n \"consumerName\": \"Test\",\r\n \"consumerSalt\": \"8b70b3eaf116c0fc7ff9696ade47970d\",\r\n \"consumerPassword\": \"555bce57ba624c48ff0ac6736d8aa1877010c6d529d2c9985e32d52bd695e35a\"\r\n}\r\n"
+ },
+ {
+ "id": "c6c184ce-ed95-830a-4103-214b3b6d07d8",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.36:8080/asdc/v1/catalog/services",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473678680793,
+ "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": []
+ },
+ {
+ "id": "e8b3af1a-d384-801a-4959-70f7bcbe7b20",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.36:8080/asdc/v1/catalog/resources",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1473678669242,
+ "name": "GET /v1/catalog/{assetType} (resources) <-- getAssetList",
+ "description": "",
+ "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89",
+ "responses": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json b/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json
new file mode 100644
index 0000000..ddae510
--- /dev/null
+++ b/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json
@@ -0,0 +1,158 @@
+{
+ "id": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "name": "External API's Integration ATT-Amdocs",
+ "description": "",
+ "order": [],
+ "folders": [
+ {
+ "id": "51e6462a-8e6b-3699-b964-13750e49355a",
+ "name": "AssetsDataServlet",
+ "description": "",
+ "order": [
+ "89c45dd7-62c2-517f-d444-70fd0e1c8643",
+ "1dcfcd29-7b47-174b-2bf5-e3b2b60c3208"
+ ],
+ "owner": "395001"
+ },
+ {
+ "id": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a",
+ "name": "Auth copy",
+ "description": "",
+ "order": [
+ "1aa1e3d9-4df0-5f6e-b891-bd3299300e20",
+ "7dac9d45-5e05-2b9e-26ee-96080f6b86fa",
+ "6244e569-4e08-eb29-769c-556410f3e6c7",
+ "3c31842b-dfe2-aecc-76b8-6176dd7bb21a"
+ ],
+ "owner": "395001",
+ "collectionId": "8ee68528-4e80-dfa2-7934-89de12bc9ab6"
+ }
+ ],
+ "timestamp": 1470748341282,
+ "owner": "395001",
+ "public": false,
+ "published": false,
+ "requests": [
+ {
+ "id": "1aa1e3d9-4df0-5f6e-b891-bd3299300e20",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\nAccept: application/json; charset=UTF-8\n",
+ "url": "http://135.21.125.105:8080/sdc2/rest/v1/consumers",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "POST",
+ "data": [],
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1470748438189,
+ "name": "Create consumer",
+ "description": "",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "responses": [],
+ "rawModeData": "{\r\n \"consumerName\": \"Test\",\r\n \"consumerSalt\": \"8b70b3eaf116c0fc7ff9696ade47970d\",\r\n \"consumerPassword\": \"555bce57ba624c48ff0ac6736d8aa1877010c6d529d2c9985e32d52bd695e35a\"\r\n}\r\n"
+ },
+ {
+ "id": "1dcfcd29-7b47-174b-2bf5-e3b2b60c3208",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.105:8080/asdc/v1/catalog/services",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1470748433437,
+ "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy",
+ "description": "",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "responses": []
+ },
+ {
+ "id": "3c31842b-dfe2-aecc-76b8-6176dd7bb21a",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/octet-stream\nAuthorization: Basic dGVzdDoxMjM0NTY=\nX-ECOMP-InstanceID: demo\n",
+ "url": "http://behost:8080/asdc/v1/catalog/services/Demo/0.1/artifacts/heat.yaml",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "GET",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "data": [],
+ "dataMode": "params",
+ "name": "Download service artifact - Distribution API copy",
+ "description": "",
+ "descriptionFormat": "html",
+ "time": 1448881625181,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "isFromCollection": true,
+ "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a"
+ },
+ {
+ "id": "6244e569-4e08-eb29-769c-556410f3e6c7",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n",
+ "url": "http://behost:8080/sdc2/rest/v1/consumers/Test",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1467800804647,
+ "name": "Get consumer",
+ "description": "",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "responses": [],
+ "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a"
+ },
+ {
+ "id": "7dac9d45-5e05-2b9e-26ee-96080f6b86fa",
+ "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n",
+ "url": "http://behost:8080/sdc2/rest/v1/consumers/test",
+ "pathVariables": {},
+ "preRequestScript": "",
+ "method": "DELETE",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "data": [],
+ "dataMode": "params",
+ "name": "Delete consumer",
+ "description": "",
+ "descriptionFormat": "html",
+ "time": 1448881916175,
+ "version": 2,
+ "responses": [],
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a"
+ },
+ {
+ "id": "89c45dd7-62c2-517f-d444-70fd0e1c8643",
+ "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n",
+ "url": "http://135.21.125.105:8080/asdc/v1/catalog/resources",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": null,
+ "dataMode": "params",
+ "version": 2,
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1470748435902,
+ "name": "GET /v1/catalog/{assetType} (resources) <-- getAssetList",
+ "description": "",
+ "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554",
+ "responses": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/asdc.properties b/src/test/resources/asdc.properties
new file mode 100644
index 0000000..8402c2e
--- /dev/null
+++ b/src/test/resources/asdc.properties
@@ -0,0 +1,4 @@
+protocol=https
+host=localhost
+port=8443
+auth=Basic changeme
diff --git a/src/test/resources/catalog.json b/src/test/resources/catalog.json
new file mode 100644
index 0000000..f2889fb
--- /dev/null
+++ b/src/test/resources/catalog.json
@@ -0,0 +1,174 @@
+{
+ "services": {
+ "0346aa9f-57b7-458a-9681-daf5b19d52b0": {
+ "uuid": "0346aa9f-57b7-458a-9681-daf5b19d52b0",
+ "name": "The Worst Service",
+ "version": "1.0",
+ "toscaModelURL": "sampleTosca.csar",
+ "category": "Bad Services",
+ "lifecycleState": "NOT_CERTIFIED_CHECKOUT",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "distributionStatus": "DISTRIBUTION_REJECTED",
+ "artifacts": [],
+ "resources": []
+ },
+ "1346aa9f-57b7-458a-9681-daf5b19d52b1": {
+ "uuid": "1346aa9f-57b7-458a-9681-daf5b19d52b1",
+ "name": "The Worst Service",
+ "version": "1.1",
+ "toscaModelURL": "sampleTosca.csar",
+ "category": "Bad Services",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": [],
+ "resources": []
+ },
+ "3346aa9f-57b7-458a-9681-daf5b19d52b3": {
+ "uuid": "3346aa9f-57b7-458a-9681-daf5b19d52b3",
+ "name": "Bland Service",
+ "version": "1.9",
+ "toscaModelURL": "sampleTosca.csar",
+ "category": "Neutral Services",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "distributionStatus": "DISTRIBUTION_NOT_APPROVED",
+ "artifacts": [],
+ "resources": []
+ },
+ "2346aa9f-57b7-458a-9681-daf5b19d52b2": {
+ "uuid": "2346aa9f-57b7-458a-9681-daf5b19d52b2",
+ "name": "The Best Service",
+ "version": "1.3",
+ "toscaModelURL": "sampleTosca.csar",
+ "category": "Good Services",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "distributionStatus": "DISTRIBUTION_APPROVED",
+ "artifacts": [
+ {
+ "artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ },
+ {
+ "artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ },
+ {
+ "artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ }
+ ],
+ "resources": []
+ }
+ },
+ "resources": {
+ "2f92b5b0-10ff-4cf4-9531-88546fe88a42": {
+ "uuid": "2f92b5b0-10ff-4cf4-9531-88546fe88a42",
+ "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",
+ "name": "The Worst Resource",
+ "version": "0.1",
+ "toscaModelURL": "sampleTosca.csar",
+ "toscaModel": "http://www.openecomp.org/",
+ "toscaResourceName": "The Worst Resource (TOSCA)",
+ "category": "Bad Resources",
+ "subCategory": "Really Bad Resources",
+ "resourceType": "VF",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "artifacts": [
+ {
+ "artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ },
+ {
+ "artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ },
+ {
+ "artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682",
+ "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",
+ "artifactName": "The Worst Artifact",
+ "artifactType": "HEAT",
+ "artifactDescription": "This is the worst artifact",
+ "artifactURL": "http://www.openecomp.org/",
+ "artifactTimeout": "60",
+ "artifactChecksum": "A worthy checksum",
+ "artifactVersion": "0.1",
+ }
+ ]
+ },
+ "0f92b5b0-10ff-4cf4-9531-88546fe88a40": {
+ "uuid": "0f92b5b0-10ff-4cf4-9531-88546fe88a40",
+ "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",
+ "name": "The Worst Resource",
+ "version": "0.1",
+ "toscaModelURL": "sampleTosca.csar",
+ "toscaModel": "http://www.openecomp.org/",
+ "toscaResourceName": "The Worst Resource (TOSCA)",
+ "category": "Bad Resources",
+ "subCategory": "Really Bad Resources",
+ "resourceType": "VF",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "artifacts": []
+ },
+ "1f92b5b0-10ff-4cf4-9531-88546fe88a41": {
+ "uuid": "1f92b5b0-10ff-4cf4-9531-88546fe88a41",
+ "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",
+ "name": "The Worst Resource",
+ "version": "0.1",
+ "toscaModelURL": "sampleTosca.csar",
+ "toscaModel": "http://www.openecomp.org/",
+ "toscaResourceName": "The Worst Resource (TOSCA)",
+ "category": "Bad Resources",
+ "subCategory": "Really Bad Resources",
+ "resourceType": "VF",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "example@example.org",
+ "lastUpdaterFullName": "Example user",
+ "artifacts": []
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/sampleTosca.csar b/src/test/resources/sampleTosca.csar
new file mode 100644
index 0000000..d9c469a
--- /dev/null
+++ b/src/test/resources/sampleTosca.csar
Binary files differ