Add explicit getExtensions()
[netconf.git] / netconf / mdsal-netconf-connector / src / test / java / org / opendaylight / netconf / mdsal / connector / ops / SchemaServiceStub.java
1 /*
2  * Copyright (c) 2018 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.mdsal.connector.ops;
9
10 import com.google.common.collect.ClassToInstanceMap;
11 import com.google.common.collect.ImmutableClassToInstanceMap;
12 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
13 import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
14 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
15 import org.opendaylight.yangtools.concepts.ListenerRegistration;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
18
19 final class SchemaServiceStub implements DOMSchemaService {
20     private final SchemaContext schemaContext;
21
22     SchemaServiceStub(SchemaContext schemaContext) {
23         this.schemaContext = schemaContext;
24     }
25
26     @Override
27     public SchemaContext getSessionContext() {
28         return schemaContext;
29     }
30
31     @Override
32     public SchemaContext getGlobalContext() {
33         return schemaContext;
34     }
35
36     @Override
37     public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
38         final SchemaContextListener listener) {
39         listener.onGlobalContextUpdated(getGlobalContext());
40         return new AbstractListenerRegistration<SchemaContextListener>(listener) {
41             @Override
42             protected void removeRegistration() {
43                 // No-op
44             }
45         };
46     }
47
48     @Override
49     public ClassToInstanceMap<DOMSchemaServiceExtension> getExtensions() {
50         return ImmutableClassToInstanceMap.of();
51     }
52 }