Remove NodeContainerProxy class 58/100058/2
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Thu, 10 Mar 2022 12:41:37 +0000 (13:41 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 10 Mar 2022 14:13:34 +0000 (14:13 +0000)
NodeContainerProxy is marked deprecated since the version 2.0.0
remove it for version 3.0.0.

This way we do not have to spend time to maintain not used class.

JIRA: NETCONF-865
Change-Id: I35bd055a938556a384fd69127113f4bc92239bd7
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/NodeContainerProxy.java [deleted file]
netconf/netconf-util/src/test/java/org/opendaylight/netconf/util/NodeContainerProxyTest.java [deleted file]

diff --git a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/NodeContainerProxy.java b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/NodeContainerProxy.java
deleted file mode 100644 (file)
index 139509a..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2014 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.netconf.util;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Maps;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement;
-import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression.QualifiedBound;
-
-/**
- * Simple proxy for container like schema nodes, where user provides a collection of children schema nodes.
- *
- * @deprecated This class is no longer used anywhere and is scheduled for removal.
- */
-@Deprecated(since = "2.0.0", forRemoval = true)
-public final class NodeContainerProxy implements ContainerSchemaNode {
-    private final Collection<? extends AugmentationSchemaNode> availableAugmentations;
-    private final @NonNull Map<QName, ? extends DataSchemaNode> childNodes;
-    private final @NonNull SchemaPath path;
-    private final @NonNull QName qname;
-
-    @VisibleForTesting
-    NodeContainerProxy(final QName qname, final SchemaPath path, final Map<QName, ? extends DataSchemaNode> childNodes,
-                       final Collection<? extends AugmentationSchemaNode> availableAugmentations) {
-        this.qname = requireNonNull(qname);
-        this.path = requireNonNull(path);
-        this.childNodes = requireNonNull(childNodes);
-        this.availableAugmentations = availableAugmentations;
-    }
-
-    public static @NonNull NodeContainerProxy ofModelContext(final QName qname, final EffectiveModelContext context) {
-        return new NodeContainerProxy(qname, SchemaPath.ROOT, asMap(context.getChildNodes()), Set.of());
-    }
-
-    public static @NonNull NodeContainerProxy ofNotification(final NotificationDefinition notification) {
-        return new NodeContainerProxy(notification.getQName(), notification.getPath(),
-            asMap(notification.getChildNodes()), notification.getAvailableAugmentations());
-    }
-
-    private static Map<QName, ? extends DataSchemaNode> asMap(final Collection<? extends DataSchemaNode> childNodes) {
-        return Maps.uniqueIndex(childNodes, DataSchemaNode::getQName);
-    }
-
-    @Override
-    public Collection<? extends TypeDefinition<?>> getTypeDefinitions() {
-        return Set.of();
-    }
-
-    @Override
-    public Collection<? extends DataSchemaNode> getChildNodes() {
-        return childNodes.values();
-    }
-
-    @Override
-    public Collection<? extends GroupingDefinition> getGroupings() {
-        return Set.of();
-    }
-
-    @Override
-    public DataSchemaNode dataChildByName(final QName name) {
-        return childNodes.get(name);
-    }
-
-    @Override
-    public Collection<? extends UsesNode> getUses() {
-        return Set.of();
-    }
-
-    @Override
-    public boolean isPresenceContainer() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<? extends AugmentationSchemaNode> getAvailableAugmentations() {
-        return availableAugmentations;
-    }
-
-    @Override
-    @Deprecated
-    public boolean isAugmenting() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    @Deprecated
-    public boolean isAddedByUses() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Optional<Boolean> effectiveConfig() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    @Deprecated
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public Optional<String> getDescription() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Optional<String> getReference() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Status getStatus() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<? extends NotificationDefinition> getNotifications() {
-        return Set.of();
-    }
-
-    @Override
-    public Collection<? extends ActionDefinition> getActions() {
-        return Set.of();
-    }
-
-    @Override
-    public Optional<? extends QualifiedBound> getWhenCondition() {
-        return Optional.empty();
-    }
-
-    @Override
-    public Collection<? extends @NonNull MustDefinition> getMustConstraints() {
-        return Set.of();
-    }
-
-    @Override
-    public ContainerEffectiveStatement asEffectiveStatement() {
-        throw new UnsupportedOperationException();
-    }
-}
diff --git a/netconf/netconf-util/src/test/java/org/opendaylight/netconf/util/NodeContainerProxyTest.java b/netconf/netconf-util/src/test/java/org/opendaylight/netconf/util/NodeContainerProxyTest.java
deleted file mode 100644 (file)
index d0a3528..0000000
+++ /dev/null
@@ -1,143 +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.netconf.util;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-@RunWith(MockitoJUnitRunner.StrictStubs.class)
-public class NodeContainerProxyTest {
-    private static final QName QNAME = QName.create("ns", "2016-10-19", "name");
-    private static final QName NODE_1_QNAME = QName.create(QNAME, "node-1");
-    private static final QName NODE_2_QNAME = QName.create(QNAME, "node-2");
-
-    @Mock
-    private AugmentationSchemaNode augSchema1;
-    @Mock
-    private AugmentationSchemaNode augSchema2;
-    @Mock
-    private DataSchemaNode schemaNode1;
-    @Mock
-    private DataSchemaNode schemaNode2;
-    private NodeContainerProxy proxy;
-
-    @Before
-    public void setUp() {
-        proxy = new NodeContainerProxy(QNAME, SchemaPath.SAME,
-            Map.of(NODE_1_QNAME, schemaNode1, NODE_2_QNAME, schemaNode2), Set.of(augSchema1, augSchema2));
-    }
-
-    @Test
-    public void testGetQName() {
-        assertSame(QNAME, proxy.getQName());
-    }
-
-    @Test
-    @Deprecated
-    public void testGetPath() {
-        assertSame(SchemaPath.SAME, proxy.getPath());
-    }
-
-    @Test
-    public void testGetChildNodes() {
-        final var children = proxy.getChildNodes();
-        assertEquals(2, children.size());
-        assertThat(children, containsInAnyOrder(schemaNode1, schemaNode2));
-    }
-
-    @Test
-    public void testGetAvailableAugmentations() {
-        final var augmentations = proxy.getAvailableAugmentations();
-        assertEquals(2, augmentations.size());
-        assertThat(augmentations, containsInAnyOrder(augSchema1, augSchema2));
-    }
-
-    @Test
-    public void testFindDataChildByName() {
-        assertEquals(Optional.of(schemaNode1), proxy.findDataChildByName(NODE_1_QNAME));
-    }
-
-    @Test
-    public void testGetTypeDefinitions() {
-        assertEmpty(proxy.getTypeDefinitions());
-    }
-
-    @Test
-    public void testGetGroupings() {
-        assertEmpty(proxy.getGroupings());
-    }
-
-    @Test
-    public void testGetUses() {
-        assertEmpty(proxy.getUses());
-    }
-
-    @Test
-    public void testGetUnknownSchemaNodes() {
-        assertEmpty(proxy.getUnknownSchemaNodes());
-    }
-
-    @Test
-    public void testIsPresenceContainer() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.isPresenceContainer());
-    }
-
-    @Test
-    @Deprecated
-    public void testIsAugmenting() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.isAugmenting());
-    }
-
-    @Test
-    @Deprecated
-    public void testIsAddedByUses() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.isAddedByUses());
-    }
-
-    @Test
-    public void testIsConfiguration() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.isConfiguration());
-    }
-
-    @Test
-    public void testGetDescription() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.getDescription());
-    }
-
-    @Test
-    public void testGetReference() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.getReference());
-    }
-
-    @Test
-    public void testGetStatus() {
-        assertThrows(UnsupportedOperationException.class, () -> proxy.getStatus());
-    }
-
-    static void assertEmpty(final Collection<?> coll) {
-        assertEquals(List.of(), List.copyOf(coll));
-    }
-}