summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api
diff options
context:
space:
mode:
authorxuegao <xue.gao@intl.att.com>2021-03-15 14:10:57 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-16 13:31:41 +0000
commitc094ebe82e4e9797c4ee20c5e14bf293f7c193c4 (patch)
tree779d5308199edf97643a9569676bb22b41905980 /openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api
parent1da764ea13793535597dc6518b5e953393e9dbe0 (diff)
Improve test coverage
Use Lombok annotations to improve test coverage. Issue-ID: SDC-3428 Change-Id: I78a9fa6171ba26e431b5e587b24548322c464ecc Signed-off-by: xuegao <xue.gao@intl.att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api')
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java104
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java37
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java63
4 files changed, 83 insertions, 160 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
index bc34b8dfda..bd6a978ed6 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
@@ -23,10 +23,16 @@ package org.openecomp.sdc.action.dao.types;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.openecomp.sdc.action.types.ActionArtifact;
import java.nio.ByteBuffer;
+@Getter
+@Setter
+@NoArgsConstructor
@Table(keyspace = "dox", name = "action_artifact")
public class ActionArtifactEntity {
@@ -41,44 +47,11 @@ public class ActionArtifactEntity {
@Column(name = "artifact")
private ByteBuffer artifact;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public ActionArtifactEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
public ActionArtifactEntity(String artifactUuId, int effectiveVersion) {
this.artifactUuId = artifactUuId;
this.effectiveVersion = effectiveVersion;
}
- public String getArtifactUuId() {
- return artifactUuId;
- }
-
- public void setArtifactUuId(String artifactUuId) {
- this.artifactUuId = artifactUuId;
- }
-
- public int getEffectiveVersion() {
- return effectiveVersion;
- }
-
- public void setEffectiveVersion(int effectiveVersion) {
- this.effectiveVersion = effectiveVersion;
- }
-
- public ByteBuffer getArtifact() {
- return artifact;
- }
-
- public void setArtifact(ByteBuffer artifact) {
- this.artifact = artifact;
- }
-
/**
* To dto action artifact.
*
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
index 17f6deaa72..d84d560557 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
@@ -25,11 +25,16 @@ import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.action.types.Action;
import org.openecomp.sdc.versioning.dao.types.Version;
-
+@Getter
+@Setter
+@NoArgsConstructor
@Table(keyspace = "dox", name = "Action")
public class ActionEntity {
@@ -61,64 +66,11 @@ public class ActionEntity {
@Column(name = "data")
private String data;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public ActionEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
public ActionEntity(String actionInvariantUuId, Version version) {
this.actionInvariantUuId = actionInvariantUuId;
this.version = version;
}
- public String getActionUuId() {
- return actionUuId;
- }
-
- public void setActionUuId(String actionUuId) {
- this.actionUuId = actionUuId;
- }
-
- public String getActionInvariantUuId() {
- return actionInvariantUuId;
- }
-
- public void setActionInvariantUuId(String actionInvariantUuId) {
- this.actionInvariantUuId = actionInvariantUuId;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Set<String> getVendorList() {
- return vendorList;
- }
-
/**
* Sets vendor list.
*
@@ -129,10 +81,6 @@ public class ActionEntity {
vendorList.stream().map(String::toLowerCase).collect(Collectors.toSet()) : vendorList;
}
- public Set<String> getCategoryList() {
- return categoryList;
- }
-
/**
* Sets category list.
*
@@ -144,46 +92,6 @@ public class ActionEntity {
categoryList;
}
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public Set<String> getSupportedModels() {
- return supportedModels;
- }
-
- public void setSupportedModels(Set<String> supportedModels) {
- this.supportedModels = supportedModels;
- }
-
- public Set<String> getSupportedComponents() {
- return supportedComponents;
- }
-
- public void setSupportedComponents(Set<String> supportedComponents) {
- this.supportedComponents = supportedComponents;
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
/**
* To dto action.
*
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
index a5025e5de8..f8380a9785 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
@@ -23,8 +23,16 @@ package org.openecomp.sdc.action.dao.types;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.openecomp.sdc.action.types.OpenEcompComponent;
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
@Table(keyspace = "dox", name = "EcompComponent")
public class OpenEcompComponentEntity {
@@ -35,35 +43,6 @@ public class OpenEcompComponentEntity {
@Column(name = "name")
private String name;
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public OpenEcompComponentEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- public OpenEcompComponentEntity(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
/**
* To dto OPENECOMP component.
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java
new file mode 100644
index 0000000000..3fbecb4082
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2021 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.sdc.action.dao.types;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class ActionEntityTest {
+
+ @Test
+ public void TestSetVendorList() {
+ ActionEntity entity = new ActionEntity();
+
+ entity.setVendorList(null);
+ assertEquals(null, entity.getVendorList());
+
+ Set<String> stringSet = new HashSet<>();
+ entity.setVendorList(stringSet);
+ assertEquals(stringSet, entity.getVendorList());
+
+ stringSet.add("TesT");
+ entity.setVendorList(stringSet);
+ assertEquals("test", entity.getVendorList().toArray()[0]);
+ }
+
+ @Test
+ public void TestSetCategoryList() {
+ ActionEntity entity = new ActionEntity();
+
+ entity.setCategoryList(null);
+ assertEquals(null, entity.getCategoryList());
+
+ Set<String> stringSet = new HashSet<>();
+ entity.setCategoryList(stringSet);
+ assertEquals(stringSet, entity.getCategoryList());
+
+ stringSet.add("TesT");
+ entity.setCategoryList(stringSet);
+ assertEquals("test", entity.getCategoryList().toArray()[0]);
+ }
+} \ No newline at end of file