summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <ks6305@att.com>2018-03-16 19:46:56 +0000
committerKevin Smokowski <ks6305@att.com>2018-03-16 21:11:49 +0000
commit6a0812672bc3d8032f170d72854fec45023cffa5 (patch)
tree768d5660af82e95938d32c40ed8d16b9a56f169e
parentc7a27b103ffdb0bf3f5565ab031eb6a2d4331ea7 (diff)
Additional enum support
support enumerations containing whitespace Change-Id: I91971a111e67e0faf757c954fb6658529e3020d2 Issue-ID: CCSDK-214 Signed-off-by: Smokowski, Kevin (ks6305) <ks6305@att.com>
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java3
-rw-r--r--sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java9
2 files changed, 12 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 bea21387b..76101514a 100644
--- 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
@@ -1267,6 +1267,9 @@ public class MdsalHelper {
// This will strip out all periods, which cannot be in a java enum
inStr = inStr.replaceAll("\\.", "");
+ //This is needed for enums containing spaces
+ inStr = inStr.replaceAll(" ", "");
+
String[] terms = inStr.split("-");
StringBuffer sbuff = new StringBuffer();
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 c00da68c5..e7f1e18b9 100644
--- 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
@@ -28,7 +28,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
+import static org.junit.Assert.*;
+
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
@@ -132,4 +135,10 @@ public class MdsalHelperTest extends TestCase {
}
+
+ public void testToJavaEnum() throws Exception{
+ assertEquals("_2018HelloWorld",MdsalHelper.toJavaEnum("2018Hello World"));
+ assertEquals("SomethingElse",MdsalHelper.toJavaEnum("Something.Else"));
+ assertEquals("MyTestString",MdsalHelper.toJavaEnum("my-test-string"));
+ }
}