r1678 - trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin
Author: tchemit Date: 2009-12-08 18:19:34 +0100 (Tue, 08 Dec 2009) New Revision: 1678 Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java Log: log when there is some errors Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java =================================================================== --- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-12-08 17:17:55 UTC (rev 1677) +++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-12-08 17:19:34 UTC (rev 1678) @@ -1,34 +1,34 @@ -/* - * *##% - * JAXX Maven plugin - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import jaxx.runtime.context.DefaultJAXXContext; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.SystemStreamLog; +import static org.junit.Assert.*; +import org.junit.Test; import java.io.File; -import org.junit.Test; -import static org.junit.Assert.*; - public class CompilerTest extends JaxxBaseTest { @Test @@ -70,14 +70,14 @@ @Test public void CSSTests() throws Exception { - getMojo().execute(); + executeMojo(); assertNumberJaxxFiles(7); } @Test public void WithLog() throws Exception { GenerateMojo mojo = getMojo(); - mojo.execute(); + executeMojo(); String[] files = mojo.files; assertNumberJaxxFiles(2); @@ -102,7 +102,7 @@ @Test public void NoLog() throws Exception { GenerateMojo mojo = getMojo(); - mojo.execute(); + executeMojo(); assertNumberJaxxFiles(2); checkPattern(mojo, "Log log = LogFactory.getLog(", false); checkPattern(mojo, "import org.apache.commons.logging.Log;", false); @@ -158,7 +158,7 @@ @Test public void Initializers() throws Exception { - getMojo().execute(); + executeMojo(); assertNumberJaxxFiles(1); } @@ -197,19 +197,19 @@ @Test public void Script() throws Exception { - getMojo().execute(); + executeMojo(); assertNumberJaxxFiles(1); } @Test public void OverridingDataBindings() throws Exception { - getMojo().execute(); + executeMojo(); assertNumberJaxxFiles(3); } @Test public void ClassReferences() throws Exception { - getMojo().execute(); + executeMojo(); assertNumberJaxxFiles(6); } @@ -218,7 +218,7 @@ // first round, with force option so will generate theonly JButton.jaxx file GenerateMojo mojo = getMojo(); - mojo.execute(); + executeMojo(); String[] files = mojo.files; assertNumberJaxxFiles(1); @@ -229,7 +229,7 @@ long oldTime = dstFile.lastModified(); // second round, no force so will not the file mojo.force = false; - mojo.execute(); + executeMojo(); assertNumberJaxxFiles(0); Thread.sleep(1000); @@ -241,14 +241,29 @@ log.warn("failed to set LastModified for file " + srcFile); } - mojo.execute(); + executeMojo(); assertNumberJaxxFiles(1); assertTrue(mojo.updater.getMirrorFile(srcFile).lastModified() > oldTime); // last round, reforce file generation for an no modify source mojo.force = true; - mojo.execute(); + executeMojo(); assertNumberJaxxFiles(1); assertTrue(mojo.updater.getMirrorFile(srcFile).lastModified() > oldTime); } + + protected void executeMojo() throws MojoExecutionException, MojoFailureException { + + try { + getMojo().execute(); + } catch (MojoExecutionException e) { + log.error(e); + throw e; + } catch (MojoFailureException e) { + log.error(e); + throw e; + } + + } + }
participants (1)
-
tchemit@users.nuiton.org