Flatten tools modules

This commit is contained in:
Willem Cazander 2024-06-15 16:28:25 +02:00
parent 15574fc840
commit 899bf24f1c
21 changed files with 9 additions and 32 deletions

View file

@ -0,0 +1,123 @@
/*
* Copyright (c) 2004-2014, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.tool.maven.plugin;
import java.io.File;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.x4o.tool.maven.plugin.X4OLanguageTaskMojo;
/**
* XX4OLanguageTaskMojoTest.
*
* @author Willem Cazander
* @version 1.0 Apr 6, 2013
*/
public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase {
/** {@inheritDoc} */
protected void setUp() throws Exception {
super.setUp(); // required
}
/** {@inheritDoc} */
protected void tearDown() throws Exception {
super.tearDown(); // required
}
private void executeGoal(String goal,String testFile) throws Exception {
File pom = getTestFile(testFile);
assertNotNull(pom);
assertTrue(pom.exists());
X4OLanguageTaskMojo mojo = (X4OLanguageTaskMojo) lookupMojo(goal,pom);
assertNotNull(mojo);
mojo.execute();
}
public void testHelp() throws Exception {
File pom = getTestFile("src/test/resources/junit/test-plugin-defaults.pom");
assertNotNull(pom);
assertTrue(pom.exists());
Mojo mojo = lookupMojo("help",pom);
assertNotNull(mojo);
mojo.execute();
}
public void testConfAllWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom");
File outputDir = new File("target/jtest/test-plugin-conf-all/doc-eld-1.0");
if (!outputDir.exists()) {
return; // TODO: fix fails in maven test run ?
}
assertTrue(outputDir.exists());
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
/*
public void testConfLangWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/cel");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one files", true, files>1);
}
public void testConfDefaultsWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/doc-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
outputDir = new File("target/x4o/doc-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testConfAllWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom");
File outputDir = new File("target/jtest/test-plugin-conf-all/xsd-eld-1.0");
assertTrue(outputDir.exists());
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testConfLangWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
}
public void testConfDefaultsWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
outputDir = new File("target/x4o/xsd-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
*/
}