YMS migration to onos-yangtool 1.10
Change-Id: I22ddf23f813840e0afec1e7713a86891f2a52f28
diff --git a/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
new file mode 100644
index 0000000..7fedce9
--- /dev/null
+++ b/apps/yms/ut/src/test/java/org/onosproject/yms/app/ydt/YdtEnumTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.onosproject.yms.app.ydt;
+
+import org.junit.Test;
+import org.onosproject.yms.app.ydt.exceptions.YdtException;
+
+import static org.onosproject.yms.app.ydt.YdtTestConstants.TYPE;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.enumYdt;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateLeafContents;
+import static org.onosproject.yms.app.ydt.YdtTestUtils.validateNodeContents;
+import static org.onosproject.yms.ydt.YdtContextOperationType.MERGE;
+
+public class YdtEnumTest {
+
+/*
+ ENUM
+
+ Positive scenario
+
+ input with in enum
+ input with "ten"
+ input with "hundred"
+ input with "thousand"
+*/
+
+ /**
+ * Creates and validates enum ydt covering different positive scenario.
+ */
+ @Test
+ public void positiveTest() throws YdtException {
+ YangRequestWorkBench ydtBuilder = enumYdt();
+ validateTree(ydtBuilder);
+ }
+
+ /**
+ * Validates the given built ydt.
+ */
+ private void validateTree(YangRequestWorkBench ydtBuilder) {
+
+ // assign root node to ydtNode for validating purpose.
+ YdtNode ydtNode = (YdtNode) ydtBuilder.getRootNode();
+ // Logical root node does not have operation type
+ validateNodeContents(ydtNode, TYPE, null);
+
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumtest", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "ten");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "hundred");
+ ydtNode = ydtNode.getParent();
+ ydtNode = ydtNode.getNextSibling();
+ validateNodeContents(ydtNode, "enumList", MERGE);
+ ydtNode = ydtNode.getFirstChild();
+ validateLeafContents(ydtNode, "enumleaf", "thousand");
+ }
+
+ //TODO negative scenario will be handled later
+// /*
+// Negative scenario
+//
+// input with "10"
+// input with "thousands"
+// */
+//
+// /**
+// * Tests all the negative scenario's for enum data type.
+// */
+// @Test
+// public void negativeTest() throws YdtException {
+// validateErrMsg("enumleaf", ENUMNS, "10", ENUM, "enumList");
+// validateErrMsg("enumleaf", ENUMNS, "thousands", ENUM, "enumList");
+// validateErrMsg("enumleaf", ENUMNS, "enumeration", ENUM, "enumList");
+// }
+}