aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-06-25 18:37:46 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-25 18:37:46 +0000
commit02a4b0715923ea52c07dc3c7ed2f3c3cd7ec2a9a (patch)
treec5069d0aed94402d79a3877463b8f8284c9976b5
parentdf52e371cf9f5e01a721aef0505ebf238e9eed55 (diff)
parentbcddb35fdcd176e210c95ef8b22d5b0321f1e658 (diff)
Merge "support yang enumerations with underscores"
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java3
-rwxr-xr-xsli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java1
2 files changed, 4 insertions, 0 deletions
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index 0300236f..730f272b 100755
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -1255,6 +1255,9 @@ public class MdsalHelper {
return (inStr);
}
+ // This is needed for enums containing under scores
+ inStr = inStr.replaceAll("_", "");
+
// This will strip out all periods, which cannot be in a java enum
inStr = inStr.replaceAll("\\.", "");
diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
index 744d48d7..cebb9966 100755
--- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
+++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
@@ -151,6 +151,7 @@ public class MdsalHelperTest extends TestCase {
}
public void testToJavaEnum() throws Exception {
+ assertEquals("VENDOR6500MODEL", MdsalHelper.toJavaEnum("VENDOR_6500_MODEL"));
assertEquals("_2018HelloWorld", MdsalHelper.toJavaEnum("2018Hello World"));
assertEquals("SomethingElse", MdsalHelper.toJavaEnum("Something.Else"));
assertEquals("MyTestString", MdsalHelper.toJavaEnum("my-test-string"));