@Test public void run() throws Exception { final File tomee = prepareProject(); try { invoke(tomee); } catch (final ClassFormatError cfe) { } new Monkey(tomee).run(); final File[] libs = new File(tomee, "lib").listFiles(new FilenameFilter() { @Override public boolean accept(final File dir, final String name) { return name.endsWith(".jar"); } }); assertEquals(1, libs.length); final File jar = libs[0]; assertTrue(jar.getName().contains("tomee-monkey-")); assertEquals(2, invoke(tomee)); FileUtils.deleteDirectory(tomee.getParentFile().getParentFile()); }
@Override public void run() { final PrintStream stream = System.out; final FileIndexer indexer = new FileIndexer(base, classes, configuration, MONKEY_CONFIGURATION_FILE).index().dump(stream); stream.println(); final JarPatcher patcher = new JarPatcher(); stream.println("Patcher:"); for (final Map.Entry<File, List<Item>> entry : indexer.getIndex().entrySet()) { patcher.patch(stream, tempFolder, entry.getKey(), entry.getValue()); } stream.println(); stream.println(indexer.getIndex().size() + " jar patched."); }
Monkey implements Runnable { @Override public void run() { final PrintStream stream = System.out; final FileIndexer indexer = new FileIndexer(base, classes, configuration, MONKEY_CONFIGURATION_FILE).index().dump(stream); stream.println(); final JarPatcher patcher = new JarPatcher(); stream.println("Patcher:"); for (final Map.Entry<File, List<Item>> entry : indexer.getIndex().entrySet()) { patcher.patch(stream, tempFolder, entry.getKey(), entry.getValue()); } stream.println(); stream.println(indexer.getIndex().size() + " jar patched."); } }
Monkey implements Runnable { @Override public void run() { final PrintStream stream = System.out; final FileIndexer indexer = new FileIndexer(base, classes, configuration, MONKEY_CONFIGURATION_FILE).index().dump(stream); stream.println(); final JarPatcher patcher = new JarPatcher(); stream.println("Patcher:"); for (final Map.Entry<File, List<Item>> entry : indexer.getIndex().entrySet()) { patcher.patch(stream, tempFolder, entry.getKey(), entry.getValue()); } stream.println(); stream.println(indexer.getIndex().size() + " jar patched."); } Monkey(final File base); }
Monkey implements Runnable { @Override public void run() { final PrintStream stream = System.out; final FileIndexer indexer = new FileIndexer(base, classes, configuration, MONKEY_CONFIGURATION_FILE).index().dump(stream); stream.println(); final JarPatcher patcher = new JarPatcher(); stream.println("Patcher:"); for (final Map.Entry<File, List<Item>> entry : indexer.getIndex().entrySet()) { patcher.patch(stream, tempFolder, entry.getKey(), entry.getValue()); } stream.println(); stream.println(indexer.getIndex().size() + " jar patched."); } Monkey(final File base); @Override void run(); }
Monkey implements Runnable { @Override public void run() { final PrintStream stream = System.out; final FileIndexer indexer = new FileIndexer(base, classes, configuration, MONKEY_CONFIGURATION_FILE).index().dump(stream); stream.println(); final JarPatcher patcher = new JarPatcher(); stream.println("Patcher:"); for (final Map.Entry<File, List<Item>> entry : indexer.getIndex().entrySet()) { patcher.patch(stream, tempFolder, entry.getKey(), entry.getValue()); } stream.println(); stream.println(indexer.getIndex().size() + " jar patched."); } Monkey(final File base); @Override void run(); static final String MONKEY_CONFIGURATION_FILE; }