aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/dcae/common/JsonDataLoader.java
diff options
context:
space:
mode:
authorVijay Venkatesh Kumar <vv770d@att.com>2023-01-20 15:31:48 -0500
committerVijay Venkatesh Kumar <vv770d@att.com>2023-01-28 23:52:44 +0000
commit952fa4a24a47b648b68f6d86b73e2cc05e044d46 (patch)
tree118426f33532e42c4774e8e2f7bc4e6ef89b6536 /src/test/java/org/onap/dcae/common/JsonDataLoader.java
parent3c31bdcdf18aff4bf755058e2d32e153d8216eb5 (diff)
VESCollector Test optimization
Fix test failure in win Add check for docker\linux dependency on related test Change-Id: I5be1fa860a69fc6479d9c0b202eabbb0336ea0c4 Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com> Issue-ID: DCAEGEN2-3334 Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Diffstat (limited to 'src/test/java/org/onap/dcae/common/JsonDataLoader.java')
-rw-r--r--src/test/java/org/onap/dcae/common/JsonDataLoader.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/java/org/onap/dcae/common/JsonDataLoader.java b/src/test/java/org/onap/dcae/common/JsonDataLoader.java
index 8c2fdd6d..fd06025a 100644
--- a/src/test/java/org/onap/dcae/common/JsonDataLoader.java
+++ b/src/test/java/org/onap/dcae/common/JsonDataLoader.java
@@ -2,7 +2,8 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.s
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2023 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,8 @@
package org.onap.dcae.common;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -27,7 +30,7 @@ import java.nio.file.Paths;
/**
* This class is static and does not have public constructor.
- * It is responsible for data loading fot test cases.
+ * It is responsible for data loading for test cases.
*
* @author Zebek
*/
@@ -42,10 +45,11 @@ public final class JsonDataLoader {
* @param path to file that will be loaded
* @return contend of the file located under path, given in parameters, as string
* @throws IOException when file under given path was not found
+ * @throws URISyntaxException
*/
- public static String loadContent(String path) throws IOException {
- URL resource = JsonDataLoader.class.getResource(path);
- Path resourcePath = Paths.get(resource.getPath());
+ public static String loadContent(String path) throws IOException, URISyntaxException {
+ URI resource = JsonDataLoader.class.getResource(path).toURI();
+ Path resourcePath = Paths.get(resource);
return new String(Files.readAllBytes(resourcePath));
}
}