Init commit of full project.
This commit is contained in:
parent
130d471bd9
commit
787b1174b0
286 changed files with 27010 additions and 1 deletions
17
x4o-plugin/.project
Normal file
17
x4o-plugin/.project
Normal 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-plugin/pom.xml
Normal file
32
x4o-plugin/pom.xml
Normal 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.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>x4o-plugin</artifactId>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<packaging>pom</packaging>
|
||||
<name>x4o-plugin</name>
|
||||
<description>x4o plugins for other applications</description>
|
||||
<modules>
|
||||
<module>x4o-plugin-ant-schema</module>
|
||||
<module>x4o-plugin-ant-elddoc</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>
|
||||
23
x4o-plugin/x4o-plugin-ant-elddoc/.project
Normal file
23
x4o-plugin/x4o-plugin-ant-elddoc/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>x4o-plugin-ant-elddoc</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>
|
||||
136
x4o-plugin/x4o-plugin-ant-elddoc/pom.xml
Normal file
136
x4o-plugin/x4o-plugin-ant-elddoc/pom.xml
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<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-plugin</artifactId>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<version>0.8.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>x4o-plugin-ant-elddoc</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>x4o-plugin-ant-elddoc</name>
|
||||
<description>Creates elddoc for languauge</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-elddoc</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>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<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>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="eldDocWriter" classname="org.x4o.plugin.ant.eld.doc.EldDocWriterTask" classpathref="maven.plugin.classpath"/>
|
||||
<eldDocWriter destdir="${coredir}/cel" supportclass="org.x4o.xml.eld.EldParserSupportCore"/>
|
||||
<eldDocWriter destdir="${coredir}/eld" supportclass="org.x4o.xml.eld.EldParserSupport"/>
|
||||
<eldDocWriter destdir="${coredir}/junit-test" supportclass="org.x4o.xml.test.TestParserSupport"/>
|
||||
<eldDocWriter destdir="${coredir}/junit-swixml2" supportclass="org.x4o.xml.test.swixml.SwiXmlParserSupport2"/>
|
||||
<eldDocWriter destdir="${coredir}/junit-swixml3" supportclass="org.x4o.xml.test.swixml.SwiXmlParserSupport3"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<artifactId>x4o-plugin-ant-elddoc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-elddoc</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>
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.doc;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.x4o.xml.core.X4OParserSupportException;
|
||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
||||
import org.x4o.xml.eld.doc.X4OLanguageEldDocWriter;
|
||||
|
||||
/**
|
||||
* EldDocWriterTask creates schema for language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 24, 2012
|
||||
*/
|
||||
public class EldDocWriterTask extends Task {
|
||||
|
||||
private String supportclass = null;
|
||||
private String destdir = null;
|
||||
private boolean verbose = false;
|
||||
private boolean failonerror = true;
|
||||
|
||||
/**
|
||||
* Executes the x4o eld schema task.
|
||||
* @see org.apache.tools.ant.Task#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() throws BuildException {
|
||||
try {
|
||||
executeTask();
|
||||
} catch (BuildException e) {
|
||||
if (isFailonerror()) {
|
||||
throw e;
|
||||
} else {
|
||||
log(e.getMessage(), Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void executeTask() throws BuildException {
|
||||
if (getSupportclass()==null) {
|
||||
throw new BuildException("supportclass attribute is not set.");
|
||||
}
|
||||
if (getDestdir()==null) {
|
||||
throw new BuildException("basePath attribute is not set.");
|
||||
}
|
||||
if (isVerbose()) {
|
||||
log("Execute task from: "+getLocation());
|
||||
log("destdir:"+getDestdir());
|
||||
log("supportclass:"+getSupportclass());
|
||||
log("verbose:"+isVerbose());
|
||||
log("failonerror:"+isFailonerror());
|
||||
}
|
||||
File basePathFile = new File(getDestdir());
|
||||
if (basePathFile.exists()==false) {
|
||||
throw new BuildException("destdir does not exists: "+basePathFile);
|
||||
}
|
||||
Class<?> parserSupport = null;
|
||||
try {
|
||||
parserSupport = X4OLanguageClassLoader.loadClass(getSupportclass());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new BuildException("Could not load class: "+getSupportclass(),e);
|
||||
}
|
||||
|
||||
// Config and start schema writer
|
||||
X4OLanguageEldDocWriter writer = new X4OLanguageEldDocWriter();
|
||||
writer.setBasePath(basePathFile);
|
||||
writer.setLanguageParserSupport(parserSupport);
|
||||
try {
|
||||
if (isVerbose()) {
|
||||
log("Starting writing.");
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
writer.execute();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
log("Done writing elddoc in "+(stopTime-startTime)+" ms.");
|
||||
} catch (X4OParserSupportException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the supportclass
|
||||
*/
|
||||
public String getSupportclass() {
|
||||
return supportclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supportclass the supportclass to set
|
||||
*/
|
||||
public void setSupportclass(String supportclass) {
|
||||
this.supportclass = supportclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the destdir
|
||||
*/
|
||||
public String getDestdir() {
|
||||
return destdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destdir the destdir to set
|
||||
*/
|
||||
public void setDestdir(String destdir) {
|
||||
this.destdir = destdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The ant elddoc plugin.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.doc;
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.doc;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.tools.ant.BuildFileTest;
|
||||
|
||||
/**
|
||||
* SchemaTaskTest tests the schema ant task.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 23, 2012
|
||||
*/
|
||||
public class EldDocWriterTaskTest extends BuildFileTest {
|
||||
|
||||
public void setUp() {
|
||||
configureProject("src/test/resources/tests/ant-elddoc-task.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 testEldDocEldVerbose() {
|
||||
executeTarget("test-elddoc-cel-verbose");
|
||||
assertLogContaining("verbose:");
|
||||
}
|
||||
|
||||
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 testFailSupportClass() {
|
||||
expectBuildException("test-fail-supportclass", "Should get exception id supportclass is not set.");
|
||||
}
|
||||
public void testFailSupportClassError() {
|
||||
expectBuildException("test-fail-supportclass-error", "Should get exception id supportclass throws error.");
|
||||
}
|
||||
public void testFailAllMissing() {
|
||||
expectBuildException("test-fail-all", "Should get exception with no attributes.");
|
||||
}
|
||||
public void testFailClassError() {
|
||||
expectBuildException("test-fail-class-error", "No build exception while class is missing.");
|
||||
}
|
||||
public void testFailClassErrorNo() {
|
||||
executeTarget("test-fail-class-error-no");
|
||||
assertLogContaining("Could not load class:");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?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 name="ant-elddoc-task" basedir="../../../..">
|
||||
|
||||
<property name="test.dir" value="${basedir}/target/test-elddoc/"/>
|
||||
|
||||
<target name="init">
|
||||
<taskdef name="eldDocWriter" classname="org.x4o.plugin.ant.eld.doc.EldDocWriterTask"/>
|
||||
<mkdir dir="${test.dir}"/>
|
||||
<mkdir dir="${test.dir}/test"/>
|
||||
</target>
|
||||
|
||||
<target name="test-elddoc-cel" depends="init">
|
||||
<mkdir dir="${test.dir}/cel"/>
|
||||
<eldDocWriter
|
||||
destdir="${test.dir}/cel"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-elddoc-cel-verbose" depends="init">
|
||||
<mkdir dir="${test.dir}/cel"/>
|
||||
<eldDocWriter
|
||||
verbose="true"
|
||||
destdir="${test.dir}/cel"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-elddoc-eld" depends="init">
|
||||
<mkdir dir="${test.dir}/eld"/>
|
||||
<eldDocWriter
|
||||
destdir="${test.dir}/eld"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-fail-all" depends="init">
|
||||
<eldDocWriter/>
|
||||
</target>
|
||||
<target name="test-fail-destdir" depends="init">
|
||||
<eldDocWriter supportclass="org.x4o.xml.eld.EldParserSupportCore"/>
|
||||
</target>
|
||||
<target name="test-fail-destdir-error" depends="init">
|
||||
<eldDocWriter supportclass="org.x4o.xml.eld.EldParserSupportCore" destdir="${test.dir}/no-dir"/>
|
||||
</target>
|
||||
<target name="test-fail-supportclass" depends="init">
|
||||
<eldDocWriter destdir="${test.dir}/test"/>
|
||||
</target>
|
||||
<target name="test-fail-supportclass-error" depends="init">
|
||||
<eldDocWriter destdir="${test.dir}/test" supportclass="org.x4o.xml.eld.EldErrorParserSupport"/>
|
||||
</target>
|
||||
<target name="test-fail-class-error" depends="init">
|
||||
<eldDocWriter destdir="${test.dir}/test" supportclass="non.excisting.clazz"/>
|
||||
</target>
|
||||
<target name="test-fail-class-error-no" depends="init">
|
||||
<eldDocWriter destdir="${test.dir}/test" supportclass="non.excisting.clazz" failonerror="false"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
23
x4o-plugin/x4o-plugin-ant-schema/.project
Normal file
23
x4o-plugin/x4o-plugin-ant-schema/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>x4o-plugin-ant-schema</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>
|
||||
135
x4o-plugin/x4o-plugin-ant-schema/pom.xml
Normal file
135
x4o-plugin/x4o-plugin-ant-schema/pom.xml
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<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-plugin</artifactId>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<version>0.8.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>x4o-plugin-ant-schema</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>x4o-plugin-ant-schema</name>
|
||||
<description>Creates schema for languauge</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</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-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<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>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-core/src/main/resources/META-INF"/>
|
||||
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask" classpathref="maven.plugin.classpath"/>
|
||||
<eldXsdWriter destdir="${coredir}/cel" supportclass="org.x4o.xml.eld.EldParserSupportCore"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<artifactId>x4o-plugin-ant-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>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-core/src/main/resources/META-INF"/>
|
||||
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask" classpathref="maven.plugin.classpath"/>
|
||||
<eldXsdWriter destdir="${coredir}/eld" supportclass="org.x4o.xml.eld.EldParserSupport"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<artifactId>x4o-plugin-ant-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.xsd;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.x4o.xml.core.X4OParserSupportException;
|
||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
||||
import org.x4o.xml.eld.xsd.X4OLanguageEldXsdWriter;
|
||||
|
||||
/**
|
||||
* SchemaWriterTask creates schema for language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 23, 2012
|
||||
*/
|
||||
public class EldXsdWriterTask extends Task {
|
||||
|
||||
private String nsuri = null;
|
||||
private String supportclass = null;
|
||||
private String destdir = null;
|
||||
private boolean verbose = false;
|
||||
private boolean failonerror = true;
|
||||
|
||||
/**
|
||||
* Executes the x4o eld schema task.
|
||||
* @see org.apache.tools.ant.Task#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() throws BuildException {
|
||||
try {
|
||||
executeTask();
|
||||
} catch (BuildException e) {
|
||||
if (isFailonerror()) {
|
||||
throw e;
|
||||
} else {
|
||||
log(e.getMessage(), Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void executeTask() throws BuildException {
|
||||
if (getSupportclass()==null) {
|
||||
throw new BuildException("supportclass attribute is not set.");
|
||||
}
|
||||
if (getDestdir()==null) {
|
||||
throw new BuildException("destdir attribute is not set.");
|
||||
}
|
||||
if (isVerbose()) {
|
||||
log("Execute task from: "+getLocation());
|
||||
log("destdir:"+getDestdir());
|
||||
log("supportclass:"+getSupportclass());
|
||||
log("nsuri:"+getNsuri());
|
||||
log("verbose:"+isVerbose());
|
||||
log("failonerror:"+isFailonerror());
|
||||
}
|
||||
File basePathFile = new File(getDestdir());
|
||||
if (basePathFile.exists()==false) {
|
||||
throw new BuildException("destdir does not exists: "+basePathFile);
|
||||
}
|
||||
Class<?> parserSupport = null;
|
||||
try {
|
||||
parserSupport = X4OLanguageClassLoader.loadClass(getSupportclass());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new BuildException("Could not load class: "+getSupportclass(),e);
|
||||
}
|
||||
|
||||
// Config and start schema writer
|
||||
X4OLanguageEldXsdWriter writer = new X4OLanguageEldXsdWriter();
|
||||
writer.setBasePath(basePathFile);
|
||||
writer.setLanguageParserSupport(parserSupport);
|
||||
writer.setLanguageNamespaceUri(getNsuri());
|
||||
try {
|
||||
if (isVerbose()) {
|
||||
log("Starting writing.");
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
writer.execute();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
log("Done writing schema in "+(stopTime-startTime)+" ms.");
|
||||
} catch (X4OParserSupportException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nsuri
|
||||
*/
|
||||
public String getNsuri() {
|
||||
return nsuri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nsuri the nsuri to set
|
||||
*/
|
||||
public void setNsuri(String nsuri) {
|
||||
this.nsuri = nsuri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the supportclass
|
||||
*/
|
||||
public String getSupportclass() {
|
||||
return supportclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supportclass the supportclass to set
|
||||
*/
|
||||
public void setSupportclass(String supportclass) {
|
||||
this.supportclass = supportclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the destdir
|
||||
*/
|
||||
public String getDestdir() {
|
||||
return destdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destdir the destdir to set
|
||||
*/
|
||||
public void setDestdir(String destdir) {
|
||||
this.destdir = destdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The ant x4o schema plugin.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.xsd;
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.x4o.plugin.ant.eld.xsd;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.tools.ant.BuildFileTest;
|
||||
|
||||
/**
|
||||
* SchemaTaskTest tests the schema ant task.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 23, 2012
|
||||
*/
|
||||
public class EldXsdWriterTaskTest extends BuildFileTest {
|
||||
|
||||
public void setUp() {
|
||||
configureProject("src/test/resources/tests/ant-schema-task.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 two 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 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 testFailSupportClass() {
|
||||
expectBuildException("test-fail-supportclass", "Should get exception id supportclass is not set.");
|
||||
}
|
||||
public void testFailSupportClassError() {
|
||||
expectBuildException("test-fail-supportclass-error", "Should get exception id supportclass throws error.");
|
||||
}
|
||||
public void testFailAllMissing() {
|
||||
expectBuildException("test-fail-all", "Should get exception if no attributes are set.");
|
||||
}
|
||||
public void testFailClassError() {
|
||||
expectBuildException("test-fail-class-error", "No build exception while class is missing.");
|
||||
}
|
||||
public void testFailClassErrorNo() {
|
||||
executeTarget("test-fail-class-error-no");
|
||||
assertLogContaining("Could not load class:");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?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 name="ant-schema-task" basedir="../../../..">
|
||||
|
||||
<property name="test.dir" value="${basedir}/target/test-schemas/"/>
|
||||
|
||||
<target name="init">
|
||||
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask"/>
|
||||
<mkdir dir="${test.dir}"/>
|
||||
<mkdir dir="${test.dir}/test"/>
|
||||
</target>
|
||||
|
||||
<target name="test-cel-schema-full" depends="init">
|
||||
<mkdir dir="${test.dir}/cel-full"/>
|
||||
<eldXsdWriter
|
||||
destdir="${test.dir}/cel-full"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-cel-schema-single" depends="init">
|
||||
<mkdir dir="${test.dir}/cel-single"/>
|
||||
<eldXsdWriter
|
||||
destdir="${test.dir}/cel-single"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
nsuri="http://cel.x4o.org/xml/ns/cel-core"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-cel-schema-verbose" depends="init">
|
||||
<mkdir dir="${test.dir}/cel-single"/>
|
||||
<eldXsdWriter
|
||||
verbose="true"
|
||||
destdir="${test.dir}/cel-single"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
nsuri="http://cel.x4o.org/xml/ns/cel-core"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="test-fail-all" depends="init">
|
||||
<eldXsdWriter/>
|
||||
</target>
|
||||
<target name="test-fail-destdir" depends="init">
|
||||
<eldXsdWriter supportclass="org.x4o.xml.eld.EldParserSupportCore"/>
|
||||
</target>
|
||||
<target name="test-fail-destdir-error" depends="init">
|
||||
<eldXsdWriter supportclass="org.x4o.xml.eld.EldParserSupportCore" destdir="${test.dir}/no-dir"/>
|
||||
</target>
|
||||
<target name="test-fail-supportclass" depends="init">
|
||||
<eldXsdWriter destdir="${test.dir}/test"/>
|
||||
</target>
|
||||
<target name="test-fail-supportclass-error" depends="init">
|
||||
<eldXsdWriter destdir="${test.dir}/test" supportclass="org.x4o.xml.eld.EldErrorParserSupport"/>
|
||||
</target>
|
||||
<target name="test-fail-class-error" depends="init">
|
||||
<eldXsdWriter destdir="${test.dir}/test" supportclass="non.excisting.clazz"/>
|
||||
</target>
|
||||
<target name="test-fail-class-error-no" depends="init">
|
||||
<eldXsdWriter destdir="${test.dir}/test" supportclass="non.excisting.clazz" failonerror="false"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue