Moved plugin keyword to back for maven and made naming space for other

type of tools.
This commit is contained in:
Willem Cazander 2013-08-31 22:21:03 +02:00
parent c5e03779e2
commit 9775c521a4
19 changed files with 31 additions and 30 deletions

17
x4o-tool/.project Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>x4o-plugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

32
x4o-tool/pom.xml Normal file
View file

@ -0,0 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>x4o</artifactId>
<groupId>org.x4o</groupId>
<version>0.8.7-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>x4o-tool</artifactId>
<groupId>org.x4o.tool</groupId>
<packaging>pom</packaging>
<name>x4o-tool</name>
<description>x4o tools to use and plugin for other applications</description>
<modules>
<module>x4o-tool-ant-plugin</module>
<module>x4o-tool-maven-plugin</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
<configuration>
<siteDirectory>${project.basedir}/../src/site-child</siteDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>x4o-plugin-ant</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,209 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.x4o.tool</groupId>
<artifactId>x4o-tool</artifactId>
<version>0.8.7-SNAPSHOT</version>
</parent>
<artifactId>x4o-tool-ant-plugin</artifactId>
<name>x4o-tool-ant-plugin</name>
<description>x4o-tool-ant-plugin</description>
<dependencies>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-eld-doc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-testutil</artifactId>
<version>${ant-testutil.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel</artifactId>
<version>${juel.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
<configuration>
<siteDirectory>${project.basedir}/../../src/site-child</siteDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>ant-update-schema-cel</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>update-schema-cel-ant</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="coredir" value="${basedir}/../../x4o-driver/src/main/resources/META-INF" />
<taskdef name="writeLanguageSchema" classname="org.x4o.plugin.ant.X4OWriteLanguageSchemaTask" classpathref="maven.plugin.classpath" />
<writeLanguageSchema destdir="${coredir}/cel" languageName="cel" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ant-update-schema-eld</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>update-schema-eld-ant</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="coredir" value="${basedir}/../../x4o-driver/src/main/resources/META-INF" />
<taskdef name="writeLanguageSchema" classname="org.x4o.plugin.ant.X4OWriteLanguageSchemaTask" classpathref="maven.plugin.classpath" />
<writeLanguageSchema destdir="${coredir}/eld" languageName="eld" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ant-site-elddoc</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>site-elddoc-ant</id>
<phase>pre-site</phase>
<configuration>
<target>
<property name="coredir" value="${basedir}/../../target/site/elddocs" />
<mkdir dir="${coredir}/cel" />
<mkdir dir="${coredir}/eld" />
<mkdir dir="${coredir}/junit-test" />
<mkdir dir="${coredir}/junit-swixml2" />
<mkdir dir="${coredir}/junit-swixml3" />
<taskdef name="writeLanguageDoc" classname="org.x4o.plugin.ant.X4OWriteLanguageDocTask" classpathref="maven.plugin.classpath" />
<writeLanguageDoc destdir="${coredir}/cel" languageName="cel" />
<writeLanguageDoc destdir="${coredir}/eld" languageName="eld" />
<writeLanguageDoc destdir="${coredir}/junit-test" languageName="test" />
<writeLanguageDoc destdir="${coredir}/junit-swixml2" languageName="swixml" languageVersion="2.0" />
<writeLanguageDoc destdir="${coredir}/junit-swixml3" languageName="swixml" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-eld-doc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel</artifactId>
<version>${juel.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,188 @@
/*
* Copyright (c) 2004-2013, 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.ant.plugin;
import java.util.ArrayList;
import java.util.List;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.x4o.xml.lang.task.X4OLanguageTaskException;
import org.x4o.xml.lang.task.run.X4OTaskProperty;
import org.x4o.xml.lang.task.run.X4OTaskRunner;
/**
* AbstractX4OLanguageTask is base ant x4o language task executor.
*
* @author Willem Cazander
* @version 1.0 Apr 8, 2013
*/
public class X4OTask extends Task {
private String taskId = null;
private String languageName = null;
private String languageVersion = null;
private boolean verbose = false;
private boolean failonerror = true;
private List<X4OTaskProperty> taskProperties = null;
/**
* Constructs this ant x4o task.
*/
public X4OTask() {
taskProperties = new ArrayList<X4OTaskProperty>(15);
}
/**
* Adds the ant child x4oTaskProperty element.
* @param property
*/
public void addX4oTaskProperty(X4OTaskProperty property) {
taskProperties.add(property);
}
/**
* Executes the x4o eld schema task.
* @see org.apache.tools.ant.Task#execute()
*/
@Override
public void execute() throws BuildException {
try {
if (isVerbose()) {
log("Task location: "+getLocation());
log("X4O language name: "+getLanguageName());
log("X4O language version: "+getLanguageVersion());
log("Verbose: "+isVerbose());
log("Fail on error: "+isFailonerror());
}
executeLanguageTask();
} catch (BuildException e) {
if (isFailonerror()) {
throw e;
} else {
log(e.getMessage(), Project.MSG_WARN);
}
}
}
private void executeLanguageTask() throws BuildException {
if (getLanguageName()==null) {
throw new BuildException("languageName attribute is not set.");
}
if (getLanguageName().length()==0) {
throw new BuildException("languageName attribute is empty.");
}
if (getLanguageVersion()!=null && getLanguageVersion().length()==0) {
throw new BuildException("languageVersion attribute is empty.");
}
if (getTaskId()==null) {
throw new BuildException("taskId attribute is not set.");
}
if (getTaskId().length()==0) {
throw new BuildException("taskId attribute is empty.");
}
if (isVerbose()) {
log("Starting "+getTaskId());
}
long startTime = System.currentTimeMillis();
try {
X4OTaskRunner.runTask(getLanguageName(),getLanguageVersion(), getTaskId(), taskProperties);
} catch (X4OLanguageTaskException e) {
throw new BuildException(e);
}
long stopTime = System.currentTimeMillis();
log("Done "+getTaskId()+" in "+(stopTime-startTime)+" ms.");
}
/**
* @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 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 taskId
*/
public String getTaskId() {
return taskId;
}
/**
* @param taskId the taskId to set
*/
public void setTaskId(String taskId) {
this.taskId = taskId;
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2004-2013, 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.
*/
/**
* The Ant plugin tasks.
*
* @since 1.0
*/
package org.x4o.tool.ant.plugin;

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2004-2013, 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.ant.plugin;
import java.io.File;
import org.apache.tools.ant.BuildFileTest;
/**
* X4OWriteDocTaskTest tests the doc ant task.
*
* @author Willem Cazander
* @version 1.0 Aug 23, 2012
*/
public class X4OWriteLanguageDocTaskTest extends BuildFileTest {
public void setUp() {
configureProject("src/test/resources/junit/test-write-language-doc.xml");
}
public void testEldDocCel() {
executeTarget("test-elddoc-cel");
File testDir = new File("target/test-elddoc/cel");
int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testEldDocEld() {
executeTarget("test-elddoc-eld");
File testDir = new File("target/test-elddoc/eld");
int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
///assertEquals("Message was logged but should not.", getLog(), "");
//expectLog("use.message", "attribute-text");
//assertLogContaining("Nested Element 1");
}
public void testEldDocEldCustom() {
executeTarget("test-elddoc-eld-custom");
File testDir = new File("target/test-elddoc/eld-custom");
int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testEldDocEldVerbose() {
executeTarget("test-elddoc-cel-verbose");
assertLogContaining("Verbose:");
}
public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception with no attributes.");
}
public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
}
public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
}
public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set.");
}
public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
}
}

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 2004-2013, 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.ant.plugin;
import java.io.File;
import org.apache.tools.ant.BuildFileTest;
/**
* X4OWriteSchemaTaskTest tests the schema ant task.
*
* @author Willem Cazander
* @version 1.0 Aug 23, 2012
*/
public class X4OWriteLanguageSchemaTaskTest extends BuildFileTest {
public void setUp() {
configureProject("src/test/resources/junit/test-write-language-schema.xml");
}
public void testCelSchemaFull() {
executeTarget("test-cel-schema-full");
File testDir = new File("target/test-schemas/cel-full");
int files = testDir.listFiles().length;
assertEquals("Should created only 2 files", 2, files);
}
public void testCelSchemaSingle() {
executeTarget("test-cel-schema-single");
File testDir = new File("target/test-schemas/cel-single");
int files = testDir.listFiles().length;
assertEquals("Should created only one file", 1, files);
///assertEquals("Message was logged but should not.", getLog(), "");
//expectLog("use.message", "attribute-text");
//assertLogContaining("Nested Element 1");
}
public void testCelSchemaVerbose() {
executeTarget("test-cel-schema-verbose");
assertLogContaining("Verbose:");
}
public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception if no attributes are set.");
}
public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
}
public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
}
public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set.");
}
public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
}
}

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2013, 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.
-->
<project name="ant-elddoc-task" basedir="../../../..">
<property name="test.dir" value="${basedir}/target/test-elddoc/"/>
<target name="init">
<taskdef name="x4oTask" classname="org.x4o.tool.ant.plugin.X4OTask"/>
<mkdir dir="${test.dir}"/>
<mkdir dir="${test.dir}/test"/>
</target>
<target name="test-elddoc-cel" depends="init">
<mkdir dir="${test.dir}/cel"/>
<x4oTask languageName="cel" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path"
value="${test.dir}/cel"
/>
</x4oTask>
</target>
<target name="test-elddoc-cel-verbose" depends="init">
<mkdir dir="${test.dir}/cel-verbose"/>
<x4oTask languageName="cel" taskId="eld-doc" verbose="true">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path"
value="${test.dir}/cel-verbose"
/>
</x4oTask>
</target>
<target name="test-elddoc-eld" depends="init">
<mkdir dir="${test.dir}/eld"/>
<x4oTask languageName="eld" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path"
value="${test.dir}/eld"
/>
</x4oTask>
</target>
<target name="test-elddoc-eld-custom" depends="init">
<mkdir dir="${test.dir}/eld-custom"/>
<x4oTask languageName="eld" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path"
value="${test.dir}/eld-custom"
/>
<x4oTaskProperty
key="http://x4o.org/properties/content/output/charTab"
value=" "
/>
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/meta/stylesheet-thema"
value="jdk6"
/>
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/javadoc/link"
value="http://docs.oracle.com/javase/7/docs/api/"
/>
<!-- fixme map type property config
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/javadoc/link-offline"
value="http://www.x4o.org/apidocs/,file:///home/willemc/devv/git/x4o/x4o-driver/target/apidocs"
/>
-->
</x4oTask>
</target>
<target name="test-fail-all" depends="init">
<x4oTask/>
</target>
<target name="test-fail-destdir" depends="init">
<x4oTask languageName="cel"/>
</target>
<target name="test-fail-destdir-error" depends="init">
<x4oTask languageName="cel" destdir="${test.dir}/no-dir"/>
</target>
<target name="test-fail-language" depends="init">
<x4oTask destdir="${test.dir}/test"/>
</target>
<target name="test-fail-language-error" depends="init">
<x4oTask destdir="${test.dir}/test" languageName="cel-error"/>
</target>
</project>

View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2013, 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.
-->
<project name="ant-schema-task" basedir="../../../..">
<property name="test.dir" value="${basedir}/target/test-schemas/"/>
<target name="init">
<taskdef name="x4oTask" classname="org.x4o.tool.ant.plugin.X4OTask"/>
<mkdir dir="${test.dir}"/>
<mkdir dir="${test.dir}/test"/>
</target>
<target name="test-cel-schema-full" depends="init">
<mkdir dir="${test.dir}/cel-full"/>
<x4oTask languageName="cel" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path"
value="${test.dir}/cel-full"
/>
</x4oTask>
</target>
<target name="test-cel-schema-single" depends="init">
<mkdir dir="${test.dir}/cel-single"/>
<x4oTask languageName="cel" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path"
value="${test.dir}/cel-single"
/>
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/filter/namespace"
value="http://cel.x4o.org/xml/ns/cel-core"
/>
</x4oTask>
</target>
<target name="test-cel-schema-verbose" depends="init">
<mkdir dir="${test.dir}/cel-single-verbose"/>
<x4oTask languageName="cel" taskId="eld-xsd" verbose="true">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path"
value="${test.dir}/cel-single-verbose"
/>
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/filter/namespace"
value="http://cel.x4o.org/xml/ns/cel-core"
/>
</x4oTask>
</target>
<target name="test-fail-all" depends="init">
<x4oTask/>
</target>
<target name="test-fail-destdir" depends="init">
<x4oTask languageName="cel"/>
</target>
<target name="test-fail-destdir-error" depends="init">
<x4oTask languageName="cel" destdir="${test.dir}/no-dir"/>
</target>
<target name="test-fail-language" depends="init">
<x4oTask destdir="${test.dir}/test"/>
</target>
<target name="test-fail-language-error" depends="init">
<x4oTask destdir="${test.dir}/test" languageName="eld-error"/>
</target>
</project>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>x4o-plugin-maven</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,132 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.x4o.tool</groupId>
<artifactId>x4o-tool</artifactId>
<version>0.8.7-SNAPSHOT</version>
</parent>
<artifactId>x4o-tool-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>x4o-tool-maven-plugin</name>
<description>x4o-tool-maven-plugin</description>
<dependencies>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-eld-doc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
<!-- generated help mojo has a dependency to plexus-utils -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals><goal>descriptor</goal></goals>
</execution>
<execution>
<id>mojo-help</id>
<goals><goal>helpmojo</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>build-site-x4o-support</id>
<build>
<plugins>
<plugin>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-maven</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>build-site-x4o-support</id>
<phase>pre-site</phase>
<configuration>
<languageName>cel</languageName>
<taskId>eld-xsd</taskId>
<taskPropertyValues>
<taskPropertyValue>http://language.x4o.org/xml/properties/eld-xsd/output/path=${basedir}/../../target/site/x4o-support</taskPropertyValue>
</taskPropertyValues>
<!-- TODO: add exe'ids
<outputDirectory>${basedir}/../../target/site/x4o-support</outputDirectory>
<languages>
<cel>ALL</cel>
<eld>ALL</eld>
<test>ALL</test>
<swixml>2.0-3.0</swixml>
</languages>
-->
</configuration>
<goals>
<goal>x4o-language-task</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-driver</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-eld-doc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel</artifactId>
<version>${juel.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,178 @@
/*
* Copyright (c) 2004-2013, 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.util.ArrayList;
import java.util.List;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.x4o.xml.lang.task.X4OLanguageTaskException;
import org.x4o.xml.lang.task.run.X4OTaskProperty;
import org.x4o.xml.lang.task.run.X4OTaskRunner;
/**
* X4OLanguageTaskMojo can execute a task on a language.
*
* @author Willem Cazander
* @version 1.0 Apr 9, 2013
*/
@Mojo( name = X4OLanguageTaskMojo.GOAL,requiresProject=true,requiresDependencyResolution=ResolutionScope.COMPILE)
public class X4OLanguageTaskMojo extends AbstractMojo {
static public final String GOAL = "x4o-language-task";
@Parameter
private String languageName = null;
@Parameter
private String languageVersion = null;
@Parameter
private String taskId = null;
@Parameter
private List<String> taskPropertyValues;
@Parameter(defaultValue="false",property="verbose")
private boolean verbose = false;
@Parameter(defaultValue="true",property="failOnError")
private boolean failOnError = true;
private void executeLanguageTask() throws MojoExecutionException {
if (taskPropertyValues==null) {
taskPropertyValues = new ArrayList<String>(10);
}
if (verbose) {
getLog().info("Verbose: "+verbose);
getLog().info("Fail on error: "+failOnError);
}
long startTime = System.currentTimeMillis();
if (verbose) {
getLog().info("Starting "+getTaskId()+" for "+getLanguageName()); //+":"+languageVersion
}
List<X4OTaskProperty> taskProperties = new ArrayList<X4OTaskProperty>(20);
for (String taskPropertyLine:taskPropertyValues) {
taskProperties.add(X4OTaskProperty.parseLine(taskPropertyLine));
}
try {
X4OTaskRunner.runTask(getLanguageName(),getLanguageVersion(), getTaskId(), taskProperties);
} catch (X4OLanguageTaskException e) {
throw new MojoExecutionException("Error while running task: "+getTaskId()+" error: "+e.getMessage(),e);
}
long stopTime = System.currentTimeMillis();
getLog().info("Done "+getTaskId()+" for "+languageName+":"+languageVersion+" in "+(stopTime-startTime)+" ms.");
}
public void execute() throws MojoExecutionException {
try {
executeLanguageTask();
} catch (MojoExecutionException e) {
if (failOnError) {
throw e;
} else {
getLog().warn(e.getMessage());
}
}
}
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
*/
public void setTaskId(String taskId) {
this.taskId = taskId;
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2004-2013, 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.
*/
/**
* The Maven plugin mojos.
*
* @since 1.0
*/
package org.x4o.tool.maven.plugin;

View file

@ -0,0 +1,122 @@
/*
* Copyright (c) 2004-2013, 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");
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);
}
*/
}

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-tool-maven-plugin</artifactId>
<configuration>
<languageName>cel</languageName>
<taskId>eld-xsd</taskId>
<taskPropertyValues>
<taskPropertyValue>http://x4o.org/properties/eld-xsd/output/path=target/jtest/test-plugin-conf-all/cel</taskPropertyValue>
</taskPropertyValues>
<verbose>false</verbose>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-tool-maven-plugin</artifactId>
<configuration>
<languageName>cel</languageName>
<taskId>eld-xsd</taskId>
<taskPropertyValues>
<taskPropertyValue>http://x4o.org/properties/eld-xsd/output/path=target/jtest/test-plugin-conf-lang/cel</taskPropertyValue>
</taskPropertyValues>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-tool-maven-plugin</artifactId>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>