aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-04-19 15:46:20 +0900
committerParshad Patel <pars.patel@samsung.com>2019-04-19 15:46:27 +0900
commitf2dc71a2443c29c00da7750230015d6555e86b1f (patch)
treeb029cfca1aa63bef9d76599d5546ea887b6c442e /vid-app-common/src
parente6571c6df02776c335b156b0fb44e31d723ffa06 (diff)
Fix sonar issue in vid-app-common
Fix Constructor has 8 parameters, which is greater than 7 authorized issue Issue-ID: VID-464 Change-Id: If3311351746f4a4890ab73e844decd34486a324f Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java80
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java13
2 files changed, 79 insertions, 14 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java b/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java
index fd4f6c7f5..be6c6e51f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java
@@ -20,9 +20,9 @@
package org.onap.vid.aai;
+import org.onap.vid.aai.model.RelationshipList;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-import org.onap.vid.aai.model.RelationshipList;
@JsonIgnoreProperties(ignoreUnknown = true)
public class OperationalEnvironment {
@@ -39,15 +39,75 @@ public class OperationalEnvironment {
public OperationalEnvironment() {
}
- public OperationalEnvironment(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String operationalEnvironmentStatus, String tenantContext, String workloadContext, String resourceVersion, RelationshipList relationshipList) {
- this.operationalEnvironmentId = operationalEnvironmentId;
- this.operationalEnvironmentName = operationalEnvironmentName;
- this.operationalEnvironmentType = operationalEnvironmentType;
- this.operationalEnvironmentStatus = operationalEnvironmentStatus;
- this.tenantContext = tenantContext;
- this.workloadContext = workloadContext;
- this.resourceVersion = resourceVersion;
- this.relationshipList = relationshipList;
+ public OperationalEnvironment(OperationalEnvironmentBuilder builder) {
+ this.operationalEnvironmentId = builder.operationalEnvironmentId;
+ this.operationalEnvironmentName = builder.operationalEnvironmentName;
+ this.operationalEnvironmentType = builder.operationalEnvironmentType;
+ this.operationalEnvironmentStatus = builder.operationalEnvironmentStatus;
+ this.tenantContext = builder.tenantContext;
+ this.workloadContext = builder.workloadContext;
+ this.resourceVersion = builder.resourceVersion;
+ this.relationshipList = builder.relationshipList;
+ }
+
+ public static class OperationalEnvironmentBuilder {
+ private String operationalEnvironmentId;
+ private String operationalEnvironmentName;
+ private String operationalEnvironmentType;
+ private String operationalEnvironmentStatus;
+ private String tenantContext;
+ private String workloadContext;
+ private String resourceVersion;
+ private RelationshipList relationshipList;
+
+ public OperationalEnvironmentBuilder setOperationalEnvironmentId(
+ String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setOperationalEnvironmentName(
+ String operationalEnvironmentName) {
+ this.operationalEnvironmentName = operationalEnvironmentName;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setOperationalEnvironmentType(
+ String operationalEnvironmentType) {
+ this.operationalEnvironmentType = operationalEnvironmentType;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setOperationalEnvironmentStatus(
+ String operationalEnvironmentStatus) {
+ this.operationalEnvironmentStatus = operationalEnvironmentStatus;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setTenantContext(String tenantContext) {
+ this.tenantContext = tenantContext;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ return this;
+ }
+
+ public OperationalEnvironmentBuilder setRelationshipList(
+ RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ return this;
+ }
+
+ public OperationalEnvironment createOperationalEnvironment() {
+ return new OperationalEnvironment(this);
+ }
}
public String getOperationalEnvironmentId() {
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
index c331b3252..076c46284 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
@@ -56,10 +56,15 @@ public class OperationalEnvironmentTest {
RelationshipList relationshipList = new RelationshipList();
relationshipList.relationship = new ArrayList<>();
- OperationalEnvironment operationalEnvironment = new OperationalEnvironment("testId",
- "testEnvName", "testEnvType",
- "testEnvStatus", "testTenant", "testWorkload",
- "testResource", relationshipList);
+ OperationalEnvironment operationalEnvironment =
+ new OperationalEnvironment.OperationalEnvironmentBuilder()
+ .setOperationalEnvironmentId("testId")
+ .setOperationalEnvironmentName("testEnvName")
+ .setOperationalEnvironmentType("testEnvType")
+ .setOperationalEnvironmentStatus("testEnvStatus")
+ .setTenantContext("testTenant").setWorkloadContext("testWorkload")
+ .setResourceVersion("testResource").setRelationshipList(relationshipList)
+ .createOperationalEnvironment();
assertThat(operationalEnvironment.getOperationalEnvironmentId()).isEqualTo("testId");
assertThat(operationalEnvironment.getWorkloadContext()).isEqualTo("testWorkload");