Fixed configuration tests to run on Linux 23/71223/2
authorvempo <vitaliy.emporopulo@amdocs.com>
Thu, 25 Oct 2018 08:47:10 +0000 (11:47 +0300)
committerOren Kleks <orenkle@amdocs.com>
Thu, 25 Oct 2018 09:55:23 +0000 (09:55 +0000)
On Linux, environment variables are case sensitive,
while on Windows they are not.

Change-Id: I49dfd68ab3596ff7ee4a7a53aeba906b606df81b
Issue-ID: SDC-1867
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
23 files changed:
common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/CliTest.java
common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/ModeAsConfigPropTest.java
common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/ConfigTestConstant.java
common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/util/TestUtil.java
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/CLI/config-NS.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/CLIFallback/config-NS.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/FallbackToGlobalNS/config-NS.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/GlobalAndNSConfig/config.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/JSONConfiguration/config.json
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/LoadOrderConfiguration/config.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/MergeStrategyAsConfigProp/config.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/NodeCLI/config.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/SourceLocation/appjarconfig.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/UnregisterNotification/config-NS.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/ValidateNodeConfig/config-NS.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/XMLConfiguration/config.xml
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/YAMLConfiguration/config.yaml
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/fallback/config-fallback.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/java-properties/config.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/multitenancy/config-at.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/multitenancy/config-tf.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/multitenancy/config-vf.properties
common/onap-common-configuration-management/onap-configuration-management-core/src/test/resources/multitenancy/config.properties

index 065f32e..18c1360 100644 (file)
@@ -77,7 +77,7 @@ public class CliTest {
         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("@" + System.getenv("Path") + "/myschema.json",
+        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",
index 7c93af0..e8fe363 100644 (file)
@@ -67,7 +67,7 @@ public class ModeAsConfigPropTest {
                List<String> locList = config.getAsStringValues(NAMESPACE, ConfigTestConstant.ARTIFACT_LOC);
                Assert.assertEquals(expectedLocList, locList);
 
-               Assert.assertEquals("@"+System.getenv("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);
index 1d4dead..828c92e 100644 (file)
@@ -18,6 +18,7 @@ public class ConfigTestConstant {
        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";
 
 }
index c6601fd..514f528 100644 (file)
@@ -84,7 +84,7 @@ public class TestUtil {
 
         Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_JSON_SCHEMA ), "@GeneratorList.json");
 
-        Assert.assertEquals("@"+System.getenv("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);
@@ -93,4 +93,13 @@ public class TestUtil {
         Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_MANDATORY_NAME ), "true");
         Assert.assertEquals(config.getAsString(nameSpace, ConfigTestConstant.ARTIFACT_ENCODED ), "true");
     }
+
+    /**
+     * This to make the behavior of tests consistent with "env:X" in configuration files
+     * when environment variable X is not defined.
+     */
+    public static String getenv(String name) {
+        String value = System.getenv(name);
+        return value == null ? "" : value;
+    }
 }
index a50cabc..67d23ab 100644 (file)
@@ -7,6 +7,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=OPENECOMP:CLI
\ No newline at end of file
index 32da54f..05bd844 100644 (file)
@@ -7,6 +7,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=OPENECOMP:CLIFallback
\ No newline at end of file
index b7e985b..74edf55 100644 (file)
@@ -8,6 +8,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=FallbackToGlobalNS
\ No newline at end of file
index 1a86f68..bd1d9fd 100644 (file)
@@ -5,6 +5,6 @@ artifact.name.allowedChar=a-zA-Z
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=GlobalAndNSConfig
\ No newline at end of file
index 1bb4e33..bfbd13f 100644 (file)
@@ -19,7 +19,7 @@
                ],
                "persistLocation": "/opt/spool,${sys:user.home}/asdc",
                "jsonSchema": "@GeneratorList.json",
-               "xmlSchema": "@${env:path}/myschema.json",
+               "xmlSchema": "@${env:PATH}/myschema.json",
                "consumerAPPC": "${artifact.consumer}"
        },
        "_config": {
index ae1f445..abab789 100644 (file)
@@ -9,6 +9,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=LoadOrderConfiguration
index a82e6b2..0791aeb 100644 (file)
@@ -5,6 +5,6 @@ artifact.name.allowedChar=a-zA-Z
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@${sys:user.home}/TestResources/GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=ModeAsConfigProp
\ No newline at end of file
index 435f98a..ee7b4a5 100644 (file)
@@ -4,6 +4,6 @@ artifact.supportedEncryption=Base64
 artifact.name.allowedChar=a-zA-Z
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=NodeCLI
\ No newline at end of file
index 22c9840..26fcc59 100644 (file)
@@ -9,6 +9,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=SourceLocation
\ No newline at end of file
index 40b4518..87e98be 100644 (file)
@@ -8,6 +8,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=UnregisterNotification
\ No newline at end of file
index a782e25..39b85f8 100644 (file)
@@ -8,6 +8,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorsList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=ValidateNodeConfig
\ No newline at end of file
index 5c6151f..10c7c20 100644 (file)
@@ -16,7 +16,7 @@
                <status>Deleted</status>
                <persistLocation>/opt/spool,${sys:user.home}/asdc</persistLocation>
                <jsonSchema>@GeneratorList.json</jsonSchema>
-               <xmlSchema>@${env:path}/myschema.json</xmlSchema>
+               <xmlSchema>@${env:PATH}/myschema.json</xmlSchema>
                <consumerAPPC>${artifact.consumer}</consumerAPPC>
        </artifact>
        <_config>
index 706b22d..f483f36 100644 (file)
@@ -21,7 +21,7 @@ artifact:
     Deleted
   persistLocation: "/opt/spool,${sys:user.home}/asdc"
   jsonSchema: "@GeneratorList.json"
-  xmlSchema: "@${env:path}/myschema.json"
+  xmlSchema: "@${env:PATH}/myschema.json"
   consumerAPPC: "${artifact.consumer}"
 _config:
   namespace: YAMLConfig
\ No newline at end of file
index d9051f6..7d6c84b 100644 (file)
@@ -9,6 +9,6 @@ artifact.status=deleted
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=javaProperties
index 3bc7733..0c484a6 100644 (file)
@@ -6,6 +6,6 @@ artifact.name.allowedChar=a-zA-Z
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=OPENECOMP:tenancy
index 196bafe..d39e688 100644 (file)
@@ -5,6 +5,6 @@ artifact.supportedEncryption=Base64
 artifact.name.allowedChar=a-zA-Z
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=Telefonica:tenancy
index 4c0c6ad..3fc228e 100644 (file)
@@ -6,6 +6,6 @@ artifact.name.allowedChar=a-zA-Z
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=Vodafone:tenancy
index 8ed2485..cafafcc 100644 (file)
@@ -6,6 +6,6 @@ artifact.name.allowedChar=a-zA-Z
 artifact.status=Deleted
 artifact.persistLocation=/opt/spool, ${sys:user.home}/asdc
 artifact.jsonSchema=@GeneratorList.json
-artifact.xmlSchema=@${env:path}/myschema.json
+artifact.xmlSchema=@${env:PATH}/myschema.json
 artifact.consumerAPPC=${artifact.consumer}
 _config.namespace=tenancy