1 package org.opendaylight.yangtools.yang.stmt.effective.build.test;
3 import static org.junit.Assert.assertEquals;
4 import java.io.FileNotFoundException;
5 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
6 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
7 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
8 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
9 import java.util.Map.Entry;
12 import org.opendaylight.yangtools.yang.model.api.Module;
13 import java.util.List;
14 import java.util.Arrays;
15 import java.net.URISyntaxException;
17 import org.junit.Test;
19 public class MappedEffectiveBuildTest {
22 public void mappedBuildTest() throws URISyntaxException, SourceException,
23 FileNotFoundException, ReactorException {
24 File sourceDir = new File(getClass().getResource("/mapped-build/")
26 List<File> yangFiles = Arrays.asList(sourceDir.listFiles());
28 assertEquals(4, yangFiles.size());
30 BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
31 Map<File, Module> parseYangModelsMapped = reactor
32 .buildEffectiveMappedToSource(yangFiles);
34 assertEquals(2, parseYangModelsMapped.size());
36 Set<Entry<File, Module>> mapEntrySet = parseYangModelsMapped.entrySet();
37 for (Entry<File, Module> entry : mapEntrySet) {
38 assertEquals(entry.getKey().getPath(), entry.getValue()
39 .getModuleSourcePath());