Skip to content

Commit

Permalink
updated templar, start of sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
synapticloop committed Aug 30, 2015
1 parent 62ed04b commit f56efb5
Show file tree
Hide file tree
Showing 39 changed files with 1,069 additions and 71 deletions.
3 changes: 3 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<classpathentry kind="lib" path="lib/runtime/c3p0-0.9.5-pre8.jar"/>
<classpathentry kind="lib" path="lib/runtime/metrics-core-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/runtime/JSON-java.jar" sourcepath="/JSON-java"/>
<classpathentry kind="lib" path="lib/runtime/commons-validator-1.4.1.jar"/>
<classpathentry kind="lib" path="lib/runtime/mysql-connector-java-5.1.10-bin.jar"/>
<classpathentry kind="lib" path="lib/runtime/sqlite-jdbc-3.8.11.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build-eclipse"/>
</classpath>
148 changes: 148 additions & 0 deletions build-cobertura.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-test" default="help-instructions">
<import file="build-common.xml" />
<import file="build-javac.xml" />

<!-- cobertura classpath -->
<path id="cobertura.classpath">
<fileset dir="${test.lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>

<!-- junit classpath -->
<path id="test.classpath">
<pathelement location="${build.classes.dir}" />
<pathelement location="${build.test.dir}" />
<fileset dir="${test.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${compile.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${runtime.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${util.lib.dir}">
<include name="*.jar" />
</fileset>
</path>

<target name="compile-test" depends="compile">
<mkdir dir="${build.test.dir}" />
<javac srcdir="${src.test.dir}" destdir="${build.test.dir}" classpathref="test.classpath" debug="on" target="1.6" source="1.6" includeantruntime="false" />
</target>

<!--
run the junit tests and generate the cobertura reports
-->
<target name="cobertura" depends="compile-test" description="[build-test] Compile, run and provide coverage for the junit tests">
<!-- define the cobertura task -->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

<mkdir dir="${cobertura.reports.dir}/xml" />
<mkdir dir="${cobertura.reports.dir}/html" />

<delete file="cobertura.ser" />

<cobertura-instrument todir="${build.instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${build.classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>

<mkdir dir="${junit.reports.dir}/xml" />
<mkdir dir="${junit.reports.dir}/html" />

<junit fork="yes" printsummary="yes" haltonfailure="no" failureproperty="junit.failure" showoutput="true">
<classpath location="${build.instrumented.dir}" />
<classpath refid="cobertura.classpath" />
<classpath refid="test.classpath" />

<batchtest fork="yes" todir="${junit.reports.dir}/xml" >
<fileset dir="${build.test.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
<formatter type="xml" />
</junit>

<junitreport todir="${junit.reports.dir}/xml">
<fileset dir="${junit.reports.dir}/xml">
<include name="TEST-*.xml" />
</fileset>
<report todir="${junit.reports.dir}/html" />
</junitreport>

<cobertura-report format="xml" destdir="${cobertura.reports.dir}/xml" >
<fileset dir="${src.java.dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>

<cobertura-report format="html" destdir="${cobertura.reports.dir}/html" >
<fileset dir="${src.java.dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>
<fail if="${junit.failure}" message="JUnit Tests Failed!" />
</target>

<!--
run the junit tests only
-->
<target name="junit" depends="compile-test" description="[build-test] Compile and run the junit tests only">
<mkdir dir="${junit.reports.dir}/xml" />
<mkdir dir="${junit.reports.dir}/html" />

<junit fork="yes" printsummary="yes" haltonfailure="no" failureproperty="junit.failure" showoutput="true">
<classpath refid="test.classpath" />

<batchtest fork="yes" todir="${junit.reports.dir}/xml" >
<fileset dir="${build.test.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
<formatter type="xml" />
</junit>

<junitreport todir="${junit.reports.dir}/xml">
<fileset dir="${junit.reports.dir}/xml">
<include name="TEST-*.xml" />
</fileset>
<report todir="${junit.reports.dir}/html" />
</junitreport>
<fail if="${junit.failure}" message="JUnit Tests Failed!" />
</target>

<!--
Compile all of the source files, instrument them by cobertura and jar them
up
-->
<target name="jar-instrumented" depends="compile" description="[build-test] Compile and build the instrumented classes">
<!-- define the cobertura task -->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

<cobertura-instrument todir="${build.instrumented.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>

<!--
Now jar up the instrumented classes, properties and all of the rest of
the information
-->
<jar destfile="${dist.dir}/${ant.project.name}-instrumented.jar">
<fileset dir="${build.instrumented.dir}">
<include name="**/*.class" />
</fileset>
<fileset dir="${build.classes.dir}">
<exclude name="**/*.class" />
</fileset>
</jar>
</target>
</project>
74 changes: 74 additions & 0 deletions build-common.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Common Build file with common routines
-->
<project name="build-common" basedir="." default="help-instructions">
<!--
First thing that we have to do is to download the ant contributions jar file
which should probably come from sourceforge, rather than the prodman hudson
server
-->
<property name="util.lib.dir" location="lib/util" />
<property name="compile.lib.dir" location="lib/compile" />
<property name="runtime.lib.dir" location="lib/runtime" />
<property name="test.lib.dir" location="lib/test" />

<mkdir dir="${util.lib.dir}" />
<mkdir dir="${compile.lib.dir}" />
<mkdir dir="${runtime.lib.dir}" />

<property name="src.java.dir" location="src/main/java" />
<property name="src.test.dir" value="src/test/java" />

<property name="build.dir" value="build" />
<property name="build.test.dir" location="build/test" />
<property name="build.classes.dir" value="build/classes" />

<property name="dist.dir" value="dist" />

<property name="junit.reports.dir" value="build/reports/junit"/>
<property name="cobertura.reports.dir" value="build/reports/cobertura"/>

<property name="build.instrumented.dir" value="build/classes-instrumented"/>

<import file="build-javac.xml" />

<target name="dist" depends="clean,init,compile,jar" description="[build-common] Build the distributable" />

<target name="jar" depends="compile" description="[build-common] Jar the code">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${ant.project.name}.jar">
<fileset dir="${build.classes.dir}">
<include name="**/*.*" />
</fileset>
</jar>
</target>

<target name="init" description="[build-common] Clean the build and distribution directories">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>

<target name="clean" description="[build-common] Clean the build and distribution directories">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>

<target name="help-instructions">
<echo>
! ! ! I M P O R T A N T ! ! !

This file is not designed to be invoked directly, however it is included and
invoked by each of the individual projects.
</echo>
</target>

<target name="help">
<echo>
type:
ant -p

For a complete list of available targets
</echo>
</target>
</project>
23 changes: 23 additions & 0 deletions build-javac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-javac" default="help-instructions">
<import file="build-common.xml" />

<path id="lib.path.compile">
<!--
Do a fileset so that it doesn't fall over if the runtime/compile directory
doesn't exist
-->
<fileset dir="${compile.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${runtime.lib.dir}">
<include name="*.jar"/>
</fileset>
</path>

<target name="compile" description="[build-javac] Compile the source files">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes.dir}" />
<javac srcdir="${src.java.dir}" destdir="${build.classes.dir}" classpathref="lib.path.compile" debug="on" includeantruntime="false" />
</target>
</project>
3 changes: 3 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

<import file="java-build.xml" />

<import file="build-common.xml" />
<import file="build-cobertura.xml" />

<target name="download-dependencies" description="download the code dependencies">
<copy file="../templar/dist/templar.jar" todir="lib/runtime" />
</target>
Expand Down
Binary file modified dist/h2zero.jar
Binary file not shown.
Binary file modified dist/h2zero.zip
Binary file not shown.
Binary file added lib/runtime/commons-validator-1.4.1.jar
Binary file not shown.
Binary file added lib/runtime/sqlite-jdbc-3.8.11.1.jar
Binary file not shown.
Binary file modified lib/runtime/templar.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions src/main/java/synapticloop/h2zero/H2ZeroParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ public class H2ZeroParser {
}
}

/*
* The following is used to determine the max width of the validators, for
* logging out the information through the SimpleLogger
*/
private static int maxValidatorClassNameLength = 0;
static {
for (BaseValidator validator : validators) {
Expand All @@ -167,6 +171,12 @@ public class H2ZeroParser {
}
}

/**
* Pare a .h2zero file
*
* @param file The file to be parsed
* @throws H2ZeroParseException if there was an error parsing the file
*/
public H2ZeroParser(File file) throws H2ZeroParseException {
JSONObject jsonObject = null;
try {
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/synapticloop/h2zero/ant/H2ZeroTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,6 @@ private void logDatabaseInfo(H2ZeroParser h2zeroParser) {
}
}

/**
*
* @param in the h2zero file to use as the input
* @deprecated
*/
@Deprecated
public void setIn(String in) {
getProject().log("Attribute 'in' is depecrated and __MUST__ be replced with 'inFile', exitting...", Project.MSG_ERR);
System.exit(-1);
}
public String getInFile() { return inFile; }
public void setInFile(String inFile) { this.inFile = inFile; }
public void setOutDir(String outDir) { this.outDir = outDir; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package synapticloop.h2zero.base.manager;
package synapticloop.h2zero.base.manager.mysql;

/*
* Copyright (c) 2012-2015 synapticloop.
Expand Down
Loading

0 comments on commit f56efb5

Please sign in to comment.