Eliminate ClassLoadingStrategy
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / test / util / TestingModuleInfoSnapshot.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.dom.adapter.test.util;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot;
12 import org.opendaylight.yangtools.util.ClassLoaderUtils;
13 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
15 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
16
17 public final class TestingModuleInfoSnapshot implements ModuleInfoSnapshot {
18     public static final TestingModuleInfoSnapshot INSTANCE = new TestingModuleInfoSnapshot();
19
20     private TestingModuleInfoSnapshot() {
21         // Hidden on purpose
22     }
23
24     @Override
25     public EffectiveModelContext getEffectiveModelContext() {
26         throw new UnsupportedOperationException();
27     }
28
29     @Override
30     public ListenableFuture<? extends YangTextSchemaSource> getSource(SourceIdentifier sourceIdentifier) {
31         throw new UnsupportedOperationException();
32     }
33
34     @Override
35     @SuppressWarnings("unchecked")
36     public <T> Class<T> loadClass(String fullyQualifiedName) throws ClassNotFoundException {
37         return (Class<T>) ClassLoaderUtils.loadClassWithTCCL(fullyQualifiedName);
38     }
39 }