Skip to content

Commit

Permalink
config module coverage up to 60% (#11560)
Browse files Browse the repository at this point in the history
* fix test case

* test case coverage

* open config module testcases

* config module testcases coverage

* test case coverage up to 55%

* test case coverage up to 55%

* test case coverage up to 60%

* fix test case

* fix test case

* fix test case

* fix test case

* fix test case

* fix test case

* coverage makeup

* coverage makeup

* coverage makeup

* coverage makeup
  • Loading branch information
shiyiyue1102 authored Dec 29, 2023
1 parent 526227c commit d4e2ccd
Show file tree
Hide file tree
Showing 59 changed files with 7,167 additions and 3,232 deletions.
4 changes: 2 additions & 2 deletions config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@
</dependencies>
<build>
<plugins>
<plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<argLine>-Dnacos.standalone=true</argLine>
</configuration>
</plugin>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alibaba.nacos.config.server.model;

import java.io.Serializable;
import java.util.Objects;

/**
* Config advance info.
Expand Down Expand Up @@ -126,4 +127,20 @@ public String getConfigTags() {
public void setConfigTags(String configTags) {
this.configTags = configTags;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConfigAdvanceInfo that = (ConfigAdvanceInfo) o;
return createTime == that.createTime && modifyTime == that.modifyTime && Objects.equals(createUser,
that.createUser) && Objects.equals(createIp, that.createIp) && Objects.equals(desc, that.desc)
&& Objects.equals(use, that.use) && Objects.equals(effect, that.effect) && Objects.equals(type,
that.type) && Objects.equals(schema, that.schema) && Objects.equals(configTags, that.configTags);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

/**
* ConfigHistoryInfo.
Expand Down Expand Up @@ -174,4 +175,27 @@ public String getEncryptedDataKey() {
public void setEncryptedDataKey(String encryptedDataKey) {
this.encryptedDataKey = encryptedDataKey;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConfigHistoryInfo that = (ConfigHistoryInfo) o;
return id == that.id && lastId == that.lastId && Objects.equals(dataId, that.dataId) && Objects.equals(group,
that.group) && Objects.equals(tenant, that.tenant) && Objects.equals(appName, that.appName)
&& Objects.equals(md5, that.md5) && Objects.equals(content, that.content) && Objects.equals(srcIp,
that.srcIp) && Objects.equals(srcUser, that.srcUser) && Objects.equals(opType, that.opType)
&& Objects.equals(createdTime, that.createdTime) && Objects.equals(lastModifiedTime,
that.lastModifiedTime) && Objects.equals(encryptedDataKey, that.encryptedDataKey);
}

@Override
public int hashCode() {
return Objects.hash(id, lastId, dataId, group, tenant, appName, md5, content, srcIp, srcUser, opType,
createdTime, lastModifiedTime, encryptedDataKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ public class ConfigInfoAggr implements Serializable {

private String content;

public ConfigInfoAggr(String dataId, String group, String datumId, String content) {
this.dataId = dataId;
this.group = group;
this.datumId = datumId;
this.content = content;
}

public ConfigInfoAggr(String dataId, String group, String datumId, String appName, String content) {
this.dataId = dataId;
this.group = group;
this.datumId = datumId;
this.appName = appName;
this.content = content;
}

public ConfigInfoAggr() {

}
Expand Down Expand Up @@ -104,17 +89,6 @@ public void setContent(String content) {
this.content = content;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((content == null) ? 0 : content.hashCode());
result = prime * result + ((dataId == null) ? 0 : dataId.hashCode());
result = prime * result + ((datumId == null) ? 0 : datumId.hashCode());
result = prime * result + ((group == null) ? 0 : group.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ConfigInfoBase(String dataId, String group, String content) {
this.group = group;
this.content = content;
if (this.content != null) {
this.md5 = MD5Utils.md5Hex(this.content, Constants.ENCODE);
this.md5 = MD5Utils.md5Hex(this.content, Constants.PERSIST_ENCODE);
}
}

Expand Down Expand Up @@ -170,17 +170,6 @@ public int compareTo(ConfigInfoBase o) {
return 0;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((content == null) ? 0 : content.hashCode());
result = prime * result + ((dataId == null) ? 0 : dataId.hashCode());
result = prime * result + ((group == null) ? 0 : group.hashCode());
result = prime * result + ((md5 == null) ? 0 : md5.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ public void setGroup(String group) {
this.group = group;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((dataId == null) ? 0 : dataId.hashCode());
result = prime * result + ((group == null) ? 0 : group.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alibaba.nacos.config.server.model;

import java.io.Serializable;
import java.util.Objects;

/**
* ConfigInfoStateWrapper. include id,dataId,group,tenant,lastModified.
Expand Down Expand Up @@ -74,4 +75,22 @@ public String getTenant() {
public void setTenant(String tenant) {
this.tenant = tenant;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConfigInfoStateWrapper that = (ConfigInfoStateWrapper) o;
return id == that.id && lastModified == that.lastModified && Objects.equals(dataId, that.dataId)
&& Objects.equals(group, that.group) && Objects.equals(tenant, that.tenant);
}

@Override
public int hashCode() {
return Objects.hash(id, dataId, group, tenant, lastModified);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alibaba.nacos.config.server.model;

import java.io.Serializable;
import java.util.Objects;

/**
* ConfigKey.
Expand All @@ -36,12 +37,6 @@ public class ConfigKey implements Serializable {
public ConfigKey() {
}

public ConfigKey(String appName, String dataId, String group) {
this.appName = appName;
this.dataId = dataId;
this.group = group;
}

public String getAppName() {
return appName;
}
Expand All @@ -66,4 +61,21 @@ public void setGroup(String group) {
this.group = group;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConfigKey configKey = (ConfigKey) o;
return Objects.equals(appName, configKey.appName) && Objects.equals(dataId, configKey.dataId) && Objects.equals(
group, configKey.group);
}

@Override
public int hashCode() {
return Objects.hash(appName, dataId, group);
}
}
Loading

0 comments on commit d4e2ccd

Please sign in to comment.