diff options
author | tang peng <tang.peng5@zte.com.cn> | 2019-02-23 07:20:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-23 07:20:47 +0000 |
commit | e44087456f6b74b61183ff783db6333eb1fe4dd4 (patch) | |
tree | 86626a68cb0ca74cf7e2d07977326242f51af420 | |
parent | 81edfdbaffd9c450f37d2418bb444473ee3bbe77 (diff) | |
parent | 953aee4dbbed4ce9edae8ca9914290b3164b077a (diff) |
Merge "Improved the UT coverage"
11 files changed, 64 insertions, 43 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java index fe1f677..c7881d1 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java @@ -17,9 +17,12 @@ package org.onap.holmes.common.api.entity; import com.google.gson.annotations.SerializedName;
import lombok.Data;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
-@Data
+@Getter
+@Setter
@NoArgsConstructor
public class AlarmInfo {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java index 4cbd6bf..e21f97d 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmsCorrelation.java @@ -18,9 +18,12 @@ package org.onap.holmes.common.api.entity; import com.google.gson.annotations.SerializedName;
import java.util.Date;
import lombok.Data;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
-@Data
+@Getter
+@Setter
@NoArgsConstructor
public class AlarmsCorrelation {
@@ -47,4 +50,18 @@ public class AlarmsCorrelation { private long reserve2 = -1;
private long reserve3 = -1;
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("[");
+ sb.append("ruleId=").append(ruleId).append(",");
+ sb.append("ruleInfo=").append(ruleInfo).append(",");
+ sb.append("createTime=").append(createTime == null ? null : createTime.toString()).append(",");
+ sb.append("parentAlarmId=").append(parentAlarmId).append(",");
+ sb.append("childAlarmId=").append(childAlarmId).append(",");
+ sb.append("reserve1=").append(reserve1).append(",");
+ sb.append("reserve2=").append(reserve2).append(",");
+ sb.append("reserve3=").append(reserve3).append("]");
+ return sb.toString();
+ }
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java index db6c19f..14a3f07 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java @@ -61,23 +61,23 @@ public class CorrelationRule implements Cloneable { throw new InternalError(e);
}
- r.rid = rid == null ? null : rid;
- r.name = name == null ? null : name;
- r.description = description == null ? null : description;
+ r.rid = rid;
+ r.name = name;
+ r.description = description;
r.enabled = enabled;
r.templateID = templateID;
- r.engineID = engineID == null ? null : engineID;
- r.engineType = engineType == null ? null : engineType;
- r.creator = creator == null ? null : creator;
- r.modifier = modifier == null ? null : modifier;
+ r.engineID = engineID;
+ r.engineType = engineType;
+ r.creator = creator;
+ r.modifier = modifier;
r.params = params == null ? null : (Properties) params.clone();
- r.content = content == null ? null : content;
- r.vendor = vendor == null ? null : vendor;
+ r.content = content;
+ r.vendor = vendor;
r.createTime = createTime == null ? null : (Date) createTime.clone();
r.updateTime = updateTime == null ? null : (Date) updateTime.clone();
- r.packageName = packageName == null ? null : packageName;
- r.closedControlLoopName = closedControlLoopName == null ? null : closedControlLoopName;
- r.engineInstance = engineInstance == null ? null : engineInstance;
+ r.packageName = packageName;
+ r.closedControlLoopName = closedControlLoopName;
+ r.engineInstance = engineInstance;
return r;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java index 0244f84..4bfb3cf 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java @@ -16,16 +16,14 @@ package org.onap.holmes.common.api.entity; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; import java.util.List; - -@Data @NoArgsConstructor @AllArgsConstructor +@Getter +@Setter public class ServiceEntity { private String serviceName; diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java index 2c2b793..a8fc04d 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java @@ -23,7 +23,6 @@ import lombok.Getter; import lombok.NoArgsConstructor;
import lombok.Setter;
-@Data
@NoArgsConstructor
@AllArgsConstructor
@Getter
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java index 205126d..98e5506 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java @@ -15,11 +15,10 @@ */ package org.onap.holmes.common.api.entity; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import lombok.*; -@Data +@Getter +@Setter @NoArgsConstructor @AllArgsConstructor public class ServiceNode4Query { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java index f5dca01..eba7544 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java @@ -24,7 +24,6 @@ import lombok.Getter; import lombok.NoArgsConstructor;
import lombok.Setter;
-@Data
@NoArgsConstructor
@AllArgsConstructor
@Setter
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java index dd940c4..822d74c 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/AlarmsCorrelationTest.java @@ -110,7 +110,6 @@ public class AlarmsCorrelationTest { assertThat(alarmsCorrelation.getReserve3(), equalTo(reserve3)); } - @Test public void testToString() throws Exception { final AlarmsCorrelation alarmsCorrelationTemp = new AlarmsCorrelation(); @@ -119,14 +118,4 @@ public class AlarmsCorrelationTest { alarmsCorrelation.setRuleId(ruleId); assertThat(alarmsCorrelation.toString(), equalTo(alarmsCorrelationTemp.toString())); } - - - @Test - public void testEqualsAndHashCode() throws Exception { - final AlarmsCorrelation alarmsCorrelationTemp = new AlarmsCorrelation(); - String ruleId = "ruleId"; - alarmsCorrelationTemp.setRuleId(ruleId); - alarmsCorrelation.setRuleId(ruleId); - assertThat(alarmsCorrelation, equalTo(alarmsCorrelationTemp)); - } -} +} diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java index 1a25a35..c4b605a 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/entity/CorrelationRuleTest.java @@ -150,4 +150,19 @@ public class CorrelationRuleTest { correlationRule.setEngineInstance(engineInstance); assertThat(correlationRule.getEngineInstance(), equalTo(engineInstance)); } + + @Test + public void getterAndSetter4ClosedControlLoopName(){ + final String closedControlLoopName = "closedControlLoopName"; + correlationRule.setClosedControlLoopName(closedControlLoopName); + assertThat(correlationRule.getClosedControlLoopName(), equalTo(closedControlLoopName)); + } + + @Test + public void testClone() { + final String rid = "rid"; + correlationRule.setRid(rid); + CorrelationRule rule = (CorrelationRule) correlationRule.clone(); + assertThat(rule.getRid(), equalTo(rid)); + } } diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java index 76aad81..ab75e06 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/MSBRegisterUtilTest.java @@ -35,6 +35,7 @@ public class MSBRegisterUtilTest { @Rule
public PowerMockRule powerMockRule = new PowerMockRule();
+
private MSBRegisterUtil msbRegisterUtil = new MSBRegisterUtil();
@Test
@@ -30,13 +30,13 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.test.skip>false</maven.test.skip>
+ <powermock.version>1.7.1</powermock.version>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<finalName>${project.artifactId}-${project.version}</finalName>
<release.dir>${basedir}/target</release.dir>
<bundle.name>${project.artifactId}-${project.version}</bundle.name>
<pkgzip.dir>${basedir}/../release/pkgzip</pkgzip.dir>
<excludesFile>**/*$*</excludesFile>
- <nexusproxy>https://nexus.open-o.org/content</nexusproxy>
<stringtemplate.version>3.2.1</stringtemplate.version>
<dropwizard.version>1.3.0</dropwizard.version>
@@ -46,6 +46,7 @@ <slf4j.version>1.7.25</slf4j.version>
<quartz.version>2.2.1</quartz.version>
</properties>
+
<dependencyManagement>
<dependencies>
<dependency>
@@ -121,7 +122,7 @@ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>1.6.5</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -133,25 +134,25 @@ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
- <version>1.6.5</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
- <version>1.7.1</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule</artifactId>
- <version>1.6.5</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-classloading-xstream</artifactId>
- <version>1.6.5</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
|