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,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>

252
x4o-tool-ant-plugin/pom.xml Normal file
View file

@ -0,0 +1,252 @@
<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</groupId>
<artifactId>x4o</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>
</dependency>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-eld-doc</artifactId>
</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>
<profiles>
<profile>
<id>x4o-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>x4o-update-schema-cel-run-ant</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="coredir"
value="${basedir}/../../x4o-driver/src/main/resources/META-INF" />
<property name="licesefile" value="${basedir}/../../license.txt" />
<taskdef name="x4oTask" classname="org.x4o.tool.ant.plugin.X4OTask"
classpathref="maven.plugin.classpath" />
<x4oTask languageName="cel" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/cel" />
<x4oTaskProperty
key="http://x4o.org/properties/content/prolog/licence-file"
value="${licesefile}" />
</x4oTask>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.tool</groupId>
<artifactId>x4o-tool-ant-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>x4o-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>x4o-update-schema-eld-run-ant</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="coredir"
value="${basedir}/../../x4o-driver/src/main/resources/META-INF" />
<property name="licesefile" value="${basedir}/../../license.txt" />
<taskdef name="x4oTask" classname="org.x4o.tool.ant.plugin.X4OTask"
classpathref="maven.plugin.classpath" />
<x4oTask languageName="eld" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/eld" />
<x4oTaskProperty
key="http://x4o.org/properties/content/prolog/licence-file"
value="${licesefile}" />
</x4oTask>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.tool</groupId>
<artifactId>x4o-tool-ant-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>x4o-build-site-doc</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>x4o-build-site-doc-run-ant</id>
<phase>pre-site</phase>
<configuration>
<target>
<property name="coredir"
value="${basedir}/../../target/site/x4o-support" />
<taskdef name="x4oTask" classname="org.x4o.tool.ant.plugin.X4OTask"
classpathref="maven.plugin.classpath" />
<x4oTask languageName="cel" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path" value="${coredir}/doc-cel-1.0" />
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/javadoc/link" value="http://docs.oracle.com/javase/7/docs/api/" />
</x4oTask>
<x4oTask languageName="eld" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path" value="${coredir}/doc-eld-1.0" />
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/javadoc/link" value="http://docs.oracle.com/javase/7/docs/api/" />
</x4oTask>
<x4oTask languageName="test" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path" value="${coredir}/doc-test-1.0" />
</x4oTask>
<x4oTask languageName="swixml" taskId="eld-doc"
languageVersion="2.0">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path" value="${coredir}/doc-swixml-2.0" />
</x4oTask>
<x4oTask languageName="swixml" taskId="eld-doc">
<x4oTaskProperty
key="http://x4o.org/properties/eld-doc/output/path" value="${coredir}/doc-swixml-3.0" />
</x4oTask>
<x4oTask languageName="cel" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/xsd-cel-1.0" />
</x4oTask>
<x4oTask languageName="eld" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/xsd-eld-1.0" />
</x4oTask>
<x4oTask languageName="test" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/xsd-test-1.0" />
</x4oTask>
<x4oTask languageName="swixml" taskId="eld-xsd"
languageVersion="2.0">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/xsd-swixml-2.0" />
</x4oTask>
<x4oTask languageName="swixml" taskId="eld-xsd">
<x4oTaskProperty
key="http://x4o.org/properties/eld-xsd/output/path" value="${coredir}/xsd-swixml-3.0" />
</x4oTask>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.x4o.tool</groupId>
<artifactId>x4o-tool-ant-plugin</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-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.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-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.
*/
/**
* The Ant plugin tasks.
*
* @since 1.0
*/
package org.x4o.tool.ant.plugin;

View file

@ -0,0 +1,86 @@
/*
* 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.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-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.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,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<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/char-tab"
value=" "
/>
<x4oTaskProperty
key="http://x4o.org/properties/content/output/comment-enable"
value="false"
/>
<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-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.
-->
<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>