X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2FAbstractSchemaAwareTest.java;fp=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2FAbstractSchemaAwareTest.java;h=0000000000000000000000000000000000000000;hb=2611e6a728e586ea34dd891f30a473bf54d6cbd8;hp=524b903bd02b5399468fb914809336d8bd49ef2e;hpb=aaea3e9a92ae9d6fac04c4a065db4b35cbca9ed0;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractSchemaAwareTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractSchemaAwareTest.java deleted file mode 100644 index 524b903bd0..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractSchemaAwareTest.java +++ /dev/null @@ -1,60 +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.controller.md.sal.binding.test; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import org.junit.Before; -import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; -import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections; -import org.opendaylight.yangtools.yang.binding.YangModuleInfo; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; - -@Deprecated -public abstract class AbstractSchemaAwareTest { - private static final LoadingCache> MODULE_INFO_CACHE = CacheBuilder.newBuilder() - .weakKeys().weakValues().build(new CacheLoader>() { - @Override - public Set load(final ClassLoader key) { - return BindingReflections.loadModuleInfos(key); - } - }); - private static final LoadingCache, SchemaContext> SCHEMA_CONTEXT_CACHE = - CacheBuilder.newBuilder().weakValues().build(new CacheLoader, SchemaContext>() { - @Override - public SchemaContext load(final Set key) { - final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create(); - moduleContext.addModuleInfos(key); - return moduleContext.tryToCreateSchemaContext().get(); - } - }); - - protected Set getModuleInfos() throws Exception { - return MODULE_INFO_CACHE.getUnchecked(Thread.currentThread().getContextClassLoader()); - } - - protected SchemaContext getSchemaContext() throws Exception { - // ImmutableSet guarantees non-null - return SCHEMA_CONTEXT_CACHE.getUnchecked(ImmutableSet.copyOf(getModuleInfos())); - } - - @Before - public final void setup() throws Exception { - setupWithSchema(getSchemaContext()); - } - - /** - * Setups test with Schema context. - * This method is called before {@link #setupWithSchemaService(SchemaService)} - */ - protected abstract void setupWithSchema(SchemaContext context); - -}