X4O: Formatted plugins and maisdoc
This commit is contained in:
parent
a61ce241e1
commit
bd4a04a813
63 changed files with 1690 additions and 1589 deletions
|
|
@ -40,58 +40,58 @@ import org.x4o.xml.lang.task.run.X4OTaskRunner;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 9, 2013
|
||||
*/
|
||||
@Mojo( name = X4OLanguageTaskMojo.GOAL,requiresProject=true,requiresDependencyResolution=ResolutionScope.COMPILE)
|
||||
@Mojo(name = X4OLanguageTaskMojo.GOAL, requiresProject = true, requiresDependencyResolution = ResolutionScope.COMPILE)
|
||||
public class X4OLanguageTaskMojo extends AbstractMojo {
|
||||
|
||||
static public final String GOAL = "x4o-language-task";
|
||||
|
||||
@Parameter(property="languageName")
|
||||
|
||||
static public final String GOAL = "x4o-language-task";
|
||||
|
||||
@Parameter(property = "languageName")
|
||||
private String languageName = null;
|
||||
|
||||
@Parameter(property="languageVersion")
|
||||
|
||||
@Parameter(property = "languageVersion")
|
||||
private String languageVersion = null;
|
||||
|
||||
@Parameter(property="taskId")
|
||||
|
||||
@Parameter(property = "taskId")
|
||||
private String taskId = null;
|
||||
|
||||
@Parameter(property="taskPropertyValues")
|
||||
|
||||
@Parameter(property = "taskPropertyValues")
|
||||
private List<String> taskPropertyValues;
|
||||
|
||||
@Parameter(defaultValue="false",property="verbose")
|
||||
|
||||
@Parameter(defaultValue = "false", property = "verbose")
|
||||
private boolean verbose = false;
|
||||
|
||||
@Parameter(defaultValue="true",property="failOnError")
|
||||
|
||||
@Parameter(defaultValue = "true", property = "failOnError")
|
||||
private boolean failOnError = true;
|
||||
|
||||
|
||||
private void executeLanguageTask() throws MojoExecutionException {
|
||||
if (taskPropertyValues==null) {
|
||||
if (taskPropertyValues == null) {
|
||||
taskPropertyValues = new ArrayList<String>(10);
|
||||
}
|
||||
if (verbose) {
|
||||
getLog().info("Verbose: "+verbose);
|
||||
getLog().info("Fail on error: "+failOnError);
|
||||
getLog().info("Verbose: " + verbose);
|
||||
getLog().info("Fail on error: " + failOnError);
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (verbose) {
|
||||
getLog().info("Starting "+getTaskId()+" for "+getLanguageName()); //+":"+languageVersion
|
||||
getLog().info("Starting " + getTaskId() + " for " + getLanguageName()); // +":"+languageVersion
|
||||
}
|
||||
List<X4OTaskProperty> taskProperties = new ArrayList<X4OTaskProperty>(20);
|
||||
for (String taskPropertyLine:taskPropertyValues) {
|
||||
for (String taskPropertyLine : taskPropertyValues) {
|
||||
taskProperties.add(X4OTaskProperty.parseLine(taskPropertyLine));
|
||||
}
|
||||
try {
|
||||
X4OTaskRunner.runTask(getLanguageName(),getLanguageVersion(), getTaskId(), taskProperties);
|
||||
X4OTaskRunner.runTask(getLanguageName(), getLanguageVersion(), getTaskId(), taskProperties);
|
||||
} catch (X4OLanguageTaskException e) {
|
||||
throw new MojoExecutionException("Error while running task: "+getTaskId()+" error: "+e.getMessage(),e);
|
||||
throw new MojoExecutionException("Error while running task: " + getTaskId() + " error: " + e.getMessage(), e);
|
||||
}
|
||||
long stopTime = System.currentTimeMillis();
|
||||
String taskName = getLanguageName();
|
||||
if (getLanguageVersion() != null) {
|
||||
taskName += ":"+getLanguageVersion();
|
||||
taskName += ":" + getLanguageVersion();
|
||||
}
|
||||
getLog().info("Done " + getTaskId() + " for " + taskName + " in " + (stopTime-startTime) + " ms.");
|
||||
getLog().info("Done " + getTaskId() + " for " + taskName + " in " + (stopTime - startTime) + " ms.");
|
||||
}
|
||||
|
||||
|
||||
public void execute() throws MojoExecutionException {
|
||||
try {
|
||||
executeLanguageTask();
|
||||
|
|
@ -103,76 +103,78 @@ public class X4OLanguageTaskMojo extends AbstractMojo {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<String> getTaskPropertyValues() {
|
||||
return taskPropertyValues;
|
||||
}
|
||||
|
||||
|
||||
public void addTaskPropertyValue(String taskPropertyLine) {
|
||||
taskPropertyValues.add(taskPropertyLine);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the verbose
|
||||
*/
|
||||
public boolean isVerbose() {
|
||||
return verbose;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param verbose the verbose to set
|
||||
*/
|
||||
public void setVerbose(boolean verbose) {
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the failOnError
|
||||
*/
|
||||
public boolean isFailOnError() {
|
||||
return failOnError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param failOnError the failOnError to set
|
||||
*/
|
||||
public void setFailOnError(boolean failOnError) {
|
||||
this.failOnError = failOnError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the languageName
|
||||
*/
|
||||
public String getLanguageName() {
|
||||
return languageName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param languageName the languageName to set
|
||||
*/
|
||||
public void setLanguageName(String languageName) {
|
||||
this.languageName = languageName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the languageVersion
|
||||
*/
|
||||
public String getLanguageVersion() {
|
||||
return languageVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param languageVersion the languageVersion to set
|
||||
*/
|
||||
public void setLanguageVersion(String languageVersion) {
|
||||
this.languageVersion = languageVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the taskId
|
||||
*/
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskId the taskId to set
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -44,77 +44,57 @@ public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase {
|
|||
protected void tearDown() throws Exception {
|
||||
super.tearDown(); // required
|
||||
}
|
||||
|
||||
private void executeGoal(String goal,String testFile) throws Exception {
|
||||
|
||||
private void executeGoal(String goal, String testFile) throws Exception {
|
||||
File pom = getTestFile(testFile);
|
||||
assertNotNull(pom);
|
||||
assertTrue(pom.exists());
|
||||
X4OLanguageTaskMojo mojo = (X4OLanguageTaskMojo) lookupMojo(goal,pom);
|
||||
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);
|
||||
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");
|
||||
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);
|
||||
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);
|
||||
}
|
||||
*/
|
||||
* 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); }
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue