aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config
diff options
context:
space:
mode:
Diffstat (limited to 'common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config')
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java1
-rwxr-xr-xcommon/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/TestCMSuite.java38
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliFallbackAndLookupTest.java (renamed from common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CLIFallbackAndLookupTest.java)54
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ConfigSourceLocationTest.java35
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackConfigTest.java35
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNSTest.java42
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java58
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNSConfigTest.java43
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java56
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JAVAPropertiesConfigTest.java40
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JSONConfigTest.java40
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java53
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java52
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/LoadOrderMergeAndOverrideTest.java34
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java122
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/MultiTenancyConfigTest.java34
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ValidateDefaultModeTest.java44
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XMLConfigTest.java40
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java52
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YAMLConfigTest.java40
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java51
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/ConfigTestConstant.java56
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java54
23 files changed, 628 insertions, 446 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java
index 71b2a01c71..94ac71d1f2 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.junit.Test;
public class ConfigurationUtilsTest {
+
@Test
public void testCommaList() {
List<?> list = Arrays.asList("1", "2", 3);
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/TestCMSuite.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/TestCMSuite.java
index 9360ce1673..6c460160d0 100755
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/TestCMSuite.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/TestCMSuite.java
@@ -18,44 +18,32 @@ package org.onap.config;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-import org.onap.config.test.CLIFallbackAndLookupTest;
+import org.onap.config.test.CliFallbackAndLookupTest;
import org.onap.config.test.CliTest;
import org.onap.config.test.ConfigSourceLocationTest;
import org.onap.config.test.FallbackConfigTest;
-import org.onap.config.test.FallbackToGlobalNSTest;
-import org.onap.config.test.GlobalAndNSConfigTest;
-import org.onap.config.test.JAVAPropertiesConfigTest;
-import org.onap.config.test.JSONConfigTest;
+import org.onap.config.test.FallbackToGlobalNamespaceTest;
+import org.onap.config.test.GlobalAndNamespaceConfigTest;
+import org.onap.config.test.JavaPropertiesConfigTest;
+import org.onap.config.test.JsonConfigTest;
import org.onap.config.test.LoadOrderMergeAndOverrideTest;
import org.onap.config.test.ModeAsConfigPropTest;
import org.onap.config.test.MultiTenancyConfigTest;
import org.onap.config.test.NodeSpecificCliTest;
import org.onap.config.test.ValidateDefaultModeTest;
-import org.onap.config.test.XMLConfigTest;
-import org.onap.config.test.YAMLConfigTest;
+import org.onap.config.test.XmlConfigTest;
+import org.onap.config.test.YamlConfigTest;
/**
* Created by sheetalm on 10/25/2016.
*/
-
@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ConfigurationUtilsTest.class,
- JAVAPropertiesConfigTest.class,
- JSONConfigTest.class,
- XMLConfigTest.class,
- YAMLConfigTest.class,
- CLIFallbackAndLookupTest.class,
- CliTest.class,
- ConfigSourceLocationTest.class,
- FallbackConfigTest.class,
- FallbackToGlobalNSTest.class,
- GlobalAndNSConfigTest.class,
- ModeAsConfigPropTest.class,
- MultiTenancyConfigTest.class,
- NodeSpecificCliTest.class,
- ValidateDefaultModeTest.class,
- LoadOrderMergeAndOverrideTest.class})
+@Suite.SuiteClasses(
+ {ConfigurationUtilsTest.class, JavaPropertiesConfigTest.class, JsonConfigTest.class, XmlConfigTest.class,
+ YamlConfigTest.class, CliFallbackAndLookupTest.class, CliTest.class, ConfigSourceLocationTest.class,
+ FallbackConfigTest.class, FallbackToGlobalNamespaceTest.class, GlobalAndNamespaceConfigTest.class,
+ ModeAsConfigPropTest.class, MultiTenancyConfigTest.class, NodeSpecificCliTest.class,
+ ValidateDefaultModeTest.class, LoadOrderMergeAndOverrideTest.class})
public class TestCMSuite extends junit.framework.TestSuite {
private TestCMSuite() {
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 d5990c8dac..48aecf4adc 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
@@ -1,5 +1,28 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.HashMap;
+import java.util.Map;
+import javax.management.JMX;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -9,15 +32,6 @@ import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
-import javax.management.JMX;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.HashMap;
-import java.util.Map;
-
-
/**
* Created by sheetalm on 10/18/2016.
@@ -25,10 +39,10 @@ import java.util.Map;
* 21 - Verify the CLI fetches only the current value unless the fallback option is specified
* 23 - Fetch value using CLI for a key with underlying resource
*/
-public class CLIFallbackAndLookupTest {
+public class CliFallbackAndLookupTest {
- public final static String NAMESPACE = "CLIFallback";
- public final static String TENANT = "OPENECOMP";
+ private static final String NAMESPACE = "CLIFallback";
+ private static final String TENANT = "OPENECOMP";
@Before
public void setUp() throws IOException {
@@ -37,7 +51,7 @@ public class CLIFallbackAndLookupTest {
}
@Test
- public void testCLIFallbackAndLookup() throws Exception{
+ public void testCliFallbackAndLookup() throws Exception {
//Verify without fallback
Map<String, Object> input = new HashMap<>();
@@ -50,19 +64,19 @@ public class CLIFallbackAndLookupTest {
ObjectName mbeanName = new ObjectName(Constants.MBEAN_NAME);
ConfigurationManager conf = JMX.newMBeanProxy(mbsc, mbeanName, ConfigurationManager.class, true);
String maxSizeWithNoFallback = conf.getConfigurationValue(input);
- Assert.assertEquals("",maxSizeWithNoFallback);
+ Assert.assertEquals("", maxSizeWithNoFallback);
//Verify underlying resource without lookup switch
input.put("key", ConfigTestConstant.ARTIFACT_JSON_SCHEMA);
String jsonSchema = conf.getConfigurationValue(input);
- System.out.println("jsonSchema=="+jsonSchema);
- Assert.assertEquals("@"+System.getProperty("user.home")+"/TestResources/GeneratorsList.json" , jsonSchema);
+ System.out.println("jsonSchema==" + jsonSchema);
+ Assert.assertEquals("@" + System.getProperty("user.home") + "/TestResources/GeneratorsList.json", jsonSchema);
//Verify underlying resource with lookup switch
input.put("externalLookup", true);
jsonSchema = conf.getConfigurationValue(input);
- System.out.println("jsonSchema=="+jsonSchema);
- Assert.assertEquals("{name:\"SCM\"}" , jsonSchema);
+ System.out.println("jsonSchema==" + jsonSchema);
+ Assert.assertEquals("{name:\"SCM\"}", jsonSchema);
//Verify with fallback
Map<String, Object> fallbackInput = new HashMap<>();
@@ -73,11 +87,11 @@ public class CLIFallbackAndLookupTest {
fallbackInput.put("key", ConfigTestConstant.ARTIFACT_MAXSIZE);
String maxSizeWithFallback = conf.getConfigurationValue(fallbackInput);
- Assert.assertEquals("1024",maxSizeWithFallback);
+ Assert.assertEquals("1024", maxSizeWithFallback);
}
@After
public void tearDown() throws Exception {
- TestUtil.cleanUp();
+ 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 c997e09f8e..f291f8e0b8 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
@@ -1,5 +1,26 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+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;
@@ -9,21 +30,15 @@ import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Properties;
-
/**
* Created by sheetalm on 10/14/2016.
* Scenario 11
- * Validate conventional and configurational source location
- *
+ * Validate conventional and configurational source location.
* Pre-requisite - set -Dconfig.location=${"user.home"}/TestResources/ while running test
*/
public class ConfigSourceLocationTest {
- public final static String NAMESPACE = "SourceLocation";
+
+ private static final String NAMESPACE = "SourceLocation";
@Before
public void setUp() throws IOException {
@@ -40,7 +55,7 @@ public class ConfigSourceLocationTest {
}
@Test
- public void testMergeStrategyInConfig() throws IOException, InterruptedException {
+ public 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));
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 17b4aee8b0..876aed098d 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
@@ -1,22 +1,36 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
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 java.io.IOException;
-
-import static org.onap.config.util.TestUtil.validateConfiguraton;
-import static org.onap.config.util.TestUtil.writeFile;
-
/**
* Created by ARR on 10/14/2016.
- *
- * Validate configuration with properties,xml,json,yaml file format with mode
+ * Validate configuration with properties,xml,json,yaml file format with mode.
*/
public class FallbackConfigTest {
- public static final String NAMESPACE = "fallback";
+ private static final String NAMESPACE = "fallback";
@Before
public void setUp() throws IOException {
@@ -25,14 +39,13 @@ public class FallbackConfigTest {
}
@Test
- public void testConfigurationWithFallbackFileFormat(){
- validateConfiguraton(NAMESPACE);
+ public void testConfigurationWithFallbackFileFormat() {
+ validateConfiguration(NAMESPACE);
}
@After
public void tearDown() throws Exception {
String data = "{name:\"SCM\"}";
writeFile(data);
- //ConfigurationUtils.executeDDLSQL("truncate dox.configuration");
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNSTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNSTest.java
deleted file mode 100644
index b70247b040..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNSTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.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;
-
-import java.io.IOException;
-
-/**
- * Scenario 12
- * Verify configuration value fallback to the global namespace if the configuraton property doesnot exist in the namespace configuration
- * Created by sheetalm on 10/14/2016.
- */
-public class FallbackToGlobalNSTest {
-
- public final static String NAMESPACE = "FallbackToGlobalNS";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
- }
-
- @Test
- public void testFallbackToGlobalNS() throws IOException, InterruptedException {
- Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("14",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals("1024",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
- }
-
- @After
- 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/FallbackToGlobalNamespaceTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java
new file mode 100644
index 0000000000..b398a700ff
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/FallbackToGlobalNamespaceTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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 org.onap.config.api.Configuration;
+import org.onap.config.api.ConfigurationManager;
+import org.onap.config.util.ConfigTestConstant;
+import org.onap.config.util.TestUtil;
+
+/**
+ * Scenario 12
+ * Verify configuration value fallback to the global namespace if the configuration property does
+ * not exist in the namespace configuration.
+ * Created by sheetalm on 10/14/2016.
+ */
+public class FallbackToGlobalNamespaceTest {
+
+ private static final String NAMESPACE = "FallbackToGlobalNS";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ TestUtil.writeFile(data);
+ }
+
+ @Test
+ public 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));
+ }
+
+ @After
+ 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/GlobalAndNSConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNSConfigTest.java
deleted file mode 100644
index e4a511064e..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNSConfigTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.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;
-
-import java.io.IOException;
-
-/**
- * Created by sheetalm on 10/13/2016.
- * Scenario 10 Verify configuration present in both global and defined namespace
- */
-public class GlobalAndNSConfigTest {
-
- public final static String NAMESPACE = "GlobalAndNSConfig";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
- }
-
- @Test
- public void testNamespaceInConfig() throws IOException, InterruptedException {
- 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 ));
- }
-
- @After
- 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
new file mode 100644
index 0000000000..d66165c762
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/GlobalAndNamespaceConfigTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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 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 sheetalm on 10/13/2016.
+ * Scenario 10 Verify configuration present in both global and defined namespace
+ */
+public class GlobalAndNamespaceConfigTest {
+
+ private static final String NAMESPACE = "GlobalAndNSConfig";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ TestUtil.writeFile(data);
+ }
+
+ @Test
+ public 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));
+ }
+
+ @After
+ 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
deleted file mode 100644
index 994bd7260b..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JAVAPropertiesConfigTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.config.util.TestUtil;
-
-import java.io.IOException;
-
-import static org.onap.config.util.TestUtil.validateConfiguraton;
-import static org.onap.config.util.TestUtil.writeFile;
-
-/**
- * Created by ARR on 10/13/2016.
- *
- * Scenario 1
- * Validate configuration with Java Properties file format with mode
- */
-public class JAVAPropertiesConfigTest {
-
- public static final String NAMESPACE = "javaProperties";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
- }
-
- @Test
- public void testConfigurationWithPropertiesFileFormat(){
- validateConfiguraton(NAMESPACE);
- }
-
-
-
- @After
- 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
deleted file mode 100644
index bf6ea5c243..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JSONConfigTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.config.util.TestUtil;
-
-import java.io.IOException;
-
-import static org.onap.config.util.TestUtil.validateConfiguraton;
-import static org.onap.config.util.TestUtil.writeFile;
-
-/**
- * Created by ARR on 10/14/2016.
- *
- * Scenario 3
- * Validate configuration with JSON file format with mode
- */
-public class JSONConfigTest {
-
- public static final String NAMESPACE = "JSONConfig";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
- }
-
- @Test
- public void testConfigurationWithJSONFileFormat(){
- validateConfiguraton(NAMESPACE);
- }
-
-
-
- @After
- 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
new file mode 100644
index 0000000000..0c82fe4219
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JavaPropertiesConfigTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.onap.config.util.TestUtil;
+
+/**
+ * Created by ARR on 10/13/2016.
+ * Scenario 1
+ * Validate configuration with Java Properties file format with mode
+ */
+public class JavaPropertiesConfigTest {
+
+ private static final String NAMESPACE = "javaProperties";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ writeFile(data);
+ }
+
+ @Test
+ public void testConfigurationWithPropertiesFileFormat() {
+ validateConfiguration(NAMESPACE);
+ }
+
+
+ @After
+ 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
new file mode 100644
index 0000000000..cd3eb6a06f
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/JsonConfigTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.onap.config.util.TestUtil;
+
+/**
+ * Created by ARR on 10/14/2016.
+ * Scenario 3 Validate configuration with JSON file format with mode.
+ */
+public class JsonConfigTest {
+
+ private static final String NAMESPACE = "JSONConfig";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ writeFile(data);
+ }
+
+ @Test
+ public void testConfigurationWithJsonFileFormat() {
+ validateConfiguration(NAMESPACE);
+ }
+
+
+ @After
+ 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 d179edfcfb..6d189a0d30 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
@@ -1,5 +1,24 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+import static org.onap.config.util.TestUtil.writeFile;
+
+import java.io.IOException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -9,18 +28,14 @@ import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
-import java.io.IOException;
-
-import static org.onap.config.util.TestUtil.writeFile;
-
/**
* Scenario
- * Check loadorder for merge and overide. Higher loadorder takes precedence for override
- * LoWer loadorder takes precedence for merge.
+ * Check load order for merge and override. Higher load order takes precedence for override
+ * Lower load order takes precedence for merge.
*/
public class LoadOrderMergeAndOverrideTest {
- public static final String NAMESPACE = "LoadOrderConfiguration";
+ private static final String NAMESPACE = "LoadOrderConfiguration";
@Before
public void setUp() throws IOException {
@@ -29,16 +44,15 @@ public class LoadOrderMergeAndOverrideTest {
}
@Test
- public void testConfigurationWithPropertiesFileFormat(){
+ public void testConfigurationWithPropertiesFileFormat() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH ), "14");
+ 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"));
}
-
@After
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 e8fe363dfd..57f632a8e4 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
@@ -1,5 +1,24 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -9,79 +28,72 @@ import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
/**
- * Scenario 8
- * Validate configuration with mode specified as a configuration property
+ * Scenario 8 Validate configuration with mode specified as a configuration property.
*/
-
public class ModeAsConfigPropTest {
- String newValue = null;
-
- public final static String NAMESPACE = "ModeAsConfigProp";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
- }
+ private static final String NAMESPACE = "ModeAsConfigProp";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ TestUtil.writeFile(data);
+ }
- @Test
- public void testMergeStrategyInConfig() throws IOException, InterruptedException {
- Configuration config = ConfigurationManager.lookup();
+ @Test
+ public void testMergeStrategyInConfig() {
+ Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals("14",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
+ Assert.assertEquals("14", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
- Assert.assertEquals("1048",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
+ Assert.assertEquals("1048", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE));
- List<String> expectedExtList = new ArrayList<String>();
- expectedExtList.add("pdf");
- expectedExtList.add("zip");
- expectedExtList.add("xml");
- expectedExtList.add("pdf");
- expectedExtList.add("tgz");
- expectedExtList.add("xls");
- List<String> extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT);
- Assert.assertEquals(expectedExtList, extList);
+ List<String> expectedExtList = new ArrayList<>();
+ expectedExtList.add("pdf");
+ expectedExtList.add("zip");
+ expectedExtList.add("xml");
+ expectedExtList.add("pdf");
+ expectedExtList.add("tgz");
+ expectedExtList.add("xls");
+ List<String> extList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_EXT);
+ Assert.assertEquals(expectedExtList, extList);
- List<String> expectedEncList = new ArrayList<String>();
- expectedEncList.add("Base64");
- expectedEncList.add("MD5");
- List<String> encList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_ENC);
- Assert.assertEquals(expectedEncList, encList);
+ List<String> expectedEncList = new ArrayList<>();
+ expectedEncList.add("Base64");
+ expectedEncList.add("MD5");
+ List<String> encList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_ENC);
+ Assert.assertEquals(expectedEncList, encList);
- String newValue = config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA);
- Assert.assertEquals("{name:\"SCM\"}",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
+ Assert.assertEquals("{name:\"SCM\"}", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_JSON_SCHEMA));
- Assert.assertEquals("a-zA-Z_0-9",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER ));
+ Assert.assertEquals("a-zA-Z_0-9", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_UPPER));
- Assert.assertEquals("Deleted",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS) );
+ Assert.assertEquals("Deleted", config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS));
- List<String> expectedLocList = new ArrayList<String>();
- expectedLocList.add("/opt/spool");
- expectedLocList.add(System.getProperty("user.home")+"/asdc");
- List<String> locList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_LOC);
- Assert.assertEquals(expectedLocList, locList);
+ 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);
- Assert.assertEquals("@"+TestUtil.getenv(ConfigTestConstant.PATH)+"/myschema.json",config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
+ Assert.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);
+ List<String> artifactConsumer = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER);
+ Assert.assertEquals(config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_CONSUMER_APPC),
+ artifactConsumer);
- Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_MANDATORY_NAME ), true);
+ Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_MANDATORY_NAME), true);
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH ), "6");
+ Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH), "6");
- Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_ENCODED ), true);
- }
+ Assert.assertEquals(config.getAsBooleanValue(NAMESPACE, ConfigTestConstant.ARTIFACT_ENCODED), true);
+ }
- @After
- public void tearDown() throws Exception {
- TestUtil.cleanUp();
- }
+ @After
+ 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 5765c4de2f..03c63569fb 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
@@ -1,5 +1,22 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+import java.io.IOException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -9,17 +26,13 @@ import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
-import java.io.IOException;
-
/**
* Created by ARR on 10/14/2016.
- *
- * Scenario 17
- * Verify Configuration management System - Support for Multi-Tenancy
+ * Scenario 17 - Verify Configuration management System - Support for Multi-Tenancy.
*/
public class MultiTenancyConfigTest {
- public static final String NAMESPACE = "tenancy";
+ private static final String NAMESPACE = "tenancy";
@Before
public void setUp() throws IOException {
@@ -28,14 +41,15 @@ public class MultiTenancyConfigTest {
}
@Test
- public void testConfigurationWithMultiTenancyFileFormat(){
+ public void testConfigurationWithMultiTenancyFileFormat() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString("OPENECOMP",NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH ), "20");
+ 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("Telefonica", NAMESPACE, ConfigTestConstant.ARTIFACT_STATUS), "Deleted");
- Assert.assertEquals(config.getAsString("TID",NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH ), "14");
+ Assert.assertEquals(config.getAsString("TID", NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
}
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 3711322056..d53bf27100 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
@@ -1,5 +1,26 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.test;
+import static org.onap.config.util.TestUtil.writeFile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -8,21 +29,13 @@ import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.util.ConfigTestConstant;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.onap.config.util.TestUtil.writeFile;
-
/**
* Created by ARR on 10/17/2016.
- *
- * Scenario 22
- * Validate the default mode if the mode is not set
+ * Scenario 22 - Validate the default mode if the mode is not set
*/
public class ValidateDefaultModeTest {
- public static final String NAMESPACE = "defaultmode";
+ private static final String NAMESPACE = "defaultmode";
@Before
public void setUp() throws IOException {
@@ -31,21 +44,21 @@ public class ValidateDefaultModeTest {
}
@Test
- public void testConfigurationWithValidateDefaultMode(){
+ public void testConfigurationWithValidateDefaultMode() {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH ), "14");
+ Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE ), "1048");
+ Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_MAXSIZE), "1048");
- List<String> expectedExtList = new ArrayList<String>();
+ 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);
- Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH ), "6");
+ Assert.assertEquals(config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH), "6");
}
@@ -53,6 +66,5 @@ public class ValidateDefaultModeTest {
public void tearDown() throws Exception {
String data = "{name:\"SCM\"}";
writeFile(data);
- // ConfigurationUtils.executeDDLSQL("truncate dox.configuration");
}
}
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
deleted file mode 100644
index 22832d378c..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XMLConfigTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.config.util.TestUtil;
-
-import java.io.IOException;
-
-import static org.onap.config.util.TestUtil.validateConfiguraton;
-import static org.onap.config.util.TestUtil.writeFile;
-
-/**
- * Created by ARR on 10/14/2016.
- *
- * Scenario 2
- * Validate configuration with XML file format with mode
- */
-public class XMLConfigTest {
-
- public static final String NAMESPACE = "XMLConfig";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
- }
-
- @Test
- public void testConfigurationWithXMLFileFormat(){
- validateConfiguraton(NAMESPACE);
- }
-
-
-
- @After
- 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/XmlConfigTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java
new file mode 100644
index 0000000000..79a917d1d1
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/XmlConfigTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.onap.config.util.TestUtil;
+
+/**
+ * Created by ARR on 10/14/2016.
+ * Scenario 2 - Validate configuration with XML file format with mode
+ */
+public class XmlConfigTest {
+
+ private static final String NAMESPACE = "XMLConfig";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ writeFile(data);
+ }
+
+ @Test
+ public void testConfigurationWithXmlFileFormat() {
+ validateConfiguration(NAMESPACE);
+ }
+
+
+ @After
+ 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
deleted file mode 100644
index f0e7ec54f7..0000000000
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YAMLConfigTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.onap.config.test;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.config.util.TestUtil;
-
-import java.io.IOException;
-
-import static org.onap.config.util.TestUtil.validateConfiguraton;
-import static org.onap.config.util.TestUtil.writeFile;
-
-/**
- * Created by ARR on 10/14/2016.
- *
- * Scenario 4
- * Validate configuration with YAML file format with mode
- */
-public class YAMLConfigTest {
-
- public static final String NAMESPACE = "YAMLConfig";
-
- @Before
- public void setUp() throws IOException {
- String data = "{name:\"SCM\"}";
- writeFile(data);
- }
-
- @Test
- public void testConfigurationWithYAMLFileFormat(){
- validateConfiguraton(NAMESPACE);
- }
-
-
-
- @After
- 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
new file mode 100644
index 0000000000..b2954f1e49
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/YamlConfigTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.onap.config.util.TestUtil;
+
+/**
+ * Created by ARR on 10/14/2016.
+ * Scenario 4 - Validate configuration with YAML file format with mode
+ */
+public class YamlConfigTest {
+
+ private static final String NAMESPACE = "YAMLConfig";
+
+ @Before
+ public void setUp() throws IOException {
+ String data = "{name:\"SCM\"}";
+ writeFile(data);
+ }
+
+ @Test
+ public void testConfigurationWithYamlFileFormat() {
+ validateConfiguration(NAMESPACE);
+ }
+
+ @After
+ 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/ConfigTestConstant.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/ConfigTestConstant.java
index 828c92ea73..434c7d3fbd 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/ConfigTestConstant.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/ConfigTestConstant.java
@@ -1,24 +1,44 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.config.util;
public class ConfigTestConstant {
-
- public static final String ARTIFACT_NAME_MAXLENGTH = "artifact.name.maxlength";
- public static final String ARTIFACT_MAXSIZE = "artifact.maxsize";
- public static final String ARTIFACT_EXT = "artifact.extension";
- public static final String ARTIFACT_ENC = "artifact.supportedEncryption";
- public static final String ARTIFACT_NAME_UPPER = "artifact.name.allowedChar";
- public static final String ARTIFACT_NAME_LOWER = "artifact.name.allowedchar";
- public static final String ARTIFACT_STATUS = "artifact.status";
- public static final String ARTIFACT_LOC = "artifact.persistLocation";
- public static final String ARTIFACT_JSON_SCHEMA = "artifact.jsonSchema";
- public static final String ARTIFACT_XML_SCHEMA = "artifact.xmlSchema";
- public static final String ARTIFACT_CONSUMER_APPC = "artifact.consumerAPPC";
- public static final String ARTIFACT_CONSUMER = "artifact.consumer";
- public static final String ARTIFACT_MANDATORY_NAME = "artifact.mandatory.name";
- public static final String ARTIFACT_NAME_MINLENGTH = "artifact.name.minlength";
- public static final String ARTIFACT_ENCODED = "artifact.encoded";
- public static final String PATH = "PATH";
- public static final String ONBOARDING_NAMESPACE = "onboarding";
+ public static final String ARTIFACT_NAME_MAXLENGTH = "artifact.name.maxlength";
+ public static final String ARTIFACT_MAXSIZE = "artifact.maxsize";
+ public static final String ARTIFACT_EXT = "artifact.extension";
+ public static final String ARTIFACT_ENC = "artifact.supportedEncryption";
+ public static final String ARTIFACT_NAME_UPPER = "artifact.name.allowedChar";
+ public static final String ARTIFACT_NAME_LOWER = "artifact.name.allowedchar";
+ public static final String ARTIFACT_STATUS = "artifact.status";
+ public static final String ARTIFACT_LOC = "artifact.persistLocation";
+ public static final String ARTIFACT_JSON_SCHEMA = "artifact.jsonSchema";
+ public static final String ARTIFACT_XML_SCHEMA = "artifact.xmlSchema";
+ public static final String ARTIFACT_CONSUMER_APPC = "artifact.consumerAPPC";
+ public static final String ARTIFACT_CONSUMER = "artifact.consumer";
+ public static final String ARTIFACT_MANDATORY_NAME = "artifact.mandatory.name";
+ public static final String ARTIFACT_NAME_MINLENGTH = "artifact.name.minlength";
+ public static final String ARTIFACT_ENCODED = "artifact.encoded";
+
+ public static final String PATH = "PATH";
+ public static final String ONBOARDING_NAMESPACE = "onboarding";
+
+ private ConfigTestConstant() {
+ // prevent instantiation
+ }
}
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 514f52899a..87ff4ba394 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
@@ -30,33 +30,32 @@ import org.onap.config.api.ConfigurationManager;
*/
public class TestUtil {
- public final static String jsonSchemaLoc = System.getProperty("user.home")+"/TestResources/";
- public static FileWriter fileWriter ;
+ public static final String jsonSchemaLoc = System.getProperty("user.home") + "/TestResources/";
+
+ public static void cleanUp() throws Exception {
+ String data = "{name:\"SCM\"}";
+ TestUtil.writeFile(data);
+ }
public static void writeFile(String data) throws IOException {
File dir = new File(jsonSchemaLoc);
dir.mkdirs();
- File file = new File(jsonSchemaLoc+"/GeneratorsList.json");
+ File file = new File(jsonSchemaLoc + "/GeneratorsList.json");
file.createNewFile();
- fileWriter = new FileWriter(file);
+ FileWriter fileWriter = new FileWriter(file);
fileWriter.write(data);
fileWriter.close();
}
- public static void cleanUp() throws Exception {
- String data = "{name:\"SCM\"}";
- TestUtil.writeFile(data);
- }
-
- public static void validateConfiguraton(String nameSpace) {
+ public static void validateConfiguration(String nameSpace) {
Configuration config = ConfigurationManager.lookup();
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH ), "14");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH), "14");
// First value from list is picked from Merge properties
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MAXSIZE ), "1048576");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MAXSIZE), "1048576");
- List<String> expectedExtList = new ArrayList<String>();
+ List<String> expectedExtList = new ArrayList<>();
expectedExtList.add("pdf");
expectedExtList.add("zip");
expectedExtList.add("xml");
@@ -66,32 +65,35 @@ public class TestUtil {
List<String> extList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_EXT);
Assert.assertEquals(expectedExtList, extList);
- List<String> expectedEncList = new ArrayList<String>();
+ List<String> expectedEncList = new ArrayList<>();
expectedEncList.add("Base64");
expectedEncList.add("MD5");
List<String> encList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_ENC);
Assert.assertEquals(expectedEncList, encList);
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_UPPER ), "a-zA-Z_0-9");
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_LOWER ), "a-zA-Z");
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_STATUS ), "deleted");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_UPPER), "a-zA-Z_0-9");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_LOWER), "a-zA-Z");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_STATUS), "deleted");
- List<String> expectedLocList = new ArrayList<String>();
+ List<String> expectedLocList = new ArrayList<>();
expectedLocList.add("/opt/spool");
- expectedLocList.add(System.getProperty("user.home")+"/asdc");
+ expectedLocList.add(System.getProperty("user.home") + "/asdc");
List<String> locList = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_LOC);
Assert.assertEquals(expectedLocList, locList);
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_JSON_SCHEMA ), "@GeneratorList.json");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_JSON_SCHEMA),
+ "@GeneratorList.json");
- Assert.assertEquals("@"+getenv(ConfigTestConstant.PATH)+"/myschema.json",config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_XML_SCHEMA));
+ Assert.assertEquals("@" + 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);
+ List<String> artifactConsumer = config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER);
+ Assert.assertEquals(config.getAsStringValues(nameSpace, ConfigTestConstant.ARTIFACT_CONSUMER_APPC),
+ artifactConsumer);
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH ), "6");
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MANDATORY_NAME ), "true");
- Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_ENCODED ), "true");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_NAME_MINLENGTH), "6");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MANDATORY_NAME), "true");
+ Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_ENCODED), "true");
}
/**