aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects')
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java111
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java64
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java103
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java112
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java33
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java193
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java44
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java101
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java128
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java58
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java79
11 files changed, 1026 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java
new file mode 100644
index 000000000..0c673e62d
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java
@@ -0,0 +1,111 @@
+package org.onap.sdc.ci.tests.devObjects;
+
+
+import java.io.Serializable;
+import java.util.List;
+
+public class CategoryDataDefinition extends ToscaDataDefinition implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2882352060242714427L;
+
+ private String name;
+ private String normalizedName;
+ private String uniqueId;
+ private List<String> icons;
+
+ public CategoryDataDefinition() {
+
+ }
+
+ public CategoryDataDefinition(CategoryDataDefinition c) {
+ this.name = c.name;
+ this.normalizedName = c.normalizedName;
+ this.uniqueId = c.uniqueId;
+ this.icons = c.icons;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getNormalizedName() {
+ return normalizedName;
+ }
+
+ public void setNormalizedName(String normalizedName) {
+ this.normalizedName = normalizedName;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ public List<String> getIcons() {
+ return icons;
+ }
+
+ public void setIcons(List<String> icons) {
+ this.icons = icons;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
+ result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
+ result = prime * result + ((icons == null) ? 0 : icons.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CategoryDataDefinition other = (CategoryDataDefinition) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (normalizedName == null) {
+ if (other.normalizedName != null)
+ return false;
+ } else if (!normalizedName.equals(other.normalizedName))
+ return false;
+ if (uniqueId == null) {
+ if (other.uniqueId != null)
+ return false;
+ } else if (!uniqueId.equals(other.uniqueId))
+ return false;
+ if (icons == null) {
+ if (other.icons != null)
+ return false;
+ } else if (!icons.equals(other.icons))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "CategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId
+ + ", icons=" + icons + "]";
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java
new file mode 100644
index 000000000..ef65a2de2
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CategoryDefinition extends CategoryDataDefinition implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6552733796860992476L;
+
+ List<SubCategoryDefinition> subcategories;
+
+ public CategoryDefinition() {
+ super();
+ }
+
+ public CategoryDefinition(CategoryDataDefinition c) {
+ super(c);
+ }
+
+ public List<SubCategoryDefinition> getSubcategories() {
+ return subcategories;
+ }
+
+ public void setSubcategories(List<SubCategoryDefinition> subcategories) {
+ this.subcategories = subcategories;
+ }
+
+ public void addSubCategory(SubCategoryDefinition subcategory) {
+ if (subcategories == null) {
+ subcategories = new ArrayList<SubCategoryDefinition>();
+ }
+ subcategories.add(subcategory);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " CategoryDefinition [subcategories=" + subcategories + "]";
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java
new file mode 100644
index 000000000..b393b9160
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java
@@ -0,0 +1,103 @@
+package org.onap.sdc.ci.tests.devObjects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+
+public enum GraphPropertyEnum {
+// field name class type unique indexed
+// stored in graph index
+ UNIQUE_ID ("uid", String.class, true, true),
+ LABEL ("nodeLabel", String.class, false, true),
+ JSON ("json", String.class, false, false),
+ METADATA ("metadata", String.class, false, false),
+ VERSION ("version", String.class, false, true),
+ STATE ("state", String.class, false, true),
+ IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true),
+ IS_DELETED ("deleted", Boolean.class, false, true),
+ NORMALIZED_NAME ("normalizedName", String.class, false, true),
+ NAME ("name", String.class, false, true),
+ TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true),
+ DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false),
+ RESOURCE_TYPE ("resourceType", String.class, false, true),
+ COMPONENT_TYPE ("componentType", String.class, false, true),
+ UUID ("uuid", String.class, false, true),
+ SYSTEM_NAME ("systemName", String.class, false, true),
+ IS_ABSTRACT ("abstract", Boolean.class, false, true),
+ INVARIANT_UUID ("invariantUuid", String.class, false, true),
+ CSAR_UUID ("csarUuid", String.class, false, true),
+ //used for user (old format, no json for users)
+ USERID ("userId", String.class, true, true),
+ ROLE ("role", String.class, false, false),
+ FIRST_NAME ("firstName", String.class, false, false),
+ LAST_NAME ("lastName", String.class, false, false),
+ EMAIL ("email", String.class, false, false),
+ LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false),
+ //used for category (old format, no json for categories)
+ ICONS ("icons", String.class, false, false);
+
+ private String property;
+ private Class clazz;
+ private boolean unique;
+ private boolean indexed;
+
+ GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) {
+ this.property = property;
+ this.clazz = clazz;
+ this.unique = unique;
+ this.indexed = indexed;
+ }
+
+ public static GraphPropertyEnum getByProperty(String property){
+ for(GraphPropertyEnum currProperty :GraphPropertyEnum.values()){
+ if(currProperty.getProperty().equals(property)){
+ return currProperty;
+ }
+ }
+ return null;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Class getClazz() {
+ return clazz;
+ }
+
+ public void setClazz(Class clazz) {
+ this.clazz = clazz;
+ }
+
+ public boolean isUnique() {
+ return unique;
+ }
+
+ public void setUnique(boolean unique) {
+ this.unique = unique;
+ }
+
+ public boolean isIndexed() {
+ return indexed;
+ }
+
+ public void setIndexed(boolean indexed) {
+ this.indexed = indexed;
+ }
+
+ public static List<String> getAllProperties() {
+
+ List<String> arrayList = new ArrayList<String>();
+
+ for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) {
+ arrayList.add(graphProperty.getProperty());
+ }
+
+ return arrayList;
+ }
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java
new file mode 100644
index 000000000..cdb45c5c6
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+import java.io.Serializable;
+
+public class GroupingDataDefinition extends ToscaDataDefinition implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2641475929148843849L;
+
+ private String name;
+ private String normalizedName;
+ private String uniqueId;
+
+ public GroupingDataDefinition() {
+
+ }
+
+ public GroupingDataDefinition(GroupingDataDefinition c) {
+ this.name = c.name;
+ this.normalizedName = c.normalizedName;
+ this.uniqueId = c.uniqueId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getNormalizedName() {
+ return normalizedName;
+ }
+
+ public void setNormalizedName(String normalizedName) {
+ this.normalizedName = normalizedName;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
+ result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GroupingDataDefinition other = (GroupingDataDefinition) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (normalizedName == null) {
+ if (other.normalizedName != null)
+ return false;
+ } else if (!normalizedName.equals(other.normalizedName))
+ return false;
+ if (uniqueId == null) {
+ if (other.uniqueId != null)
+ return false;
+ } else if (!uniqueId.equals(other.uniqueId))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId
+ + "]";
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java
new file mode 100644
index 000000000..7b04d2307
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+public class GroupingDefinition extends GroupingDataDefinition {
+
+ public GroupingDefinition() {
+ super();
+ }
+
+ public GroupingDefinition(GroupingDataDefinition g) {
+ super(g);
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java
new file mode 100644
index 000000000..d17755207
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java
@@ -0,0 +1,193 @@
+package org.onap.sdc.ci.tests.devObjects;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+
+//@JsonDeserialize(using = MyDeserializer.class)
+
+public enum JsonPresentationFields {
+ UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID),
+ HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION),
+ LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE),
+ CREATION_DATE ("creationDate", null),
+ LAST_UPDATE_DATE ("lastUpdateDate", null),
+ SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME),
+ NAME ("name", GraphPropertyEnum.NAME),
+ VERSION ("version", GraphPropertyEnum.VERSION),
+ NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME),
+ UUID ("UUID", GraphPropertyEnum.UUID),
+ RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE),
+ COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE),
+ IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED),
+ ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null),
+ NAMING_POLICY ("namingPolicy", null),
+ TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME),
+ DESCRIPTION ("description", null),
+ TYPE ("type", null),
+ DERIVED_FROM ("derivedFrom", null),
+ VENDOR_NAME ("vendorName", null),
+ VENDOR_RELEASE ("vendorRelease", null),
+ CONFORMANCE_LEVEL ("conformanceLevel", null),
+ ICON ("icon", null),
+ TAGS ("tags", null),
+ INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID),
+ CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID),
+ CSAR_VERSION ("csarVersion", null),
+ IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null),
+ CONTACT_ID ("contactId", null),
+ PROJECT_CODE ("projectCode", null),
+ DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS),
+ DERIVED_FROM_GENERIC_TYPE ("derivedFromGenericType", null),
+ DERIVED_FROM_GENERIC_VERSION ("derivedFromGenericVersion", null),
+
+ ////Artifact
+ ARTIFACT_TYPE ("artifactType", null),
+ ARTIFACT_REF ("artifactRef", null),
+ ARTIFACT_REPOSITORY ("artifactRepository", null),
+ ARTIFACT_CHECKSUM ("artifactChecksum", null),
+ ARTIFACT_CREATOR ("artifactCreator", null),
+ USER_ID_CREATOR ("userIdCreator", null),
+ USER_ID_LAST_UPDATER ("userIdLastUpdater", null),
+ CREATOR_FULL_NAME ("creatorFullName", null),
+ UPDATER_FULL_NAME ("updaterFullName", null),
+
+ ES_ID ("esId", null),
+ ARTIFACT_LABEL ("artifactLabel", null),
+ IS_ABSTRACT ("mandatory", null),
+ ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null),
+ API_URL ("apiUrl", null),
+ SERVICE_API ("serviceApi", null),
+ ARTIFACT_VERSION ("artifactVersion", null),
+ ARTIFACT_UUID ("artifactUUID", null),
+ PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null),
+ HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null),
+ GENERATED ("generated", null),
+ ARTIFACT_GROUP_TYPE ("artifactGroupType", null),
+ ARTIFACT_TIMEOUT ("timeout", null),
+ REQUIRED_ARTIFACTS ("requiredArtifacts", null),
+ DUPLICATED ("duplicated", null),
+ HEAT_PARAMETERS ("heatParameters", null),
+ GENERATED_FROM_ID ("generatedFromId", null),
+
+
+ // end artifacts
+
+
+ //property
+ DEFINITION ("definition", null),
+ DEFAULT_VALUE ("defaultValue", null),
+ REQUIRED ("required", null),
+ PASSWORD ("password", null),
+ CONSTRAINTS ("constraints", null),
+ PROPERTIES ("properties", null),
+ PROPERTY ("property", null),
+ SCHEMA ("schema", null),
+ VALUE ("value", null),
+ PARENT_UNIQUE_ID ("parentUniqueId", null),
+
+ COMPONENT_INSTANCES ("componentInstances", null),
+ RELATIONS ("relations", null),
+
+ //attribute
+ STATUS ("status", null),
+ //capability
+ VALID_SOURCE_TYPE ("validSourceTypes", null),
+ CREATION_TIME ("creationTime", null),
+ MODIFICATION_TIME ("modificationTime", null),
+ CAPABILITY_SOURCES ("capabilitySources", null),
+ MAX_OCCURRENCES ("maxOccurrences", null),
+ MIN_OCCURRENCES ("minOccurrences", null),
+ OWNER_NAME ("ownerName", null),
+ OWNER_ID ("ownerId", null),
+ LEFT_OCCURRENCES ("leftOccurences", null),
+ CAPABILITY_ID ("capabiltyId", null),
+ PATH ("path", null),
+ SOURCE ("source", null),
+
+ //Requirement
+ CAPAPILITY ("capability", null),
+ NODE ("node", null),
+ RELATIONSHIP ("relationship", null),
+ VALID_SOURCE_TYPES ("validSourceTypes", null),
+ REQUIREMENT_ID ("requirementId", null),
+
+ //Relation
+ CAPABILTY_OWNER_ID ("capabilityOwnerId", null),
+ REQUIREMENT_OWNER_ID ("requirementOwnerId", null),
+ FROM_ID ("fromId", null),
+ TO_ID ("toId", null),
+ REQUIREMENT ("requirement", null),
+
+ //Groups
+
+ GROUP_INVARIANT_UUID ("invariantUUID", null),
+ GROUP_UUID ("groupUUID", null),
+ GROUP_MEMBER ("members", null),
+ GROUP_ARTIFACTS ("artifacts", null),
+ GROUP_ARTIFACTS_UUID ("artifactsUuid", null),
+ GROUP_PROPERTIES ("properties", null),
+ GROUP_UNIQUE_ID ("groupUid", null),
+ POS_X ("posX", null),
+ POS_Y ("posY", null),
+ PROPERTY_VALUE_COUNTER ("propertyValueCounter", null),
+ CUSTOMIZATION_UUID ("customizationUUID", null),
+ GROUP_NAME ("groupName", null),
+ GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null),
+ GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null),
+ GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null),
+
+ ;
+
+
+ private String presentation;
+ private GraphPropertyEnum storedAs;
+
+ JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
+ this.presentation = presentation;
+ this.storedAs = storedAs;
+ }
+
+ @JsonValue
+ public String getPresentation() {
+ return presentation;
+ }
+
+ public void setPresentation(String presentation) {
+ this.presentation = presentation;
+ }
+
+ public GraphPropertyEnum getStoredAs() {
+ return storedAs;
+ }
+
+ public void setStoredAs(GraphPropertyEnum storedAs) {
+ this.storedAs = storedAs;
+ }
+
+ public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
+ for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){
+ if(currPresentation.getStoredAs() == property){
+ return currPresentation.getPresentation();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ // TODO Auto-generated method stub
+ return presentation;
+ }
+
+ @JsonCreator
+ public static JsonPresentationFields getByPresentation(String presentation) {
+ for (JsonPresentationFields inst : JsonPresentationFields.values()) {
+ if (inst.getPresentation().equals(presentation)) {
+ return inst;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java
new file mode 100644
index 000000000..e17222cf2
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+public enum LifecycleStateEnum {
+
+ READY_FOR_CERTIFICATION,
+
+ CERTIFICATION_IN_PROGRESS,
+
+ CERTIFIED,
+
+ NOT_CERTIFIED_CHECKIN,
+
+ NOT_CERTIFIED_CHECKOUT;
+
+ public static LifecycleStateEnum findState(String state) {
+
+ for (LifecycleStateEnum lifecycleStateEnum : LifecycleStateEnum.values()) {
+ if (lifecycleStateEnum.name().equals(state)) {
+ return lifecycleStateEnum;
+ }
+ }
+ return null;
+ }
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java
new file mode 100644
index 000000000..549968205
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+/**
+ * Resource Type Enum
+ * @author mshitrit
+ *
+ */
+public enum ResourceTypeEnum {
+
+ VFC("VFC (Virtual Function Component)"), VF("VF"/* (Virtual Function)" */), CP("CP (Connection Point)"),
+ VL( "VL (Virtual Link)"), VFCMT("VFCMT (VFC Monitoring Template)"), ABSTRACT("Abstract (Generic VFC/VF/Service Type)");
+
+ private String value;
+
+ private ResourceTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public static ResourceTypeEnum getType(String type) {
+ for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
+ if (e.name().equals(type)) {
+ return e;
+ }
+ }
+ return null;
+ }
+
+ public static ResourceTypeEnum getTypeByName(String type) {
+ for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
+ if (e.name().equalsIgnoreCase(type)) {
+ return e;
+ }
+ }
+ return null;
+ }
+/**
+ * Returns ResourceTypeEnum matching to received String ignore case
+ * @param type
+ * @return
+ */
+ public static ResourceTypeEnum getTypeIgnoreCase(String type) {
+ for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
+ if (e.name().toLowerCase().equals(type.toLowerCase())) {
+ return e;
+ }
+ }
+ return null;
+ }
+ /**
+ * Checks if enum exist with given type
+ * @param type
+ * @return
+ */
+ public static boolean containsName(String type) {
+
+ for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
+ if (e.name().equals(type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Checks if enum exist with given type ignare case
+ * @param type
+ * @return
+ */
+ public static boolean containsIgnoreCase(String type) {
+
+ for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
+ if (e.name().toLowerCase().equals(type.toLowerCase())) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java
new file mode 100644
index 000000000..0eb76014e
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class SubCategoryDataDefinition extends ToscaDataDefinition implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8279397988497086676L;
+
+ private String name;
+ private String normalizedName;
+ private String uniqueId;
+ private List<String> icons;
+
+ public SubCategoryDataDefinition() {
+
+ }
+
+ public SubCategoryDataDefinition(SubCategoryDataDefinition c) {
+ this.name = c.name;
+ this.normalizedName = c.normalizedName;
+ this.uniqueId = c.uniqueId;
+ this.icons = c.icons;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getNormalizedName() {
+ return normalizedName;
+ }
+
+ public void setNormalizedName(String normalizedName) {
+ this.normalizedName = normalizedName;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ public List<String> getIcons() {
+ return icons;
+ }
+
+ public void setIcons(List<String> icons) {
+ this.icons = icons;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
+ result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
+ result = prime * result + ((icons == null) ? 0 : icons.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SubCategoryDataDefinition other = (SubCategoryDataDefinition) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (normalizedName == null) {
+ if (other.normalizedName != null)
+ return false;
+ } else if (!normalizedName.equals(other.normalizedName))
+ return false;
+ if (uniqueId == null) {
+ if (other.uniqueId != null)
+ return false;
+ } else if (!uniqueId.equals(other.uniqueId))
+ return false;
+ if (icons == null) {
+ if (other.icons != null)
+ return false;
+ } else if (!icons.equals(other.icons))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "SubCategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId="
+ + uniqueId + ", icons=" + icons + "]";
+ }
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java
new file mode 100644
index 000000000..b45ce4fa1
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.onap.sdc.ci.tests.devObjects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SubCategoryDefinition extends SubCategoryDataDefinition {
+
+ private List<GroupingDefinition> groupings;
+
+ public SubCategoryDefinition() {
+ super();
+ }
+
+ public SubCategoryDefinition(SubCategoryDataDefinition subCategory) {
+ super(subCategory);
+ }
+
+ public List<GroupingDefinition> getGroupings() {
+ return groupings;
+ }
+
+ public void setGroupings(List<GroupingDefinition> groupingDefinitions) {
+ this.groupings = groupingDefinitions;
+ }
+
+ public void addGrouping(GroupingDefinition groupingDefinition) {
+ if (groupings == null) {
+ groupings = new ArrayList<GroupingDefinition>();
+ }
+ groupings.add(groupingDefinition);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " SubCategoryDefinition [groupings=" + groupings + "]";
+ }
+
+}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java
new file mode 100644
index 000000000..c4fa53b5d
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java
@@ -0,0 +1,79 @@
+package org.onap.sdc.ci.tests.devObjects;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import fj.data.Either;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+public abstract class ToscaDataDefinition {
+
+ protected Map<String, Object> toscaPresentation;
+
+
+ public ToscaDataDefinition(){
+ toscaPresentation = new HashMap<String, Object>();
+ }
+ @JsonCreator
+ public ToscaDataDefinition(Map<String, Object> art){
+ toscaPresentation = art;
+ }
+ @JsonValue
+ public Object getToscaPresentationValue(JsonPresentationFields name) {
+ if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) {
+ return toscaPresentation.get(name.getPresentation());
+ }
+ return null;
+ }
+
+ public void setToscaPresentationValue(JsonPresentationFields name, Object value) {
+ if (toscaPresentation == null && value !=null) {
+ toscaPresentation = new HashMap<String, Object>();
+ }
+ toscaPresentation.put(name.getPresentation(), value);
+
+ }
+ public void setOwnerIdIfEmpty(String ownerId){
+ if ( getOwnerId() == null ){
+ setOwnerId(ownerId);
+ }
+ }
+ public void setOwnerId(String ownerId){
+ setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId);
+ }
+
+ public String getOwnerId(){
+ return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID);
+ }
+
+
+ //default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2)
+ public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){
+ other.setOwnerId(getOwnerId());
+ return other;
+ }
+
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2){
+ return mergeDataMaps(map1, map2, false);
+ }
+
+ //return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden)
+ public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride){
+ for(Entry<String, T> entry : map2.entrySet()){
+ map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride));
+ //validate merge success
+ if(!map1.containsKey(entry.getKey()))
+ return Either.right(entry.getKey());
+ }
+ return Either.left(map1);
+ }
+
+ public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) {
+ return null == dataList? new HashMap<>() : dataList.stream()
+ .collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p));
+ }
+}