plugins ext FEATURE initial schema-mount support
Only for XML data for now. Includes lots of other
changes needed to support this extension.
diff --git a/tests/utests/basic/test_context.c b/tests/utests/basic/test_context.c
index 7899079..8b79a1c 100644
--- a/tests/utests/basic/test_context.c
+++ b/tests/utests/basic/test_context.c
@@ -440,7 +440,10 @@
struct lys_glob_unres unres = {0};
unsigned int index = 0;
- const char *names[] = {"ietf-yang-metadata", "yang", "ietf-inet-types", "ietf-yang-types", "ietf-datastores", "ietf-yang-library", "a", "a", "a"};
+ const char *names[] = {
+ "ietf-yang-metadata", "yang", "ietf-inet-types", "ietf-yang-types", "ietf-yang-schema-mount",
+ "ietf-datastores", "ietf-yang-library", "a", "a", "a"
+ };
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str0, &in0));
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str1, &in1));
@@ -507,7 +510,7 @@
while ((mod = (struct lys_module *)ly_ctx_get_module_iter(UTEST_LYCTX, &index))) {
assert_string_equal(names[index - 1], mod->name);
}
- assert_int_equal(9, index);
+ assert_int_equal(10, index);
/* cleanup */
ly_in_free(in0, 0);
diff --git a/tests/utests/basic/test_plugins.c b/tests/utests/basic/test_plugins.c
index 95b190f..dd50347 100644
--- a/tests/utests/basic/test_plugins.c
+++ b/tests/utests/basic/test_plugins.c
@@ -68,61 +68,6 @@
}
static void
-test_validation(void **state)
-{
- struct lys_module *mod;
- struct lyd_node *tree;
- const char *data;
- const char *schema = "module libyang-plugins-validate {"
- " namespace urn:libyang:tests:plugins:validate;"
- " prefix v;"
- " extension extra-validation;"
- " typedef note { type string { v:extra-validation;}}"
- " leaf test1 {"
- " type v:note;"
- " }"
- " leaf test2 {"
- " type string;"
- " v:extra-validation;"
- " }"
- " leaf test3 {"
- " type string {v:extra-validation;}"
- " }"
- " leaf test4 {"
- " type string;"
- " }"
- "}";
-
- assert_int_equal(LY_SUCCESS, lyplg_add(TESTS_BIN "/plugins/plugin_validate" LYPLG_SUFFIX));
-
- UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, &mod);
-
- /* test1 - extra-validation done based on typedef's extension */
- data = "<test1 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test1>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test1", NULL);
- lyd_free_all(tree);
-
- /* test2 - extra-validation done based on node's extension */
- data = "<test2 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test2>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test2", NULL);
- lyd_free_all(tree);
-
- /* test3 - extra-validation done based on node type's extension */
- data = "<test3 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test3>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test3", NULL);
- lyd_free_all(tree);
-
- /* test4 - extra-validation not done */
- data = "<test4 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test4>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX(NULL, NULL);
- lyd_free_all(tree);
-}
-
-static void
test_not_implemented(void **state)
{
struct lys_module *mod;
@@ -157,7 +102,6 @@
const struct CMUnitTest tests[] = {
UTEST(test_add_invalid),
UTEST(test_add_simple),
- UTEST(test_validation),
UTEST(test_not_implemented),
};
diff --git a/tests/utests/basic/test_xml.c b/tests/utests/basic/test_xml.c
index 1999f65..7e8132d 100644
--- a/tests/utests/basic/test_xml.c
+++ b/tests/utests/basic/test_xml.c
@@ -23,7 +23,6 @@
#include "xml.h"
LY_ERR lyxml_ns_add(struct lyxml_ctx *xmlctx, const char *prefix, size_t prefix_len, char *uri);
-LY_ERR lyxml_ns_rm(struct lyxml_ctx *xmlctx);
static void
test_element(void **state)