diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2019-04-18 19:05:58 +0900 |
---|---|---|
committer | arind.mondal <arind.mondal@samsung.com> | 2019-04-18 20:15:29 +0900 |
commit | b3ced8c4eb98a152076b3f0a05ba601bce7f8d2a (patch) | |
tree | b291f70c47c93cca6584665ee97161fb9452717d /ecomp-sdk/epsdk-domain/src/test/java | |
parent | 383968fe6e903bc81c127e797b7c32cf99e0e246 (diff) |
Fix sonar issue: implement builder
Sonar link: https://sonar.onap.org/issues?projectUuids=AV8LJxI3uDqGnRl2bdaB&resolved=false&rules=squid%3AS00107
Issue-ID: PORTAL-559
Change-Id: I28c202e69f4856131b91918c41343ae6a5df3bbe
Signed-off-by: arind.mondal <arind.mondal@samsung.com>
Diffstat (limited to 'ecomp-sdk/epsdk-domain/src/test/java')
2 files changed, 68 insertions, 24 deletions
diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java index ec455b43..016cd3f9 100644 --- a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java @@ -43,9 +43,6 @@ import java.util.HashMap; import java.util.Map; import org.junit.Test; -import org.onap.portalsdk.core.domain.support.Container; -import org.onap.portalsdk.core.domain.support.Domain; -import org.onap.portalsdk.core.domain.support.Size; public class DomainTest { @@ -53,7 +50,10 @@ public class DomainTest { public Domain mockDomain(){ - Domain domain = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + Domain domain = + new Domain.DomainBuilder().setId(null).setName(null).setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(0).setNumOfColsofContainer(0) + .createDomain(); domain.setP(null); domain.setNewXafterColl(0); @@ -74,7 +74,10 @@ public class DomainTest { public void domainTest(){ Domain domain = mockDomain(); - Domain domain1 = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + Domain domain1 = + new Domain.DomainBuilder().setId(null).setName(null).setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(0).setNumOfColsofContainer(0) + .createDomain(); domain1.setP(null); domain1.setNewXafterColl(0); @@ -103,7 +106,10 @@ public class DomainTest { @Test public void computeSizeTest(){ - Domain domain = new Domain("test", "VNI", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test").setName("VNI").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Container container = new Container("test","test",1,1,10,10,10,10,10,10); Map<String, Container> containerRowCol = new HashMap<>(); containerRowCol.put("00", container); @@ -115,7 +121,10 @@ public class DomainTest { } @Test public void computeSizeWithoutNameTest(){ - Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Container container = new Container("test","test",1,1,10,10,10,10,10,10); Map<String, Container> containerRowCol = new HashMap<>(); containerRowCol.put("00", container); @@ -135,7 +144,10 @@ public class DomainTest { containerRowCol.put("10", container01); containerRowCol.put("11", container01); - Domain domain = new Domain("test", "XYZ", 0, 1, 1, 4, 4, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(1).setDomainToLayoutWd(1) + .setDomainToLayoutH(4).setDomainToContH(4).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); domain.setContainers(containerRowCol); domain.computeConatinerPositions(); assertEquals(21.0, domain.getContainerRowCol().get("10").getP().getX(), DELTA); diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java index c7038144..1573da86 100644 --- a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java @@ -45,10 +45,6 @@ import java.util.List; import java.util.Map; import org.junit.Test; -import org.onap.portalsdk.core.domain.support.Container; -import org.onap.portalsdk.core.domain.support.Domain; -import org.onap.portalsdk.core.domain.support.Layout; -import org.onap.portalsdk.core.domain.support.Position; public class LayoutTest { @@ -84,7 +80,10 @@ public class LayoutTest { @Test public void computeDomainPositionsTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Map<String, Domain> domainRowCol = new HashMap<>(); List<Domain> domainList = new ArrayList<>(); domainList.add(domain); @@ -100,7 +99,10 @@ public class LayoutTest { @Test public void computeDomainPositionsModifiedTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Map<String, Container> containerRowCol = new HashMap<>(); Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); Position position = new Position(); @@ -124,8 +126,14 @@ public class LayoutTest { @Test public void collapseDomainModifiedTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); - Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); + Domain domain2 = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Map<String, Container> containerRowCol = new HashMap<>(); Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); Position position = new Position(); @@ -149,8 +157,14 @@ public class LayoutTest { @Test public void collapseDomainNewTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); - Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); + Domain domain2 = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Map<String, Container> containerRowCol = new HashMap<>(); Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); Position position = new Position(); @@ -174,8 +188,14 @@ public class LayoutTest { @Test public void collapseDomainTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); - Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); + Domain domain2 = + new Domain.DomainBuilder().setId("test").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Map<String, Container> containerRowCol = new HashMap<>(); Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); Position position = new Position(); @@ -204,7 +224,10 @@ public class LayoutTest { Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Position position = new Position(); position.setX(10); position.setY(10); @@ -239,7 +262,10 @@ public class LayoutTest { public void uncollapseDomainTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Position position = new Position(); position.setX(10); position.setY(10); @@ -272,7 +298,10 @@ public class LayoutTest { public void uncollapseDomainNewTest(){ Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Position position = new Position(); position.setX(10); position.setY(10); @@ -304,7 +333,10 @@ public class LayoutTest { Layout layout = new Layout(null, 0, 0, 2, 2); - Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain = + new Domain.DomainBuilder().setId("test1").setName("XYZ").setInterContWd(0).setInterContH(0).setDomainToLayoutWd(0) + .setDomainToLayoutH(0).setDomainToContH(0).setNumOfRowsofContainer(2).setNumOfColsofContainer(2) + .createDomain(); Position position = new Position(); position.setX(10); position.setY(10); |