Do not rely on path to detect image optimization
Do not rely on path to detect image optimization

Because the path technics does not support symbolic links.

Signed-off-by: Clement Escoffier <6397137e57d1f87002962a37058f2a1c76fca9db@gmail.com>

import org.wisdom.framework.maven.integration.BuiltProject;
import static org.assertj.core.api.Assertions.assertThat;

System.out.println("Checking " + basedir)
def project = new BuiltProject(basedir)

assertThat(project.wasBuilt()).isTrue()
project.assertErrorFreeLog()

// ---- Check Artifacts ----
assertThat(project.target()).isDirectory()
// Bundle
assertThat(new File(project.target(), project.bundleArtifactName)).isFile()
// Distribution
assertThat(new File(project.target(), project.distributionArtifactName)).isFile()

// ---- Wisdom Runtime ----
assertThat(project.wisdom()).isDirectory()
def bundle = new File(project.app(), project.bundleName)
assertThat(bundle).isFile()

// ---- Webjars copied ----
assertThat(new File(project.wisdom(), "application/jquery-2.1.0-2.jar")).isFile()
assertThat(new File(project.wisdom(), "application/bootstrap-3.1.1.jar")).isFile()

// ---- Optipng and jpegtran ----
project.assertContainedInLog("46x30 pixels, 4x8 bits/pixel, RGB+alpha")
project.assertContainedInLog("/classes/assets/cat.jpg]")

// ---- Unit Test ---
project.assertContainedInLog("Running sample.UnitTest")
project.assertContainedInLog("Tests run: 2, Failures: 0, Errors: 0, Skipped: 0")

// Integration-Test
project.assertContainedInLog("Running sample.BlackBoxIT")
project.assertContainedInLog("Running sample.FluentLeniumIT")
project.assertContainedInLog("Running sample.InContainerIT")

return true;


import org.wisdom.framework.maven.integration.BuiltProject;
import static org.assertj.core.api.Assertions.assertThat;

System.out.println("Checking " + basedir)
def project = new BuiltProject(basedir)

assertThat(project.wasBuilt()).isTrue()
project.assertErrorFreeLog()

// ---- Check Artifacts ----
assertThat(project.target()).isDirectory()
// Bundle
assertThat(new File(project.target(), project.bundleArtifactName)).isFile()
// Distribution
assertThat(new File(project.target(), project.distributionArtifactName)).isFile()

// ---- Wisdom Runtime ----
assertThat(project.wisdom()).isDirectory()
def bundle = new File(project.app(), project.bundleName)
assertThat(bundle).isFile()

// ---- Webjars copied ----
assertThat(new File(project.wisdom(), "application/jquery-2.1.0-2.jar")).isFile()
assertThat(new File(project.wisdom(), "application/bootstrap-3.1.1.jar")).isFile()

// ---- Optipng and jpegtran ----
project.assertContainedInLog("Optimizing " + project.target().getAbsolutePath()
        + "/classes/assets/cat.jpg")
project.assertContainedInLog("Optimizing " + project.target().getAbsolutePath()
        + "/classes/assets/owl-small.png")

// ---- Unit Test ---
project.assertContainedInLog("Running sample.UnitTest")
project.assertContainedInLog("Tests run: 2, Failures: 0, Errors: 0, Skipped: 0")

// Integration-Test
project.assertContainedInLog("Running sample.BlackBoxIT")
project.assertContainedInLog("Running sample.FluentLeniumIT")
project.assertContainedInLog("Running sample.InContainerIT")

return true;

