From 4e9b7568daca3fcf26a40d07626b51ba872050b1 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 31 Jan 2024 12:47:59 +0100 Subject: [PATCH] Refactor some TAPI Junit tests code JIRA: TRNSPRTPCE:758 Signed-off-by: guillaume.lambert Change-Id: I49fe0a517fd7c57616ddd32697cd4ab8fd931085 --- .../ConvertORTopoToFullTapiTopoTest.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java index a01165d7d..0c371e95d 100644 --- a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java +++ b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java @@ -1298,28 +1298,19 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest { private Integer nrgContainsClientAndNetwork(List nrgList, Uuid clientNepUuid, Uuid networkNepUuid) { // 1 NRG should at least contain the NEP of interest in the NEP List - Boolean foundClient = false; - Boolean foundNetwork = false; Integer indexNrg = 0; for (NodeRuleGroup nrg : nrgList) { + Boolean foundClient = false; + Boolean foundNetwork = false; for (NodeEdgePoint nep : nrg.nonnullNodeEdgePoint().values()) { - if (nep.getNodeEdgePointUuid().equals(clientNepUuid)) { - foundClient = true; - } else if (nep.getNodeEdgePointUuid().equals(networkNepUuid)) { - foundNetwork = true; - } + foundClient = foundClient || nep.getNodeEdgePointUuid().equals(clientNepUuid); + foundNetwork = foundNetwork || nep.getNodeEdgePointUuid().equals(networkNepUuid); } if (foundClient && foundNetwork) { - break; - } else { - foundClient = false; - foundNetwork = false; + return indexNrg; } indexNrg++; } - if (foundClient && foundNetwork) { - return indexNrg; - } return null; } -- 2.36.6