2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.yangtools.yang.stmt;
11 import static org.junit.Assert.assertEquals;
12 import java.io.FileNotFoundException;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
14 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
15 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
16 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
17 import java.util.Map.Entry;
20 import org.opendaylight.yangtools.yang.model.api.Module;
21 import java.util.List;
22 import java.util.Arrays;
23 import java.net.URISyntaxException;
25 import org.junit.Test;
27 public class MappedEffectiveBuildTest {
30 public void mappedBuildTest() throws URISyntaxException, SourceException,
31 FileNotFoundException, ReactorException {
32 File sourceDir = new File(getClass().getResource("/mapped-build/")
34 List<File> yangFiles = Arrays.asList(sourceDir.listFiles());
36 assertEquals(4, yangFiles.size());
38 BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
39 Map<File, Module> parseYangModelsMapped = reactor
40 .buildEffectiveMappedToSource(yangFiles);
42 assertEquals(2, parseYangModelsMapped.size());
44 Set<Entry<File, Module>> mapEntrySet = parseYangModelsMapped.entrySet();
45 for (Entry<File, Module> entry : mapEntrySet) {
46 assertEquals(entry.getKey().getPath(), entry.getValue()
47 .getModuleSourcePath());