Remove SchemaServiceStub 69/110069/2
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 28 Jan 2024 23:53:43 +0000 (00:53 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 28 Jan 2024 23:58:50 +0000 (00:58 +0100)
We have FixedDOMSchemaService, use that instead of brewing our own.

Change-Id: Ib1cf5a7ac2f9417865d98b73228a2b7b6c4281d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/AbstractNetconfOperationTest.java
plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/SchemaServiceStub.java [deleted file]

index c6b59d34dbb6e48859664f15aaf86c59c8860a2a..ccf34021376f2a177bb7e2c250424002264d6b3b 100644 (file)
@@ -37,6 +37,7 @@ import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
+import org.opendaylight.mdsal.dom.spi.FixedDOMSchemaService;
 import org.opendaylight.mdsal.dom.spi.store.DOMStore;
 import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStoreFactory;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -87,7 +88,7 @@ public abstract class AbstractNetconfOperationTest {
         XMLUnit.setIgnoreWhitespace(true);
         XMLUnit.setIgnoreAttributeOrder(true);
 
-        final DOMSchemaService schemaService = new SchemaServiceStub(SCHEMA_CONTEXT);
+        final DOMSchemaService schemaService = new FixedDOMSchemaService(SCHEMA_CONTEXT);
         final DOMStore operStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", schemaService);
         final DOMStore configStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", schemaService);
 
diff --git a/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/SchemaServiceStub.java b/plugins/netconf-server-mdsal/src/test/java/org/opendaylight/netconf/server/mdsal/operations/SchemaServiceStub.java
deleted file mode 100644 (file)
index 013c846..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2018 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.server.mdsal.operations;
-
-import static java.util.Objects.requireNonNull;
-
-import java.util.function.Consumer;
-import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-
-final class SchemaServiceStub implements DOMSchemaService {
-    private final EffectiveModelContext schemaContext;
-
-    SchemaServiceStub(final EffectiveModelContext schemaContext) {
-        this.schemaContext = requireNonNull(schemaContext);
-    }
-
-    @Override
-    public EffectiveModelContext getGlobalContext() {
-        return schemaContext;
-    }
-
-    @Override
-    public Registration registerSchemaContextListener(final Consumer<EffectiveModelContext> listener) {
-        listener.accept(schemaContext);
-        return () -> {
-            // No-op
-        };
-    }
-}