@Test public void error() throws Exception { assertThat(rezeneratorRunner.run(config.setInDir(new File("src/test/resources/runner-error"))).isSuccessful()).isFalse(); }
public RunResult run(final Configuration configuration) { final Logger logger = configuration.getLogger(); final RunResult result = new RunResult(); final File inDir = configuration.getInDir(); final File baseOutDir = configuration.getBaseOutDir(); final DefinitionFinder finder = new DefinitionFinder(configuration.getDefinitionDirs()); final Map<String, Processor> processors = loadProcessors(configuration.getScannedPackages(), configuration.getLogger()); if (!inDir.exists() || !inDir.isDirectory()) { throw new IllegalStateException(inDir.getName() + " doesn't exist or is not a directory !"); } boolean successful = true; for (final File inFile : inDir.listFiles()) { logger.info("Processing file: " + inFile.getName()); try { final String[] nameSplit = splitFileName(inFile); final DefinitionReader definitionReader = new DefinitionReader(finder.find(nameSplit[1])); final Processor processor = getProcessor(processors, nameSplit[2]); final String outFileName = nameSplit[0] + "." + processor.extension(); final Set<Entry<String, Dimensions>> entrySet = definitionReader.getConfigurations().entrySet(); for (final Entry<String, Dimensions> entry : entrySet) { final File outFile = getOutFile(baseOutDir, entry.getKey(), outFileName); if (configuration.isForceUpdate() || shouldProcess(inFile, outFile, entry.getValue())) { successful &= processor.process(inFile, outFile, entry.getValue(), logger); } else { logger.info("Skipping " + outFile); } } } catch (final Exception e) { logger.error(e.getMessage()); logger.verbose(e); result.addError(inFile, e); successful = false; } } logger.info("Rezenerator processing done !"); if (!successful) { logger.error("There were some errors !"); } result.setSuccessful(successful); return result; }
RezeneratorRunner { public RunResult run(final Configuration configuration) { final Logger logger = configuration.getLogger(); final RunResult result = new RunResult(); final File inDir = configuration.getInDir(); final File baseOutDir = configuration.getBaseOutDir(); final DefinitionFinder finder = new DefinitionFinder(configuration.getDefinitionDirs()); final Map<String, Processor> processors = loadProcessors(configuration.getScannedPackages(), configuration.getLogger()); if (!inDir.exists() || !inDir.isDirectory()) { throw new IllegalStateException(inDir.getName() + " doesn't exist or is not a directory !"); } boolean successful = true; for (final File inFile : inDir.listFiles()) { logger.info("Processing file: " + inFile.getName()); try { final String[] nameSplit = splitFileName(inFile); final DefinitionReader definitionReader = new DefinitionReader(finder.find(nameSplit[1])); final Processor processor = getProcessor(processors, nameSplit[2]); final String outFileName = nameSplit[0] + "." + processor.extension(); final Set<Entry<String, Dimensions>> entrySet = definitionReader.getConfigurations().entrySet(); for (final Entry<String, Dimensions> entry : entrySet) { final File outFile = getOutFile(baseOutDir, entry.getKey(), outFileName); if (configuration.isForceUpdate() || shouldProcess(inFile, outFile, entry.getValue())) { successful &= processor.process(inFile, outFile, entry.getValue(), logger); } else { logger.info("Skipping " + outFile); } } } catch (final Exception e) { logger.error(e.getMessage()); logger.verbose(e); result.addError(inFile, e); successful = false; } } logger.info("Rezenerator processing done !"); if (!successful) { logger.error("There were some errors !"); } result.setSuccessful(successful); return result; } }
RezeneratorRunner { public RunResult run(final Configuration configuration) { final Logger logger = configuration.getLogger(); final RunResult result = new RunResult(); final File inDir = configuration.getInDir(); final File baseOutDir = configuration.getBaseOutDir(); final DefinitionFinder finder = new DefinitionFinder(configuration.getDefinitionDirs()); final Map<String, Processor> processors = loadProcessors(configuration.getScannedPackages(), configuration.getLogger()); if (!inDir.exists() || !inDir.isDirectory()) { throw new IllegalStateException(inDir.getName() + " doesn't exist or is not a directory !"); } boolean successful = true; for (final File inFile : inDir.listFiles()) { logger.info("Processing file: " + inFile.getName()); try { final String[] nameSplit = splitFileName(inFile); final DefinitionReader definitionReader = new DefinitionReader(finder.find(nameSplit[1])); final Processor processor = getProcessor(processors, nameSplit[2]); final String outFileName = nameSplit[0] + "." + processor.extension(); final Set<Entry<String, Dimensions>> entrySet = definitionReader.getConfigurations().entrySet(); for (final Entry<String, Dimensions> entry : entrySet) { final File outFile = getOutFile(baseOutDir, entry.getKey(), outFileName); if (configuration.isForceUpdate() || shouldProcess(inFile, outFile, entry.getValue())) { successful &= processor.process(inFile, outFile, entry.getValue(), logger); } else { logger.info("Skipping " + outFile); } } } catch (final Exception e) { logger.error(e.getMessage()); logger.verbose(e); result.addError(inFile, e); successful = false; } } logger.info("Rezenerator processing done !"); if (!successful) { logger.error("There were some errors !"); } result.setSuccessful(successful); return result; }  }
RezeneratorRunner { public RunResult run(final Configuration configuration) { final Logger logger = configuration.getLogger(); final RunResult result = new RunResult(); final File inDir = configuration.getInDir(); final File baseOutDir = configuration.getBaseOutDir(); final DefinitionFinder finder = new DefinitionFinder(configuration.getDefinitionDirs()); final Map<String, Processor> processors = loadProcessors(configuration.getScannedPackages(), configuration.getLogger()); if (!inDir.exists() || !inDir.isDirectory()) { throw new IllegalStateException(inDir.getName() + " doesn't exist or is not a directory !"); } boolean successful = true; for (final File inFile : inDir.listFiles()) { logger.info("Processing file: " + inFile.getName()); try { final String[] nameSplit = splitFileName(inFile); final DefinitionReader definitionReader = new DefinitionReader(finder.find(nameSplit[1])); final Processor processor = getProcessor(processors, nameSplit[2]); final String outFileName = nameSplit[0] + "." + processor.extension(); final Set<Entry<String, Dimensions>> entrySet = definitionReader.getConfigurations().entrySet(); for (final Entry<String, Dimensions> entry : entrySet) { final File outFile = getOutFile(baseOutDir, entry.getKey(), outFileName); if (configuration.isForceUpdate() || shouldProcess(inFile, outFile, entry.getValue())) { successful &= processor.process(inFile, outFile, entry.getValue(), logger); } else { logger.info("Skipping " + outFile); } } } catch (final Exception e) { logger.error(e.getMessage()); logger.verbose(e); result.addError(inFile, e); successful = false; } } logger.info("Rezenerator processing done !"); if (!successful) { logger.error("There were some errors !"); } result.setSuccessful(successful); return result; }  RunResult run(final Configuration configuration); }
RezeneratorRunner { public RunResult run(final Configuration configuration) { final Logger logger = configuration.getLogger(); final RunResult result = new RunResult(); final File inDir = configuration.getInDir(); final File baseOutDir = configuration.getBaseOutDir(); final DefinitionFinder finder = new DefinitionFinder(configuration.getDefinitionDirs()); final Map<String, Processor> processors = loadProcessors(configuration.getScannedPackages(), configuration.getLogger()); if (!inDir.exists() || !inDir.isDirectory()) { throw new IllegalStateException(inDir.getName() + " doesn't exist or is not a directory !"); } boolean successful = true; for (final File inFile : inDir.listFiles()) { logger.info("Processing file: " + inFile.getName()); try { final String[] nameSplit = splitFileName(inFile); final DefinitionReader definitionReader = new DefinitionReader(finder.find(nameSplit[1])); final Processor processor = getProcessor(processors, nameSplit[2]); final String outFileName = nameSplit[0] + "." + processor.extension(); final Set<Entry<String, Dimensions>> entrySet = definitionReader.getConfigurations().entrySet(); for (final Entry<String, Dimensions> entry : entrySet) { final File outFile = getOutFile(baseOutDir, entry.getKey(), outFileName); if (configuration.isForceUpdate() || shouldProcess(inFile, outFile, entry.getValue())) { successful &= processor.process(inFile, outFile, entry.getValue(), logger); } else { logger.info("Skipping " + outFile); } } } catch (final Exception e) { logger.error(e.getMessage()); logger.verbose(e); result.addError(inFile, e); successful = false; } } logger.info("Rezenerator processing done !"); if (!successful) { logger.error("There were some errors !"); } result.setSuccessful(successful); return result; }  RunResult run(final Configuration configuration);  }