2 * Copyright (c) 2013 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
8 package org.opendaylight.controller.yang2sources.plugin;
10 import static org.hamcrest.core.Is.*;
11 import static org.junit.Assert.*;
14 import java.util.Collection;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.controller.yang2sources.plugin.ConfigArg.ResourceProviderArg;
19 import org.opendaylight.controller.yang2sources.spi.ResourceGenerator;
21 public class GenerateResourcesTest {
24 private YangToResourcesMojo mojo;
29 yang = new File(getClass().getResource("/mock.yang").getFile())
31 outDir = new File("outputDir");
32 mojo = new YangToResourcesMojo(
33 new ResourceProviderArg[] {
34 new ResourceProviderArg(ProviderMock.class.getName(),
36 new ResourceProviderArg(ProviderMock2.class.getName(),
41 public void test() throws Exception {
43 assertThat(ProviderMock.called, is(1));
44 assertThat(ProviderMock2.called, is(1));
45 assertThat(ProviderMock2.baseDir, is(outDir));
46 assertThat(ProviderMock.baseDir, is(outDir));
49 public static class ProviderMock implements ResourceGenerator {
51 private static int called = 0;
52 private static File baseDir;
55 public void generateResourceFiles(Collection<File> resources,
62 public static class ProviderMock2 implements ResourceGenerator {
64 private static int called = 0;
65 private static File baseDir;
68 public void generateResourceFiles(Collection<File> resources,