aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2020-06-18 12:00:35 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-19 11:16:21 +0000
commit6152e450f7164c0a8e84da63e354c8c0ffccb237 (patch)
treef9bdf8c2c3c5e013da110fac15902ded7676e0c1 /common
parent61aa954c94ddb1b60cb57d1c9d4b0908e0929487 (diff)
Remove unused method
Removing unused method in Constraint and use lombok annotations instead. Issue-ID: SDC-3130 Signed-off-by: xuegao <xg353y@intl.att.com> Change-Id: Ia718d184c55d40503f42830966bb11675b7c3f85 Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'common')
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java106
-rw-r--r--common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConstraintTest.java44
2 files changed, 52 insertions, 98 deletions
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
index f119d6f71c..5b62af0dc9 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
@@ -23,7 +23,15 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
public class Constraint implements Cloneable {
+
private Object equal;
private Object greater_or_equal;
private Object greater_than;
@@ -36,53 +44,6 @@ public class Constraint implements Cloneable {
private Integer max_length;
private Object pattern;
- public Constraint() {
- }
-
- public Object getGreater_or_equal() {
- return greater_or_equal;
- }
-
- public void setGreater_or_equal(Object greater_or_equal) {
- this.greater_or_equal = greater_or_equal;
- }
-
- public Object getEqual() {
- return equal;
- }
-
- public void setEqual(Object equal) {
- this.equal = equal;
- }
-
- public Object getGreater_than() {
- return greater_than;
- }
-
- public void setGreater_than(Object greater_than) {
- this.greater_than = greater_than;
- }
-
- public Object getLess_than() {
- return less_than;
- }
-
- public void setLess_than(Object less_than) {
- this.less_than = less_than;
- }
-
- public Object getLess_or_equal() {
- return less_or_equal;
- }
-
- public void setLess_or_equal(Object less_or_equal) {
- this.less_or_equal = less_or_equal;
- }
-
- public Object[] getIn_range() {
- return in_range;
- }
-
/**
* Sets in_range attribute.
* @param in_range.
@@ -93,57 +54,6 @@ public class Constraint implements Cloneable {
this.in_range[1] = in_range[1];
}
- public List<Object> getValid_values() {
- return valid_values;
- }
-
- public void setValid_values(List<Object> valid_values) {
- this.valid_values = valid_values;
- }
-
- /**
- * Add Valid value
- * @param validValue object.
- */
- public void addValidValue(Object validValue) {
- if (this.valid_values == null) {
- this.valid_values = new ArrayList<>();
- }
- valid_values.add(validValue);
- }
-
- public Integer getLength() {
- return length;
- }
-
- public void setLength(Integer length) {
- this.length = length;
- }
-
- public Integer getMin_length() {
- return min_length;
- }
-
- public void setMin_length(Integer min_length) {
- this.min_length = min_length;
- }
-
- public Integer getMax_length() {
- return max_length;
- }
-
- public void setMax_length(Integer max_length) {
- this.max_length = max_length;
- }
-
- public Object getPattern() {
- return pattern;
- }
-
- public void setPattern(Object pattern) {
- this.pattern = pattern;
- }
-
@Override
public Constraint clone() {
Constraint constraint = new Constraint();
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConstraintTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConstraintTest.java
new file mode 100644
index 0000000000..a67ed5a0e7
--- /dev/null
+++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConstraintTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 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.tosca.datatypes.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class ConstraintTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Constraint.class, hasValidGettersAndSettersExcluding("in_range"));
+ }
+
+ @Test
+ public void setInRangeTest() {
+ Constraint constraint = new Constraint();
+ Object[] tmpInRange = new Object[] {"str1","str2","str3"};
+ constraint.setIn_range(tmpInRange);
+ assertEquals(constraint.getIn_range().length, 2);
+ assertEquals(constraint.getIn_range()[0], "str1");
+ assertEquals(constraint.getIn_range()[1], "str2");
+ }
+}