summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java1
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java50
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java27
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigurationQueryTest.java25
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java25
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java27
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java27
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java21
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java21
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java30
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java54
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java32
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java25
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java35
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java21
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java21
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java44
17 files changed, 234 insertions, 252 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java
index 4d92889ab7..dd2887af11 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java
@@ -18,7 +18,6 @@ package org.onap.config.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.AfterEach;
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java
index 4383124208..d0fba695da 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java
@@ -16,13 +16,13 @@
package org.onap.config.test;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.HashMap;
import java.util.Map;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.impl.CliConfigurationImpl;
import org.onap.config.util.ConfigTestConstant;
@@ -33,19 +33,18 @@ import org.onap.config.util.TestUtil;
* Scenario 17
* Verify Configuration Management System - Command Line Interface for query, update and list operations
*/
-public class CliTest {
+class CliTest {
private static final String NAMESPACE = "CLI";
private static final String TENANT = "OPENECOMP";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testCliApi() throws Exception {
+ void testCliApi() throws Exception {
//Verify without fallback
Map<String, Object> input = new HashMap<>();
input.put("ImplClass", "org.onap.config.type.ConfigurationQuery");
@@ -55,7 +54,7 @@ public class CliTest {
ConfigurationManager conf = new CliConfigurationImpl();
String maxLength = conf.getConfigurationValue(input);
- Assert.assertEquals("14", maxLength);
+ assertEquals("14", maxLength);
Map<String, String> outputMap = conf.listConfiguration(input);
validateCliListConfig(outputMap);
@@ -63,23 +62,20 @@ public class CliTest {
private void validateCliListConfig(Map<String, String> outputMap) {
- Assert.assertEquals("@" + System.getProperty("user.home") + "/TestResources/GeneratorsList.json",
- outputMap.get(ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
- Assert.assertEquals("appc,catalog", outputMap.get(ConfigTestConstant.ARTIFACT_CONSUMER));
- Assert.assertEquals("6", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_MINLENGTH));
- Assert.assertEquals("true", outputMap.get(ConfigTestConstant.ARTIFACT_ENCODED));
- Assert.assertEquals("14", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals("pdf,zip,xml,pdf,tgz,xls", outputMap.get(ConfigTestConstant.ARTIFACT_EXT));
- Assert.assertEquals("Base64,MD5", outputMap.get(ConfigTestConstant.ARTIFACT_ENC));
- Assert.assertEquals("@" + TestUtil.getenv(ConfigTestConstant.PATH) + "/myschema.json",
- outputMap.get(ConfigTestConstant.ARTIFACT_XML_SCHEMA));
- Assert.assertEquals("a-zA-Z_0-9", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_UPPER));
- Assert.assertEquals("/opt/spool," + System.getProperty("user.home") + "/asdc",
- outputMap.get(ConfigTestConstant.ARTIFACT_LOC));
- Assert.assertEquals("deleted,Deleted", outputMap.get(ConfigTestConstant.ARTIFACT_STATUS));
+ assertEquals("@" + System.getProperty("user.home") + "/TestResources/GeneratorsList.json", outputMap.get(ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
+ assertEquals("appc,catalog", outputMap.get(ConfigTestConstant.ARTIFACT_CONSUMER));
+ assertEquals("6", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_MINLENGTH));
+ assertEquals("true", outputMap.get(ConfigTestConstant.ARTIFACT_ENCODED));
+ assertEquals("14", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ assertEquals("pdf,zip,xml,pdf,tgz,xls", outputMap.get(ConfigTestConstant.ARTIFACT_EXT));
+ assertEquals("Base64,MD5", outputMap.get(ConfigTestConstant.ARTIFACT_ENC));
+ assertEquals("@" + TestUtil.getenv(ConfigTestConstant.PATH) + "/myschema.json", outputMap.get(ConfigTestConstant.ARTIFACT_XML_SCHEMA));
+ assertEquals("a-zA-Z_0-9", outputMap.get(ConfigTestConstant.ARTIFACT_NAME_UPPER));
+ assertEquals("/opt/spool," + System.getProperty("user.home") + "/asdc", outputMap.get(ConfigTestConstant.ARTIFACT_LOC));
+ assertEquals("deleted,Deleted", outputMap.get(ConfigTestConstant.ARTIFACT_STATUS));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java
index f291f8e0b8..897ed359ff 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java
@@ -16,15 +16,15 @@
package org.onap.config.test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.File;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -36,14 +36,13 @@ import org.onap.config.util.TestUtil;
* Validate conventional and configurational source location.
* Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test
*/
-public class ConfigSourceLocationTest {
+class ConfigSourceLocationTest {
private static final String NAMESPACE = "SourceLocation";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
Properties props = new Properties();
props.setProperty("maxCachedBufferSize", "1024");
@@ -55,13 +54,13 @@ public class ConfigSourceLocationTest {
}
@Test
- public void testMergeStrategyInConfig() {
+ void testMergeStrategyInConfig() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
- Assert.assertEquals("1024", config.getAsString(ConfigTestConstant.ARTIFACT_MAXSIZE));
+ assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
+ assertEquals("1024", config.getAsString(ConfigTestConstant.ARTIFACT_MAXSIZE));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigurationQueryTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigurationQueryTest.java
index 7a468ce7f5..8f9076c338 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigurationQueryTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigurationQueryTest.java
@@ -16,31 +16,32 @@
package org.onap.config.test;
-import org.junit.Test;
-import org.onap.config.type.ConfigurationQuery;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-public class ConfigurationQueryTest {
+import org.junit.jupiter.api.Test;
+import org.onap.config.type.ConfigurationQuery;
+
+class ConfigurationQueryTest {
+
private static String TENANT = "OPENECOMP";
private static String NAMESPACE = "tetsNamepspace";
private static String KEY = "testKey";
@Test
- public void testConfigurationQueryBuild() {
+ void testConfigurationQueryBuild() {
// given
ConfigurationQuery configurationQuery = new ConfigurationQuery();
// when
configurationQuery = configurationQuery
- .externalLookup(true)
- .fallback(true)
- .latest(true)
- .nodeSpecific(true)
- .namespace(NAMESPACE)
- .tenant(TENANT)
- .key(KEY);
+ .externalLookup(true)
+ .fallback(true)
+ .latest(true)
+ .nodeSpecific(true)
+ .namespace(NAMESPACE)
+ .tenant(TENANT)
+ .key(KEY);
// then
assertEquals(TENANT.toUpperCase(), configurationQuery.getTenant());
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java
index 876aed098d..27f63438bd 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java
@@ -17,35 +17,32 @@
package org.onap.config.test;
import static org.onap.config.util.TestUtil.validateConfiguration;
-import static org.onap.config.util.TestUtil.writeFile;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.onap.config.util.TestUtil;
/**
* Created by ARR on 10/14/2016.
* Validate configuration with properties,xml,json,yaml file format with mode.
*/
-public class FallbackConfigTest {
+class FallbackConfigTest {
private static final String NAMESPACE = "fallback";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithFallbackFileFormat() {
+ void testConfigurationWithFallbackFileFormat() {
validateConfiguration(NAMESPACE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ TestUtil.cleanUp();
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java
index b398a700ff..ab36b60bd5 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java
@@ -16,11 +16,11 @@
package org.onap.config.test;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -32,24 +32,23 @@ import org.onap.config.util.TestUtil;
* not exist in the namespace configuration.
* Created by sheetalm on 10/14/2016.
*/
-public class FallbackToGlobalNamespaceTest {
+class FallbackToGlobalNamespaceTest {
private static final String NAMESPACE = "FallbackToGlobalNS";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testFallbackToGlobalNamespace() {
+ void testFallbackToGlobalNamespace() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals("1024", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
+ assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ assertEquals("1024", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java
index d66165c762..5180d0a37e 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java
@@ -16,11 +16,11 @@
package org.onap.config.test;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -30,24 +30,23 @@ import org.onap.config.util.TestUtil;
* Created by sheetalm on 10/13/2016.
* Scenario 10 Verify configuration present in both global and defined namespace
*/
-public class GlobalAndNamespaceConfigTest {
+class GlobalAndNamespaceConfigTest {
private static final String NAMESPACE = "GlobalAndNSConfig";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testNamespaceInConfig() {
+ void testNamespaceInConfig() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("a-zA-Z", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
- Assert.assertEquals("a-zA-Z_0-9", config.getAsString(ConfigTestConstant.ARTIFACT_NAME_UPPER));
+ assertEquals("a-zA-Z", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
+ assertEquals("a-zA-Z_0-9", config.getAsString(ConfigTestConstant.ARTIFACT_NAME_UPPER));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java
index 0c82fe4219..5055f37b83 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java
@@ -17,12 +17,10 @@
package org.onap.config.test;
import static org.onap.config.util.TestUtil.validateConfiguration;
-import static org.onap.config.util.TestUtil.writeFile;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.util.TestUtil;
/**
@@ -30,23 +28,22 @@ import org.onap.config.util.TestUtil;
* Scenario 1
* Validate configuration with Java Properties file format with mode
*/
-public class JavaPropertiesConfigTest {
+class JavaPropertiesConfigTest {
private static final String NAMESPACE = "javaProperties";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithPropertiesFileFormat() {
+ void testConfigurationWithPropertiesFileFormat() {
validateConfiguration(NAMESPACE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java
index cd3eb6a06f..67a9d050a7 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java
@@ -17,35 +17,32 @@
package org.onap.config.test;
import static org.onap.config.util.TestUtil.validateConfiguration;
-import static org.onap.config.util.TestUtil.writeFile;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.util.TestUtil;
/**
* Created by ARR on 10/14/2016.
* Scenario 3 Validate configuration with JSON file format with mode.
*/
-public class JsonConfigTest {
+class JsonConfigTest {
private static final String NAMESPACE = "JSONConfig";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithJsonFileFormat() {
+ void testConfigurationWithJsonFileFormat() {
validateConfiguration(NAMESPACE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java
index 6d189a0d30..2b9f0f9c99 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java
@@ -16,13 +16,11 @@
package org.onap.config.test;
-import static org.onap.config.util.TestUtil.writeFile;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -33,27 +31,25 @@ import org.onap.config.util.TestUtil;
* Check load order for merge and override. Higher load order takes precedence for override
* Lower load order takes precedence for merge.
*/
-public class LoadOrderMergeAndOverrideTest {
+class LoadOrderMergeAndOverrideTest {
private static final String NAMESPACE = "LoadOrderConfiguration";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithPropertiesFileFormat() {
+ void testConfigurationWithPropertiesFileFormat() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
- Assert.assertEquals("5", config.getAsString(NAMESPACE, "artifact.length"));
- Assert.assertEquals("56", config.getAsString(NAMESPACE, "artifact.size"));
+ assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ assertEquals("5", config.getAsString(NAMESPACE, "artifact.length"));
+ assertEquals("56", config.getAsString(NAMESPACE, "artifact.size"));
}
-
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java
index 57f632a8e4..172d324a87 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java
@@ -16,13 +16,14 @@
package org.onap.config.test;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -31,23 +32,22 @@ import org.onap.config.util.TestUtil;
/**
* Scenario 8 Validate configuration with mode specified as a configuration property.
*/
-public class ModeAsConfigPropTest {
+class ModeAsConfigPropTest {
private static final String NAMESPACE = "ModeAsConfigProp";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testMergeStrategyInConfig() {
+ void testMergeStrategyInConfig() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals("1048", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
+ assertEquals("1048", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
List<String> expectedExtList = new ArrayList<>();
expectedExtList.add("pdf");
@@ -57,41 +57,41 @@ public class ModeAsConfigPropTest {
expectedExtList.add("tgz");
expectedExtList.add("xls");
List<String> extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT);
- Assert.assertEquals(expectedExtList, extList);
+ assertEquals(expectedExtList, extList);
List<String> expectedEncList = new ArrayList<>();
expectedEncList.add("Base64");
expectedEncList.add("MD5");
List<String> encList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_ENC);
- Assert.assertEquals(expectedEncList, encList);
+ assertEquals(expectedEncList, encList);
- Assert.assertEquals("{name:\"SCM\"}", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
+ assertEquals("{name:\"SCM\"}", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
- Assert.assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
+ assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
- Assert.assertEquals("Deleted", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS));
+ assertEquals("Deleted", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS));
List<String> expectedLocList = new ArrayList<>();
expectedLocList.add("/opt/spool");
expectedLocList.add(System.getProperty("user.home") + "/asdc");
List<String> locList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_LOC);
- Assert.assertEquals(expectedLocList, locList);
+ assertEquals(expectedLocList, locList);
- Assert.assertEquals("@" + TestUtil.getenv(ConfigTestConstant.PATH) + "/myschema.json",
- config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
+ assertEquals("@" + TestUtil.getenv(ConfigTestConstant.PATH) + "/myschema.json",
+ config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
List<String> artifactConsumer = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER);
- Assert.assertEquals(config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER_APPC),
- artifactConsumer);
+ assertEquals(config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER_APPC),
+ artifactConsumer);
- Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_MANDATORY_NAME), true);
+ assertTrue(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_MANDATORY_NAME));
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH), "6");
+ assertEquals("6", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH));
- Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_ENCODED), true);
+ assertTrue(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_ENCODED));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java
index 03c63569fb..c128cfcf68 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java
@@ -16,11 +16,11 @@
package org.onap.config.test;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
@@ -30,30 +30,26 @@ import org.onap.config.util.TestUtil;
* Created by ARR on 10/14/2016.
* Scenario 17 - Verify Configuration management System - Support for Multi-Tenancy.
*/
-public class MultiTenancyConfigTest {
+class MultiTenancyConfigTest {
private static final String NAMESPACE = "tenancy";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithMultiTenancyFileFormat() {
+ void testConfigurationWithMultiTenancyFileFormat() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString("OPENECOMP", NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH),
- "20");
-
- Assert.assertEquals(config.getAsString("Telefonica", NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS), "Deleted");
-
- Assert.assertEquals(config.getAsString("TID", NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
+ assertEquals("20", config.getAsString("OPENECOMP", NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ assertEquals("Deleted", config.getAsString("Telefonica", NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS));
+ assertEquals("14", config.getAsString("TID", NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
index cba1739768..c0db95a902 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
@@ -27,7 +27,8 @@ import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.onap.config.api.ConfigurationManager;
@@ -36,8 +37,10 @@ import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
/**
- * Created by sheetalm on 10/19/2016. Scenario 19 Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test Verify
- * node specific override using CLI
+ * Created by sheetalm on 10/19/2016.
+ * Scenario 19
+ * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test
+ * Verify node specific override using CLI
*/
@Disabled("Investigate instability (random failures)"
+ "[ERROR] NodeSpecificCliTest.testCliApi:73 ยป FileNotFound /home/jenkins/TestResources/c...")
@@ -46,12 +49,9 @@ class NodeSpecificCliTest {
private static final String NAMESPACE = "NodeCLI";
private static final File FILE = new File(TestUtil.jsonSchemaLoc + "config.properties");
- @AfterAll
- public static void tearDown() throws Exception {
+ @BeforeEach
+ public void setUp() throws Exception {
TestUtil.cleanUp();
- if (FILE.exists()) {
- assertTrue(FILE.delete());
- }
}
@Test
@@ -87,4 +87,13 @@ class NodeSpecificCliTest {
assertTrue(FILE.delete());
}
}
+
+ @AfterEach
+ public void tearDown() throws Exception {
+ TestUtil.cleanUp();
+ if (FILE.exists()) {
+ assertTrue(FILE.delete());
+ }
+ }
+
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java
index d53bf27100..3d7533fac5 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java
@@ -16,55 +16,52 @@
package org.onap.config.test;
-import static org.onap.config.util.TestUtil.writeFile;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
+import org.onap.config.util.TestUtil;
/**
* Created by ARR on 10/17/2016.
* Scenario 22 - Validate the default mode if the mode is not set
*/
-public class ValidateDefaultModeTest {
+class ValidateDefaultModeTest {
private static final String NAMESPACE = "defaultmode";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithValidateDefaultMode() {
+ void testConfigurationWithValidateDefaultMode() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
+ assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE), "1048");
+ assertEquals("1048", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
List<String> expectedExtList = new ArrayList<>();
expectedExtList.add("pdf");
expectedExtList.add("tgz");
expectedExtList.add("xls");
List<String> extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT);
- Assert.assertEquals(expectedExtList, extList);
+ assertEquals(expectedExtList, extList);
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH), "6");
+ assertEquals("6", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH));
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ TestUtil.cleanUp();
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java
index 79a917d1d1..32ac272713 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java
@@ -17,35 +17,32 @@
package org.onap.config.test;
import static org.onap.config.util.TestUtil.validateConfiguration;
-import static org.onap.config.util.TestUtil.writeFile;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.util.TestUtil;
/**
* Created by ARR on 10/14/2016.
* Scenario 2 - Validate configuration with XML file format with mode
*/
-public class XmlConfigTest {
+class XmlConfigTest {
private static final String NAMESPACE = "XMLConfig";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithXmlFileFormat() {
+ void testConfigurationWithXmlFileFormat() {
validateConfiguration(NAMESPACE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java
index b2954f1e49..784e61b410 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java
@@ -17,34 +17,31 @@
package org.onap.config.test;
import static org.onap.config.util.TestUtil.validateConfiguration;
-import static org.onap.config.util.TestUtil.writeFile;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.config.util.TestUtil;
/**
* Created by ARR on 10/14/2016.
* Scenario 4 - Validate configuration with YAML file format with mode
*/
-public class YamlConfigTest {
+class YamlConfigTest {
private static final String NAMESPACE = "YAMLConfig";
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
+ @BeforeEach
+ public void setUp() throws Exception {
+ TestUtil.cleanUp();
}
@Test
- public void testConfigurationWithYamlFileFormat() {
+ void testConfigurationWithYamlFileFormat() {
validateConfiguration(NAMESPACE);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
TestUtil.cleanUp();
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java
index 3f19cec346..85da0d5a0a 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java
@@ -19,8 +19,8 @@ package org.onap.config.util;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
@@ -30,27 +30,33 @@ import java.util.List;
import org.junit.Assert;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Created by sheetalm on 10/13/2016.
*/
public class TestUtil {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestUtil.class);
+
public static final String jsonSchemaLoc = System.getProperty("user.home") + "/TestResources/";
public static void cleanUp() throws Exception {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
+ writeFile("{name:\"SCM\"}");
}
- public static void writeFile(String data) throws IOException {
- File dir = new File(jsonSchemaLoc);
+ private static void writeFile(final String data) {
+ final File dir = new File(jsonSchemaLoc);
dir.mkdirs();
- File file = new File(jsonSchemaLoc + "/GeneratorsList.json");
- file.createNewFile();
- FileWriter fileWriter = new FileWriter(file);
- fileWriter.write(data);
- fileWriter.close();
+ final File file = new File(jsonSchemaLoc + "/GeneratorsList.json");
+ String canonicalPath = "";
+ try (final FileWriter fileWriter = new FileWriter(file)) {
+ canonicalPath = file.getCanonicalPath();
+ fileWriter.write(data);
+ } catch (final IOException e) {
+ LOGGER.warn("Failed to write file {}", canonicalPath, e);
+ }
}
public static void validateConfiguration(String nameSpace) {
@@ -88,14 +94,14 @@ public class TestUtil {
Assert.assertEquals(expectedLocList, locList);
Assert.assertEquals("@GeneratorList.json",
- config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
+ config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
Assert.assertEquals("@" + getenv(ConfigTestConstant.PATH) + "/myschema.json",
- config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
+ config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
List<String> artifactConsumer = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER);
Assert.assertEquals(config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER_APPC),
- artifactConsumer);
+ artifactConsumer);
Assert.assertEquals("6", config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH));
Assert.assertEquals("true", config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MANDATORY_NAME));
@@ -122,13 +128,13 @@ public class TestUtil {
Path tmpPath = Files.createTempDirectory(tmpDirPrefix);
Path dir0 = Paths.get(tmpPath.toString(), "dir0", "dir1", "dir2");
Files.createDirectories(dir0);
- Path[] files= {
- Paths.get(tmpPath.toString(), "file001"),
- Paths.get(tmpPath.toString(), "dir0", "file002"),
- Paths.get(tmpPath.toString(), "dir0", "dir1", "file003"),
- Paths.get(tmpPath.toString(), "dir0", "dir1", "dir2", "file004"),
+ Path[] files = {
+ Paths.get(tmpPath.toString(), "file001"),
+ Paths.get(tmpPath.toString(), "dir0", "file002"),
+ Paths.get(tmpPath.toString(), "dir0", "dir1", "file003"),
+ Paths.get(tmpPath.toString(), "dir0", "dir1", "dir2", "file004"),
};
- for (Path file : files ) {
+ for (Path file : files) {
Files.createFile(file);
}
return tmpPath;