BUG-865: remove CrossSourceStatementReactor.buildEffectiveMappedToSource() 93/41993/3
authorRobert Varga <rovarga@cisco.com>
Mon, 18 Jul 2016 16:38:46 +0000 (18:38 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 20 Jul 2016 10:22:13 +0000 (10:22 +0000)
This method has been deprecated and is used by a test. Remove the test
and the method.

Change-Id: Icf44b4361626dd6cf470d8e7547adfbcd1784ac8
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/CrossSourceStatementReactor.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MappedEffectiveBuildTest.java [deleted file]

index eee66de03e140fc9fe37062bd232566dd0c940a8..8ce59f70e5667a1f5f1ebea767d1307a353c5b06 100644 (file)
@@ -9,20 +9,14 @@ package org.opendaylight.yangtools.yang.parser.stmt.reactor;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.ByteSource;
-import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.EnumMap;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.function.Predicate;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.IfFeaturePredicates;
 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
@@ -33,7 +27,6 @@ import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
-import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
 
 public class CrossSourceStatementReactor {
 
@@ -151,33 +144,5 @@ public class CrossSourceStatementReactor {
 
             return buildEffective();
         }
-
-        /**
-         * @deprecated This method was never used and relies on deprecated
-         *             module methods.
-         */
-        @Deprecated
-        public Map<File, Module> buildEffectiveMappedToSource(final List<File> yangFiles) throws ReactorException,
-                FileNotFoundException {
-            if (yangFiles == null || yangFiles.isEmpty()) {
-                return Collections.emptyMap();
-            }
-
-            final Map<String, File> pathToFile = new HashMap<>();
-            final Map<File, Module> sourceFileToModule = new HashMap<>();
-
-            for (final File yangFile : yangFiles) {
-                addSource(new YangStatementSourceImpl(new NamedFileInputStream(yangFile, yangFile.getPath())));
-                pathToFile.put(yangFile.getPath(), yangFile);
-            }
-
-            final EffectiveSchemaContext schema = buildEffective();
-            final Set<Module> modules = schema.getModules();
-            for (final Module module : modules) {
-                sourceFileToModule.put(pathToFile.get(module.getModuleSourcePath()), module);
-            }
-
-            return sourceFileToModule;
-        }
     }
 }
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MappedEffectiveBuildTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MappedEffectiveBuildTest.java
deleted file mode 100644 (file)
index c541df5..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2016 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.yangtools.yang.stmt;
-
-import static org.junit.Assert.assertEquals;
-import java.io.FileNotFoundException;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Map;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import java.util.List;
-import java.util.Arrays;
-import java.net.URISyntaxException;
-import java.io.File;
-import org.junit.Test;
-
-public class MappedEffectiveBuildTest {
-
-    @Test
-    public void mappedBuildTest() throws URISyntaxException, SourceException,
-            FileNotFoundException, ReactorException {
-        File sourceDir = new File(getClass().getResource("/mapped-build/")
-                .toURI());
-        List<File> yangFiles = Arrays.asList(sourceDir.listFiles());
-
-        assertEquals(4, yangFiles.size());
-
-        BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        Map<File, Module> parseYangModelsMapped = reactor
-                .buildEffectiveMappedToSource(yangFiles);
-
-        assertEquals(2, parseYangModelsMapped.size());
-
-        Set<Entry<File, Module>> mapEntrySet = parseYangModelsMapped.entrySet();
-        for (Entry<File, Module> entry : mapEntrySet) {
-            assertEquals(entry.getKey().getPath(), entry.getValue()
-                    .getModuleSourcePath());
-        }
-    }
-}