@Test public void testInstallationAndOptimization() throws MojoExecutionException { ImageOptimizationMojo mojo = new ImageOptimizationMojo(); mojo.basedir = basedir; mojo.buildDirectory = target; mojo.execute(); assertThat(new File(classes, jpg.getName()).length()).isLessThan(jpg.length()); assertThat(new File(classes, png.getName()).length()).isLessThan(png.length()); assertThat(new File(assets, jpg.getName()).length()).isLessThan(jpg.length()); assertThat(new File(assets, png.getName()).length()).isLessThan(png.length()); assertThat(new File(assets, gif.getName()).length()).isLessThan(gif.length()); assertThat(new File(internalNested, jpg.getName()).length()).isLessThan(jpg.length()); assertThat(new File(internalNested, png.getName()).length()).isLessThan(png.length()); assertThat(new File(internalNested, gif.getName()).length()).isLessThan(gif.length()); assertThat(new File(externalNested, jpg.getName()).length()).isLessThan(jpg.length()); assertThat(new File(externalNested, png.getName()).length()).isLessThan(png.length()); assertThat(new File(externalNested, gif.getName()).length()).isLessThan(gif.length()); }
@Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); } }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); static final String NPM_NAME; static final String COMMAND; static final List<String> EXTENSIONS; @Parameter(defaultValue = "${skipImageOptimization}", required = false)
    public boolean skipImageOptimization; }