From 37ed86ed44e466409ac6d0ab425589377ab33c81 Mon Sep 17 00:00:00 2001 From: Krishnakumar Jinka Date: Sun, 2 Dec 2018 22:22:25 +0900 Subject: Fix sonar issue in node Fix issue reported by sonar on more than allowed params in method using a builder object. Issue-ID: PORTAL-481 Change-Id: I0b88f083253570aa1a1f1be2c8af2d2bb3334e50 Signed-off-by: krisjinka --- .../analytics/gmap/map/layer/SwingLayerTest.java | 17 ++++- .../portalsdk/analytics/gmap/node/NodeTest.java | 74 ++++++++++++++++------ 2 files changed, 69 insertions(+), 22 deletions(-) (limited to 'ecomp-sdk/epsdk-analytics/src/test') diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayerTest.java index e52d01b6..100525bc 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayerTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayerTest.java @@ -3,6 +3,7 @@ * ONAP Portal SDK * =================================================================== * Copyright © 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -52,6 +53,7 @@ import org.onap.portalsdk.analytics.gmap.line.Line; import org.onap.portalsdk.analytics.gmap.map.ColorProperties; import org.onap.portalsdk.analytics.gmap.map.NovaMap; import org.onap.portalsdk.analytics.gmap.node.Node; +import org.onap.portalsdk.analytics.gmap.node.NodeParam; import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite; import org.springframework.test.util.ReflectionTestUtils; @@ -81,9 +83,18 @@ public class SwingLayerTest { novaMap.setShowLegend(true); ReflectionTestUtils.setField(novaMap, "transform", new AffineTransform()); Node nodeObj = new Node(new NovaMap()); - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2016", 13, true, true); - nodeObj.addNode(13.14d, 10.11d, "nodeType", "nodeID", "type=international|year=2017", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2016").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.14d).setLatitude(10.11d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=international|year=2017").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); novaMap.setNode(nodeObj); swingLayer = new SwingLayer(novaMap); BufferedImage image = new BufferedImage(novaMap.getBoundingBox().width, novaMap.getBoundingBox().height, BufferedImage.TYPE_INT_ARGB); diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/node/NodeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/node/NodeTest.java index a6cd2933..bd46e25a 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/node/NodeTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/node/NodeTest.java @@ -3,6 +3,7 @@ * ONAP Portal SDK * =================================================================== * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -51,6 +52,7 @@ import org.mockito.Mockito; import org.onap.portalsdk.analytics.gmap.map.ColorProperties; import org.onap.portalsdk.analytics.gmap.map.NovaMap; import org.onap.portalsdk.analytics.gmap.node.Node; +import org.onap.portalsdk.analytics.gmap.node.NodeParam; import org.springframework.test.util.ReflectionTestUtils; public class NodeTest { @@ -72,9 +74,12 @@ public class NodeTest { Node nodeObj = new Node(new NovaMap()); Double longitude = 13.13d; Double latitude =28.28d; - NodeInfo nodeINfo = nodeObj.addNode(longitude, latitude, "nodeType", "nodeID", "nodeAttributes", 13, true, true); + NodeInfo nodeINfo = nodeObj.addNode( + new NodeParam().setLongitude(longitude).setLatitude(latitude).setNodeType("nodeType") + .setNodeID("nodeID").setNodeAttributes("nodeAttributes").setState(13).setMoveable(true) + .setDeleteable(true)); + assertNotNull(nodeINfo); assertNotNull(nodeINfo); - assertEquals((Double)longitude,(Double)nodeINfo.geoCoordinate.longitude); assertEquals((Double)latitude,(Double)nodeINfo.geoCoordinate.latitude); assertEquals("nodeType",nodeINfo.getNodeType()); @@ -87,11 +92,19 @@ public class NodeTest { public void testUpdateNumberCase1() { Node nodeObj = new Node(new NovaMap()); - - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2018", 13, true, true); - nodeObj.addNode(13.14d, 10.11d, "nodeType", "nodeID", "type=international|year=2018", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.14d).setLatitude(10.11d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=international|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); nodeObj.updateNumberT1("year"); HashMap hashMap = nodeObj.getNodeCollection().getNodeCollection(); @@ -169,10 +182,18 @@ public class NodeTest { novaMap.setColorProperties(new ColorProperties(novaMap)); ReflectionTestUtils.setField(novaMap, "transform", new AffineTransform()); Node nodeObj = new Node(novaMap); - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2016", 13, true, true); - nodeObj.addNode(13.14d, 10.11d, "nodeType", "nodeID", "type=international|year=2017", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); - + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2016").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.14d).setLatitude(10.11d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=international|year=2017").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); Point pointObj= new Point(3,3); nodeObj.nodeExist(pointObj); // assertNotNull(existNodeInfo); @@ -185,9 +206,14 @@ public class NodeTest { @Test public void testGetNodeCollection() { Node nodeObj = new Node(new NovaMap()); - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2016", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); - + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2016").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); nodeObj.getNodeCollection(); assertNotNull(nodeObj.getNodeCollection()); } @@ -195,8 +221,14 @@ public class NodeTest { @Test public void testClearNodeIDSet() { Node nodeObj = new Node(new NovaMap()); - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2016", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2016").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); nodeObj.clearNodeIDSet(); } @@ -204,10 +236,15 @@ public class NodeTest { public void testClearSelectionList() { Node nodeObj = new Node(new NovaMap()); - nodeObj.addNode(13.13d, 10.10d, "nodeType", "nodeID", "type=domestic|year=2016", 13, true, true); - nodeObj.addNode(13.15d, 10.12d, "nodeType", "nodeID", "type=local|year=2018", 13, true, true); + nodeObj.addNode( + new NodeParam().setLongitude(13.13d).setLatitude(10.10d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=domestic|year=2016").setState(13).setMoveable(true) + .setDeleteable(true)); + nodeObj.addNode( + new NodeParam().setLongitude(13.15d).setLatitude(10.12d).setNodeType("nodeType").setNodeID("nodeID") + .setNodeAttributes("type=local|year=2018").setState(13).setMoveable(true) + .setDeleteable(true)); nodeObj.clearSelectionList(); - } @Test @@ -216,5 +253,4 @@ public class NodeTest { nodeObj.clearSelectionList(); } - } -- cgit 1.2.3-korg