summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"));
+ }
}