diff options
author | Samuel Liard <samuel.liard@gmail.com> | 2021-10-01 10:09:17 +0200 |
---|---|---|
committer | Samuel Liard <samuel.liard@gmail.com> | 2021-10-01 10:17:43 +0200 |
commit | 0f940df172f04ad5261b2443b296b3ab58faf02c (patch) | |
tree | b9b0626100b813dd0185883a2c9e938ab3f920d1 /src/test/java | |
parent | 1cc27839c3c1e06de6b52389921db057bd10c6fc (diff) |
Fix sonar issues :
Remove all printStackTrace
Change split regex
Remove all string comparison with !=
Issue-ID: AAI-3362
Signed-off-by: sliard <samuel.liard@gmail.com>
Change-Id: Ia473d0e2d0af5a6cde333e593c42bddd89709167
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java | 39 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java | 2 |
2 files changed, 24 insertions, 17 deletions
diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java index 25d7bc7..2b2a61d 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java @@ -19,29 +19,36 @@ */ package org.onap.aai.migration.v12; -import org.janusgraph.core.JanusGraphFactory; -import org.janusgraph.core.JanusGraph; -import org.janusgraph.core.JanusGraphTransaction; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraphTransaction; import org.javatuples.Pair; -import org.junit.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.onap.aai.AAISetup; -import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.ModelType; -import org.onap.aai.setup.SchemaVersions; -import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; +import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import java.util.*; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - public class MigrateINVPhysicalInventoryMethodTest extends AAISetup { private final static ModelType introspectorFactoryType = ModelType.MOXY; @@ -110,12 +117,12 @@ public class MigrateINVPhysicalInventoryMethodTest extends AAISetup { public void readLineTest() throws Exception { MigrateINVPhysicalInventory m = new MigrateINVPhysicalInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); String line = "pnf-name-collector-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,\"1.7 \",SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651881_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-1\n"; - Pair<String, String> pair = m.processLine(Arrays.asList(line.split("\\s*,\\s*", -1))).get(); + Pair<String, String> pair = m.processLine(Arrays.asList(line.split(",", -1))).get(); assertEquals("Test 1","pnf-name-collector-1", pair.getValue0()); assertEquals("Test 1","1.7", pair.getValue1()); line = "pnf-name-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,1.2,SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651882_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-3"; - pair = m.processLine(Arrays.asList(line.split("\\s*,\\s*", -1))).get(); + pair = m.processLine(Arrays.asList(line.split(",", -1))).get(); assertEquals("Test 1","pnf-name-1", pair.getValue0()); assertEquals("Test 1","1.2", pair.getValue1()); diff --git a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java index f89f87d..fc7e55f 100644 --- a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java +++ b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java @@ -101,7 +101,7 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup { try{ Files.createFile(Paths.get(FILE)); }catch(Exception e) { - e.printStackTrace(); + System.out.println("Create File error : " + e.getMessage()); } String finalStr = ""; finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1\",\"resource-version\":\"333\"}" + "\n"; |