From: Martin Vitez Date: Wed, 21 Aug 2013 15:51:44 +0000 (+0200) Subject: Added 'excludeFiles' option to yang-maven-plugin configuration. X-Git-Tag: yangtools-0.1.0~58 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=08b4485aef333fe646cdcaf269334494c8a6b9b5;p=yangtools.git Added 'excludeFiles' option to yang-maven-plugin configuration. Signed-off-by: Martin Vitez --- diff --git a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/Util.java b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/Util.java index e40be97893..0621cb4ab6 100644 --- a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/Util.java +++ b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/Util.java @@ -43,8 +43,7 @@ final class Util { // phase Second: yang files are copied as resources during // generate-resources phase. This cache ensures that yang files are listed // only once. - private static Map> cache = Maps - .newHashMapWithExpectedSize(10); + private static Map> cache = Maps.newHashMapWithExpectedSize(10); /** * List files recursively and return as array of String paths. Use cache of @@ -58,18 +57,44 @@ final class Util { throw new FileNotFoundException(root.toString()); } - Collection yangFiles = FileUtils.listFiles(root, - new String[] { YANG_SUFFIX }, true); + Collection yangFiles = FileUtils.listFiles(root, new String[] { YANG_SUFFIX }, true); toCache(root, yangFiles); return yangFiles; } - static List listFilesAsStream(File rootDir) + static Collection listFiles(File root, File[] excludedFiles, Log log) throws FileNotFoundException { + if (!root.exists()) { + throw new FileNotFoundException(root.toString()); + } + Collection result = new ArrayList<>(); + Collection yangFiles = FileUtils.listFiles(root, new String[] { YANG_SUFFIX }, true); + for (File f : yangFiles) { + boolean excluded = false; + for (File ex : excludedFiles) { + if (ex.equals(f)) { + excluded = true; + break; + } + } + if (excluded) { + if(log != null) { + log.info(Util.message("%s file excluded %s", YangToSourcesProcessor.LOG_PREFIX, + Util.YANG_SUFFIX.toUpperCase(), f)); + } + } else { + result.add(f); + } + } + + return result; + } + + static List listFilesAsStream(File rootDir, File[] excludedFiles, Log log) throws FileNotFoundException { List is = new ArrayList(); - Collection files = listFiles(rootDir); + Collection files = listFiles(rootDir, excludedFiles, log); for (File f : files) { is.add(new NamedFileInputStream(f)); } @@ -91,33 +116,27 @@ final class Util { } } - private static void toCache(final File rootDir, - final Collection yangFiles) { + private static void toCache(final File rootDir, final Collection yangFiles) { cache.put(rootDir, yangFiles); } /** * Instantiate object from fully qualified class name */ - static T getInstance(String codeGeneratorClass, Class baseType) - throws ClassNotFoundException, InstantiationException, - IllegalAccessException { - return baseType.cast(resolveClass(codeGeneratorClass, baseType) - .newInstance()); + static T getInstance(String codeGeneratorClass, Class baseType) throws ClassNotFoundException, + InstantiationException, IllegalAccessException { + return baseType.cast(resolveClass(codeGeneratorClass, baseType).newInstance()); } - private static Class resolveClass(String codeGeneratorClass, - Class baseType) throws ClassNotFoundException { + private static Class resolveClass(String codeGeneratorClass, Class baseType) throws ClassNotFoundException { Class clazz = Class.forName(codeGeneratorClass); if (!isImplemented(baseType, clazz)) - throw new IllegalArgumentException("Code generator " + clazz - + " has to implement " + baseType); + throw new IllegalArgumentException("Code generator " + clazz + " has to implement " + baseType); return clazz; } - private static boolean isImplemented(Class expectedIface, - Class byClazz) { + private static boolean isImplemented(Class expectedIface, Class byClazz) { for (Class iface : byClazz.getInterfaces()) { if (iface.equals(expectedIface)) return true; @@ -144,21 +163,18 @@ final class Util { private static final String JAR_SUFFIX = ".jar"; private static boolean isJar(File element) { - return (element.isFile() && element.getName().endsWith(JAR_SUFFIX)) ? true - : false; + return (element.isFile() && element.getName().endsWith(JAR_SUFFIX)) ? true : false; } static T checkNotNull(T obj, String paramName) { - return Preconditions.checkNotNull(obj, "Parameter " + paramName - + " is null"); + return Preconditions.checkNotNull(obj, "Parameter " + paramName + " is null"); } final static class YangsInZipsResult implements Closeable { final List yangStreams; private final List zipInputStreams; - private YangsInZipsResult(List yangStreams, - List zipInputStreams) { + private YangsInZipsResult(List yangStreams, List zipInputStreams) { this.yangStreams = yangStreams; this.zipInputStreams = zipInputStreams; } @@ -174,35 +190,29 @@ final class Util { } } - static YangsInZipsResult findYangFilesInDependenciesAsStream(Log log, - MavenProject project) + static YangsInZipsResult findYangFilesInDependenciesAsStream(Log log, MavenProject project) throws MojoFailureException { List yangsFromDependencies = new ArrayList<>(); List zips = new ArrayList<>(); try { List filesOnCp = Util.getClassPath(project); - log.info(Util.message( - "Searching for yang files in following dependencies: %s", + log.info(Util.message("Searching for yang files in following dependencies: %s", YangToSourcesProcessor.LOG_PREFIX, filesOnCp)); for (File file : filesOnCp) { List foundFilesForReporting = new ArrayList<>(); // is it jar file or directory? if (file.isDirectory()) { - File yangDir = new File(file, - YangToSourcesProcessor.META_INF_YANG_STRING); + File yangDir = new File(file, YangToSourcesProcessor.META_INF_YANG_STRING); if (yangDir.exists() && yangDir.isDirectory()) { - File[] yangFiles = yangDir - .listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.endsWith(".yang") - && new File(dir, name).isFile(); - } - }); + File[] yangFiles = yangDir.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".yang") && new File(dir, name).isFile(); + } + }); for (File yangFile : yangFiles) { - yangsFromDependencies.add(new NamedFileInputStream( - yangFile)); + yangsFromDependencies.add(new NamedFileInputStream(yangFile)); } } @@ -215,25 +225,20 @@ final class Util { ZipEntry entry = entries.nextElement(); String entryName = entry.getName(); - if (entryName - .startsWith(YangToSourcesProcessor.META_INF_YANG_STRING_JAR)) { - if (entry.isDirectory() == false - && entryName.endsWith(".yang")) { + if (entryName.startsWith(YangToSourcesProcessor.META_INF_YANG_STRING_JAR)) { + if (entry.isDirectory() == false && entryName.endsWith(".yang")) { foundFilesForReporting.add(entryName); // This will be closed after all strams are // parsed. - InputStream entryStream = zip - .getInputStream(entry); + InputStream entryStream = zip.getInputStream(entry); yangsFromDependencies.add(entryStream); } } } } if (foundFilesForReporting.size() > 0) { - log.info(Util.message("Found %d yang files in %s: %s", - YangToSourcesProcessor.LOG_PREFIX, - foundFilesForReporting.size(), file, - foundFilesForReporting)); + log.info(Util.message("Found %d yang files in %s: %s", YangToSourcesProcessor.LOG_PREFIX, + foundFilesForReporting.size(), file, foundFilesForReporting)); } } diff --git a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesMojo.java b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesMojo.java index 07c3edcffe..cebef8c69c 100644 --- a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesMojo.java +++ b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesMojo.java @@ -58,6 +58,9 @@ public final class YangToSourcesMojo extends AbstractMojo { @Parameter(required = false) private String yangFilesRootDir; // defaults to ${basedir}/src/main/yang + @Parameter(required = false) + private String[] excludeFiles; + @Parameter(property = "project", required = true, readonly = true) protected MavenProject project; @@ -82,18 +85,16 @@ public final class YangToSourcesMojo extends AbstractMojo { List codeGeneratorArgs = processCodeGenerators(codeGenerators); // defaults to ${basedir}/src/main/yang - File yangFilesRootFile = processYangFilesRootDir(yangFilesRootDir, - project.getBasedir()); + File yangFilesRootFile = processYangFilesRootDir(yangFilesRootDir, project.getBasedir()); + File[] excludedFiles = processExcludeFiles(excludeFiles, yangFilesRootFile); - yangToSourcesProcessor = new YangToSourcesProcessor(getLog(), - yangFilesRootFile, codeGeneratorArgs, project, - inspectDependencies); + yangToSourcesProcessor = new YangToSourcesProcessor(getLog(), yangFilesRootFile, excludedFiles, + codeGeneratorArgs, project, inspectDependencies); } yangToSourcesProcessor.execute(); } - private static List processCodeGenerators( - CodeGeneratorArg[] codeGenerators) { + private static List processCodeGenerators(CodeGeneratorArg[] codeGenerators) { List codeGeneratorArgs; if (codeGenerators == null) { codeGeneratorArgs = Collections.emptyList(); @@ -103,12 +104,10 @@ public final class YangToSourcesMojo extends AbstractMojo { return codeGeneratorArgs; } - private static File processYangFilesRootDir(String yangFilesRootDir, - File baseDir) { + private static File processYangFilesRootDir(String yangFilesRootDir, File baseDir) { File yangFilesRootFile; if (yangFilesRootDir == null) { - yangFilesRootFile = new File(baseDir, "src" + File.separator - + "main" + File.separator + "yang"); + yangFilesRootFile = new File(baseDir, "src" + File.separator + "main" + File.separator + "yang"); } else { File file = new File(yangFilesRootDir); if (file.isAbsolute()) { @@ -119,4 +118,17 @@ public final class YangToSourcesMojo extends AbstractMojo { } return yangFilesRootFile; } + + private static File[] processExcludeFiles(String[] excludeFiles, File baseDir) { + if (excludeFiles == null) { + return new File[] {}; + } + File[] result = new File[excludeFiles.length]; + for (int i = 0; i < excludeFiles.length; i++) { + result[i] = new File(baseDir, excludeFiles[i]); + } + + return result; + } + } diff --git a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesProcessor.java b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesProcessor.java index ca972bf993..eb7269d818 100644 --- a/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesProcessor.java +++ b/yang/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesProcessor.java @@ -24,7 +24,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.FileUtils; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; @@ -38,43 +37,39 @@ import com.google.common.collect.Maps; class YangToSourcesProcessor { static final String LOG_PREFIX = "yang-to-sources:"; - static final String META_INF_YANG_STRING = "META-INF" + File.separator - + "yang"; + static final String META_INF_YANG_STRING = "META-INF" + File.separator + "yang"; static final String META_INF_YANG_STRING_JAR = "META-INF" + "/" + "yang"; static final File META_INF_YANG_DIR = new File(META_INF_YANG_STRING); private final Log log; private final File yangFilesRootDir; + private final File[] excludedFiles; private final List codeGenerators; private final MavenProject project; private final boolean inspectDependencies; private YangProvider yangProvider; @VisibleForTesting - YangToSourcesProcessor(Log log, File yangFilesRootDir, - List codeGenerators, MavenProject project, - boolean inspectDependencies, YangProvider yangProvider) { + YangToSourcesProcessor(Log log, File yangFilesRootDir, File[] excludedFiles, List codeGenerators, + MavenProject project, boolean inspectDependencies, YangProvider yangProvider) { this.log = Util.checkNotNull(log, "log"); - this.yangFilesRootDir = Util.checkNotNull(yangFilesRootDir, - "yangFilesRootDir"); - this.codeGenerators = Collections.unmodifiableList(Util.checkNotNull( - codeGenerators, "codeGenerators")); + this.yangFilesRootDir = Util.checkNotNull(yangFilesRootDir, "yangFilesRootDir"); + this.excludedFiles = excludedFiles; + this.codeGenerators = Collections.unmodifiableList(Util.checkNotNull(codeGenerators, "codeGenerators")); this.project = Util.checkNotNull(project, "project"); this.inspectDependencies = inspectDependencies; this.yangProvider = yangProvider; } - YangToSourcesProcessor(Log log, File yangFilesRootDir, - List codeGenerators, MavenProject project, - boolean inspectDependencies) { - this(log, yangFilesRootDir, codeGenerators, project, - inspectDependencies, new YangProvider()); + YangToSourcesProcessor(Log log, File yangFilesRootDir, File[] excludedFiles, List codeGenerators, + MavenProject project, boolean inspectDependencies) { + this(log, yangFilesRootDir, excludedFiles, codeGenerators, project, inspectDependencies, new YangProvider()); } public void execute() throws MojoExecutionException, MojoFailureException { ContextHolder context = processYang(); generateSources(context); - yangProvider.addYangsToMETA_INF(log, project, yangFilesRootDir); + yangProvider.addYangsToMETA_INF(log, project, yangFilesRootDir, excludedFiles); } private ContextHolder processYang() throws MojoExecutionException { @@ -82,16 +77,14 @@ class YangToSourcesProcessor { List closeables = new ArrayList<>(); log.info(Util.message("Inspecting %s", LOG_PREFIX, yangFilesRootDir)); try { - List yangsInProject = Util - .listFilesAsStream(yangFilesRootDir); + List yangsInProject = Util.listFilesAsStream(yangFilesRootDir, excludedFiles, log); List all = new ArrayList<>(yangsInProject); closeables.addAll(yangsInProject); Map allYangModules; Set projectYangModules; try { if (inspectDependencies) { - YangsInZipsResult dependentYangResult = Util - .findYangFilesInDependenciesAsStream(log, project); + YangsInZipsResult dependentYangResult = Util.findYangFilesInDependenciesAsStream(log, project); Closeable dependentYangResult1 = dependentYangResult; closeables.add(dependentYangResult1); all.addAll(dependentYangResult.yangStreams); @@ -110,18 +103,15 @@ class YangToSourcesProcessor { } } - Set parsedAllYangModules = new HashSet<>( - allYangModules.values()); - SchemaContext resolveSchemaContext = parser - .resolveSchemaContext(parsedAllYangModules); - log.info(Util.message("%s files parsed from %s", LOG_PREFIX, - Util.YANG_SUFFIX.toUpperCase(), yangsInProject)); + Set parsedAllYangModules = new HashSet<>(allYangModules.values()); + SchemaContext resolveSchemaContext = parser.resolveSchemaContext(parsedAllYangModules); + log.info(Util.message("%s files parsed from %s", LOG_PREFIX, Util.YANG_SUFFIX.toUpperCase(), yangsInProject)); return new ContextHolder(resolveSchemaContext, projectYangModules); // MojoExecutionException is thrown since execution cannot continue } catch (Exception e) { - String message = Util.message("Unable to parse %s files from %s", - LOG_PREFIX, Util.YANG_SUFFIX, yangFilesRootDir); + String message = Util.message("Unable to parse %s files from %s", LOG_PREFIX, Util.YANG_SUFFIX, + yangFilesRootDir); log.error(message, e); throw new MojoExecutionException(message, e); } @@ -129,30 +119,30 @@ class YangToSourcesProcessor { static class YangProvider { - private static final String yangResourceDir = "target" + File.separator - + "yang"; + private static final String yangResourceDir = "target" + File.separator + "yang"; - void addYangsToMETA_INF(Log log, MavenProject project, - File yangFilesRootDir) throws MojoFailureException { + void addYangsToMETA_INF(Log log, MavenProject project, File yangFilesRootDir, File[] excludedFiles) + throws MojoFailureException { File targetYangDir = new File(project.getBasedir(), yangResourceDir); try { - FileUtils.copyDirectory(yangFilesRootDir, targetYangDir); + Collection files = Util.listFiles(yangFilesRootDir, excludedFiles, null); + for (File file : files) { + org.apache.commons.io.FileUtils.copyFile(file, new File(targetYangDir, file.getName())); + } } catch (IOException e) { - String message = "Unable to copy yang files into resource folder"; + String message = "Unable to list yang files into resource folder"; log.warn(message, e); throw new MojoFailureException(message, e); } setResource(targetYangDir, META_INF_YANG_STRING_JAR, project); - log.debug(Util.message( - "Yang files from: %s marked as resources: %s", LOG_PREFIX, - yangFilesRootDir, META_INF_YANG_STRING_JAR)); + log.debug(Util.message("Yang files from: %s marked as resources: %s", LOG_PREFIX, yangFilesRootDir, + META_INF_YANG_STRING_JAR)); } - private static void setResource(File targetYangDir, String targetPath, - MavenProject project) { + private static void setResource(File targetYangDir, String targetPath, MavenProject project) { Resource res = new Resource(); res.setDirectory(targetYangDir.getPath()); if (targetPath != null) @@ -164,8 +154,7 @@ class YangToSourcesProcessor { /** * Call generate on every generator from plugin configuration */ - private void generateSources(ContextHolder context) - throws MojoFailureException { + private void generateSources(ContextHolder context) throws MojoFailureException { if (codeGenerators.size() == 0) { log.warn(Util.message("No code generators provided", LOG_PREFIX)); return; @@ -177,19 +166,17 @@ class YangToSourcesProcessor { generateSourcesWithOneGenerator(context, codeGenerator); } catch (Exception e) { // try other generators, exception will be thrown after - log.error(Util.message( - "Unable to generate sources with %s generator", - LOG_PREFIX, codeGenerator.getCodeGeneratorClass()), e); - thrown.put(codeGenerator.getCodeGeneratorClass(), e.getClass() - .getCanonicalName()); + log.error( + Util.message("Unable to generate sources with %s generator", LOG_PREFIX, + codeGenerator.getCodeGeneratorClass()), e); + thrown.put(codeGenerator.getCodeGeneratorClass(), e.getClass().getCanonicalName()); } } if (!thrown.isEmpty()) { - String message = Util - .message( - "One or more code generators failed, including failed list(generatorClass=exception) %s", - LOG_PREFIX, thrown.toString()); + String message = Util.message( + "One or more code generators failed, including failed list(generatorClass=exception) %s", + LOG_PREFIX, thrown.toString()); log.error(message); throw new MojoFailureException(message); } @@ -198,29 +185,23 @@ class YangToSourcesProcessor { /** * Instantiate generator from class and call required method */ - private void generateSourcesWithOneGenerator(ContextHolder context, - CodeGeneratorArg codeGeneratorCfg) throws ClassNotFoundException, - InstantiationException, IllegalAccessException, IOException { + private void generateSourcesWithOneGenerator(ContextHolder context, CodeGeneratorArg codeGeneratorCfg) + throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { codeGeneratorCfg.check(); - CodeGenerator g = Util.getInstance( - codeGeneratorCfg.getCodeGeneratorClass(), CodeGenerator.class); - log.info(Util.message("Code generator instantiated from %s", - LOG_PREFIX, codeGeneratorCfg.getCodeGeneratorClass())); + CodeGenerator g = Util.getInstance(codeGeneratorCfg.getCodeGeneratorClass(), CodeGenerator.class); + log.info(Util.message("Code generator instantiated from %s", LOG_PREFIX, + codeGeneratorCfg.getCodeGeneratorClass())); File outputDir = codeGeneratorCfg.getOutputBaseDir(project); - log.info(Util.message("Sources will be generated to %s", LOG_PREFIX, - outputDir)); - log.debug(Util.message("Project root dir is %s", LOG_PREFIX, - project.getBasedir())); - log.debug(Util.message( - "Additional configuration picked up for : %s: %s", LOG_PREFIX, - codeGeneratorCfg.getCodeGeneratorClass(), - codeGeneratorCfg.getAdditionalConfiguration())); + log.info(Util.message("Sources will be generated to %s", LOG_PREFIX, outputDir)); + log.debug(Util.message("Project root dir is %s", LOG_PREFIX, project.getBasedir())); + log.debug(Util.message("Additional configuration picked up for : %s: %s", LOG_PREFIX, + codeGeneratorCfg.getCodeGeneratorClass(), codeGeneratorCfg.getAdditionalConfiguration())); - if(outputDir != null) { + if (outputDir != null) { project.addCompileSourceRoot(outputDir.getAbsolutePath()); } g.setLog(log); @@ -230,15 +211,13 @@ class YangToSourcesProcessor { YangProvider.setResource(resourceBaseDir, null, project); g.setResourceBaseDir(resourceBaseDir); - log.debug(Util.message( - "Folder: %s marked as resources for generator: %s", LOG_PREFIX, - resourceBaseDir, codeGeneratorCfg.getCodeGeneratorClass())); + log.debug(Util.message("Folder: %s marked as resources for generator: %s", LOG_PREFIX, resourceBaseDir, + codeGeneratorCfg.getCodeGeneratorClass())); - Collection generated = g.generateSources(context.getContext(), - outputDir, context.getYangModules()); + Collection generated = g.generateSources(context.getContext(), outputDir, context.getYangModules()); - log.info(Util.message("Sources generated by %s: %s", LOG_PREFIX, - codeGeneratorCfg.getCodeGeneratorClass(), generated)); + log.info(Util.message("Sources generated by %s: %s", LOG_PREFIX, codeGeneratorCfg.getCodeGeneratorClass(), + generated)); } } diff --git a/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/GenerateSourcesTest.java b/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/GenerateSourcesTest.java index ef20864fa3..2f7a050cb0 100644 --- a/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/GenerateSourcesTest.java +++ b/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/GenerateSourcesTest.java @@ -46,17 +46,14 @@ public class GenerateSourcesTest { public void setUp() throws MojoFailureException { MockitoAnnotations.initMocks(this); - yang = new File(getClass().getResource("/yang/mock.yang").getFile()) - .getParent(); + yang = new File(getClass().getResource("/yang/mock.yang").getFile()).getParent(); outDir = new File("/outputDir"); YangProvider mock = mock(YangProvider.class); - doNothing().when(mock).addYangsToMETA_INF(any(Log.class), - any(MavenProject.class), any(File.class)); + doNothing().when(mock).addYangsToMETA_INF(any(Log.class), any(MavenProject.class), any(File.class), + any(File[].class)); - YangToSourcesProcessor processor = new YangToSourcesProcessor( - mock(Log.class), new File(yang), - Lists.newArrayList(new CodeGeneratorArg(GeneratorMock.class - .getName(), "outputDir")), project, false, + YangToSourcesProcessor processor = new YangToSourcesProcessor(mock(Log.class), new File(yang), new File[] {}, + Lists.newArrayList(new CodeGeneratorArg(GeneratorMock.class.getName(), "outputDir")), project, false, mock); mojo = new YangToSourcesMojo(processor); doReturn(new File("")).when(project).getBasedir(); @@ -71,9 +68,8 @@ public class GenerateSourcesTest { assertThat(GeneratorMock.project, is(project)); assertNotNull(GeneratorMock.log); assertTrue(GeneratorMock.additionalCfg.isEmpty()); - assertThat(GeneratorMock.resourceBaseDir.toString(), - containsString("target" + File.separator - + "generated-resources")); + assertThat(GeneratorMock.resourceBaseDir.toString(), containsString("target" + File.separator + + "generated-resources")); } public static class GeneratorMock implements CodeGenerator { @@ -86,8 +82,7 @@ public class GenerateSourcesTest { private static MavenProject project; @Override - public Collection generateSources(SchemaContext context, - File outputBaseDir, Set currentModules) + public Collection generateSources(SchemaContext context, File outputBaseDir, Set currentModules) throws IOException { called++; outputDir = outputBaseDir; @@ -100,8 +95,7 @@ public class GenerateSourcesTest { } @Override - public void setAdditionalConfig( - Map additionalConfiguration) { + public void setAdditionalConfig(Map additionalConfiguration) { GeneratorMock.additionalCfg = additionalConfiguration; }