Remove yang-data-jaxen 95/95095/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Feb 2021 17:14:12 +0000 (18:14 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Feb 2021 17:32:31 +0000 (18:32 +0100)
This has been a prototype, whose API and performance characteristics
that are not acceptable. Remove it and we will start from scratch
around yang-xpath-api.

JIRA: YANGTOOLS-1227
Change-Id: I5c2a7f427d165a390eff4291eefc3130f9841997
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
59 files changed:
artifacts/pom.xml
attic/pom.xml [deleted file]
attic/yang-data-jaxen/pom.xml [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ConverterNamespaceContext.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprListener.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprWalker.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenDocument.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContext.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContextFactory.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenXPath.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/LeafrefXPathStringParsingPathArgumentBuilder.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContext.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContextSupport.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeNavigator.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/Operator.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/StepListener.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/YangFunctionContext.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpression.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpressionException.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/OptimizableXPathExpression.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/PrefixConverters.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/RelocatableXPathExpression.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathBooleanResult.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathDocument.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathExpression.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNodesetResult.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNumberResult.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathResult.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContext.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContextFactory.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathStringResult.java [deleted file]
attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/package-info.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/BitIsSetXPathFunctionTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerefXPathFunctionTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerivedFromXPathFunctionTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/EnumValueXPathFunctionTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/ReMatchXPathFunctionTest.java [deleted file]
attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/TestUtils.java [deleted file]
attic/yang-data-jaxen/src/test/resources/test/documentTest/test2.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo-invalid.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-iid/foo.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-leafref/foo.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar-invalid.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/foo.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo-invalid.yang [deleted file]
attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo.yang [deleted file]
docs/pom.xml
features/features-yangtools-experimental/pom.xml
features/pom.xml
pom.xml
yang/pom.xml
yang/yang-data-xpath-api/pom.xml [deleted file]
yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/DataTreeCandidateDocument.java [deleted file]
yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/NormalizedNodeDocument.java [deleted file]
yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/XPathDocument.java [deleted file]
yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/package-info.java [deleted file]

index 3034c3e3819434f8379084844a5af8d0cdc81a81..caebbd179e4610748aaac4141b13d0f201e0e555 100644 (file)
                 <artifactId>yang-data-api</artifactId>
                 <version>7.0.0-SNAPSHOT</version>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-xpath-api</artifactId>
-                <version>0.5.0-SNAPSHOT</version>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-data-impl</artifactId>
                 <artifactId>yang-data-transform</artifactId>
                 <version>7.0.0-SNAPSHOT</version>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-jaxen</artifactId>
-                <version>7.0.0-SNAPSHOT</version>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-data-codec-binfmt</artifactId>
diff --git a/attic/pom.xml b/attic/pom.xml
deleted file mode 100644 (file)
index 12ba600..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>odlparent-lite</artifactId>
-        <version>8.1.0</version>
-        <relativePath/>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.opendaylight.yangtools</groupId>
-    <artifactId>attic-aggregator</artifactId>
-    <version>7.0.0-SNAPSHOT</version>
-    <packaging>pom</packaging>
-
-    <modules>
-        <module>yang-data-jaxen</module>
-    </modules>
-
-    <properties>
-        <maven.deploy.skip>true</maven.deploy.skip>
-        <maven.install.skip>true</maven.install.skip>
-    </properties>
-</project>
diff --git a/attic/yang-data-jaxen/pom.xml b/attic/yang-data-jaxen/pom.xml
deleted file mode 100644 (file)
index b6b0024..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-    Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
-
-    This program and the accompanying materials are made available under the
-    terms of the Eclipse Public License v1.0 which accompanies this distribution,
-    and is available at http://www.eclipse.org/legal/epl-v10.html
-    -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>bundle-parent</artifactId>
-        <version>7.0.0-SNAPSHOT</version>
-        <relativePath>../../bundle-parent</relativePath>
-    </parent>
-
-    <artifactId>yang-data-jaxen</artifactId>
-    <name>${project.artifactId}</name>
-    <description>${project.artifactId}</description>
-    <packaging>bundle</packaging>
-
-    <properties>
-        <!-- FIXME: we have some violations here -->
-        <odlparent.spotbugs.enforce>false</odlparent.spotbugs.enforce>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>jaxen</groupId>
-            <artifactId>jaxen</artifactId>
-            <version>1.1.6</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-data-xpath-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-data-util</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-model-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-model-spi</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.kohsuke.metainf-services</groupId>
-            <artifactId>metainf-services</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.guicedee.services</groupId>
-            <artifactId>javax.inject</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.component.annotations</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-test-util</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-data-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Automatic-Module-Name>org.opendaylight.yangtools.yang.data.jaxen</Automatic-Module-Name>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ConverterNamespaceContext.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ConverterNamespaceContext.java
deleted file mode 100644 (file)
index 959a2b6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.base.Converter;
-import org.eclipse.jdt.annotation.NonNull;
-import org.jaxen.NamespaceContext;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-
-final class ConverterNamespaceContext extends Converter<String, QNameModule> implements NamespaceContext {
-    private final @NonNull Converter<String, QNameModule> delegate;
-
-    ConverterNamespaceContext(final Converter<String, QNameModule> converter) {
-        this.delegate = requireNonNull(converter);
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:parameterName")
-    protected QNameModule doForward(final String a) {
-        return delegate.convert(a);
-    }
-
-    @Override
-    @SuppressWarnings("checkstyle:parameterName")
-    protected String doBackward(final QNameModule b) {
-        return delegate.reverse().convert(b);
-    }
-
-    @Override
-    public String translateNamespacePrefixToUri(final String prefix) {
-        return convert(prefix).getNamespace().toString();
-    }
-
-    @NonNull String jaxenQName(final QName qname) {
-        return reverse().convert(qname.getModule()) + ':' + qname.getLocalName();
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprListener.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprListener.java
deleted file mode 100644 (file)
index d1c31a2..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import java.util.Optional;
-import org.jaxen.expr.BinaryExpr;
-import org.jaxen.expr.FilterExpr;
-import org.jaxen.expr.FunctionCallExpr;
-import org.jaxen.expr.LiteralExpr;
-import org.jaxen.expr.LocationPath;
-import org.jaxen.expr.NumberExpr;
-import org.jaxen.expr.PathExpr;
-import org.jaxen.expr.UnaryExpr;
-import org.jaxen.expr.VariableReferenceExpr;
-
-abstract class ExprListener {
-    void enterBinaryExpr(final BinaryExpr expr) {
-
-    }
-
-    void exitBinaryExpr(final BinaryExpr expr) {
-
-    }
-
-    void enterFilterExpr(final FilterExpr expr) {
-
-    }
-
-    void exitFilterExpr(final FilterExpr expr) {
-
-    }
-
-    void enterFunctionCallExpr(final FunctionCallExpr expr) {
-
-    }
-
-    void exitFunctionCallExpr(final FunctionCallExpr expr) {
-
-    }
-
-    void enterNotExpr(final UnaryExpr expr) {
-
-    }
-
-    void exitNotExpr(final UnaryExpr expr) {
-
-    }
-
-    Optional<StepListener> enterLocationPath(final LocationPath path) {
-        return Optional.empty();
-    }
-
-    void exitLocationPath(final LocationPath path) {
-
-    }
-
-    void enterPathExpr(final PathExpr expr) {
-
-    }
-
-    void exitPathExpr(final PathExpr expr) {
-
-    }
-
-    void visitLiteralExpr(final LiteralExpr expr) {
-
-    }
-
-    void visitNumberExpr(final NumberExpr expr) {
-
-    }
-
-    void visitOperator(final Operator oper) {
-
-    }
-
-    void visitVariableReferenceExpr(final VariableReferenceExpr expr)  {
-
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprWalker.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/ExprWalker.java
deleted file mode 100644 (file)
index 87bd1ec..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static java.util.Objects.requireNonNull;
-
-import java.util.Optional;
-import org.jaxen.expr.AllNodeStep;
-import org.jaxen.expr.BinaryExpr;
-import org.jaxen.expr.CommentNodeStep;
-import org.jaxen.expr.Expr;
-import org.jaxen.expr.FilterExpr;
-import org.jaxen.expr.FunctionCallExpr;
-import org.jaxen.expr.LiteralExpr;
-import org.jaxen.expr.LocationPath;
-import org.jaxen.expr.NameStep;
-import org.jaxen.expr.NumberExpr;
-import org.jaxen.expr.PathExpr;
-import org.jaxen.expr.ProcessingInstructionNodeStep;
-import org.jaxen.expr.TextNodeStep;
-import org.jaxen.expr.UnaryExpr;
-import org.jaxen.expr.VariableReferenceExpr;
-
-final class ExprWalker {
-    private final ExprListener listener;
-
-    ExprWalker(final ExprListener listener) {
-        this.listener = requireNonNull(listener);
-    }
-
-    public void walk(final Expr expr) {
-        if (expr instanceof BinaryExpr) {
-            final BinaryExpr binary = (BinaryExpr) expr;
-            listener.enterBinaryExpr(binary);
-            walk(binary.getLHS());
-            listener.visitOperator(Operator.forString(binary.getOperator()));
-            walk(binary.getRHS());
-            listener.exitBinaryExpr(binary);
-        } else if (expr instanceof FilterExpr) {
-            final FilterExpr filter = (FilterExpr) expr;
-            listener.enterFilterExpr(filter);
-            walk(expr);
-            listener.exitFilterExpr(filter);
-        } else if (expr instanceof FunctionCallExpr) {
-            final FunctionCallExpr func = (FunctionCallExpr) expr;
-            listener.enterFunctionCallExpr(func);
-
-            for (Object arg : func.getParameters()) {
-                walk((Expr) arg);
-            }
-
-            listener.exitFunctionCallExpr(func);
-        } else if (expr instanceof LiteralExpr) {
-            listener.visitLiteralExpr((LiteralExpr) expr);
-        } else if (expr instanceof LocationPath) {
-            final LocationPath path = (LocationPath) expr;
-            final Optional<StepListener> maybeListener = listener.enterLocationPath(path);
-            if (maybeListener.isPresent()) {
-                final StepListener l = maybeListener.get();
-                for (Object step : path.getSteps()) {
-                    if (step instanceof AllNodeStep) {
-                        l.onAll((AllNodeStep) step);
-                    } else if (step instanceof CommentNodeStep) {
-                        l.onComment((CommentNodeStep) step);
-                    } else if (step instanceof NameStep) {
-                        l.onName((NameStep) step);
-                    } else if (step instanceof ProcessingInstructionNodeStep) {
-                        l.onProcessingInstruction((ProcessingInstructionNodeStep) step);
-                    } else if (step instanceof TextNodeStep) {
-                        l.onTest((TextNodeStep) step);
-                    } else {
-                        throw new IllegalArgumentException("Unsupported step " + step);
-                    }
-                }
-            }
-
-            listener.exitLocationPath(path);
-        } else if (expr instanceof NumberExpr) {
-            listener.visitNumberExpr((NumberExpr) expr);
-        } else if (expr instanceof PathExpr) {
-            final PathExpr path = (PathExpr) expr;
-            listener.enterPathExpr(path);
-            walk(path.getFilterExpr());
-            walk(path.getLocationPath());
-            listener.exitPathExpr(path);
-        } else if (expr instanceof UnaryExpr) {
-            final UnaryExpr unary = (UnaryExpr) expr;
-            listener.enterNotExpr(unary);
-            walk(unary.getExpr());
-            listener.exitNotExpr(unary);
-        } else if (expr instanceof VariableReferenceExpr) {
-            listener.visitVariableReferenceExpr((VariableReferenceExpr) expr);
-        } else {
-            throw new IllegalArgumentException("Unsupported expression " + expr);
-        }
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenDocument.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenDocument.java
deleted file mode 100644 (file)
index 59326aa..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static java.util.Objects.requireNonNull;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
-import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.spi.AbstractEffectiveModelContextProvider;
-
-@NonNullByDefault
-final class JaxenDocument extends AbstractEffectiveModelContextProvider implements XPathDocument {
-    private final DataSchemaContextNode<?> schema;
-    private final NormalizedNode root;
-
-    JaxenDocument(final EffectiveModelContext context, final DataSchemaContextTree tree, final NormalizedNode root) {
-        super(context);
-        this.root = requireNonNull(root);
-        this.schema = requireNonNull(tree.getRoot().getChild(root.getIdentifier()));
-    }
-
-    @Override
-    public NormalizedNode getRootNode() {
-        return root;
-    }
-
-    DataSchemaContextNode<?> getSchema() {
-        return schema;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContext.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContext.java
deleted file mode 100644 (file)
index 5cded5c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.base.Converter;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.jaxen.JaxenException;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathExpression;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-@NonNullByDefault
-final class JaxenSchemaContext implements XPathSchemaContext {
-    private final DataSchemaContextTree tree;
-    private final EffectiveModelContext context;
-
-    JaxenSchemaContext(final EffectiveModelContext context) {
-        this.context = requireNonNull(context);
-        this.tree = DataSchemaContextTree.from(context);
-    }
-
-    @Override
-    public XPathExpression compileExpression(final SchemaPath schemaPath,
-            final Converter<String, QNameModule> prefixes, final String xpath) throws XPathExpressionException {
-        try {
-            return JaxenXPath.create(prefixes, schemaPath, xpath);
-        } catch (JaxenException e) {
-            throw new XPathExpressionException(e);
-        }
-    }
-
-    @Override
-    public XPathDocument createDocument(final NormalizedNode documentRoot) {
-        return new JaxenDocument(context, tree, documentRoot);
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContextFactory.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenSchemaContextFactory.java
deleted file mode 100644 (file)
index e66810f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.kohsuke.MetaInfServices;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@MetaInfServices
-@Singleton
-@Component
-@NonNullByDefault
-public final class JaxenSchemaContextFactory implements XPathSchemaContextFactory {
-    private static final Logger LOG = LoggerFactory.getLogger(JaxenSchemaContextFactory.class);
-
-    @Inject
-    public JaxenSchemaContextFactory() {
-        // For DI
-    }
-
-    @Override
-    public XPathSchemaContext createContext(final EffectiveModelContext context) {
-        return new JaxenSchemaContext(context);
-    }
-
-    @Activate
-    @SuppressWarnings("static-method")
-    void activate() {
-        LOG.info("Jaxen XPathSchemaContextFactory enabled");
-    }
-
-    @Deactivate
-    @SuppressWarnings("static-method")
-    void deactivate() {
-        LOG.info("Jaxen XPathSchemaContextFactory disabled");
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenXPath.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenXPath.java
deleted file mode 100644 (file)
index b2d1e4b..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.base.Converter;
-import com.google.common.base.Verify;
-import com.google.common.collect.Lists;
-import java.util.AbstractMap.SimpleImmutableEntry;
-import java.util.List;
-import java.util.Optional;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.jaxen.JaxenException;
-import org.jaxen.JaxenHandler;
-import org.jaxen.XPathSyntaxException;
-import org.jaxen.expr.Expr;
-import org.jaxen.saxpath.SAXPathException;
-import org.jaxen.saxpath.XPathReader;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathBooleanResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathExpression;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathNodesetResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathNumberResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathStringResult;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class JaxenXPath implements XPathExpression {
-    private static final Logger LOG = LoggerFactory.getLogger(JaxenXPath.class);
-
-    private final @NonNull Converter<String, QNameModule> converter;
-    private final @NonNull SchemaPath schemaPath;
-    private final @NonNull Expr expr;
-
-    private JaxenXPath(final @NonNull Converter<String, QNameModule> converter, final @NonNull SchemaPath schemaPath,
-            final @NonNull Expr expr) {
-        this.converter = requireNonNull(converter);
-        this.schemaPath = requireNonNull(schemaPath);
-        this.expr = requireNonNull(expr);
-    }
-
-    static @NonNull JaxenXPath create(final @NonNull Converter<String, QNameModule> converter,
-            final @NonNull SchemaPath schemaPath, final @NonNull String xpath) throws JaxenException {
-
-        final @NonNull Expr parsed;
-        try {
-            final XPathReader reader = new org.jaxen.saxpath.base.XPathReader();
-            final JaxenHandler handler = new JaxenHandler();
-            reader.setXPathHandler(handler);
-            reader.parse(xpath);
-            parsed = handler.getXPathExpr().getRootExpr();
-        } catch (org.jaxen.saxpath.XPathSyntaxException e) {
-            throw new XPathSyntaxException(e);
-        } catch (SAXPathException e) {
-            throw new JaxenException(e);
-        }
-
-        LOG.debug("Compiled {} to expression {}", xpath, parsed);
-
-        new ExprWalker(new ExprListener() {
-            // FIXME: perform expression introspection to understand things like apex, etc.
-        }).walk(parsed);
-
-        return new JaxenXPath(converter, schemaPath, parsed);
-    }
-
-    @Override
-    public Optional<? extends XPathResult<?>> evaluate(final XPathDocument document,
-            final YangInstanceIdentifier path) throws XPathExpressionException {
-        checkArgument(document instanceof JaxenDocument);
-
-        final NormalizedNodeContextSupport contextSupport = NormalizedNodeContextSupport.create(
-            (JaxenDocument)document, converter);
-
-        final Object result = evaluate(contextSupport.createContext(path));
-        if (result instanceof String) {
-            return Optional.of((XPathStringResult) () -> (String) result);
-        } else if (result instanceof Number) {
-            return Optional.of((XPathNumberResult) () -> (Number) result);
-        } else if (result instanceof Boolean) {
-            return Optional.of((XPathBooleanResult) () -> (Boolean) result);
-        } else if (result == null) {
-            return Optional.empty();
-        }
-
-        Verify.verify(result instanceof List, "Unhandled result %s", result);
-        @SuppressWarnings("unchecked")
-        final List<NormalizedNodeContext> resultList = (List<NormalizedNodeContext>) result;
-        return Optional.of((XPathNodesetResult) () -> {
-            // XXX: Will this really work, or do we need to perform deep transformation?
-            return Lists.transform(resultList,
-                context -> new SimpleImmutableEntry<>(context.getPath(), context.getNode()));
-        });
-    }
-
-    private Object evaluate(final NormalizedNodeContext context) throws XPathExpressionException {
-        final Object result;
-        try {
-            result = expr.evaluate(context);
-        } catch (JaxenException e) {
-            throw new XPathExpressionException(e);
-        }
-
-        if (result instanceof List) {
-            final List<?> list = (List<?>) result;
-            if (list.size() == 1) {
-                final Object first = list.get(0);
-                if (first instanceof String || first instanceof Number || first instanceof Boolean) {
-                    return first;
-                }
-            }
-        }
-
-        return result;
-    }
-
-    @Override
-    public SchemaPath getEvaluationPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public SchemaPath getApexPath() {
-        // TODO: improve this
-        return SchemaPath.ROOT;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/LeafrefXPathStringParsingPathArgumentBuilder.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/LeafrefXPathStringParsingPathArgumentBuilder.java
deleted file mode 100644 (file)
index 841937e..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.checkerframework.checker.regex.qual.Regex;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
-
-@Beta
-final class LeafrefXPathStringParsingPathArgumentBuilder implements Builder<List<PathArgument>> {
-
-    private static final String UP_ONE_LEVEL = "..";
-    private static final String CURRENT_FUNCTION_INVOCATION_STR = "current()";
-
-    @Regex
-    private static final String NODE_IDENTIFIER_STR = "([A-Za-z_][A-Za-z0-9_\\.-]*:)?([A-Za-z_][A-Za-z0-9_\\.-]*)";
-
-    /**
-     * Pattern matching node-identifier YANG ABNF token.
-     */
-    private static final Pattern NODE_IDENTIFIER_PATTERN = Pattern.compile(NODE_IDENTIFIER_STR);
-
-    /**
-     * Matcher matching WSP YANG ABNF token.
-     */
-    private static final CharMatcher WSP = CharMatcher.anyOf(" \t");
-
-    /**
-     * Matcher matching IDENTIFIER first char token.
-     */
-    private static final CharMatcher IDENTIFIER_FIRST_CHAR = CharMatcher.inRange('a', 'z')
-            .or(CharMatcher.inRange('A', 'Z')).or(CharMatcher.is('_')).precomputed();
-    /**
-     * Matcher matching IDENTIFIER token.
-     */
-    private static final CharMatcher IDENTIFIER = IDENTIFIER_FIRST_CHAR.or(CharMatcher.inRange('0', '9'))
-            .or(CharMatcher.anyOf(".-")).precomputed();
-
-    private static final Splitter SLASH_SPLITTER = Splitter.on('/');
-
-    private static final char SLASH = '/';
-    private static final char COLON = ':';
-    private static final char EQUALS = '=';
-    private static final char PRECONDITION_START = '[';
-    private static final char PRECONDITION_END = ']';
-
-    private final String xpathString;
-    private final SchemaContext schemaContext;
-    private final TypedDataSchemaNode schemaNode;
-    private final NormalizedNodeContext currentNodeCtx;
-    private final List<PathArgument> product = new ArrayList<>();
-
-    private int offset = 0;
-
-    LeafrefXPathStringParsingPathArgumentBuilder(final String xpathString, final SchemaContext schemaContext,
-            final TypedDataSchemaNode schemaNode, final NormalizedNodeContext currentNodeCtx) {
-        this.xpathString = xpathString;
-        this.schemaContext = schemaContext;
-        this.schemaNode = schemaNode;
-        this.currentNodeCtx = currentNodeCtx;
-    }
-
-    @Override
-    public List<PathArgument> build() {
-        while (!allCharactersConsumed()) {
-            product.add(computeNextArgument());
-        }
-        return ImmutableList.copyOf(product);
-    }
-
-    private PathArgument computeNextArgument() {
-        checkValid(SLASH == currentChar(), "Identifier must start with '/'.");
-        skipCurrentChar();
-        checkValid(!allCharactersConsumed(), "Identifier cannot end with '/'.");
-
-        final QName name = nextQName();
-        if (allCharactersConsumed() || SLASH == currentChar()) {
-            return new NodeIdentifier(name);
-        }
-
-        checkValid(PRECONDITION_START == currentChar(), "Last element must be identifier, predicate or '/'");
-        return computeIdentifierWithPredicate(name);
-    }
-
-    private PathArgument computeIdentifierWithPredicate(final QName name) {
-        product.add(new NodeIdentifier(name));
-
-        ImmutableMap.Builder<QName, Object> keyValues = ImmutableMap.builder();
-        while (!allCharactersConsumed() && PRECONDITION_START == currentChar()) {
-            skipCurrentChar();
-            skipWhitespaces();
-            final QName key = nextQName();
-
-            skipWhitespaces();
-            checkCurrentAndSkip(EQUALS, "Precondition must contain '='");
-            skipWhitespaces();
-            final Object keyValue = nextCurrentFunctionPathValue();
-            skipWhitespaces();
-            checkCurrentAndSkip(PRECONDITION_END, "Precondition must ends with ']'");
-
-            keyValues.put(key, keyValue);
-        }
-        return NodeIdentifierWithPredicates.of(name, keyValues.build());
-    }
-
-    private Object nextCurrentFunctionPathValue() {
-        final String xPathSubStr = xpathString.substring(offset);
-        final String pathKeyExpression = xPathSubStr.substring(0, xPathSubStr.indexOf(PRECONDITION_END));
-        final String relPathKeyExpression = pathKeyExpression.substring(CURRENT_FUNCTION_INVOCATION_STR.length());
-
-        offset += CURRENT_FUNCTION_INVOCATION_STR.length();
-        skipWhitespaces();
-        checkCurrentAndSkip(SLASH, "Expression 'current()' must be followed by slash.");
-        skipWhitespaces();
-
-        final List<String> pathComponents = SLASH_SPLITTER.trimResults().omitEmptyStrings()
-                .splitToList(relPathKeyExpression);
-        checkValid(!pathComponents.isEmpty(), "Malformed path key expression: '%s'.", pathKeyExpression);
-
-        boolean inNodeIdentifierPart = false;
-        NormalizedNodeContext nodeCtx = this.currentNodeCtx;
-        NormalizedNode node = null;
-        for (String pathComponent : pathComponents) {
-            final Matcher matcher = NODE_IDENTIFIER_PATTERN.matcher(pathComponent);
-            if (UP_ONE_LEVEL.equals(pathComponent)) {
-                checkValid(!inNodeIdentifierPart, "Up-one-level expression cannot follow concrete path component.");
-                nodeCtx = nodeCtx.getParent();
-                node = nodeCtx.getNode();
-                offset += UP_ONE_LEVEL.length() + 1;
-            } else if (matcher.matches()) {
-                inNodeIdentifierPart = true;
-                if (node != null && node instanceof DataContainerNode) {
-                    node = ((DataContainerNode<?>) node).childByArg(new NodeIdentifier(nextQName()));
-                }
-            } else {
-                throw new IllegalArgumentException(String.format(
-                        "Could not parse leafref path '%s'. Offset: %s : Reason: Malformed path component: '%s'.",
-                        xpathString, offset, pathComponent));
-            }
-        }
-
-        if (node != null && node instanceof LeafNode) {
-            return node.body();
-        }
-
-        throw new IllegalArgumentException("Could not resolve current function path value.");
-
-    }
-
-    /**
-     * Returns following QName and sets offset to end of QName.
-     *
-     * @return following QName.
-     */
-    private QName nextQName() {
-        // Consume prefix or identifier
-        final String maybePrefix = nextIdentifier();
-        final String prefix;
-        final String localName;
-        if (!allCharactersConsumed() && COLON == currentChar()) {
-            // previous token is prefix
-            prefix = maybePrefix;
-            skipCurrentChar();
-            localName = nextIdentifier();
-        } else {
-            prefix = "";
-            localName = maybePrefix;
-        }
-        return createQName(prefix, localName);
-    }
-
-    /**
-     * Returns true if all characters from input string were consumed.
-     *
-     * @return true if all characters from input string were consumed.
-     */
-    private boolean allCharactersConsumed() {
-        return offset == xpathString.length();
-    }
-
-    private QName createQName(final String prefix, final String localName) {
-        final Module module = schemaContext.findModule(schemaNode.getQName().getModule()).get();
-        if (prefix.isEmpty() || module.getPrefix().equals(prefix)) {
-            return QName.create(module.getQNameModule(), localName);
-        }
-
-        for (final ModuleImport moduleImport : module.getImports()) {
-            if (prefix.equals(moduleImport.getPrefix())) {
-                final Module importedModule = schemaContext.findModule(moduleImport.getModuleName(),
-                        moduleImport.getRevision()).get();
-                return QName.create(importedModule.getQNameModule(),localName);
-            }
-        }
-
-        throw new IllegalArgumentException(String.format("Failed to lookup a module for prefix %s", prefix));
-    }
-
-    /**
-     * Skips current char if it equals expected otherwise fails parsing.
-     *
-     * @param expected Expected character
-     * @param errorMsg Error message if {@link #currentChar()} does not match expected.
-     */
-    private void checkCurrentAndSkip(final char expected, final String errorMsg) {
-        checkValid(expected == currentChar(), errorMsg);
-        offset++;
-    }
-
-    /**
-     * Fails parsing if condition is not met.
-     *
-     * <p>
-     * In case of error provides pointer to failed leafref, offset on which failure occured with explanation.
-     *
-     * @param condition Fails parsing if {@code condition} is false
-     * @param errorMsg Error message which will be provided to user.
-     * @param attributes Message attributes
-     */
-    private void checkValid(final boolean condition, final String errorMsg, final Object... attributes) {
-        if (!condition) {
-            throw new IllegalArgumentException(String.format(
-                    "Could not parse leafref path '%s'. Offset: %s : Reason: %s", xpathString, offset,
-                    String.format(errorMsg, attributes)));
-        }
-    }
-
-    /**
-     * Returns character at current offset.
-     *
-     * @return character at current offset.
-     */
-    private char currentChar() {
-        return xpathString.charAt(offset);
-    }
-
-    /**
-     * Increments processing offset by 1.
-     */
-    private void skipCurrentChar() {
-        offset++;
-    }
-
-    /**
-     * Skip whitespace characters, sets offset to first following non-whitespace character.
-     */
-    private void skipWhitespaces() {
-        nextSequenceEnd(WSP);
-    }
-
-    /**
-     * Returns a string which matches IDENTIFIER YANG ABNF token
-     * and sets processing offset after the end of identifier.
-     *
-     * @return string which matches IDENTIFIER YANG ABNF token
-     */
-    private String nextIdentifier() {
-        int start = offset;
-        checkValid(IDENTIFIER_FIRST_CHAR.matches(currentChar()),
-                "Identifier must start with character from set 'a-zA-Z_'");
-        nextSequenceEnd(IDENTIFIER);
-        return xpathString.substring(start, offset);
-    }
-
-    private void nextSequenceEnd(final CharMatcher matcher) {
-        while (!allCharactersConsumed() && matcher.matches(xpathString.charAt(offset))) {
-            offset++;
-        }
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContext.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContext.java
deleted file mode 100644 (file)
index 7b426ac..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Verify.verify;
-import static com.google.common.base.Verify.verifyNotNull;
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterators;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.jaxen.Context;
-import org.jaxen.ContextSupport;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-
-/**
- * Context wrapper around a {@link NormalizedNode} for use with Jaxen. It tracks the parent node for purposes of
- * traversing upwards the NormalizedNode tree.
- */
-@NonNullByDefault
-final class NormalizedNodeContext extends Context {
-    private static final long serialVersionUID = 1L;
-    private final @Nullable NormalizedNodeContext parent;
-    private final DataSchemaContextNode<?> schema;
-    private final NormalizedNode node;
-
-    private NormalizedNodeContext(final ContextSupport contextSupport, final DataSchemaContextNode<?> schema,
-        final NormalizedNode node, final @Nullable NormalizedNodeContext parent) {
-        super(contextSupport);
-        this.schema = requireNonNull(schema);
-        this.node = requireNonNull(node);
-        this.parent = parent;
-
-        setNodeSet(ImmutableList.of(this));
-    }
-
-    static NormalizedNodeContext forRoot(final NormalizedNodeContextSupport contextSupport) {
-        final JaxenDocument document = contextSupport.getNavigator().getDocument();
-        return new NormalizedNodeContext(contextSupport, document.getSchema(), document.getRootNode(), null);
-    }
-
-    NormalizedNode getNode() {
-        return node;
-    }
-
-    @Nullable NormalizedNodeContext getParent() {
-        return parent;
-    }
-
-    YangInstanceIdentifier getPath() {
-        return (parent == null ? YangInstanceIdentifier.empty() : parent.getPath()).node(node.getIdentifier());
-    }
-
-    DataSchemaContextNode<?> getSchema() {
-        return schema;
-    }
-
-    NormalizedNodeContext createChild(final NormalizedNode input) {
-        DataSchemaContextNode<?> childSchema = schema.getChild(input.getIdentifier());
-        if (childSchema == null) {
-            /* This feels very much like a hack: but solves lookup of child nodes with predicates.
-             *
-             * What is happening is that a Map context gets queried for its children, which results in contexts being
-             * backed by UnorderedMapMixinContextNode, which requires us to unmask it.
-             *
-             * When the predicate is being evaluated, each child is queried for its child -- but since it is protected,
-             * we cannot find it.
-             */
-            final DataSchemaNode mySchema = schema.getDataSchemaNode();
-            if (mySchema instanceof ListSchemaNode) {
-                childSchema = verifyNotNull(schema.getChild(mySchema.getQName())).getChild(input.getIdentifier());
-            }
-        }
-
-        checkArgument(childSchema != null, "Failed to find schema for child %s", input);
-        return new NormalizedNodeContext(getContextSupport(), childSchema, input, this);
-    }
-
-    Optional<NormalizedNodeContext> findChild(final PathArgument arg) {
-        return node instanceof DataContainerNode
-            ? ((DataContainerNode<?>)node).findChildByArg(arg).map(this::createChild) : Optional.empty();
-    }
-
-    Optional<NormalizedNodeContext> findDescendant(final YangInstanceIdentifier path) {
-        if (path.isEmpty()) {
-            return Optional.of(this);
-        }
-
-        NormalizedNodeContext ctxWalk = this;
-        NormalizedNode dataWalk = node;
-        for (PathArgument arg : path.getPathArguments()) {
-            checkArgument(dataWalk instanceof DataContainerNode, "Path %s refers beyond node %s", path, dataWalk);
-
-            dataWalk = ((DataContainerNode<?>)dataWalk).childByArg(arg);
-            if (dataWalk == null) {
-                return Optional.empty();
-            }
-
-            ctxWalk = createChild(dataWalk);
-        }
-
-        return Optional.of(ctxWalk.createChild(dataWalk));
-    }
-
-    Iterator<NormalizedNodeContext> iterateChildren(final DataContainerNode<?> data) {
-        return Iterators.transform(((DataContainerNode<?>) node).body().iterator(), this::createChild);
-    }
-
-    @Nullable Iterator<NormalizedNodeContext> iterateChildrenNamed(final DataContainerNode<?> data, final QName qname) {
-        final DataContainerChild child = data.childByArg(new NodeIdentifier(qname));
-        if (child == null) {
-            return null;
-        }
-
-        final Collection<? extends NormalizedNode> collection;
-        // The child may be a structural node
-        if (child instanceof MapNode) {
-            collection = ((MapNode)child).body();
-        } else if (child instanceof LeafSetNode) {
-            collection = ((LeafSetNode<?>)child).body();
-        } else {
-            return Iterators.singletonIterator(createChild(child));
-        }
-
-        return Iterators.transform(collection.iterator(), this::createChild);
-    }
-
-    static NormalizedNodeContext cast(@Nullable final Context context) {
-        verify(context instanceof NormalizedNodeContext);
-        return (@NonNull NormalizedNodeContext) context;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContextSupport.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeContextSupport.java
deleted file mode 100644 (file)
index ba927da..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.base.Converter;
-import java.util.Optional;
-import org.jaxen.ContextSupport;
-import org.jaxen.SimpleVariableContext;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
-
-final class NormalizedNodeContextSupport extends ContextSupport implements EffectiveModelContextProvider {
-    private static final long serialVersionUID = 1L;
-    private final NormalizedNodeContext root;
-
-    private NormalizedNodeContextSupport(final ConverterNamespaceContext context,
-            final NormalizedNodeNavigator navigator) {
-        super(context, YangFunctionContext.getInstance(), new SimpleVariableContext(), navigator);
-        this.root = NormalizedNodeContext.forRoot(this);
-    }
-
-    static NormalizedNodeContextSupport create(final JaxenDocument document,
-            final Converter<String, QNameModule> prefixes) {
-        final ConverterNamespaceContext context = new ConverterNamespaceContext(prefixes);
-        final NormalizedNodeNavigator navigator = new NormalizedNodeNavigator(context, document);
-
-        return new NormalizedNodeContextSupport(context, navigator);
-    }
-
-    NormalizedNodeContext createContext(final YangInstanceIdentifier path) {
-        NormalizedNodeContext result = root;
-        for (PathArgument arg : path.getPathArguments()) {
-            final Optional<NormalizedNode> node = NormalizedNodes.getDirectChild(result.getNode(), arg);
-            checkArgument(node.isPresent(), "Node %s has no child %s", result.getNode(), arg);
-            result = result.createChild(node.get());
-        }
-        return result;
-    }
-
-    @Override
-    public NormalizedNodeNavigator getNavigator() {
-        return (NormalizedNodeNavigator) super.getNavigator();
-    }
-
-    @Override
-    public EffectiveModelContext getEffectiveModelContext() {
-        return getNavigator().getEffectiveModelContext();
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeNavigator.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/NormalizedNodeNavigator.java
deleted file mode 100644 (file)
index 1a8b971..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Verify;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.UnmodifiableIterator;
-import java.util.Base64;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import org.jaxen.DefaultNavigator;
-import org.jaxen.NamedAccessNavigator;
-import org.jaxen.Navigator;
-import org.jaxen.UnsupportedAxisException;
-import org.jaxen.XPath;
-import org.jaxen.saxpath.SAXPathException;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
-
-/**
- * A {@link Navigator} implementation for YANG XPaths instantiated on a particular root {@link NormalizedNode}.
- */
-final class NormalizedNodeNavigator extends DefaultNavigator
-        implements NamedAccessNavigator, EffectiveModelContextProvider {
-    private static final long serialVersionUID = 1L;
-    private static final Joiner JOINER = Joiner.on(" ").skipNulls();
-    private final ConverterNamespaceContext namespaceContext;
-    private final JaxenDocument document;
-
-    NormalizedNodeNavigator(final ConverterNamespaceContext context, final JaxenDocument document) {
-        this.namespaceContext = requireNonNull(context);
-        this.document = document;
-    }
-
-    private static NormalizedNodeContext cast(final Object context) {
-        Verify.verify(context instanceof NormalizedNodeContext, "Unhandled context node %s", context);
-        return (NormalizedNodeContext) context;
-    }
-
-    private static NormalizedNode contextNode(final Object context) {
-        return cast(context).getNode();
-    }
-
-    private QName resolveQName(final NormalizedNode node, final String prefix, final String localName) {
-        final QNameModule module;
-        if (prefix.isEmpty()) {
-            module = node.getNodeType().getModule();
-        } else {
-            module = namespaceContext.convert(prefix);
-        }
-
-        return QName.create(module, localName);
-    }
-
-    @SuppressWarnings("unchecked")
-    private static Entry<QName, String> attribute(final Object attr) {
-        Verify.verify(attr instanceof Entry, "Unhandled attribute %s", attr);
-        return (Entry<QName, String>) attr;
-    }
-
-    @Override
-    public String getElementNamespaceUri(final Object element) {
-        return contextNode(element).getNodeType().getNamespace().toString();
-    }
-
-    @Override
-    public String getElementName(final Object element) {
-        return contextNode(element).getNodeType().getLocalName();
-    }
-
-    @Override
-    public String getElementQName(final Object element) {
-        return namespaceContext.jaxenQName(contextNode(element).getNodeType());
-    }
-
-    @Override
-    public String getAttributeNamespaceUri(final Object attr) {
-        return attribute(attr).getKey().getNamespace().toString();
-    }
-
-    @Override
-    public String getAttributeName(final Object attr) {
-        return attribute(attr).getKey().getLocalName();
-    }
-
-    @Override
-    public String getAttributeQName(final Object attr) {
-        return namespaceContext.jaxenQName(attribute(attr).getKey());
-    }
-
-    @Override
-    public NormalizedNodeContext getDocumentNode(final Object contextNode) {
-        NormalizedNodeContext ctx = cast(contextNode);
-        while (ctx.getParent() != null) {
-            ctx = ctx.getParent();
-        }
-
-        return ctx;
-    }
-
-    @Override
-    public boolean isDocument(final Object object) {
-        return cast(object).getParent() == null;
-    }
-
-    @Override
-    public boolean isElement(final Object object) {
-        return object instanceof NormalizedNodeContext;
-    }
-
-    @Override
-    public boolean isAttribute(final Object object) {
-        return object instanceof Entry;
-    }
-
-    @Override
-    public boolean isNamespace(final Object object) {
-        return false;
-    }
-
-    @Override
-    public boolean isComment(final Object object) {
-        return false;
-    }
-
-    @Override
-    public boolean isText(final Object object) {
-        return object instanceof String;
-    }
-
-    @Override
-    public boolean isProcessingInstruction(final Object object) {
-        return false;
-    }
-
-    @Override
-    public String getCommentStringValue(final Object comment) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getElementStringValue(final Object element) {
-        final NormalizedNode node = contextNode(element);
-        if (node instanceof LeafNode || node instanceof LeafSetEntryNode) {
-            final Object value = node.body();
-
-            // TODO: This is a rather poor approximation of what the codec infrastructure, but it should be sufficient
-            //       to work for now. Tracking SchemaPath will mean we will need to wrap each NormalizedNode with a
-            //       corresponding SchemaPath. That in turn would complicate this class and result in a lot of object
-            //       allocations.
-            if (value instanceof byte[]) {
-                // Binary
-                return Base64.getEncoder().encodeToString((byte[]) value);
-            }
-            if (value instanceof Set) {
-                // Bits
-                return JOINER.join((Set<?>)value);
-            }
-            if (value != null) {
-                // Everything else...
-                return String.valueOf(value);
-            }
-        }
-
-        return "";
-    }
-
-    @Override
-    public String getAttributeStringValue(final Object attr) {
-        return attribute(attr).getValue();
-    }
-
-    @Override
-    public String getNamespaceStringValue(final Object ns) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getTextStringValue(final Object text) {
-        return text.toString();
-    }
-
-    @Override
-    public String getNamespacePrefix(final Object ns) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public XPath parseXPath(final String xpath) throws SAXPathException {
-        // FIXME: need to bind YangXPath probably
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getChildAxisIterator(final Object contextNode) {
-        final NormalizedNodeContext ctx = cast(contextNode);
-        final NormalizedNode node = ctx.getNode();
-        return node instanceof DataContainerNode ? ctx.iterateChildren((DataContainerNode<?>) node) : null;
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getChildAxisIterator(final Object contextNode, final String localName,
-            final String namespacePrefix, final String namespaceURI) {
-        final NormalizedNodeContext ctx = cast(contextNode);
-        final NormalizedNode node = ctx.getNode();
-        return node instanceof DataContainerNode
-                ? ctx.iterateChildrenNamed((DataContainerNode<?>)node, resolveQName(node, namespacePrefix, localName))
-                        : null;
-    }
-
-    @Override
-    public Iterator<? extends Entry<?, ?>> getAttributeAxisIterator(final Object contextNode) {
-        // FIXME: how do we mix in metadata?
-        //      final NormalizedNode<?, ?> node = contextNode(contextNode);
-        //      if (node instanceof AttributesContainer) {
-        //          final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
-        //          if (attributes.isEmpty()) {
-        //              return null;
-        //          }
-        //
-        //          return attributes.entrySet().iterator();
-        //      }
-        return null;
-    }
-
-    @Override
-    public Iterator<? extends Entry<?, ?>> getAttributeAxisIterator(final Object contextNode, final String localName,
-            final String namespacePrefix, final String namespaceURI) {
-        // FIXME: how do we mix in metadata?
-        //      final NormalizedNode<?, ?> node = contextNode(contextNode);
-        //      if (node instanceof AttributesContainer) {
-        //          final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
-        //          if (attributes.isEmpty()) {
-        //              return null;
-        //          }
-        //
-        //          final QName qname = resolveQName(node, namespacePrefix, localName);
-        //          final String value = attributes.get(qname);
-        //          return value == null ? null : Iterators.singletonIterator(new SimpleImmutableEntry<>(qname, value));
-        //      }
-        return null;
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getParentAxisIterator(final Object contextNode) {
-        final NormalizedNodeContext parent = cast(contextNode).getParent();
-        return parent == null ? null : Iterators.singletonIterator(parent);
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getAncestorAxisIterator(final Object contextNode)
-            throws UnsupportedAxisException {
-        final NormalizedNodeContext parent = cast(contextNode).getParent();
-        return parent == null ? null : new NormalizedNodeContextIterator(parent);
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getSelfAxisIterator(final Object contextNode)
-            throws UnsupportedAxisException {
-        return Iterators.singletonIterator(cast(contextNode));
-    }
-
-    @Override
-    public Iterator<NormalizedNodeContext> getAncestorOrSelfAxisIterator(final Object contextNode)
-            throws UnsupportedAxisException {
-        return new NormalizedNodeContextIterator(cast(contextNode));
-    }
-
-    @Override
-    public NormalizedNodeContext getParentNode(final Object contextNode) throws UnsupportedAxisException {
-        return cast(contextNode).getParent();
-    }
-
-    @Override
-    public EffectiveModelContext getEffectiveModelContext() {
-        return document.getEffectiveModelContext();
-    }
-
-    JaxenDocument getDocument() {
-        return document;
-    }
-
-    private static final class NormalizedNodeContextIterator extends UnmodifiableIterator<NormalizedNodeContext> {
-        private NormalizedNodeContext next;
-
-        NormalizedNodeContextIterator(final NormalizedNodeContext initial) {
-            this.next = requireNonNull(initial);
-        }
-
-        @Override
-        public boolean hasNext() {
-            return next != null;
-        }
-
-        @Override
-        public NormalizedNodeContext next() {
-            if (next == null) {
-                throw new NoSuchElementException();
-            }
-
-            final NormalizedNodeContext ret = next;
-            next = next.getParent();
-            return ret;
-        }
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/Operator.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/Operator.java
deleted file mode 100644 (file)
index 4774ef7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-enum Operator {
-    EQUALS,
-    NOT_EQUALS,
-    GREATER_THAN,
-    GREATER_THAN_EQUALS,
-    LESS_THAN,
-    LESS_THAN_EQUALS,
-    MINUS,
-    PLUS,
-    AND,
-    OR,
-    DIV,
-    MOD,
-    MULTIPLY,
-    UNION;
-
-    static Operator forString(final String str) {
-        switch (str) {
-            case "=":
-                return Operator.EQUALS;
-            case "!=":
-                return Operator.NOT_EQUALS;
-            case "-":
-                return Operator.MINUS;
-            case "+":
-                return Operator.PLUS;
-            case "and":
-                return Operator.AND;
-            case "or":
-                return Operator.OR;
-            case "div":
-                return Operator.DIV;
-            case "mod":
-                return Operator.MOD;
-            case "*":
-                return Operator.MULTIPLY;
-            case ">=":
-                return Operator.GREATER_THAN_EQUALS;
-            case ">":
-                return Operator.GREATER_THAN;
-            case "<=":
-                return Operator.LESS_THAN_EQUALS;
-            case "<":
-                return Operator.LESS_THAN;
-            case "|":
-                return Operator.UNION;
-            default:
-                throw new IllegalArgumentException("Unknown operator " + str);
-
-        }
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/StepListener.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/StepListener.java
deleted file mode 100644 (file)
index 3530b5e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import org.jaxen.expr.AllNodeStep;
-import org.jaxen.expr.CommentNodeStep;
-import org.jaxen.expr.NameStep;
-import org.jaxen.expr.ProcessingInstructionNodeStep;
-import org.jaxen.expr.TextNodeStep;
-
-abstract class StepListener {
-
-    void onAll(final AllNodeStep step) {
-
-    }
-
-    void onComment(final CommentNodeStep step) {
-
-    }
-
-    void onName(final NameStep step) {
-
-    }
-
-    void onProcessingInstruction(final ProcessingInstructionNodeStep step) {
-
-    }
-
-    void onTest(final TextNodeStep step) {
-
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/YangFunctionContext.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/YangFunctionContext.java
deleted file mode 100644 (file)
index d7c1b06..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Verify.verify;
-
-import com.google.common.base.Splitter;
-import java.util.AbstractMap.SimpleImmutableEntry;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.Set;
-import org.eclipse.jdt.annotation.Nullable;
-import org.jaxen.Context;
-import org.jaxen.ContextSupport;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.jaxen.FunctionContext;
-import org.jaxen.UnresolvableException;
-import org.jaxen.XPathFunctionContext;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.PathExpression;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.RegexUtils;
-
-/**
- * A {@link FunctionContext} which contains also YANG-specific functions current(), re-match(), deref(),
- * derived-from(), derived-from-or-self(), enum-value() and bit-is-set().
- */
-final class YangFunctionContext implements FunctionContext {
-    private static final Splitter COLON_SPLITTER = Splitter.on(':');
-    private static final Double DOUBLE_NAN = Double.NaN;
-
-    // Core XPath functions, as per http://tools.ietf.org/html/rfc6020#section-6.4.1
-    private static final FunctionContext XPATH_FUNCTION_CONTEXT = new XPathFunctionContext(false);
-
-    // Singleton instance of reuse
-    private static final YangFunctionContext INSTANCE = new YangFunctionContext();
-
-    private YangFunctionContext() {
-    }
-
-    static YangFunctionContext getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Function getFunction(final String namespaceURI, final String prefix, final String localName)
-            throws UnresolvableException {
-        if (prefix == null) {
-            switch (localName) {
-                case "bit-is-set":
-                    return YangFunctionContext::bitIsSet;
-                case "current":
-                    return YangFunctionContext::current;
-                case "deref":
-                    return YangFunctionContext::deref;
-                case "derived-from":
-                    return YangFunctionContext::derivedFrom;
-                case "derived-from-or-self":
-                    return YangFunctionContext::derivedFromOrSelf;
-                case "enum-value":
-                    return YangFunctionContext::enumValueFunction;
-                case "re-match":
-                    return YangFunctionContext::reMatch;
-                default:
-                    break;
-            }
-        }
-
-        return XPATH_FUNCTION_CONTEXT.getFunction(namespaceURI, prefix, localName);
-    }
-
-    // bit-is-set(node-set nodes, string bit-name) function as per
-    // https://tools.ietf.org/html/rfc7950#section-10.6.1
-    private static boolean bitIsSet(final Context context, final List<?> args) throws FunctionCallException {
-        if (args == null || args.size() != 1) {
-            throw new FunctionCallException("bit-is-set() takes two arguments: node-set nodes, string bit-name");
-        }
-
-        if (!(args.get(0) instanceof String)) {
-            throw new FunctionCallException("Argument bit-name of bit-is-set() function should be a String");
-        }
-
-        final String bitName = (String) args.get(0);
-
-        final NormalizedNodeContext currentNodeContext = verifyContext(context);
-        final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
-
-        final TypeDefinition<?> nodeType = correspondingSchemaNode.getType();
-        if (!(nodeType instanceof BitsTypeDefinition)) {
-            return false;
-        }
-
-        final Object nodeValue = currentNodeContext.getNode().body();
-        if (!(nodeValue instanceof Set)) {
-            return false;
-        }
-
-        final BitsTypeDefinition bitsType = (BitsTypeDefinition) nodeType;
-        checkState(containsBit(bitsType, bitName), "Bit %s does not belong to bits %s.", bitName, bitsType);
-        return ((Set<?>)nodeValue).contains(bitName);
-    }
-
-    // current() function, as per http://tools.ietf.org/html/rfc6020#section-6.4.1
-    private static NormalizedNodeContext current(final Context context, final List<?> args)
-            throws FunctionCallException {
-        if (!args.isEmpty()) {
-            throw new FunctionCallException("current() takes no arguments.");
-        }
-
-        return verifyContext(context);
-    }
-
-    // deref(node-set nodes) function as per https://tools.ietf.org/html/rfc7950#section-10.3.1
-    private static NormalizedNode deref(final Context context, final List<?> args) throws FunctionCallException {
-        if (!args.isEmpty()) {
-            throw new FunctionCallException("deref() takes only one argument: node-set nodes.");
-        }
-
-        final NormalizedNodeContext currentNodeContext = verifyContext(context);
-        final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
-
-        final Object nodeValue = currentNodeContext.getNode().body();
-        final TypeDefinition<?> type = correspondingSchemaNode.getType();
-        if (type instanceof InstanceIdentifierTypeDefinition) {
-            return nodeValue instanceof YangInstanceIdentifier
-                    ? getNodeReferencedByInstanceIdentifier((YangInstanceIdentifier) nodeValue, currentNodeContext)
-                            : null;
-        }
-        if (type instanceof LeafrefTypeDefinition) {
-            final PathExpression xpath = ((LeafrefTypeDefinition) type).getPathStatement();
-            return getNodeReferencedByLeafref(xpath, currentNodeContext, getSchemaContext(currentNodeContext),
-                correspondingSchemaNode, nodeValue);
-        }
-        return null;
-    }
-
-    // derived-from(node-set nodes, string identity) function as per https://tools.ietf.org/html/rfc7950#section-10.4.1
-    private static boolean derivedFrom(final Context context, final List<?> args) throws FunctionCallException {
-        final Entry<IdentitySchemaNode, IdentitySchemaNode> ids = commonDerivedFrom("derived-from", context, args);
-        return ids != null && isAncestorOf(ids.getKey(), ids.getValue());
-    }
-
-    // derived-from-or-self(node-set nodes, string identity) function as per
-    // https://tools.ietf.org/html/rfc7950#section-10.4.2
-    private static boolean derivedFromOrSelf(final Context context, final List<?> args) throws FunctionCallException {
-        final Entry<IdentitySchemaNode, IdentitySchemaNode> ids = commonDerivedFrom("derived-from-or-self", context,
-            args);
-        return ids != null && (ids.getValue().equals(ids.getKey()) || isAncestorOf(ids.getKey(), ids.getValue()));
-    }
-
-    private static @Nullable Entry<IdentitySchemaNode, IdentitySchemaNode> commonDerivedFrom(final String functionName,
-            final Context context, final List<?> args) throws FunctionCallException {
-        if (args == null || args.size() != 1) {
-            throw new FunctionCallException(functionName + "() takes two arguments: node-set nodes, string identity");
-        }
-        if (!(args.get(0) instanceof String)) {
-            throw new FunctionCallException("Argument 'identity' of " + functionName
-                + "() function should be a String.");
-        }
-
-        final NormalizedNodeContext currentNodeContext = verifyContext(context);
-        final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
-
-        final SchemaContext schemaContext = getSchemaContext(currentNodeContext);
-        return correspondingSchemaNode.getType() instanceof IdentityrefTypeDefinition
-                && currentNodeContext.getNode().body() instanceof QName ? new SimpleImmutableEntry<>(
-                        getIdentitySchemaNodeFromString((String) args.get(0), schemaContext, correspondingSchemaNode),
-                        getIdentitySchemaNodeFromQName((QName) currentNodeContext.getNode().body(), schemaContext))
-                        : null;
-    }
-
-    // enum-value(node-set nodes) function as per https://tools.ietf.org/html/rfc7950#section-10.5.1
-    private static Object enumValueFunction(final Context context, final List<?> args) throws FunctionCallException {
-        if (!args.isEmpty()) {
-            throw new FunctionCallException("enum-value() takes one argument: node-set nodes.");
-        }
-
-        final NormalizedNodeContext currentNodeContext = verifyContext(context);
-        final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
-
-        final TypeDefinition<?> nodeType = correspondingSchemaNode.getType();
-        if (!(nodeType instanceof EnumTypeDefinition)) {
-            return DOUBLE_NAN;
-        }
-
-        final Object nodeValue = currentNodeContext.getNode().body();
-        if (!(nodeValue instanceof String)) {
-            return DOUBLE_NAN;
-        }
-
-        final EnumTypeDefinition enumerationType = (EnumTypeDefinition) nodeType;
-        final String enumName = (String) nodeValue;
-
-        return getEnumValue(enumerationType, enumName);
-    }
-
-    // re-match(string subject, string pattern) function as per https://tools.ietf.org/html/rfc7950#section-10.2.1
-    private static boolean reMatch(final Context context, final List<?> args) throws FunctionCallException {
-        if (args == null || args.size() != 2) {
-            throw new FunctionCallException("re-match() takes two arguments: string subject, string pattern.");
-        }
-        final Object subject = args.get(0);
-        if (!(subject instanceof String)) {
-            throw new FunctionCallException("First argument of re-match() should be a String.");
-        }
-        final Object pattern = args.get(1);
-        if (!(pattern instanceof String)) {
-            throw new FunctionCallException("Second argument of re-match() should be a String.");
-        }
-
-        return ((String) subject).matches(RegexUtils.getJavaRegexFromXSD((String) pattern));
-    }
-
-    private static boolean isAncestorOf(final IdentitySchemaNode identity, final IdentitySchemaNode descendant) {
-        for (IdentitySchemaNode base : descendant.getBaseIdentities()) {
-            if (identity.equals(base) || isAncestorOf(identity, base)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static IdentitySchemaNode getIdentitySchemaNodeFromQName(final QName identityQName,
-            final SchemaContext schemaContext) {
-        final Optional<Module> module = schemaContext.findModule(identityQName.getModule());
-        checkArgument(module.isPresent(), "Module for %s not found", identityQName);
-        return findIdentitySchemaNodeInModule(module.get(), identityQName);
-    }
-
-    private static IdentitySchemaNode getIdentitySchemaNodeFromString(final String identity,
-            final SchemaContext schemaContext, final TypedDataSchemaNode correspondingSchemaNode) {
-        final List<String> identityPrefixAndName = COLON_SPLITTER.splitToList(identity);
-        final Module module = schemaContext.findModule(correspondingSchemaNode.getQName().getModule()).get();
-        if (identityPrefixAndName.size() == 2) {
-            // prefix of local module
-            if (identityPrefixAndName.get(0).equals(module.getPrefix())) {
-                return findIdentitySchemaNodeInModule(module, QName.create(module.getQNameModule(),
-                        identityPrefixAndName.get(1)));
-            }
-
-            // prefix of imported module
-            for (final ModuleImport moduleImport : module.getImports()) {
-                if (identityPrefixAndName.get(0).equals(moduleImport.getPrefix())) {
-                    final Module importedModule = schemaContext.findModule(moduleImport.getModuleName(),
-                        moduleImport.getRevision()).get();
-                    return findIdentitySchemaNodeInModule(importedModule, QName.create(
-                        importedModule.getQNameModule(), identityPrefixAndName.get(1)));
-                }
-            }
-
-            throw new IllegalArgumentException(String.format("Cannot resolve prefix '%s' from identity '%s'.",
-                    identityPrefixAndName.get(0), identity));
-        }
-
-        if (identityPrefixAndName.size() == 1) {
-            // without prefix
-            return findIdentitySchemaNodeInModule(module, QName.create(module.getQNameModule(),
-                    identityPrefixAndName.get(0)));
-        }
-
-        throw new IllegalArgumentException(String.format("Malformed identity argument: %s.", identity));
-    }
-
-    private static IdentitySchemaNode findIdentitySchemaNodeInModule(final Module module, final QName identityQName) {
-        for (final IdentitySchemaNode id : module.getIdentities()) {
-            if (identityQName.equals(id.getQName())) {
-                return id;
-            }
-        }
-
-        throw new IllegalArgumentException(String.format("Identity %s does not have a corresponding"
-                    + " identity schema node in the module %s.", identityQName, module));
-    }
-
-    private static NormalizedNode getNodeReferencedByInstanceIdentifier(final YangInstanceIdentifier path,
-            final NormalizedNodeContext currentNodeContext) {
-        final NormalizedNodeNavigator navigator = (NormalizedNodeNavigator) currentNodeContext.getNavigator();
-        final NormalizedNode rootNode = navigator.getDocument().getRootNode();
-        final List<PathArgument> pathArguments = path.getPathArguments();
-        if (pathArguments.get(0).getNodeType().equals(rootNode.getNodeType())) {
-            final List<PathArgument> relPath = pathArguments.subList(1, pathArguments.size());
-            final Optional<NormalizedNode> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
-            if (possibleNode.isPresent()) {
-                return possibleNode.get();
-            }
-        }
-
-        return null;
-    }
-
-    private static NormalizedNode getNodeReferencedByLeafref(final PathExpression xpath,
-            final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
-            final TypedDataSchemaNode correspondingSchemaNode, final Object nodeValue) {
-        final NormalizedNode referencedNode = xpath.isAbsolute() ? getNodeReferencedByAbsoluteLeafref(xpath,
-                currentNodeContext, schemaContext, correspondingSchemaNode) : getNodeReferencedByRelativeLeafref(xpath,
-                currentNodeContext, schemaContext, correspondingSchemaNode);
-
-        if (referencedNode instanceof LeafSetNode) {
-            return getReferencedLeafSetEntryNode((LeafSetNode<?>) referencedNode, nodeValue);
-        }
-
-        if (referencedNode instanceof LeafNode && referencedNode.body().equals(nodeValue)) {
-            return referencedNode;
-        }
-
-        return null;
-    }
-
-    private static NormalizedNode getNodeReferencedByAbsoluteLeafref(final PathExpression xpath,
-            final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
-            final TypedDataSchemaNode correspondingSchemaNode) {
-        final LeafrefXPathStringParsingPathArgumentBuilder builder = new LeafrefXPathStringParsingPathArgumentBuilder(
-                xpath.getOriginalString(), schemaContext, correspondingSchemaNode, currentNodeContext);
-        final List<PathArgument> pathArguments = builder.build();
-        final NormalizedNodeNavigator navigator = (NormalizedNodeNavigator) currentNodeContext.getNavigator();
-        final NormalizedNode rootNode = navigator.getDocument().getRootNode();
-        if (pathArguments.get(0).getNodeType().equals(rootNode.getNodeType())) {
-            final List<PathArgument> relPath = pathArguments.subList(1, pathArguments.size());
-            final Optional<NormalizedNode> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
-            if (possibleNode.isPresent()) {
-                return possibleNode.get();
-            }
-        }
-
-        return null;
-    }
-
-    private static NormalizedNode getNodeReferencedByRelativeLeafref(final PathExpression xpath,
-            final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
-            final TypedDataSchemaNode correspondingSchemaNode) {
-        NormalizedNodeContext relativeNodeContext = currentNodeContext;
-        final StringBuilder xPathStringBuilder = new StringBuilder(xpath.getOriginalString());
-        // strip the relative path of all ../ at the beginning
-        while (xPathStringBuilder.indexOf("../") == 0) {
-            xPathStringBuilder.delete(0, 3);
-            relativeNodeContext = relativeNodeContext.getParent();
-        }
-
-        // add / to the beginning of the path so that it can be processed the same way as an absolute path
-        xPathStringBuilder.insert(0, '/');
-        final LeafrefXPathStringParsingPathArgumentBuilder builder = new LeafrefXPathStringParsingPathArgumentBuilder(
-                xPathStringBuilder.toString(), schemaContext, correspondingSchemaNode, currentNodeContext);
-        final List<PathArgument> pathArguments = builder.build();
-        final NormalizedNode relativeNode = relativeNodeContext.getNode();
-        return NormalizedNodes.findNode(relativeNode, pathArguments).orElse(null);
-    }
-
-    private static LeafSetEntryNode<?> getReferencedLeafSetEntryNode(final LeafSetNode<?> referencedNode,
-            final Object currentNodeValue) {
-        for (final LeafSetEntryNode<?> entryNode : referencedNode.body()) {
-            if (currentNodeValue.equals(entryNode.body())) {
-                return entryNode;
-            }
-        }
-
-        return null;
-    }
-
-
-    private static boolean containsBit(final BitsTypeDefinition bitsType, final String bitName) {
-        for (BitsTypeDefinition.Bit bit : bitsType.getBits()) {
-            if (bitName.equals(bit.getName())) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    private static int getEnumValue(final EnumTypeDefinition enumerationType, final String enumName) {
-        for (final EnumTypeDefinition.EnumPair enumPair : enumerationType.getValues()) {
-            if (enumName.equals(enumPair.getName())) {
-                return enumPair.getValue();
-            }
-        }
-
-        throw new IllegalStateException(String.format("Enum %s does not belong to enumeration %s.",
-                enumName, enumerationType));
-    }
-
-    private static EffectiveModelContext getSchemaContext(final NormalizedNodeContext normalizedNodeContext) {
-        final ContextSupport contextSupport = normalizedNodeContext.getContextSupport();
-        verify(contextSupport instanceof NormalizedNodeContextSupport, "Unhandled context support %s",
-                contextSupport.getClass());
-        return ((NormalizedNodeContextSupport) contextSupport).getEffectiveModelContext();
-    }
-
-    private static TypedDataSchemaNode getCorrespondingTypedSchemaNode(final NormalizedNodeContext currentNodeContext) {
-        final DataSchemaNode schemaNode = currentNodeContext.getSchema().getDataSchemaNode();
-        checkState(schemaNode instanceof TypedDataSchemaNode, "Node %s must be a leaf or a leaf-list.",
-                currentNodeContext.getNode());
-        return (TypedDataSchemaNode) schemaNode;
-    }
-
-    private static NormalizedNodeContext verifyContext(final Context context) {
-        verify(context instanceof NormalizedNodeContext, "Unhandled context %s", context.getClass());
-        return (NormalizedNodeContext) context;
-    }
-
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpression.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpression.java
deleted file mode 100644 (file)
index f07425d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Optional;
-import java.util.concurrent.Future;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
-/**
- * Asynchronous interface to evaluation. It is functionally the same as an XPathExpression, but allows for asynchronous
- * execution of evaluation of the expression.
- *
- * <p>
- * FIXME: Whether or not the resulting XPathResult can perform blocking calls is up for grabs, but implementations are
- *        definitely allowed to perform things like on-demand data transformation from foreign object and data models.
- *
- * @deprecated PREVIEW API. DO NOT IMPLEMENT YET AS THIS NEEDS TO BE VALIDATED FOR USE IN CLIENT APPLICATIONS.
- *             APPLICATIONS WILLING TO USE THIS API PLEASE CONTACT
- *             <a href="mailto:yangtools-dev@lists.opendaylight.org">yangtools-dev</a>.
- */
-@Deprecated
-@Beta
-public interface LazyXPathExpression {
-    /**
-     * Evaluate this expression at the specified path in a document. If evaluation succeeds, it will return an
-     * {@link XPathResult} at some point it the future. If it fails to match anything, it {@link Future#get()} will
-     * return {@link Optional#empty()}.
-     *
-     * <p>
-     * FIXME: The amount of overhead an implementation can incur on the user as data from the resulting
-     *        {@link XPathResult} is being accessed is left UNDEFINED.
-     *        Specifically, the user is expected to store each result returned directly or indirectly in a local
-     *        variable instead of repeated calls to the result's methods, as these may incur CPU processing overhead.
-     *        Furthermore all method invocations can throw {@link LazyXPathExpressionException}, which the users are
-     *        expected to handle gracefully. RESILIENT USERS ARE EXPECTED TO CATCH {@link LazyXPathExpressionException}
-     *        AND RECOVER IN THE SAME MANNER THEY WOULD IF AN {@link XPathExpressionException} WOULD HAVE BEEN THROWN.
-     *        [ FIXME: would it be appropriate to allow implementations to SneakyThrow {@link XPathExpressionException}
-     *                 and not introduce a RuntimeExpcetion ? ]
-     *
-     * @param document {@link XPathDocument} on which evaluation should take place
-     * @param path Path to the node on which to evaluate the expression
-     * @return An optional {@link XPathResult}
-     * @throws NullPointerException if any of the arguments are null
-     * @throws IllegalArgumentException if the path does not match the path at which this expression was compiled
-     */
-    ListenableFuture<Optional<? extends XPathResult<?>>> evaluateLazily(@NonNull XPathDocument document,
-            @NonNull YangInstanceIdentifier path);
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpressionException.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/LazyXPathExpressionException.java
deleted file mode 100644 (file)
index 99c16ca..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import javax.xml.xpath.XPathExpressionException;
-
-/**
- * The runtime counterpart of {@link XPathExpressionException}. Can occur only when the user is accessing any state
- * created from the user's invocation to the {@link LazyXPathExpression} API.
- *
- * @deprecated PREVIEW API. DO NOT IMPLEMENT YET AS THIS NEEDS TO BE VALIDATED FOR USE IN CLIENT APPLICATIONS.
- *             APPLICATIONS WILLING TO USE THIS API PLEASE CONTACT
- *             <a href="mailto:yangtools-dev@lists.opendaylight.org">yangtools-dev</a>.
- */
-@Beta
-@Deprecated
-public class LazyXPathExpressionException extends RuntimeException {
-    private static final long serialVersionUID = 1L;
-
-    public LazyXPathExpressionException(final String message) {
-        super(message);
-    }
-
-    public LazyXPathExpressionException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/OptimizableXPathExpression.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/OptimizableXPathExpression.java
deleted file mode 100644 (file)
index 2f245ab..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Interface implemented by {@link XPathExpression}s which can be further optimized for execution efficiency at the
- * expense of additional processing being performed on them. The decision to optimize a particular expression is left
- * to the user's discretion.
- *
- * <p>
- * Implementations supporting profile-driven and similar optimizations which depend on data being gathered during
- * evaluation should not implement this interface, but rather perform these optimizations transparently behind the
- * scenes. That implies the users can expect those optimizations not interfering with the user's ability to evaluate
- * the expression.
- */
-@Beta
-@Deprecated
-public interface OptimizableXPathExpression extends XPathExpression {
-    /**
-     * Perform optimization of this expression. If an implementation supports different levels of optimization, it
-     * should return an {@link OptimizableXPathExpression} as a result of progressing optimizations for as long as
-     * it determines further processing can result in execution benefits. Note this expression is expected to remain
-     * unchanged.
-     *
-     * @return An optimized version of this expression.
-     */
-    @NonNull XPathExpression optimizeExpression();
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/PrefixConverters.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/PrefixConverters.java
deleted file mode 100644 (file)
index 9e9ef35..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Converter;
-import com.google.common.collect.ImmutableBiMap;
-import com.google.common.collect.ImmutableBiMap.Builder;
-import com.google.common.collect.Maps;
-import java.util.Optional;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-/**
- * A set of utility functions for dealing with common types of namespace mappings.
- */
-@Beta
-@Deprecated
-public final class PrefixConverters {
-    private PrefixConverters() {
-        // Hidden on purpose
-    }
-
-    /**
-     * Create a prefix {@link Converter} for {@link XPathExpressionException} defined in a particular YANG
-     * {@link Module} .Instantiation requires establishing how a module's imports are mapped to actual modules
-     * and their namespaces. This information is cached and used for improved lookups.
-     *
-     * @param ctx A SchemaContext
-     * @param module Module in which the XPath is defined
-     * @return A new Converter
-     */
-    public static @NonNull Converter<String, QNameModule> create(final SchemaContext ctx, final Module module) {
-        // Always check for null ctx
-        requireNonNull(ctx, "Schema context may not be null");
-
-        // Use immutable map builder for detection of duplicates (which should never occur)
-        final Builder<String, QNameModule> b = ImmutableBiMap.builder();
-        b.put(module.getPrefix(), module.getQNameModule());
-
-        for (ModuleImport i : module.getImports()) {
-            final Optional<? extends Module> mod = ctx.findModule(i.getModuleName(), i.getRevision());
-            checkArgument(mod.isPresent(), "Unsatisfied import of %s by module %s", i, module);
-
-            b.put(i.getPrefix(), mod.get().getQNameModule());
-        }
-
-        return Maps.asConverter(b.build());
-    }
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/RelocatableXPathExpression.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/RelocatableXPathExpression.java
deleted file mode 100644 (file)
index e68984a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * Interface implemented by {@link XPathExpression}s which can be recompiled to execute more efficiently at a
- * at a different {@link SchemaPath} than they were originally compiled at. This can result in the expression being
- * moved either up or down in a SchemaPath tree, usually closer to their {@link #getApexPath()}.
- */
-@Beta
-@Deprecated
-public interface RelocatableXPathExpression extends XPathExpression {
-    /**
-     * Return a new XPathExpression relocated to a SchemaPath of the implementation's choosing. Note that
-     * {@link #getApexPath()} must not change during this operation.
-     *
-     * @return A new XPathExpression instance.
-     */
-    @NonNull XPathExpression relocateExpression();
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathBooleanResult.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathBooleanResult.java
deleted file mode 100644 (file)
index afac102..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-
-/**
- * An {@link XPathResult} containing a Boolean.
- */
-@Beta
-@Deprecated
-public interface XPathBooleanResult extends XPathResult<Boolean> {
-
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathDocument.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathDocument.java
deleted file mode 100644 (file)
index e30072e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-/**
- * The notion of a document, modeled as a {@link NormalizedNode}.
- */
-@Beta
-@Deprecated
-public interface XPathDocument {
-    /**
-     * Return the root node of this document.
-     *
-     * @return This document's root node.
-     */
-    @NonNull NormalizedNode getRootNode();
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathExpression.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathExpression.java
deleted file mode 100644 (file)
index 61e46a9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import java.util.Optional;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * A compiled XPath expression. Each instance is bound to a particular {@link XPathSchemaContext} and may not be
- * evaluated on {@link XPathDocument}s from other context.
- */
-@Beta
-@Deprecated
-public interface XPathExpression {
-    /**
-     * Evaluate this expression at the specified path in a document. If evaluation succeeds, it will return an
-     * {@link XPathResult}. If it fails to match anything, it will return {@link Optional#empty()}. Implementations
-     * of this method are expected to perform complete evaluation such that accessing data via the resulting
-     * {@link XPathResult} will not incur large overhead.
-     *
-     * @param document {@link XPathDocument} on which evaluation should take place
-     * @param path Path to the node on which to evaluate the expression
-     * @return An optional {@link XPathResult}
-     * @throws NullPointerException if any of the arguments are null
-     * @throws XPathExpressionException if the expression cannot be evaluated
-     * @throws IllegalArgumentException if the path does not match the path at which this expression was compiled
-     */
-    Optional<? extends XPathResult<?>> evaluate(@NonNull XPathDocument document, @NonNull YangInstanceIdentifier path)
-            throws XPathExpressionException;
-
-    /**
-     * Return the evaluation context SchemaPath of this expression. This is corresponds to the SchemaPath at which this
-     * expression was compiled at, or relocated to via {@link RelocatableXPathExpression#relocateExpression()}.
-     *
-     * @return The evaluation {@link SchemaPath}
-     */
-    @NonNull SchemaPath getEvaluationPath();
-
-    /**
-     * Return the SchemaPath of the topmost node which affects the result of evaluation of this expression. This
-     * information is useful for large evolving documents (such as
-     * {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree} implementations) to minimize the frequency
-     * of evaluation. The apex can be either logically higher or lower in the SchemaPath tree than
-     * {@link #getEvaluationPath()}.
-     *
-     * @return The apex node evaluation of this expression can reference, or {@link SchemaPath#ROOT} if it cannot
-     *         cannot be conclusively determined.
-     */
-    @NonNull SchemaPath getApexPath();
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNodesetResult.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNodesetResult.java
deleted file mode 100644 (file)
index 99f6b2e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import java.util.Collection;
-import java.util.Map.Entry;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-/**
- * An {@link XPathResult} containing a set of nodes. Resulting nodes are identified by their
- * {@link YangInstanceIdentifier}.
- */
-@Beta
-@Deprecated
-public interface XPathNodesetResult extends XPathResult<Collection<Entry<YangInstanceIdentifier, NormalizedNode>>> {
-
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNumberResult.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathNumberResult.java
deleted file mode 100644 (file)
index 8771602..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-
-/**
- * An {@link XPathResult} containing a Number.
- */
-@Beta
-@Deprecated
-public interface XPathNumberResult extends XPathResult<Number> {
-
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathResult.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathResult.java
deleted file mode 100644 (file)
index 012c446..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Base interface for various things an XPath evaluation can return.
- *
- * @param <T> type of returned value
- */
-@Beta
-@Deprecated
-// FIXME: do we want to support all the modes of
-//        <a href="http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResultType">DOM XPath</a> ?
-//        The default DataTree (yang-data-impl) implementation can support ORDERED_NODE_SNAPSHOT_TYPE. The clustered
-//        datastore may want to implement ORDERED_NODE_ITERATOR_TYPE (via iterators).
-public interface XPathResult<T> {
-    /**
-     * Get the value contained in this result.
-     *
-     * @return Result value
-     */
-    @NonNull T getValue();
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContext.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContext.java
deleted file mode 100644 (file)
index c4b5755..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Converter;
-import javax.xml.xpath.XPathExpressionException;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * A schema-informed XPath context. It supports creation of {@link XPathDocument}s, which are bound to
- * a particular root node.
- */
-@Beta
-@Deprecated
-public interface XPathSchemaContext {
-    /**
-     * Compile an XPath expression for execution on {@link XPathDocument}s produced by this context.
-     *
-     * <p>
-     * The user must provide a prefix-to-mapping {@link Converter}, which will be used to convert any prefixes found
-     * in the XPath expression being compiled in the resulting context.
-     *
-     * @param schemaPath Schema path of the node at which this expression is expected to be evaluated
-     * @param prefixes Prefix-to-namespace converter
-     * @param xpath XPath expression to compile
-     * @return A compiled XPath expression
-     * @throws XPathExpressionException if the provided expression is invalid, either syntactically or by referencing
-     *         namespaces unknown to this schema context.
-     */
-    @NonNull XPathExpression compileExpression(@NonNull SchemaPath schemaPath,
-            @NonNull Converter<String, QNameModule> prefixes, @NonNull String xpath) throws XPathExpressionException;
-
-    /**
-     * Create a new document context.
-     *
-     * @param documentRoot Root node of the document
-     * @return A new {@link XPathDocument} on which queries may be executed.
-     * @throws IllegalArgumentException if the document root is not known to this schema context.
-     */
-    @NonNull XPathDocument createDocument(@NonNull NormalizedNode documentRoot);
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContextFactory.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathSchemaContextFactory.java
deleted file mode 100644 (file)
index 09bfbfa..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-
-/**
- * A factory for obtaining {@link XPathSchemaContext}s. This is the primary entry point to an XPath evaluation
- * implementation. Users are expected to resolve these via their service resolution framework, be it
- * {@link java.util.ServiceLoader}, OSGi or similar.
- *
- * <p>
- * Implementations are required to support {@link java.util.ServiceLoader}.
- */
-@Deprecated
-@NonNullByDefault
-public interface XPathSchemaContextFactory {
-    /**
-     * Create an {@link XPathSchemaContext} based on a {@link EffectiveModelContext}. This effectively binds the
-     * namespaces the user expects to map to YANG schema. The {@link XPathExpression} compilation, relocation and
-     * optimization processes can take advantage of the YANG schema provided.
-     *
-     * @param context SchemaContext associated with the resulting {@link XPathSchemaContext}
-     * @return An {@link XPathSchemaContext} instance
-     */
-    XPathSchemaContext createContext(EffectiveModelContext context);
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathStringResult.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/XPathStringResult.java
deleted file mode 100644 (file)
index 1ecb689..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen.api;
-
-import com.google.common.annotations.Beta;
-
-/**
- * An {@link XPathResult} containing a String.
- */
-@Beta
-@Deprecated
-public interface XPathStringResult extends XPathResult<String> {
-
-}
diff --git a/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/package-info.java b/attic/yang-data-jaxen/src/main/java/org/opendaylight/yangtools/yang/data/jaxen/api/package-info.java
deleted file mode 100644 (file)
index 8493cc6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Deprecated APIs for evaluating XPath expressions on
- * {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode} trees.
- *
- * <p>
- * This API is deprecated and will be removed in a future version. For replacement refer to
- * {@code org.opendaylight.yang.data.api.xpath} package.
- */
-@java.lang.Deprecated
-package org.opendaylight.yangtools.yang.data.jaxen.api;
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/BitIsSetXPathFunctionTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/BitIsSetXPathFunctionTest.java
deleted file mode 100644 (file)
index 8fd8284..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import java.util.Set;
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-
-public class BitIsSetXPathFunctionTest {
-
-    private static final JaxenSchemaContextFactory SCHEMA_CONTEXT_FACTORY = new JaxenSchemaContextFactory();
-    private static final QNameModule FOO_MODULE =
-        QNameModule.create(XMLNamespace.of("foo-ns"), Revision.of("2017-04-03"));
-    private static final QName MY_CONTAINER = QName.create(FOO_MODULE, "my-container");
-    private static final QName MY_LIST = QName.create(FOO_MODULE, "my-list");
-    private static final QName FLAGS = QName.create(FOO_MODULE, "flags");
-    private static final QName ORDINARY_LEAF = QName.create(FOO_MODULE, "ordinary-leaf");
-
-    @Test
-    public void testBitIsSetFunction() throws Exception {
-        final Set<String> setOfBits = ImmutableSet.of("UP", "PROMISCUOUS");
-
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            BitIsSetXPathFunctionTest.class, "/yang-xpath-functions-test/bit-is-set-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(setOfBits));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToFlagsLeafNode(setOfBits));
-
-        final Function bitIsSetFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "bit-is-set");
-        boolean bitIsSetResult = (boolean) bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("UP"));
-        assertTrue(bitIsSetResult);
-        bitIsSetResult = (boolean) bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("PROMISCUOUS"));
-        assertTrue(bitIsSetResult);
-        bitIsSetResult = (boolean) bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("DISABLED"));
-        assertFalse(bitIsSetResult);
-    }
-
-    @Test
-    public void testInvalidTypeOfCorrespondingSchemaNode() throws Exception {
-        final Set<String> setOfBits = ImmutableSet.of("UP", "PROMISCUOUS");
-
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            BitIsSetXPathFunctionTest.class, "/yang-xpath-functions-test/bit-is-set-function/foo-invalid.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(setOfBits));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToFlagsLeafNode(setOfBits));
-
-        final Function bitIsSetFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "bit-is-set");
-        boolean bitIsSetResult = (boolean) bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("UP"));
-        assertFalse(bitIsSetResult);
-    }
-
-    @Test
-    public void testInvalidNormalizedNodeValueType() throws Exception {
-        final String invalidNodeValueType = "value of invalid type";
-
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            BitIsSetXPathFunctionTest.class, "/yang-xpath-functions-test/bit-is-set-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(
-                    invalidNodeValueType));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToFlagsLeafNode(invalidNodeValueType));
-
-        final Function bitIsSetFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "bit-is-set");
-        boolean bitIsSetResult = (boolean) bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("UP"));
-        assertFalse(bitIsSetResult);
-    }
-
-    @Test
-    public void shouldFailOnUnknownBitArgument() throws Exception {
-        final Set<String> setOfBits = ImmutableSet.of("UP", "PROMISCUOUS");
-
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            BitIsSetXPathFunctionTest.class, "/yang-xpath-functions-test/bit-is-set-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(setOfBits));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToFlagsLeafNode(setOfBits));
-
-        final Function bitIsSetFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "bit-is-set");
-        try {
-            bitIsSetFunction.call(normalizedNodeContext, ImmutableList.of("UNKNOWN"));
-            fail("Function call should have failed on unknown bit-name argument");
-        } catch (final IllegalStateException ex) {
-            assertTrue(ex.getMessage().startsWith("Bit UNKNOWN does not belong to bits"));
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidNumberOfArguments() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function bitIsSetFunction = yangFunctionContext.getFunction(null, null, "bit-is-set");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            bitIsSetFunction.call(mockedContext, ImmutableList.of("bit-a", "bit-b"));
-            fail("Function call should have failed on invalid number of arguments.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("bit-is-set() takes two arguments: node-set nodes, string bit-name", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidTypeOfArgument() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function bitIsSetFunction = yangFunctionContext.getFunction(null, null, "bit-is-set");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            bitIsSetFunction.call(mockedContext, ImmutableList.of(100));
-            fail("Function call should have failed on invalid type of the bit-name argument.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("Argument bit-name of bit-is-set() function should be a String", ex.getMessage());
-        }
-    }
-
-    private static ContainerNode buildMyContainerNode(final Object keyLeafValue) {
-        final LeafNode<?> ordinaryLeafNode = Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(ORDINARY_LEAF)).withValue("test-value").build();
-
-        final SystemMapNode myListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_LIST))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(MY_LIST, FLAGS, keyLeafValue))
-                        .withChild(ordinaryLeafNode).build()).build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_CONTAINER)).withChild(myListNode).build();
-
-        return myContainerNode;
-    }
-
-    private static YangInstanceIdentifier buildPathToFlagsLeafNode(final Object keyLeafValue) {
-        final ImmutableMap.Builder<QName, Object> builder = ImmutableMap.builder();
-        final ImmutableMap<QName, Object> keys = builder.put(FLAGS, keyLeafValue).build();
-
-        final YangInstanceIdentifier path = YangInstanceIdentifier.of(MY_LIST)
-                .node(NodeIdentifierWithPredicates.of(MY_LIST, keys)).node(FLAGS);
-        return path;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerefXPathFunctionTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerefXPathFunctionTest.java
deleted file mode 100644 (file)
index a644b93..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import java.util.Map;
-import org.jaxen.Function;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.SystemLeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-
-public class DerefXPathFunctionTest {
-
-    private static JaxenSchemaContextFactory jaxenSchemaContextFactory = new JaxenSchemaContextFactory();
-
-    private static final QNameModule FOO_MODULE =
-        QNameModule.create(XMLNamespace.of("foo-ns"), Revision.of("2017-04-03"));
-    private static final QName MY_CONTAINER = QName.create(FOO_MODULE, "my-container");
-    private static final QName MY_INNER_CONTAINER = QName.create(FOO_MODULE, "my-inner-container");
-    private static final QName MY_LIST = QName.create(FOO_MODULE, "my-list");
-    private static final QName KEY_LEAF_A = QName.create(FOO_MODULE, "key-leaf-a");
-    private static final QName KEY_LEAF_B = QName.create(FOO_MODULE, "key-leaf-b");
-    private static final QName IID_LEAF = QName.create(FOO_MODULE, "iid-leaf");
-    private static final QName REFERENCED_LEAF = QName.create(FOO_MODULE, "referenced-leaf");
-    private static final QName REFERENCED_LEAFLIST = QName.create(FOO_MODULE, "referenced-leaf-list");
-    private static final QName ABS_LEAFREF_LEAF = QName.create(FOO_MODULE, "abs-leafref-leaf");
-    private static final QName REL_LEAFREF_LEAF = QName.create(FOO_MODULE, "rel-leafref-leaf");
-    private static final QName LEAFLIST_LEAFREF_LEAF = QName.create(FOO_MODULE, "leaf-list-leafref-leaf");
-    private static final QName ORDINARY_LEAF_A = QName.create(FOO_MODULE, "ordinary-leaf-a");
-    private static final QName ORDINARY_LEAF_B = QName.create(FOO_MODULE, "ordinary-leaf-b");
-
-    @Test
-    public void testDerefFunctionForInstanceIdentifier() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(DerefXPathFunctionTest.class,
-                "/yang-xpath-functions-test/deref-function-iid/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = jaxenSchemaContextFactory.createContext(schemaContext);
-
-        final LeafNode<?> referencedLeafNode = Builders.leafBuilder().withNodeIdentifier(
-            new NodeIdentifier(REFERENCED_LEAF)).withValue("referenced-leaf-node-value").build();
-
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNodeForIIdTest(
-            referencedLeafNode));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIIdLeafNode());
-
-        final Function derefFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "deref");
-        final Object derefResult = derefFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertNotNull(derefResult);
-        assertTrue(derefResult instanceof LeafNode<?>);
-        assertEquals(referencedLeafNode, derefResult);
-    }
-
-    @Test
-    public void testDerefFunctionForLeafref() throws Exception {
-        // tests absolute and relative leafref that references a leaf node
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(DerefXPathFunctionTest.class,
-                "/yang-xpath-functions-test/deref-function-leafref/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = jaxenSchemaContextFactory.createContext(schemaContext);
-
-        final LeafNode<?> referencedLeafNode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(REFERENCED_LEAF)).withValue("referenced-leaf-node-value").build();
-
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNodeForLeafrefTest(
-                referencedLeafNode));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final YangInstanceIdentifier absLeafrefPath = YangInstanceIdentifier.of(MY_INNER_CONTAINER)
-                .node(ABS_LEAFREF_LEAF);
-        NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(absLeafrefPath);
-
-        final Function derefFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "deref");
-        Object derefResult = derefFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertNotNull(derefResult);
-        assertTrue(derefResult instanceof LeafNode<?>);
-        assertEquals(referencedLeafNode, derefResult);
-
-        final YangInstanceIdentifier relLeafrefPath = YangInstanceIdentifier.of(MY_INNER_CONTAINER)
-                .node(REL_LEAFREF_LEAF);
-        normalizedNodeContext = normalizedNodeContextSupport.createContext(relLeafrefPath);
-
-        derefResult = derefFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertNotNull(derefResult);
-        assertTrue(derefResult instanceof LeafNode<?>);
-        assertEquals(referencedLeafNode, derefResult);
-    }
-
-    @Test
-    public void testDerefFunctionForLeafref2() throws Exception {
-        // tests leafref that references a leaf-list node
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(DerefXPathFunctionTest.class,
-                "/yang-xpath-functions-test/deref-function-leafref/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = jaxenSchemaContextFactory.createContext(schemaContext);
-
-        final SystemLeafSetNode<?> referencedLeafListNode = Builders.leafSetBuilder()
-                .withNodeIdentifier(new NodeIdentifier(REFERENCED_LEAFLIST))
-                .withChild(Builders.leafSetEntryBuilder().withNodeIdentifier(
-                        new NodeWithValue<>(REFERENCED_LEAFLIST, "referenced-node-entry-value-a"))
-                        .withValue("referenced-node-entry-value-a").build())
-                .withChild(Builders.leafSetEntryBuilder().withNodeIdentifier(
-                        new NodeWithValue<>(REFERENCED_LEAFLIST, "referenced-node-entry-value-b"))
-                        .withValue("referenced-node-entry-value-b").build())
-                .withChild(Builders.leafSetEntryBuilder().withNodeIdentifier(
-                        new NodeWithValue<>(REFERENCED_LEAFLIST, "referenced-node-entry-value-c"))
-                        .withValue("referenced-node-entry-value-c").build())
-                .build();
-
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNodeForLeafrefTest(
-                referencedLeafListNode));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final YangInstanceIdentifier leafListLeafrefPath = YangInstanceIdentifier.of(MY_INNER_CONTAINER)
-                .node(LEAFLIST_LEAFREF_LEAF);
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport
-                .createContext(leafListLeafrefPath);
-
-        final Function derefFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "deref");
-        Object derefResult = derefFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertNotNull(derefResult);
-        assertTrue(derefResult instanceof NormalizedNode);
-
-        final LeafSetEntryNode<?> referencedLeafListNodeEntry = referencedLeafListNode.childByArg(
-                new NodeWithValue<>(REFERENCED_LEAFLIST, "referenced-node-entry-value-b"));
-        assertSame(referencedLeafListNodeEntry, derefResult);
-    }
-
-    private static ContainerNode buildMyContainerNodeForIIdTest(final LeafNode<?> referencedLeafNode) {
-        final Map<QName, Object> keyValues = ImmutableMap.of(KEY_LEAF_A, "key-value-a", KEY_LEAF_B, "key-value-b");
-        final YangInstanceIdentifier iidPath = YangInstanceIdentifier.of(MY_CONTAINER).node(MY_LIST)
-                .node(NodeIdentifierWithPredicates.of(MY_LIST, keyValues)).node(REFERENCED_LEAF);
-
-        final LeafNode<?> iidLeafNode = Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(IID_LEAF))
-                .withValue(iidPath).build();
-
-        final SystemMapNode myListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_LIST))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(MY_LIST, keyValues))
-                        .withChild(iidLeafNode)
-                        .withChild(referencedLeafNode).build())
-                .build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_CONTAINER)).withChild(myListNode).build();
-        return myContainerNode;
-    }
-
-    private static YangInstanceIdentifier buildPathToIIdLeafNode() {
-        final Map<QName, Object> keyValues = ImmutableMap.of(KEY_LEAF_A, "key-value-a", KEY_LEAF_B, "key-value-b");
-        final YangInstanceIdentifier path = YangInstanceIdentifier.of(MY_LIST)
-                .node(NodeIdentifierWithPredicates.of(MY_LIST, keyValues)).node(IID_LEAF);
-        return path;
-    }
-
-    // variant for a leafref that references a leaf
-    private static ContainerNode buildMyContainerNodeForLeafrefTest(final LeafNode<?> referencedLeafNode) {
-        final Map<QName, Object> keyValues = ImmutableMap.of(KEY_LEAF_A, "value-a", KEY_LEAF_B, "value-b");
-
-        final LeafNode<?> absLeafrefNode = Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(ABS_LEAFREF_LEAF))
-                .withValue("referenced-leaf-node-value").build();
-        final LeafNode<?> relLeafrefNode = Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(REL_LEAFREF_LEAF))
-                .withValue("referenced-leaf-node-value").build();
-        final LeafNode<?> ordinaryLeafANode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(ORDINARY_LEAF_A)).withValue("value-a").build();
-        final LeafNode<?> ordinaryLeafBNode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(ORDINARY_LEAF_B)).withValue("value-b").build();
-
-        final SystemMapNode myListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_LIST))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(MY_LIST, keyValues))
-                        .withChild(referencedLeafNode).build())
-                .build();
-
-        final ContainerNode myInnerContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_INNER_CONTAINER))
-                .withChild(absLeafrefNode)
-                .withChild(relLeafrefNode)
-                .withChild(ordinaryLeafANode)
-                .withChild(ordinaryLeafBNode).build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_CONTAINER))
-                .withChild(myListNode)
-                .withChild(myInnerContainerNode).build();
-        return myContainerNode;
-    }
-
-    // variant for a leafref that references a leaf-list
-    private static ContainerNode buildMyContainerNodeForLeafrefTest(final SystemLeafSetNode<?> referencedLeafListNode) {
-        final LeafNode<?> leafListLeafrefNode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(LEAFLIST_LEAFREF_LEAF)).withValue("referenced-node-entry-value-b").build();
-
-        final LeafNode<?> ordinaryLeafANode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(ORDINARY_LEAF_A)).withValue("value-a").build();
-        final LeafNode<?> ordinaryLeafBNode = Builders.leafBuilder().withNodeIdentifier(
-                new NodeIdentifier(ORDINARY_LEAF_B)).withValue("value-b").build();
-
-        final ContainerNode myInnerContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_INNER_CONTAINER))
-                .withChild(leafListLeafrefNode)
-                .withChild(ordinaryLeafANode)
-                .withChild(ordinaryLeafBNode).build();
-
-        final Map<QName, Object> keyValues = ImmutableMap.of(KEY_LEAF_A, "value-a", KEY_LEAF_B, "value-b");
-        final SystemMapNode myListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_LIST))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(MY_LIST, keyValues))
-                        .withChild(referencedLeafListNode).build())
-                .build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_CONTAINER))
-                .withChild(myListNode)
-                .withChild(myInnerContainerNode).build();
-        return myContainerNode;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerivedFromXPathFunctionTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/DerivedFromXPathFunctionTest.java
deleted file mode 100644 (file)
index 08520d9..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-
-public class DerivedFromXPathFunctionTest {
-
-    private static final JaxenSchemaContextFactory SCHEMA_CONTEXT_FACTORY = new JaxenSchemaContextFactory();
-    private static final QNameModule BAR_MODULE =
-        QNameModule.create(XMLNamespace.of("bar-ns"), Revision.of("2017-04-03"));
-    private static final QName MY_CONTAINER = QName.create(BAR_MODULE, "my-container");
-    private static final QName MY_LIST = QName.create(BAR_MODULE, "my-list");
-    private static final QName KEY_LEAF = QName.create(BAR_MODULE, "key-leaf");
-    private static final QName IDREF_LEAF = QName.create(BAR_MODULE, "idref-leaf");
-    private static final QName ID_C2_IDENTITY = QName.create(BAR_MODULE, "id-c2");
-
-    @Test
-    public void testDerivedFromFunction() throws Exception {
-        // also includes test for derived-from-or-self function
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class,
-            "/yang-xpath-functions-test/derived-from-function/foo.yang",
-            "/yang-xpath-functions-test/derived-from-function/bar.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(ID_C2_IDENTITY));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        assertTrue(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a3"));
-        assertTrue(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a4"));
-        assertTrue(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-b2"));
-        assertTrue(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "bar-prefix:id-b3"));
-        assertTrue(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "id-b4"));
-
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a1"));
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a2"));
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-b1"));
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-c1"));
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "bar-prefix:id-c2"));
-
-        final Function derivedFromOrSelfFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from-or-self");
-        assertTrue(getDerivedFromResult(derivedFromOrSelfFunction, normalizedNodeContext, "bar-prefix:id-c2"));
-    }
-
-    @Test
-    public void testInvalidTypeOfCorrespondingSchemaNode() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class, "/yang-xpath-functions-test/derived-from-function/bar-invalid.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(ID_C2_IDENTITY));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "some-identity"));
-    }
-
-    @Test
-    public void testInvalidNormalizedNodeValueType() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class,
-            "/yang-xpath-functions-test/derived-from-function/foo.yang",
-            "/yang-xpath-functions-test/derived-from-function/bar.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode("should be QName"));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        assertFalse(getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a3"));
-    }
-
-    @Test
-    public void shouldFailOnUnknownPrefixOfIdentity() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class,
-            "/yang-xpath-functions-test/derived-from-function/foo.yang",
-            "/yang-xpath-functions-test/derived-from-function/bar.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(ID_C2_IDENTITY));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        try {
-            getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "unknown-prefix:id-a3");
-            fail("Function call should have failed on unresolved prefix of the identity argument.");
-        } catch (IllegalArgumentException ex) {
-            assertEquals("Cannot resolve prefix 'unknown-prefix' from identity 'unknown-prefix:id-a3'.",
-                ex.getMessage());
-        }
-    }
-
-    @Test
-    public void shouldFailOnMalformedIdentityArgument() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class,
-            "/yang-xpath-functions-test/derived-from-function/foo.yang",
-            "/yang-xpath-functions-test/derived-from-function/bar.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(ID_C2_IDENTITY));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        try {
-            getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo:bar:id-a3");
-            fail("Function call should have failed on malformed identity argument.");
-        } catch (IllegalArgumentException ex) {
-            assertEquals("Malformed identity argument: foo:bar:id-a3.", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void shouldFailOnUnknownIdentityArgument() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            DerivedFromXPathFunctionTest.class,
-            "/yang-xpath-functions-test/derived-from-function/foo.yang",
-            "/yang-xpath-functions-test/derived-from-function/bar.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(ID_C2_IDENTITY));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("bar-prefix", BAR_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToIdrefLeafNode());
-
-        final Function derivedFromFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "derived-from");
-
-        try {
-            getDerivedFromResult(derivedFromFunction, normalizedNodeContext, "foo-prefix:id-a333");
-            fail("Function call should have failed on unknown identity argument.");
-        } catch (IllegalArgumentException ex) {
-            assertTrue(ex.getMessage().startsWith(
-                    "Identity (foo-ns?revision=2017-04-03)id-a333 does not have a corresponding identity schema "
-                    + "node in the module"));
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidNumberOfArguments() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function derivedFromFunction = yangFunctionContext.getFunction(null, null, "derived-from");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            derivedFromFunction.call(mockedContext, ImmutableList.of("some-identity", "should not be here"));
-            fail("Function call should have failed on invalid number of arguments.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("derived-from() takes two arguments: node-set nodes, string identity", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidTypeOfArgument() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function bitIsSetFunction = yangFunctionContext.getFunction(null, null, "derived-from");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            bitIsSetFunction.call(mockedContext, ImmutableList.of(100));
-            fail("Function call should have failed on invalid type of the identity argument.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("Argument 'identity' of derived-from() function should be a String.", ex.getMessage());
-        }
-    }
-
-    private static boolean getDerivedFromResult(final Function derivedFromFunction, final NormalizedNodeContext nnCtx,
-            final String identityArg) throws Exception {
-        return (boolean) derivedFromFunction.call(nnCtx, ImmutableList.of(identityArg));
-    }
-
-    private static ContainerNode buildMyContainerNode(final Object idrefLeafValue) {
-        final LeafNode<?> idrefLeafNode = Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(IDREF_LEAF))
-                .withValue(idrefLeafValue).build();
-
-        final SystemMapNode myListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MY_LIST))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(MY_LIST, KEY_LEAF, "key-value"))
-                        .withChild(idrefLeafNode).build()).build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_CONTAINER)).withChild(myListNode).build();
-        return myContainerNode;
-    }
-
-    private static YangInstanceIdentifier buildPathToIdrefLeafNode() {
-        final ImmutableMap.Builder<QName, Object> builder = ImmutableMap.builder();
-        final ImmutableMap<QName, Object> keys = builder.put(KEY_LEAF, "key-value").build();
-
-        final YangInstanceIdentifier path = YangInstanceIdentifier.of(MY_LIST)
-                .node(NodeIdentifierWithPredicates.of(MY_LIST, keys)).node(IDREF_LEAF);
-        return path;
-    }
-}
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/EnumValueXPathFunctionTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/EnumValueXPathFunctionTest.java
deleted file mode 100644 (file)
index a2c9245..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-
-public class EnumValueXPathFunctionTest {
-
-    private static final JaxenSchemaContextFactory SCHEMA_CONTEXT_FACTORY = new JaxenSchemaContextFactory();
-    private static final QNameModule FOO_MODULE =
-        QNameModule.create(XMLNamespace.of("foo-ns"), Revision.of("2017-04-03"));
-    private static final QName MY_CONTAINER = QName.create(FOO_MODULE, "my-container");
-    private static final QName ALARM = QName.create(FOO_MODULE, "alarm");
-    private static final QName SEVERITY = QName.create(FOO_MODULE, "severity");
-    private static final QName ORDINARY_LEAF = QName.create(FOO_MODULE, "ordinary-leaf");
-
-    @Test
-    public void testEnumValueFunction() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            EnumValueXPathFunctionTest.class, "/yang-xpath-functions-test/enum-value-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode("major"));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToSeverityLeafNode("major"));
-
-        final Function enumValueFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "enum-value");
-        final int enumValueResult = (int) enumValueFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertEquals(5, enumValueResult);
-    }
-
-    @Test
-    public void testInvalidTypeOfCorrespondingSchemaNode() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            EnumValueXPathFunctionTest.class, "/yang-xpath-functions-test/enum-value-function/foo-invalid.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode("major"));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToSeverityLeafNode("major"));
-
-        final Function enumValueFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "enum-value");
-        final Double enumValueResult = (Double) enumValueFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertEquals(Double.NaN, enumValueResult, 0.001);
-    }
-
-    @Test
-    public void testInvalidNormalizedNodeValueType() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            EnumValueXPathFunctionTest.class, "/yang-xpath-functions-test/enum-value-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode(100));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToSeverityLeafNode(100));
-
-        final Function enumValueFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "enum-value");
-        final Double enumValueResult = (Double) enumValueFunction.call(normalizedNodeContext, ImmutableList.of());
-        assertEquals(Double.NaN, enumValueResult, 0.001);
-    }
-
-    @Test
-    public void shouldFailOnUnknownEnumNodeValue() throws Exception {
-        final EffectiveModelContext schemaContext = YangParserTestUtils.parseYangResources(
-            EnumValueXPathFunctionTest.class, "/yang-xpath-functions-test/enum-value-function/foo.yang");
-        assertNotNull(schemaContext);
-
-        final XPathSchemaContext jaxenSchemaContext = SCHEMA_CONTEXT_FACTORY.createContext(schemaContext);
-        final XPathDocument jaxenDocument = jaxenSchemaContext.createDocument(buildMyContainerNode("unknown"));
-
-        final BiMap<String, QNameModule> converterBiMap = HashBiMap.create();
-        converterBiMap.put("foo-prefix", FOO_MODULE);
-
-        final NormalizedNodeContextSupport normalizedNodeContextSupport = NormalizedNodeContextSupport.create(
-                (JaxenDocument) jaxenDocument, Maps.asConverter(converterBiMap));
-
-        final NormalizedNodeContext normalizedNodeContext = normalizedNodeContextSupport.createContext(
-                buildPathToSeverityLeafNode("unknown"));
-
-        final Function enumValueFunction = normalizedNodeContextSupport.getFunctionContext()
-                .getFunction(null, null, "enum-value");
-        try {
-            enumValueFunction.call(normalizedNodeContext, ImmutableList.of());
-            fail("Function call should have failed on unknown enum node value");
-        } catch (final IllegalStateException ex) {
-            assertTrue(ex.getMessage().startsWith("Enum unknown does not belong to enumeration"));
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidNumberOfArguments() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function enumValueFunction = yangFunctionContext.getFunction(null, null, "enum-value");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            enumValueFunction.call(mockedContext, ImmutableList.of("should not be here"));
-            fail("Function call should have failed on invalid number of arguments.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("enum-value() takes one argument: node-set nodes.", ex.getMessage());
-        }
-    }
-
-    private static ContainerNode buildMyContainerNode(final Object keyLeafValue) {
-        final LeafNode<?> ordinaryLeafNode = Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(ORDINARY_LEAF)).withValue("test-value").build();
-
-        final SystemMapNode alarmListNode = Builders.mapBuilder()
-                .withNodeIdentifier(new NodeIdentifier(ALARM))
-                .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
-                        NodeIdentifierWithPredicates.of(ALARM, SEVERITY, keyLeafValue))
-                        .withChild(ordinaryLeafNode).build()).build();
-
-        final ContainerNode myContainerNode = Builders.containerBuilder().withNodeIdentifier(
-                new NodeIdentifier(MY_CONTAINER)).withChild(alarmListNode).build();
-        return myContainerNode;
-    }
-
-    private static YangInstanceIdentifier buildPathToSeverityLeafNode(final Object keyLeafValue) {
-        final ImmutableMap.Builder<QName, Object> builder = ImmutableMap.builder();
-        final ImmutableMap<QName, Object> keys = builder.put(SEVERITY, keyLeafValue).build();
-
-        final YangInstanceIdentifier path = YangInstanceIdentifier.of(ALARM)
-                .node(NodeIdentifierWithPredicates.of(ALARM, keys)).node(SEVERITY);
-        return path;
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenTest.java
deleted file mode 100644 (file)
index b3b05e2..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.base.Converter;
-import com.google.common.base.VerifyException;
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-import com.google.common.collect.Maps;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import javax.xml.xpath.XPathExpressionException;
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.jaxen.UnresolvableException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathDocument;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathExpression;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathNodesetResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathResult;
-import org.opendaylight.yangtools.yang.data.jaxen.api.XPathSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-
-public class JaxenTest {
-    private ConverterNamespaceContext convertNctx;
-    private XPathSchemaContext xpathSchemaContext;
-    private XPathDocument xpathDocument;
-    private XPathExpression xpathExpression;
-    private NormalizedNodeNavigator navigator;
-
-    private QNameModule moduleQName;
-    private QName rootQName;
-    private QName listAQName;
-    private QName listBQName;
-    private QName leafAQName;
-    private QName leafBQName;
-    private QName leafDQName;
-    private QName containerAQName;
-    private QName containerBQName;
-
-    @Before
-    public void setup() throws XPathExpressionException {
-        final EffectiveModelContext schemaContext =
-            YangParserTestUtils.parseYangResourceDirectory("/test/documentTest");
-        assertNotNull(schemaContext);
-
-        initQNames();
-        xpathSchemaContext = new JaxenSchemaContextFactory().createContext(schemaContext);
-        assertNotNull(xpathSchemaContext);
-
-        xpathExpression = xpathSchemaContext.compileExpression(createSchemaPath(), createPrefixes(), createXPath(
-                    false));
-        assertNotNull(xpathExpression);
-
-        xpathDocument = xpathSchemaContext.createDocument(TestUtils.createNormalizedNodes());
-        assertNotNull(xpathDocument);
-        String rootNodeName = xpathDocument.getRootNode().getNodeType().getLocalName();
-        assertNotNull(rootNodeName);
-        assertEquals("root", rootNodeName);
-
-        Optional<? extends XPathResult<?>> resultExpressionEvaluate = xpathExpression
-                .evaluate(xpathDocument, createYangInstanceIdentifier(false));
-        assertNotNull(resultExpressionEvaluate);
-        assertTrue(resultExpressionEvaluate.isPresent());
-        XPathResult<?> xpathResult = resultExpressionEvaluate.get();
-        assertTrue(xpathResult instanceof XPathNodesetResult);
-        XPathNodesetResult nodeset = (XPathNodesetResult) xpathResult;
-
-        Entry<YangInstanceIdentifier, NormalizedNode> entry = nodeset.getValue().iterator().next();
-        assertNotNull(entry);
-        assertEquals("three", entry.getValue().body());
-
-        convertNctx = new ConverterNamespaceContext(createPrefixes());
-        navigator = new NormalizedNodeNavigator(convertNctx, (JaxenDocument) xpathDocument);
-        assertNotNull(navigator);
-    }
-
-    @Test
-    public void testConverterNamespaceContextBackFront() {
-        assertEquals("test2", convertNctx.doBackward(moduleQName));
-        assertEquals(moduleQName, convertNctx.doForward("test2"));
-    }
-
-    @Test
-    public void testConverterNamespaceContextPrefixJaxenName() {
-        assertNotNull(rootQName);
-        assertEquals("test2:root", convertNctx.jaxenQName(rootQName));
-        String prefix = convertNctx.translateNamespacePrefixToUri("test2");
-        assertNotNull(prefix);
-        assertEquals("urn:opendaylight.test2", prefix);
-    }
-
-    @Test
-    public void testCompileExpression() {
-        assertNotNull(xpathExpression.getApexPath());
-        assertEquals(createSchemaPath(), xpathExpression.getEvaluationPath());
-    }
-
-    @Test
-    public void testJaxenXpath() throws XPathExpressionException {
-        assertNotNull(xpathExpression.evaluate(xpathDocument, createYangInstanceIdentifier(false)));
-    }
-
-    @Test
-    public void testXpathWithPredicates() throws XPathExpressionException {
-        XPathExpression xpathExpressionWithPredicates = xpathSchemaContext.compileExpression(createSchemaPath(),
-                createPrefixes(), createXPath(true));
-
-        Optional<? extends XPathResult<?>> resultExpressionEvaluate = xpathExpressionWithPredicates
-                .evaluate(xpathDocument, createYangInstanceIdentifier(true));
-        assertTrue(resultExpressionEvaluate.isPresent());
-        XPathResult<?> xpathResult = resultExpressionEvaluate.get();
-        assertTrue(xpathResult instanceof XPathNodesetResult);
-        XPathNodesetResult nodeset = (XPathNodesetResult) xpathResult;
-
-        Entry<YangInstanceIdentifier, NormalizedNode> entry = nodeset.getValue().iterator().next();
-        assertNotNull(entry);
-        assertEquals("two", entry.getValue().body());
-    }
-
-    @Test(expected = VerifyException.class)
-    public void testIsMethodsInNodeNavigator() {
-        assertTrue(navigator.isDocument("test"));
-    }
-
-    @Test(expected = XPathExpressionException.class)
-    public void testCompileExpressionException() throws XPathExpressionException {
-        assertNotNull(xpathSchemaContext.compileExpression(createSchemaPath(), createPrefixes(), "/broken-path*"));
-    }
-
-    @Test(expected = UnresolvableException.class)
-    public void testYangFunctionContext() throws UnresolvableException, FunctionCallException {
-        final YangFunctionContext yangFun = YangFunctionContext.getInstance();
-        assertNotNull(yangFun);
-        final Function function = yangFun.getFunction("urn:opendaylight.test2", null, "current");
-        assertNotNull(function);
-
-        try {
-            final Context context = mock(Context.class);
-            final ArrayList<Object> list = new ArrayList<>();
-            function.call(context, list);
-            fail();
-        } catch (VerifyException e) {
-            // Expected
-        }
-
-        yangFun.getFunction("urn:opendaylight.test2", "test2", "root");
-    }
-
-    /*
-     * container-a -> container-b -> leaf-d
-     *           list-a -> list-b -> leaf-b
-     */
-    private YangInstanceIdentifier createYangInstanceIdentifier(final boolean withPredicates) {
-        YangInstanceIdentifier testYangInstanceIdentifier = YangInstanceIdentifier.of(containerAQName).node(
-                containerBQName).node(leafDQName);
-        if (withPredicates) {
-            final Map<QName, Object> keys1 = new HashMap<>();
-            keys1.put(leafAQName, "bar");
-
-            final NodeIdentifierWithPredicates mapEntryPath1 = NodeIdentifierWithPredicates.of(listAQName , keys1);
-
-            final Map<QName, Object> keys2 = new HashMap<>();
-            keys2.put(leafBQName, "two");
-
-            final NodeIdentifierWithPredicates mapEntryPath2 = NodeIdentifierWithPredicates.of(listBQName , keys2);
-
-            testYangInstanceIdentifier = YangInstanceIdentifier.of(listAQName).node(mapEntryPath1)
-                    .node(listBQName).node(mapEntryPath2).node(leafBQName);
-        }
-        return testYangInstanceIdentifier;
-    }
-
-    private static String createXPath(final boolean withPredicates) {
-        return withPredicates ? "/list-a[leaf-a='bar']/list-b[leaf-b='two']/leaf-b" : "/container-a/container-b/leaf-d";
-    }
-
-    private Converter<String, QNameModule> createPrefixes() {
-        BiMap<String, QNameModule> currentConverter = HashBiMap.create();
-        currentConverter.put("test2", moduleQName);
-
-        return Maps.asConverter(currentConverter);
-    }
-
-    // rootQName -> listAQName -> leafAQName
-    private  SchemaPath createSchemaPath() {
-        return SchemaPath.create(true, rootQName, listAQName, leafAQName);
-    }
-
-    private void initQNames() {
-        this.moduleQName = QNameModule.create(XMLNamespace.of("urn:opendaylight.test2"), Revision.of("2015-08-08"));
-        this.rootQName = QName.create(moduleQName, "root");
-        this.listAQName = QName.create(moduleQName, "list-a");
-        this.listBQName = QName.create(moduleQName, "list-b");
-        this.leafAQName = QName.create(moduleQName, "leaf-a");
-        this.leafBQName = QName.create(moduleQName, "leaf-b");
-        this.leafDQName = QName.create(moduleQName, "leaf-d");
-        this.containerAQName = QName.create(moduleQName, "container-a");
-        this.containerBQName = QName.create(moduleQName, "container-b");
-    }
-}
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/ReMatchXPathFunctionTest.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/ReMatchXPathFunctionTest.java
deleted file mode 100644 (file)
index 27dc726..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.collect.ImmutableList;
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.FunctionCallException;
-import org.junit.Test;
-
-public class ReMatchXPathFunctionTest {
-
-    @Test
-    public void testRematchFunction() throws Exception {
-        // re-match() uses regex processing from yang-parser-impl which has been thoroughly tested within
-        // the Bug5410Test unit test class, so here is just a basic test
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function rematchFunction = yangFunctionContext.getFunction(null, null, "re-match");
-
-        final Context mockedContext = mock(Context.class);
-
-        boolean rematchResult = (boolean) rematchFunction.call(mockedContext, ImmutableList.of("abbc", "[abc]{1,4}"));
-        assertTrue(rematchResult);
-        rematchResult = (boolean) rematchFunction.call(mockedContext, ImmutableList.of("abbcc", "[abc]{1,4}"));
-        assertFalse(rematchResult);
-    }
-
-    @Test
-    public void shouldFailOnInvalidNumberOfArguments() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function rematchFunction = yangFunctionContext.getFunction(null, null, "re-match");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            rematchFunction.call(mockedContext, ImmutableList.of("abbc", "[abc]{1,4}", "should not be here"));
-            fail("Function call should have failed on invalid number of arguments.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("re-match() takes two arguments: string subject, string pattern.", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void shouldFailOnInvalidTypeOfArgument() throws Exception {
-        final YangFunctionContext yangFunctionContext = YangFunctionContext.getInstance();
-        final Function rematchFunction = yangFunctionContext.getFunction(null, null, "re-match");
-
-        final Context mockedContext = mock(Context.class);
-
-        try {
-            rematchFunction.call(mockedContext, ImmutableList.of(100, "[abc]{1,4}"));
-            fail("Function call should have failed on invalid type of the subject argument.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("First argument of re-match() should be a String.", ex.getMessage());
-        }
-
-        try {
-            rematchFunction.call(mockedContext, ImmutableList.of("abbc", 100));
-            fail("Function call should have failed on invalid type of the pattern argument.");
-        } catch (final FunctionCallException ex) {
-            assertEquals("Second argument of re-match() should be a String.", ex.getMessage());
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/TestUtils.java b/attic/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/TestUtils.java
deleted file mode 100644 (file)
index 8169228..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.jaxen;
-
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-
-final class TestUtils {
-
-    private static final QName ROOT_QNAME = QName.create("urn:opendaylight.test2", "2015-08-08", "root");
-    private static final QName LIST_A_QNAME = QName.create(ROOT_QNAME, "list-a");
-    private static final QName LIST_B_QNAME = QName.create(ROOT_QNAME, "list-b");
-    private static final QName LEAF_A_QNAME = QName.create(ROOT_QNAME, "leaf-a");
-    private static final QName LEAF_B_QNAME = QName.create(ROOT_QNAME, "leaf-b");
-    private static final QName LEAF_C_QNAME = QName.create(ROOT_QNAME, "leaf-c");
-    private static final QName LEAF_D_QNAME = QName.create(ROOT_QNAME, "leaf-d");
-    private static final QName CONTAINER_A_QNAME = QName.create(ROOT_QNAME, "container-a");
-    private static final QName CONTAINER_B_QNAME = QName.create(ROOT_QNAME, "container-b");
-    private static final String FOO = "foo";
-    private static final String BAR = "bar";
-    private static final String WAZ = "waz";
-    private static final String ONE = "one";
-    private static final String TWO = "two";
-    private static final String THREE = "three";
-
-    private TestUtils() {
-    }
-
-    /**
-     * Returns a test document.
-     *
-     * <pre>
-     * root
-     *     leaf-c "waz"
-     *     list-a
-     *          leaf-a "foo"
-     *     list-a
-     *          leaf-a "bar"
-     *          list-b
-     *                  leaf-b "one"
-     *          list-b
-     *                  leaf-b "two"
-     *     container-a
-     *          container-b
-     *                  leaf-d "three"
-     * </pre>
-     *
-     * @return A test document instance.
-     */
-    public static ContainerNode createNormalizedNodes() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(ROOT_QNAME))
-                .withChild(ImmutableNodes.leafNode(LEAF_C_QNAME, WAZ))
-                .withChild(mapNodeBuilder(LIST_A_QNAME)
-                        .withChild(mapEntry(LIST_A_QNAME, LEAF_A_QNAME, FOO))
-                        .withChild(mapEntryBuilder(LIST_A_QNAME, LEAF_A_QNAME, BAR)
-                                .withChild(mapNodeBuilder(LIST_B_QNAME)
-                                        .withChild(mapEntry(LIST_B_QNAME, LEAF_B_QNAME, ONE))
-                                        .withChild(mapEntry(LIST_B_QNAME, LEAF_B_QNAME, TWO))
-                                        .build())
-                                .build())
-                        .build())
-                .withChild(ImmutableContainerNodeBuilder.create()
-                        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONTAINER_A_QNAME))
-                        .withChild(ImmutableContainerNodeBuilder.create()
-                            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONTAINER_B_QNAME))
-                                .withChild(ImmutableNodes.leafNode(LEAF_D_QNAME, THREE))
-                                .build())
-                        .build())
-                .build();
-    }
-}
diff --git a/attic/yang-data-jaxen/src/test/resources/test/documentTest/test2.yang b/attic/yang-data-jaxen/src/test/resources/test/documentTest/test2.yang
deleted file mode 100644 (file)
index c8cd382..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-module test2 {
-    yang-version 1;
-    namespace "urn:opendaylight.test2";
-    prefix "test2";
-
-    organization "opendaylight";
-    contact "urn:opendaylight.com";
-    description "test description";
-
-    revision "2015-08-08" {
-        reference "1st edit";
-    }
-
-    container root {
-        leaf leaf-c {
-            type string;
-        }
-
-        list list-a {
-            key "leaf-a";
-
-            leaf leaf-a {
-                type string;
-            }
-
-            choice choice-a {
-                case one {
-                    leaf one {
-                        type string;
-                    }
-                }
-                case two-three {
-                    leaf two {
-                        type string;
-                    }
-                    leaf three {
-                        type string;
-                    }
-                }
-            }
-
-            list list-b {
-                key "leaf-b";
-                leaf leaf-b {
-                    type string;
-                }
-            }
-        }
-
-        container container-a {
-            container container-b {
-                leaf leaf-d {
-                    type string;
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo-invalid.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo-invalid.yang
deleted file mode 100644 (file)
index 13e09e2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-module foo-invalid {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list my-list {
-            key flags;
-
-            leaf flags {
-                type int32;
-            }
-
-            leaf ordinary-leaf {
-                type string;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/bit-is-set-function/foo.yang
deleted file mode 100644 (file)
index 3d18861..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-module foo {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list my-list {
-            key flags;
-
-            leaf flags {
-                type bits {
-                    bit UP;
-                    bit PROMISCUOUS;
-                    bit DISABLED;
-                }
-            }
-
-            leaf ordinary-leaf {
-                type string;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-iid/foo.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-iid/foo.yang
deleted file mode 100644 (file)
index 7dfda62..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-module foo {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list my-list {
-            key "key-leaf-a key-leaf-b";
-
-            leaf key-leaf-a {
-                type string;
-            }
-
-            leaf key-leaf-b {
-                type string;
-            }
-
-            leaf iid-leaf {
-                type instance-identifier;
-            }
-
-            leaf referenced-leaf {
-                type string;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-leafref/foo.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/deref-function-leafref/foo.yang
deleted file mode 100644 (file)
index 4b12f54..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-module foo {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list my-list {
-            key "key-leaf-a key-leaf-b";
-
-            leaf key-leaf-a {
-                type string;
-            }
-
-            leaf key-leaf-b {
-                type string;
-            }
-
-            leaf referenced-leaf {
-                type string;
-            }
-
-            leaf referenced-leaf-list {
-                type string;
-            }
-        }
-
-        container my-inner-container {
-            leaf abs-leafref-leaf {
-                type leafref {
-                    path "/my-container/my-list[key-leaf-a=current()/../ordinary-leaf-a]" +
-                        "[key-leaf-b=current()/../ordinary-leaf-b]/referenced-leaf";
-                }
-            }
-
-            leaf rel-leafref-leaf {
-                type leafref {
-                    path "../../foo-prefix:my-list[foo-prefix:key-leaf-a=current()/../ordinary-leaf-a]" +
-                        "[key-leaf-b=current()/../ordinary-leaf-b]/foo-prefix:referenced-leaf";
-                }
-            }
-
-            leaf leaf-list-leafref-leaf {
-                type leafref {
-                    path "/my-container/my-list[key-leaf-a=current()/../ordinary-leaf-a]" +
-                        "[key-leaf-b=current()/../ordinary-leaf-b]/referenced-leaf-list";
-                }
-            }
-
-            leaf ordinary-leaf-a {
-                type string;
-            }
-
-            leaf ordinary-leaf-b {
-                type string;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar-invalid.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar-invalid.yang
deleted file mode 100644 (file)
index c43fd47..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-module bar-invalid {
-    namespace bar-ns;
-    prefix bar-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list my-list {
-            key key-leaf;
-
-            leaf key-leaf {
-                type string;
-            }
-
-            leaf idref-leaf {
-                type int32;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/bar.yang
deleted file mode 100644 (file)
index 1532fc7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-module bar {
-    namespace bar-ns;
-    prefix bar-prefix;
-    yang-version 1.1;
-
-    import foo {
-        prefix foo-prefix;
-        revision-date 2017-04-03;
-    }
-
-    revision 2017-04-03;
-
-    identity id-b3;
-    identity id-b4;
-
-    identity id-c2 {
-        base foo-prefix:id-b2;
-        base id-b3;
-        base id-b4;
-    }
-
-    container my-container {
-        list my-list {
-            key key-leaf;
-
-            leaf key-leaf {
-                type string;
-            }
-
-            leaf idref-leaf {
-                type identityref {
-                    base foo-prefix:id-a3;
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/foo.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/derived-from-function/foo.yang
deleted file mode 100644 (file)
index 7fec0c6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-module foo {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    identity id-a1;
-    identity id-a2;
-    identity id-a3;
-    identity id-a4;
-
-    identity id-b1 {
-        base id-a1;
-        base id-a2;
-    }
-
-    identity id-b2 {
-        base id-a3;
-        base id-a4;
-    }
-
-    identity id-c1 {
-        base id-b1;
-        base id-b2;
-    }
-
-    container my-container {}
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo-invalid.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo-invalid.yang
deleted file mode 100644 (file)
index aa238fe..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-module foo-invalid {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list alarm {
-            key severity;
-
-            leaf ordinary-leaf {
-                type string;
-            }
-
-            leaf severity {
-                type int32;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo.yang b/attic/yang-data-jaxen/src/test/resources/yang-xpath-functions-test/enum-value-function/foo.yang
deleted file mode 100644 (file)
index 40dc2fd..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-module foo {
-    namespace foo-ns;
-    prefix foo-prefix;
-    yang-version 1.1;
-
-    revision 2017-04-03;
-
-    container my-container {
-        list alarm {
-            key severity;
-
-            leaf ordinary-leaf {
-                type string;
-            }
-
-            leaf severity {
-                type enumeration {
-                    enum cleared {
-                        value 1;
-                    }
-                    enum indeterminate {
-                        value 2;
-                    }
-                    enum minor {
-                        value 3;
-                    }
-                    enum warning {
-                        value 4;
-                    }
-                    enum major {
-                        value 5;
-                    }
-                    enum critical {
-                        value 6;
-                    }
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
index 4b411a41205bb7a5a8c8ce86a6771de0bda987d5..08243d3a0af565f9a7b5479f9599651de7392c20 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-transform</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-data-jaxen</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-codec-binfmt</artifactId>
index b61ca502e044a3a521fdaad9af2972ea3be873da..50152efee818ac5ab58b9af34a8308b4da2d7e08 100644 (file)
             <classifier>features</classifier>
             <type>xml</type>
         </dependency>
-
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>odl-yangtools-exp-data-xpath-api</artifactId>
-            <classifier>features</classifier>
-            <type>xml</type>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>odl-yangtools-exp-data-xpath</artifactId>
-            <classifier>features</classifier>
-            <type>xml</type>
-        </dependency>
     </dependencies>
 </project>
index 18b7db6fe70a865a08b2a037c1b887ae13cda872..fe9130115ec18c02d60650d1554cb2a0736a8c22 100644 (file)
@@ -40,8 +40,7 @@
         <module>features-yangtools</module>
 
         <!-- Experimental features -->
-        <module>odl-yangtools-exp-data-xpath-api</module>
-        <module>odl-yangtools-exp-data-xpath</module>
+        <!-- none at this time -->
 
         <!-- Experimental feature repostitory -->
         <module>features-yangtools-experimental</module>
diff --git a/pom.xml b/pom.xml
index 8cbc62b10e63de4b55fca9373a29cbfd9b371e9d..db1037bda7fdc289ff481160d5a06bb6d5ec800e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,6 @@
         <module>docs</module>
         <module>features</module>
 
-        <module>attic</module>
         <module>benchmarks</module>
         <module>bundle-parent</module>
         <module>common</module>
index 1991b519bb673979b5e1f38d1d1d82be32970d56..448752e5552450d7fe19a25564b7bea5c318798f 100644 (file)
@@ -26,7 +26,6 @@
         <module>yang-common</module>
         <module>yang-common-netty</module>
         <module>yang-data-api</module>
-        <module>yang-data-xpath-api</module>
         <module>yang-data-util</module>
         <module>yang-data-impl</module>
         <module>yang-data-transform</module>
diff --git a/yang/yang-data-xpath-api/pom.xml b/yang/yang-data-xpath-api/pom.xml
deleted file mode 100644 (file)
index 66cb5d5..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>bundle-parent</artifactId>
-        <version>7.0.0-SNAPSHOT</version>
-        <relativePath>../../bundle-parent</relativePath>
-    </parent>
-
-    <artifactId>yang-data-xpath-api</artifactId>
-    <packaging>bundle</packaging>
-    <version>0.5.0-SNAPSHOT</version>
-    <name>${project.artifactId}</name>
-    <description>${project.artifactId}</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>concepts</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>util</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-common</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.opendaylight.yangtools</groupId>
-          <artifactId>yang-data-api</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.opendaylight.yangtools</groupId>
-          <artifactId>yang-xpath-api</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Automatic-Module-Name>org.opendaylight.yangtools.yang.data.xpath.api</Automatic-Module-Name>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/DataTreeCandidateDocument.java b/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/DataTreeCandidateDocument.java
deleted file mode 100644 (file)
index 90d70cc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.api.xpath;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-
-/**
- * An {@link XPathDocument} bound to a {@link DataTreeCandidate}.
- *
- * @author Robert Varga
- */
-@Beta
-public interface DataTreeCandidateDocument extends XPathDocument<DataTreeCandidate> {
-
-}
diff --git a/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/NormalizedNodeDocument.java b/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/NormalizedNodeDocument.java
deleted file mode 100644 (file)
index 9b5bc79..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.api.xpath;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-/**
- * An {@link XPathDocument} bound to a {@link NormalizedNode} tree.
- *
- * @author Robert Varga
- */
-@Beta
-public interface NormalizedNodeDocument extends XPathDocument<NormalizedNode> {
-
-}
diff --git a/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/XPathDocument.java b/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/XPathDocument.java
deleted file mode 100644 (file)
index 4614732..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.api.xpath;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * The notion of a W3C documented bound to a specific object model. This binding is expressed in terms of the document
- * exposing a root node from the object model.
- *
- * <p>
- * This interface is not meant to be used directly. Refer to its specializations like {@link NormalizedNodeDocument}
- * and {@link DataTreeCandidateDocument}.
- *
- * @param <T> Object model node type
- * @author Robert Varga
- */
-@Beta
-public interface XPathDocument<T> {
-    /**
-     * Return the root node of this document.
-     *
-     * @return This document's root node.
-     */
-    @NonNull T getRootNode();
-}
diff --git a/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/package-info.java b/yang/yang-data-xpath-api/src/main/java/org/opendaylight/yangtools/yang/data/api/xpath/package-info.java
deleted file mode 100644 (file)
index 973da3e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Experimental support for evaluating {@link org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression}s on top
- * of {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode} trees.
- *
- * @author Robert Varga
- */
-package org.opendaylight.yangtools.yang.data.api.xpath;
\ No newline at end of file