You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/12/06 08:52:00 UTC
svn commit: r482952 - in /db/ddlutils/trunk: build.properties build.xml
src/test-summary/ src/test-summary/moinmoin.xsl
src/test/org/apache/ddlutils/TestSummaryCreatorTask.java
Author: tomdz
Date: Tue Dec 5 23:51:59 2006
New Revision: 482952
URL: http://svn.apache.org/viewvc?view=rev&rev=482952
Log:
Added MoinMoin compatible output generation to the test summary task
Added:
db/ddlutils/trunk/src/test-summary/
db/ddlutils/trunk/src/test-summary/moinmoin.xsl
Modified:
db/ddlutils/trunk/build.properties
db/ddlutils/trunk/build.xml
db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java
Modified: db/ddlutils/trunk/build.properties
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/build.properties?view=diff&rev=482952&r1=482951&r2=482952
==============================================================================
--- db/ddlutils/trunk/build.properties (original)
+++ db/ddlutils/trunk/build.properties Tue Dec 5 23:51:59 2006
@@ -37,24 +37,26 @@
dist.dir=dist
doc.dir=doc
-project-name=DdlUtils
-version=1.0-RC1
-dist-filename-prefix=${project-name}-${version}
+dist.name=DdlUtils
+dist.vendor=Apache Software Foundation
+dist.version=1.0-RC1
+dist.filename.prefix=${dist.name}-${dist.version}
checkstyle.version.pattern=\\$Revision.*\\$
checkstyle.author.pattern=\\S
checkstyle.license.file=${src.check.dir}/license-check.txt
-test.profile.directory=src/test-profiles
+test.profile.dir=${src.dir}/test-profiles
+test.summary.dir=${src.dir}/test-summary
#
# Documentation properties
#
-javadoc.title=${project-name} ${version} API Documentation
+javadoc.title=${dist.name} ${dist.version} API Documentation
javadoc.footer=Copyright © 2005-2006 Apache Software Foundation. All Rights Reserved.
-antdoc.title=${project-name} ${version} Ant Tasks
+antdoc.title=${dist.name} ${dist.version} Ant Tasks
antdoc.templates.dir=${src.antdoc.dir}/templates
forrest.antdoc.destdir=${build.doc.dir}/src/documentation/content/ant
Modified: db/ddlutils/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/build.xml?view=diff&rev=482952&r1=482951&r2=482952
==============================================================================
--- db/ddlutils/trunk/build.xml (original)
+++ db/ddlutils/trunk/build.xml Tue Dec 5 23:51:59 2006
@@ -69,9 +69,20 @@
<fileset dir="${src.java.dir}"
excludes="**/*.java"/>
</copy>
- <jar jarfile="${dist.dir}/${dist-filename-prefix}.jar"
+ <jar jarfile="${dist.dir}/${dist.filename.prefix}.jar"
basedir="${build.java.dir}"
- excludes="**/package.html"/>
+ excludes="**/package.html">
+ <manifest>
+ <attribute name="Built-By" value="${java.version} (${java.vendor})"/>
+ <attribute name="Package" value="org.apache.ddlutils"/>
+ <attribute name="Extension-Name" value="ddlutils"/>
+ <attribute name="Specification-Version" value="${dist.version}"/>
+ <attribute name="Specification-Vendor" value="${dist.vendor}"/>
+ <attribute name="Specification-Title" value="${dist.name}"/>
+ <attribute name="Implementation-Version" value="${dist.version}"/>
+ <attribute name="Implementation-Vendor" value="${dist.vendor}"/>
+ </manifest>
+ </jar>
</target>
<target name="clean"
@@ -249,7 +260,7 @@
<!-- ================================================================== -->
<target name="doc-archive" depends="doc"
description="Builds the complete documentation archive.">
- <zip zipfile="${dist.dir}/${dist-filename-prefix}-doc.zip"
+ <zip zipfile="${dist.dir}/${dist.filename.prefix}-doc.zip"
basedir="."
includes="doc/**"/>
</target>
@@ -302,27 +313,29 @@
</target>
<!-- ================================================================== -->
- <!-- Runs the test cases against HsqlDb -->
+ <!-- Runs the test cases against AxionDB -->
<!-- ================================================================== -->
- <target name="junit-hsqldb"
- description="Runs the test cases against Hsqldb">
- <property name="jdbc.properties.file" value="/jdbc.properties.hsqldb"/>
+ <target name="junit-axion"
+ description="Runs the test cases against Axion">
+ <property name="jdbc.properties.file" value="/jdbc.properties.axion"/>
<antcall target="-junit-internal"/>
</target>
<!-- ================================================================== -->
- <!-- Runs the test cases against AxionDB -->
+ <!-- Runs the test cases against Derby -->
<!-- ================================================================== -->
- <target name="junit-axion"
- description="Runs the test cases against axion">
- <condition property="jdbc.properties.file" value="${test.profile.directory}/${profile}/jdbc.properties.axion">
- <isset property="profile"/>
- </condition>
- <condition property="jdbc.properties.file" value="/jdbc.properties.axion">
- <not>
- <isset property="jdbc.properties.file"/>
- </not>
- </condition>
+ <target name="junit-derby"
+ description="Runs the test cases against Derby">
+ <property name="jdbc.properties.file" value="/jdbc.properties.derby"/>
+ <antcall target="-junit-internal"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Runs the test cases against HsqlDb -->
+ <!-- ================================================================== -->
+ <target name="junit-hsqldb"
+ description="Runs the test cases against Hsqldb">
+ <property name="jdbc.properties.file" value="/jdbc.properties.hsqldb"/>
<antcall target="-junit-internal"/>
</target>
@@ -330,15 +343,8 @@
<!-- Runs the test cases against MySQL -->
<!-- ================================================================== -->
<target name="junit-mysql"
- description="Runs the test cases against mysql">
- <condition property="jdbc.properties.file" value="${test.profile.directory}/${profile}/jdbc.properties.mysql">
- <isset property="profile"/>
- </condition>
- <condition property="jdbc.properties.file" value="/jdbc.properties.mysql">
- <not>
- <isset property="jdbc.properties.file"/>
- </not>
- </condition>
+ description="Runs the test cases against MySql">
+ <property name="jdbc.properties.file" value="/jdbc.properties.mysql"/>
<antcall target="-junit-internal"/>
</target>
@@ -394,12 +400,17 @@
<taskdef name="testSummary"
classname="org.apache.ddlutils.TestSummaryCreatorTask"
classpathref="compilation-classpath"/>
- <testSummary>
+ <testSummary version="${dist.version}"
+ outputfile="${build.test.dir}/summary.xml">
<fileset dir="${build.test.dir}"
casesensitive="false">
<include name="test*.xml"/>
</fileset>
</testSummary>
+ <property name="test.summary.stylesheet" value="${test.summary.dir}/moinmoin.xsl"/>
+ <style in="${build.test.dir}/summary.xml"
+ style="${test.summary.stylesheet}"
+ out="${build.test.dir}/summary.txt"/>
</target>
<!-- ================================================================== -->
@@ -416,7 +427,7 @@
</condition>
</fail>
- <taskdef resource="checkstyletask.properties"
+ <taskdef resource="checkstyletask.properties"
classpathref="compilation-classpath"/>
<checkstyle config="${src.check.dir}/ddlutils-checks.xml"
Added: db/ddlutils/trunk/src/test-summary/moinmoin.xsl
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test-summary/moinmoin.xsl?view=auto&rev=482952
==============================================================================
--- db/ddlutils/trunk/src/test-summary/moinmoin.xsl (added)
+++ db/ddlutils/trunk/src/test-summary/moinmoin.xsl Tue Dec 5 23:51:59 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!--
+ This is a stylesheet to transform the output of the TestSummaryCreatorTask
+ to the MoinMoin wiki format suitable for posting to DdlUtils' wiki.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="no"/>
+<xsl:strip-space elements="*"/>
+<xsl:template match="/summary/general">
+----
+=== Test run on <xsl:value-of select="@date"/> using DdlUtils version <xsl:value-of select="@ddlUtilsVersion"/> ===
+
+''' System info '''
+||||||<tablestyle="border: 0px hidden;">||
+||<style="border: 0px hidden;">Java version:||<style="border: 0px hidden;"><xsl:value-of select="@jre"/>||
+||<style="border: 0px hidden;">Operating system:||<style="border: 0px hidden;"><xsl:value-of select="@os"/>||
+||<style="border: 0px hidden;">Language setting:||<style="border: 0px hidden;"><xsl:value-of select="@lang"/>||
+
+''' Database and JDBC info '''
+||||||<tablestyle="border: 0px hidden;">||
+||<style="border: 0px hidden;">Database:||<style="border: 0px hidden;"><xsl:value-of select="@dbProductName"/>||
+||<style="border: 0px hidden;">Database version:||<style="border: 0px hidden;"><xsl:value-of select="@dbProductVersion"/>||
+||<style="border: 0px hidden;">Database product version:||<style="border: 0px hidden;"><xsl:value-of select="@dbVersion"/>||
+||<style="border: 0px hidden;">JDBC data source class:||<style="border: 0px hidden;">`<xsl:value-of select="@dataSourceClass"/>`||
+||<style="border: 0px hidden;">JDBC driver:||<style="border: 0px hidden;"><xsl:value-of select="@driverName"/>||
+||<style="border: 0px hidden;">JDBC driver version:||<style="border: 0px hidden;"><xsl:value-of select="@driverVersion"/>||
+||<style="border: 0px hidden;">JDBC version:||<style="border: 0px hidden;"><xsl:value-of select="@jdbcVersion"/>||
+
+''' Test summary '''
+||||||<tablestyle="border: 0px hidden;">||
+||<style="border: 0px hidden;">Number of tests run:||<style="border: 0px hidden;"><xsl:value-of select="@tests"/>||
+||<style="border: 0px hidden;">Number of errors:||<style="border: 0px hidden;"><xsl:value-of select="@errors"/>||
+||<style="border: 0px hidden;">Number of test failures:||<style="border: 0px hidden;"><xsl:value-of select="@failures"/>||
+<xsl:if test="../failedTest">
+''' Failed tests '''[[BR]]
+<xsl:apply-templates/>
+</xsl:if>
+</xsl:template>
+<xsl:template match="failedTest">
+<xsl:text> `</xsl:text>
+<xsl:choose>
+ <xsl:when test="string-length(@name) > 0"><xsl:value-of select="@name"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@testsuite"/></xsl:otherwise>
+</xsl:choose>
+<xsl:text>`[[BR]]
+</xsl:text>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java?view=diff&rev=482952&r1=482951&r2=482952
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestSummaryCreatorTask.java Tue Dec 5 23:51:59 2006
@@ -59,12 +59,24 @@
*/
public class TestSummaryCreatorTask extends Task
{
+ /** The DdlUtils version. */
+ private String _version;
/** The file to write the snippet to. */
- private File _outputFile = null;
+ private File _outputFile;
/** The input files. */
private ArrayList _fileSets = new ArrayList();
/**
+ * Set the DdlUtils version used to run the tests.
+ *
+ * @param version The version
+ */
+ public void setVersion(String version)
+ {
+ _version = version;
+ }
+
+ /**
* Set the output file.
*
* @param outputFile The output file
@@ -186,8 +198,12 @@
generalElement = summaryDoc.getRootElement().addElement("general");
// General run info (we only need this once)
- generalElement.addAttribute("date", getAttrValue(testDoc, "//property[@name='TODAY']", "value"));
- generalElement.addAttribute("lang", getAttrValue(testDoc, "//property[@name='env.LANG']", "value"));
+ generalElement.addAttribute("ddlUtilsVersion",
+ _version);
+ generalElement.addAttribute("date",
+ getAttrValue(testDoc, "//property[@name='TODAY']", "value"));
+ generalElement.addAttribute("lang",
+ getAttrValue(testDoc, "//property[@name='env.LANG']", "value"));
generalElement.addAttribute("jre",
getAttrValue(testDoc, "//property[@name='java.runtime.name']", "value") + " " +
getAttrValue(testDoc, "//property[@name='java.runtime.version']", "value") + " (" +
@@ -196,7 +212,8 @@
getAttrValue(testDoc, "//property[@name='os.name']", "value") + " " +
getAttrValue(testDoc, "//property[@name='os.version']", "value") + ", arch " +
getAttrValue(testDoc, "//property[@name='os.arch']", "value"));
- addTargetDatabaseInfo(generalElement, getAttrValue(testDoc, "//property[@name='jdbc.properties.file']", "value"));
+ addTargetDatabaseInfo(generalElement,
+ getAttrValue(testDoc, "//property[@name='jdbc.properties.file']", "value"));
}
else
{
@@ -301,8 +318,6 @@
element.addAttribute("platform", platformName);
element.addAttribute("dataSourceClass", dataSourceClass);
- // TODO: we're also interested in the specific versions of the DB and the JDBC driver
- // used as well as the used data source
conn = dataSource.getConnection();
metaData = conn.getMetaData();