diff options
author | sonicke <10112215@zte.com.cn> | 2019-02-26 16:18:32 +0800 |
---|---|---|
committer | sonicke <10112215@zte.com.cn> | 2019-02-26 16:18:32 +0800 |
commit | 51814384b801b5479582cc190065a44e9c866279 (patch) | |
tree | 2848f20aaf54fae17a3dff3e46f135bf4fe318ed /zte/sfc-driver | |
parent | 77dddd871421b1de8d92dd76e2a1b237cb00b50f (diff) |
override hashCode for sonar
Issue-ID: VFC-1264
Change-Id: I0881451ead3bf6c8e5e5c04781ea8d0cb6869081
Signed-off-by: Zhuoyao Huang <10112215@zte.com.cn>
Diffstat (limited to 'zte/sfc-driver')
12 files changed, 36 insertions, 6 deletions
diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java index 6f494c4..006e5c6 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java @@ -36,4 +36,8 @@ public class MsbRegisterEntity { } return false; } + + public int hashCode() { + return super.hashCode(); + } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java index 7956166..8b4d249 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/NodeEntity.java @@ -31,4 +31,8 @@ public class NodeEntity { } return false; } + + public int hashCode() { + return super.hashCode(); + } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java index 2f7f020..9c8ec0d 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java @@ -33,4 +33,8 @@ public class Result { return false; } + public int hashCode() { + return super.hashCode(); + } + } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java index 9910336..2d64a87 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/SdnControllerInfo.java @@ -30,4 +30,8 @@ public class SdnControllerInfo { } return false; } + + public int hashCode() { + return super.hashCode(); + } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java index 31af38f..1d6e534 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/PortInfo.java @@ -34,4 +34,8 @@ public class PortInfo { } return false; } + + public int hashCode() { + return super.hashCode(); + } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java index f98c7d9..c1848d7 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/portpair/ServiceFunctionParameter.java @@ -31,4 +31,8 @@ public class ServiceFunctionParameter { } return false; } + + public int hashCode() { + return super.hashCode(); + } } diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/MsbRegisterEntityTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/MsbRegisterEntityTest.java index 4a1e024..7bbb5ba 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/MsbRegisterEntityTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/MsbRegisterEntityTest.java @@ -61,12 +61,8 @@ public class MsbRegisterEntityTest { public void equals() throws Exception { assert !entity2.equals(entity1); assert entity2.equals(entity2); -/* MsbRegisterEntity entity = new MsbRegisterEntity(); - assert entity2.equals(entity1); - assert entity2.equals(entity2); - assert !entity2.equals(null); - assert !entity.equals(entity2); - assert !entity2.equals(entity);*/ + assert entity2.hashCode() == entity2.hashCode(); + assert entity2.hashCode() != entity1.hashCode(); } @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/NodeEntityTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/NodeEntityTest.java index afc2d58..392ace6 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/NodeEntityTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/NodeEntityTest.java @@ -46,6 +46,8 @@ public class NodeEntityTest { public void equals() throws Exception { assert !entity2.equals(entity1); assert entity2.equals(entity2); + assert entity2.hashCode() == entity2.hashCode(); + assert entity2.hashCode() != entity1.hashCode(); } @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java index c74424b..2f596c4 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/ResultTest.java @@ -39,6 +39,8 @@ public class ResultTest { public void equals() throws Exception { assert !entity2.equals(entity1); assert entity2.equals(entity2); + assert entity2.hashCode() == entity2.hashCode(); + assert entity2.hashCode() != entity1.hashCode(); } @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/SdnControllerInfoTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/SdnControllerInfoTest.java index 0937b20..8d9f11e 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/SdnControllerInfoTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/SdnControllerInfoTest.java @@ -46,6 +46,8 @@ public class SdnControllerInfoTest { public void equals() throws Exception { assert !entity2.equals(entity1); assert entity2.equals(entity2); + assert entity2.hashCode() == entity2.hashCode(); + assert entity2.hashCode() != entity1.hashCode(); } @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/PortInfoTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/PortInfoTest.java index 7d20b5c..9093d98 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/PortInfoTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/PortInfoTest.java @@ -49,6 +49,8 @@ public class PortInfoTest { public void equals() throws Exception { assert !portInfo2.equals(portInfo1); assert portInfo2.equals(portInfo2); + assert portInfo2.hashCode() == portInfo2.hashCode(); + assert portInfo2.hashCode() != portInfo1.hashCode(); } @Test diff --git a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/ServiceFunctionParameterTest.java b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/ServiceFunctionParameterTest.java index 0a85f7e..0eceaac 100644 --- a/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/ServiceFunctionParameterTest.java +++ b/zte/sfc-driver/sfc-driver/src/test/java/org/onap/sfc/entity/portpair/ServiceFunctionParameterTest.java @@ -43,6 +43,8 @@ public class ServiceFunctionParameterTest { public void equals() throws Exception { assert !entity2.equals(entity1); assert entity2.equals(entity2); + assert entity2.hashCode() == entity2.hashCode(); + assert entity2.hashCode() != entity1.hashCode(); } @Test |