Remove deprecated SchemaRepository.createSchemaContextFactory() 88/80588/7
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 25 Feb 2019 15:54:59 +0000 (16:54 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 26 Feb 2019 10:16:14 +0000 (11:16 +0100)
Filter-based createSchemaContextFactory() has been deprecated, remove
it in the next major release.

Change-Id: I3033670b833cf3f6d5c7fc21fed7921255d516c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 files changed:
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SchemaRepository.java
yang/yang-model-export/src/test/java/org/opendaylight/yangtools/yang/model/export/SimpleModuleTest.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaRepository.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformerTest.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaContextFactory.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepository.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/YangTextSchemaContextResolver.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/MultipleRevImportBug6875Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/OpenconfigVerSharedSchemaRepositoryTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaContextFactoryTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepositoryTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepositoryWithFeaturesTest.java

index 5418e49c63fe359cff90fdec2bf728471c00d29c..6959d0aded23f7b42d9ee31181768bb6361ae719 100644 (file)
@@ -19,24 +19,21 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 @Beta
 public interface SchemaRepository {
     /**
-     * Instantiate a new {@link SchemaContextFactory}, which will filter available schema sources using the provided
-     * filter.
+     * Returns {@link SchemaContextFactory} with supplied configuration.
      *
-     * @param filter Filter which acts as the gating function before a schema source is considered by the factory
-     *               for inclusion in the {@link SchemaContext} it produces.
-     * @return A new schema context factory.
-     * @deprecated Use {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)} instead.
+     * @param config configuration of schema context factory.
+     * @return schema context factory.
      */
-    @Deprecated
-    @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaSourceFilter filter);
+    @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaContextFactoryConfiguration config);
 
     /**
-     * Returns {@link SchemaContextFactory} with supplied configuration.
+     * Returns {@link SchemaContextFactory} with {@link SchemaContextFactoryConfiguration#getDefault()}.
      *
-     * @param config configuration of schema context factory.
      * @return schema context factory.
      */
-    @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaContextFactoryConfiguration config);
+    default @NonNull SchemaContextFactory createSchemaContextFactory() {
+        return createSchemaContextFactory(SchemaContextFactoryConfiguration.getDefault());
+    }
 
     <T extends SchemaSourceRepresentation> @NonNull ListenableFuture<T> getSchemaSource(@NonNull SourceIdentifier id,
             @NonNull Class<T> represetation);
index c0571174a327e97e25036a2e02046dfe4bbe9f55..a6096d28760f4dd3820eac5d45632789967328d8 100644 (file)
@@ -18,7 +18,6 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
@@ -38,7 +37,7 @@ public class SimpleModuleTest {
         final TextToASTTransformer astTransformer = TextToASTTransformer.create(schemaRegistry, schemaRegistry);
         schemaRegistry.registerSchemaSourceListener(astTransformer);
 
-        schemaContextFactory = schemaRegistry.createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
+        schemaContextFactory = schemaRegistry.createSchemaContextFactory();
         allTestSources = new HashSet<>();
         final SchemaListenerRegistration reg = schemaRegistry.registerSchemaSourceListener(new SchemaSourceListener() {
 
index c84f852720bbf08daa0a9d0a683b1f1ae90eb92a..3c3b4ab222e2bbd0a77a5465f23c6690574ed454 100644 (file)
@@ -30,7 +30,6 @@ import java.util.Map;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
@@ -43,9 +42,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Abstract base class for {@link SchemaRepository} implementations. It handles registration
- * and lookup of schema sources, subclasses need only to provide their own
- * {@link #createSchemaContextFactory(SchemaSourceFilter)} implementation.
+ * Abstract base class for {@link SchemaRepository} implementations. It handles registration and lookup of schema
+ * sources, subclasses need only to provide their own {@link #createSchemaContextFactory()} implementation.
  */
 @Beta
 public abstract class AbstractSchemaRepository implements SchemaRepository, SchemaSourceRegistry {
index 31e0c88e2544338b3a5441ad514cdc2ca692d737..3bafc0f27401bc2fa9dd3fbf4cff4fed81feffb8 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactoryConfiguration;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangSchemaSourceRepresentation;
@@ -142,12 +141,6 @@ public class SchemaSourceTransformerTest {
     }
 
     private class Provider extends AbstractSchemaRepository {
-        @Deprecated
-        @Override
-        public SchemaContextFactory createSchemaContextFactory(final SchemaSourceFilter filter) {
-            return mock(SchemaContextFactory.class);
-        }
-
         @Override
         public SchemaContextFactory createSchemaContextFactory(final SchemaContextFactoryConfiguration config) {
             return mock(SchemaContextFactory.class);
@@ -155,12 +148,6 @@ public class SchemaSourceTransformerTest {
     }
 
     private class Consumer extends AbstractSchemaRepository {
-        @Deprecated
-        @Override
-        public SchemaContextFactory createSchemaContextFactory(final SchemaSourceFilter filter) {
-            return mock(SchemaContextFactory.class);
-        }
-
         @Override
         public SchemaContextFactory createSchemaContextFactory(final SchemaContextFactoryConfiguration config) {
             return mock(SchemaContextFactory.class);
index 3b45991776bd2b3d07d374cd5263c7ab521de07c..466b0387fb6efd2d5791c138f51b0ab2e0fdbedd 100644 (file)
@@ -40,7 +40,6 @@ import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactoryConfiguration;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
 import org.opendaylight.yangtools.yang.parser.impl.DefaultReactors;
@@ -62,14 +61,6 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
     private final @NonNull SchemaRepository repository;
     private final @NonNull SchemaContextFactoryConfiguration config;
 
-    // FIXME SchemaRepository should be the type for repository parameter instead of SharedSchemaRepository
-    //       (final implementation)
-    @Deprecated
-    SharedSchemaContextFactory(final @NonNull SharedSchemaRepository repository,
-            final @NonNull SchemaSourceFilter filter) {
-        this(repository, SchemaContextFactoryConfiguration.builder().setFilter(filter).build());
-    }
-
     SharedSchemaContextFactory(final @NonNull SchemaRepository repository,
         final @NonNull SchemaContextFactoryConfiguration config) {
         this.repository = requireNonNull(repository);
index d47217b2548c21ad59281c449f1bedb52e4df688..86e9503d6614a673f2c143a602bd68f588658845 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactoryConfiguration;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.util.AbstractSchemaRepository;
 
@@ -33,15 +32,6 @@ import org.opendaylight.yangtools.yang.model.repo.util.AbstractSchemaRepository;
 @Beta
 @MetaInfServices(value = SchemaRepository.class)
 public final class SharedSchemaRepository extends AbstractSchemaRepository implements Identifiable<String> {
-    @Deprecated
-    private final LoadingCache<SchemaSourceFilter, SchemaContextFactory> cacheByFilter = CacheBuilder.newBuilder()
-            .softValues().build(new CacheLoader<SchemaSourceFilter, SchemaContextFactory>() {
-                @Override
-                public SchemaContextFactory load(final SchemaSourceFilter key) {
-                    return new SharedSchemaContextFactory(SharedSchemaRepository.this, key);
-                }
-            });
-
     private final LoadingCache<SchemaContextFactoryConfiguration, SchemaContextFactory> cacheByConfig = CacheBuilder
             .newBuilder().softValues()
             .build(new CacheLoader<SchemaContextFactoryConfiguration, SchemaContextFactory>() {
@@ -62,12 +52,6 @@ public final class SharedSchemaRepository extends AbstractSchemaRepository imple
         return id;
     }
 
-    @Override
-    @Deprecated
-    public @NonNull SchemaContextFactory createSchemaContextFactory(final @NonNull SchemaSourceFilter filter) {
-        return cacheByFilter.getUnchecked(filter);
-    }
-
     @Override
     public @NonNull SchemaContextFactory createSchemaContextFactory(
             final @NonNull SchemaContextFactoryConfiguration config) {
index 1955136d169564484f44575d8c78fde1f804994f..dba5d2e1a739eaf08fee6ff736f10624f0566c96 100644 (file)
@@ -37,10 +37,10 @@ import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException
 import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactoryConfiguration;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@@ -212,7 +212,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
      *         new schema context was successfully built.
      */
     public Optional<SchemaContext> getSchemaContext(final StatementParserMode statementParserMode) {
-        final SchemaContextFactory factory = repository.createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
+        final SchemaContextFactory factory = repository.createSchemaContextFactory(config(statementParserMode));
         Optional<SchemaContext> sc;
         Object ver;
         do {
@@ -299,7 +299,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
     public SchemaContext trySchemaContext(final StatementParserMode statementParserMode)
             throws SchemaResolutionException {
         final ListenableFuture<SchemaContext> future = repository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT)
+                .createSchemaContextFactory(config(statementParserMode))
                 .createSchemaContext(ImmutableSet.copyOf(requiredSources), statementParserMode);
 
         try {
@@ -320,4 +320,8 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
     public void close() {
         transReg.close();
     }
+
+    private static SchemaContextFactoryConfiguration config(final StatementParserMode statementParserMode) {
+        return SchemaContextFactoryConfiguration.builder().setStatementParserMode(statementParserMode).build();
+    }
 }
index 1b178e389b0a890a90f9ec3fd425dc160f448822..8aa53ed2ba7039704d89cd6d2733f9b2e8e73b55 100644 (file)
@@ -5,7 +5,6 @@
  * 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.yangtools.yang.parser.repo;
 
 import static org.junit.Assert.assertEquals;
@@ -22,8 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.ASTSchemaSource;
@@ -55,10 +52,7 @@ public class MultipleRevImportBug6875Test {
         setAndRegister(sharedSchemaRepository, bar2);
         setAndRegister(sharedSchemaRepository, bar3);
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
-        final ListenableFuture<SchemaContext> schemaContextFuture = fact
+        final ListenableFuture<SchemaContext> schemaContextFuture = sharedSchemaRepository.createSchemaContextFactory()
                 .createSchemaContext(ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId(), bar3.getId()));
         assertTrue(schemaContextFuture.isDone());
 
@@ -98,10 +92,8 @@ public class MultipleRevImportBug6875Test {
         setAndRegister(sharedSchemaRepository, bar1);
         setAndRegister(sharedSchemaRepository, bar2);
 
-        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(
-                SchemaSourceFilter.ALWAYS_ACCEPT);
-        final ListenableFuture<SchemaContext> schemaContextFuture = fact.createSchemaContext(
-                ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
+        final ListenableFuture<SchemaContext> schemaContextFuture = sharedSchemaRepository.createSchemaContextFactory()
+                .createSchemaContext(ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
         assertTrue(schemaContextFuture.isDone());
 
         try {
index 0db8d53045b7619a89ab5b6cc4e5c9ff383c3476..166dccabdc4e6a661efff3995afa4d590c04edee 100644 (file)
@@ -17,7 +17,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.ASTSchemaSource;
@@ -43,8 +42,7 @@ public class OpenconfigVerSharedSchemaRepositoryTest {
         semVer.register(sharedSchemaRepository);
         semVer.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
 
         final ListenableFuture<SchemaContext> inetAndTopologySchemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(bar.getId(), foo.getId(), semVer.getId()),
@@ -75,9 +73,7 @@ public class OpenconfigVerSharedSchemaRepositoryTest {
         semVer.register(sharedSchemaRepository);
         semVer.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> inetAndTopologySchemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(bar.getId(), foo.getId(), semVer.getId()));
         assertTrue(inetAndTopologySchemaContextFuture.isDone());
index 2cc14f856e3a8d58027985f2a8aed1da7b093287..1cc3298c66194d19a1a5c23401dfc334b184d407 100644 (file)
@@ -15,24 +15,25 @@ import java.util.Arrays;
 import java.util.concurrent.ExecutionException;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Mock;
+import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactoryConfiguration;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.ASTSchemaSource;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.TextToASTTransformer;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class SharedSchemaContextFactoryTest {
 
     private final SharedSchemaRepository repository = new SharedSchemaRepository("test");
 
-    @Mock
-    private SchemaSourceFilter filter;
+    private final SchemaContextFactoryConfiguration config = SchemaContextFactoryConfiguration.getDefault();
     private SourceIdentifier s1;
     private SourceIdentifier s2;
 
@@ -58,7 +59,7 @@ public class SharedSchemaContextFactoryTest {
     @Test
     public void testCreateSchemaContextWithDuplicateRequiredSources() throws InterruptedException, ExecutionException {
         final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository,
-            filter);
+            config);
         final ListenableFuture<SchemaContext> schemaContext =
                 sharedSchemaContextFactory.createSchemaContext(Arrays.asList(s1, s1, s2));
         assertNotNull(schemaContext.get());
@@ -83,7 +84,7 @@ public class SharedSchemaContextFactoryTest {
                 sIdWithoutRevision, ASTSchemaSource.class, PotentialSchemaSource.Costs.IMMEDIATE.getValue()));
 
         final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository,
-            filter);
+            config);
         final ListenableFuture<SchemaContext> schemaContext =
                 sharedSchemaContextFactory.createSchemaContext(Arrays.asList(sIdWithoutRevision, provider.getId()));
         assertNotNull(schemaContext.get());
index c659ceec475261138c420e67a0203a56cb802f62..5583e1f2bbff6cd11fa51113d455831cd46e18e1 100644 (file)
@@ -20,7 +20,6 @@ import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFluentFuture;
-import static org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter.ALWAYS_ACCEPT;
 
 import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.collect.ImmutableList;
@@ -94,7 +93,7 @@ public class SharedSchemaRepositoryTest {
             remoteInetTypesYang.getId(), ASTSchemaSource.class);
         assertFalse(registeredSourceFuture.isDone());
 
-        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(ALWAYS_ACCEPT);
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> schemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(remoteInetTypesYang.getId()));
 
@@ -110,8 +109,7 @@ public class SharedSchemaRepositoryTest {
         assertSchemaContext(firstSchemaContext, 1);
 
         // Try same schema second time
-        final ListenableFuture<SchemaContext> secondSchemaFuture = sharedSchemaRepository
-                .createSchemaContextFactory(ALWAYS_ACCEPT)
+        final ListenableFuture<SchemaContext> secondSchemaFuture = sharedSchemaRepository.createSchemaContextFactory()
                 .createSchemaContext(ImmutableList.of(remoteInetTypesYang.getId()));
 
         // Verify second schema created successfully immediately
@@ -136,7 +134,7 @@ public class SharedSchemaRepositoryTest {
                 getImmediateYangSourceProviderFromResource("/no-revision/module-without-revision.yang");
         remoteModuleNoRevYang.register(sharedSchemaRepository);
 
-        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(ALWAYS_ACCEPT);
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> inetAndTopologySchemaContextFuture = fact
                 .createSchemaContext(ImmutableList.of(remoteInetTypesYang.getId(), remoteTopologyYang.getId()));
         assertTrue(inetAndTopologySchemaContextFuture.isDone());
@@ -159,7 +157,7 @@ public class SharedSchemaRepositoryTest {
             "/ietf/ietf-inet-types@2010-09-24.yang");
         remoteInetTypesYang.register(sharedSchemaRepository);
 
-        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(ALWAYS_ACCEPT);
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
 
         // Make source appear
         final Throwable ex = new IllegalStateException("failed schema");
@@ -194,8 +192,7 @@ public class SharedSchemaRepositoryTest {
         remoteInetTypesYang.register(sharedSchemaRepository);
         remoteInetTypesYang.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(ALWAYS_ACCEPT);
-
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> schemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(remoteInetTypesYang.getId()));
 
@@ -292,7 +289,8 @@ public class SharedSchemaRepositoryTest {
 
         // Request schema to make repository notify the cache
         final ListenableFuture<SchemaContext> schemaFuture = sharedSchemaRepository
-                .createSchemaContextFactory(ALWAYS_ACCEPT).createSchemaContext(ImmutableList.of(runningId));
+                .createSchemaContextFactory()
+                .createSchemaContext(ImmutableList.of(runningId));
         Futures.addCallback(schemaFuture, new FutureCallback<SchemaContext>() {
             @Override
             public void onSuccess(final SchemaContext result) {
index d1a2b5cd04260811040bc9f81536c8a1f4b1067b..f6832e463a92996825226316bff2037bd2bd6626 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.ASTSchemaSource;
 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.TextToASTTransformer;
@@ -43,9 +42,7 @@ public class SharedSchemaRepositoryWithFeaturesTest {
         foobar.register(sharedSchemaRepository);
         foobar.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> testSchemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(foobar.getId()), supportedFeatures);
         assertTrue(testSchemaContextFuture.isDone());
@@ -84,9 +81,7 @@ public class SharedSchemaRepositoryWithFeaturesTest {
         foobar.register(sharedSchemaRepository);
         foobar.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> testSchemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(foobar.getId()));
         assertTrue(testSchemaContextFuture.isDone());
@@ -130,9 +125,7 @@ public class SharedSchemaRepositoryWithFeaturesTest {
         foobar.register(sharedSchemaRepository);
         foobar.setResult();
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory();
         final ListenableFuture<SchemaContext> testSchemaContextFuture =
                 fact.createSchemaContext(ImmutableList.of(foobar.getId()), supportedFeatures);
         assertTrue(testSchemaContextFuture.isDone());