Last commit before renaming.
This commit is contained in:
parent
798c755293
commit
b59663a45f
4 changed files with 216 additions and 196 deletions
|
@ -7,5 +7,6 @@
|
|||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
|
||||
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
|
||||
<classpathentry kind="output" path="build/classes"/>
|
||||
</classpath>
|
||||
|
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/build
|
||||
/dist
|
||||
/build_demo
|
||||
/build_test
|
18
build.xml
18
build.xml
|
@ -26,7 +26,7 @@
|
|||
|
||||
<!-- ******* build ******* -->
|
||||
<target name="build_xid" depends="init">
|
||||
<javac srcdir="${src}" destdir="${build}/classes" debug="${debug}" deprecation="on">
|
||||
<javac srcdir="${src}" destdir="${build}/classes" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
</classpath>
|
||||
|
@ -37,15 +37,15 @@
|
|||
<!-- ****** dist_xid ****** -->
|
||||
<target name="dist_xid" depends="build_xid">
|
||||
<jar update="no" jarfile="dist/xid.jar">
|
||||
<fileset dir="build/classes" includes="xid/**.class" />
|
||||
<fileset dir="resources" includes="**" />
|
||||
<fileset dir="build/classes" />
|
||||
<fileset dir="resources" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ******* build_test ******* -->
|
||||
<target name="build_test" depends="dist_xid">
|
||||
<javac srcdir="test" destdir="build_test/classes" debug="${debug}" deprecation="on">
|
||||
<javac srcdir="test" destdir="build_test/classes" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
<pathelement path="dist/xid.jar"/>
|
||||
|
@ -57,8 +57,8 @@
|
|||
<!-- ****** dist_test ****** -->
|
||||
<target name="dist_test" depends="build_test">
|
||||
<jar update="no" jarfile="dist/test.jar">
|
||||
<fileset dir="build_tests/classes" includes="xid/tests/**.class" />
|
||||
<fileset dir="resources" includes="**" />
|
||||
<fileset dir="build_test/classes" />
|
||||
<fileset dir="resources" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
|
||||
<!-- ******* build_demo ******* -->
|
||||
<target name="build_demo" depends="dist_xid">
|
||||
<javac srcdir="demo" destdir="build_demo/classes" debug="${debug}" deprecation="on">
|
||||
<javac srcdir="demo" destdir="build_demo/classes" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
<pathelement path="dist/xid.jar"/>
|
||||
|
@ -90,8 +90,8 @@
|
|||
<!-- ****** dist_demo ****** -->
|
||||
<target name="dist_demo" depends="build_demo">
|
||||
<jar update="no" jarfile="dist/demo.jar">
|
||||
<fileset dir="build_demo/classes" includes="**.class" />
|
||||
<fileset dir="resources" includes="**" />
|
||||
<fileset dir="build_demo/classes" />
|
||||
<fileset dir="resources" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
|
|
|
@ -2,14 +2,31 @@
|
|||
* XidTest.
|
||||
*/
|
||||
|
||||
|
||||
import fr.devinsy.xid.*;
|
||||
import fr.devinsy.xid.Data;
|
||||
import fr.devinsy.xid.IdData;
|
||||
import fr.devinsy.xid.StringPresenter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class XidTest
|
||||
{
|
||||
public enum MONTHS
|
||||
{
|
||||
JANUARY,
|
||||
FEBRUARY,
|
||||
MARCH,
|
||||
APRIL,
|
||||
MAY,
|
||||
JUNE,
|
||||
JULY,
|
||||
AUGUST,
|
||||
SEPTEMBER,
|
||||
OCTOBER,
|
||||
NOVEMBRE,
|
||||
DECEMBRE
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
// Initialize logger.
|
||||
|
@ -17,15 +34,13 @@ class XidTest
|
|||
|
||||
org.apache.log4j.Logger log = null;
|
||||
log = org.apache.log4j.Logger.getRootLogger();
|
||||
log = org.apache.log4j.Logger.getLogger (XidDemo.class);
|
||||
log = org.apache.log4j.Logger.getLogger(XidTest.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static String check (String title, StringBuffer source, String model)
|
||||
public static String check(final String title, final StringBuffer source, final String model)
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -39,25 +54,20 @@ class XidTest
|
|||
result = String.format("%-40s [ OK ] ", title);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
public enum MONTHS {JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBRE, DECEMBRE};
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
public static void main(final String[] args)
|
||||
{
|
||||
System.out.println("Automatic test action for Xid!");
|
||||
|
||||
|
||||
Data datas;
|
||||
IdData tag;
|
||||
|
||||
|
||||
String htmlSource;
|
||||
StringBuffer html;
|
||||
|
||||
|
@ -77,7 +87,6 @@ class XidTest
|
|||
|
||||
System.out.println(check("only content change", html, "<div id=\"name\">Superman</div>"));
|
||||
|
||||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
datas = new Data();
|
||||
|
@ -95,7 +104,8 @@ class XidTest
|
|||
System.out.println(exception.getMessage());
|
||||
html = null;
|
||||
}
|
||||
System.out.println (check ("content and attributes", html, "<div id=\"lastname\" style=\"background: blue;foreground: red;\" class=\"nameClass\">Spiderman</div>"));
|
||||
System.out.println(check("content and attributes", html,
|
||||
"<div id=\"lastname\" style=\"background: blue;foreground: red;\" class=\"nameClass\">Spiderman</div>"));
|
||||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
|
@ -149,97 +159,102 @@ class XidTest
|
|||
html = null;
|
||||
}
|
||||
|
||||
System.out.println (check ("table 1 assertion 1", html, "<tr id=\"identity_0\"><td>noid</td><td id=\"nom_0\">Jemba</td><td id=\"prenom_0\">Epo</td></tr>"));
|
||||
System.out.println (check ("table 1 assertion 2", html, "<tr id=\"identity_1\"><td>noid</td><td id=\"nom_1\">Momon</td><td id=\"prenom_1\">Christian</td></tr>"));
|
||||
System.out.println (check ("table 1 assertion 3", html, "<tr id=\"identity_2\"><td>noid</td><td id=\"nom_2\">Tronche</td><td id=\"prenom_2\">Christophe</td></tr>"));
|
||||
System.out
|
||||
.println(check("table 1 assertion 1", html, "<tr id=\"identity_0\"><td>noid</td><td id=\"nom_0\">Jemba</td><td id=\"prenom_0\">Epo</td></tr>"));
|
||||
System.out.println(check("table 1 assertion 2", html,
|
||||
"<tr id=\"identity_1\"><td>noid</td><td id=\"nom_1\">Momon</td><td id=\"prenom_1\">Christian</td></tr>"));
|
||||
System.out.println(check("table 1 assertion 3", html,
|
||||
"<tr id=\"identity_2\"><td>noid</td><td id=\"nom_2\">Tronche</td><td id=\"prenom_2\">Christophe</td></tr>"));
|
||||
|
||||
/*
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println ("----------------------------");
|
||||
datas = new Data ();
|
||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||
datas.setContent ("identity", 1, "nom", "Momon");
|
||||
datas.setContent ("identity", 1, "prenom", "Christian");
|
||||
datas.setContent ("identity", 2, "nom", "Tronche");
|
||||
datas.setContent ("identity", 2, "prenom", "Christophe");
|
||||
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||
|
||||
|
||||
errorMessage = new StringBuffer ();
|
||||
source = new StringBuffer ();
|
||||
source.append ("<table>\n");
|
||||
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
||||
source.append (" <tr><td>noid</td><td id='nom3'>un nom</td><td id='prenom3'>un prenom</td></tr>\n");
|
||||
source.append ("</table>");
|
||||
htmlSource = source.toString ();
|
||||
|
||||
System.out.println ("datas = new Data ();");
|
||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
||||
System.out.println ("datas.setContent (\"identity\", 1, \"prenom\", \"Christian\");");
|
||||
System.out.println ("datas.setContent (\"identity\", 2, \"nom\", \"Tronche\");");
|
||||
System.out.println ("datas.setContent (\"identity\", 2, \"prenom\", \"Christophe\");");
|
||||
|
||||
System.out.println ("+");
|
||||
System.out.println (htmlSource);
|
||||
System.out.println ("=>");
|
||||
|
||||
|
||||
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||
System.out.println ("ONLY_FIRST_ROW:");
|
||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||
System.out.println (html);
|
||||
|
||||
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
System.out.println ("ONLY_ROWS_WITH_ID:");
|
||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||
System.out.println (html);
|
||||
|
||||
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
System.out.println ("ONLY_ROWS_WITHOUT_ID:");
|
||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||
System.out.println (html);
|
||||
|
||||
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||
System.out.println ("ALL_ROWS:");
|
||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||
System.out.println (html);
|
||||
|
||||
|
||||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println ("----------------------------");
|
||||
datas = new Data ();
|
||||
datas.setAttribute ("<div>", "class", "aDivClass");
|
||||
datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
||||
datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
||||
|
||||
errorMessage = new StringBuffer ();
|
||||
source = new StringBuffer ();
|
||||
source.append ("<div>\n");
|
||||
source.append (" <h1>one</h1>\n");
|
||||
source.append ("</div>\n");
|
||||
source.append ("<div id=\"number\">\n");
|
||||
source.append (" <h1>three</h1>\n");
|
||||
source.append ("</div>");
|
||||
htmlSource = source.toString ();
|
||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||
|
||||
System.out.println (htmlSource);
|
||||
System.out.println ("+");
|
||||
System.out.println ("datas = new Data ();");
|
||||
System.out.println ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
||||
System.out.println ("datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");");
|
||||
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
|
||||
|
||||
System.out.println ("=>");
|
||||
System.out.println (html);
|
||||
* // Populate attributes of Test 03. System.out.println
|
||||
* ("----------------------------"); datas = new Data ();
|
||||
* datas.setContent ("identity", 0, "nom", "Jemba"); datas.setContent
|
||||
* ("identity", 0, "prenom", "Epo"); datas.setContent ("identity", 1,
|
||||
* "nom", "Momon"); datas.setContent ("identity", 1, "prenom",
|
||||
* "Christian"); datas.setContent ("identity", 2, "nom", "Tronche");
|
||||
* datas.setContent ("identity", 2, "prenom", "Christophe");
|
||||
* datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||
* //datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
* //datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
* //datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||
*
|
||||
*
|
||||
* errorMessage = new StringBuffer (); source = new StringBuffer ();
|
||||
* source.append ("<table>\n"); source.append (
|
||||
* " <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n"
|
||||
* ); source.append (
|
||||
* " <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n"
|
||||
* ); source.append (
|
||||
* " <tr><td>noid</td><td id='nom3'>un nom</td><td id='prenom3'>un prenom</td></tr>\n"
|
||||
* ); source.append ("</table>"); htmlSource = source.toString ();
|
||||
*
|
||||
* System.out.println ("datas = new Data ();"); System.out.println
|
||||
* ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||
* System.out.println
|
||||
* ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||
* System.out.println
|
||||
* ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
||||
* System.out.println
|
||||
* ("datas.setContent (\"identity\", 1, \"prenom\", \"Christian\");");
|
||||
* System.out.println
|
||||
* ("datas.setContent (\"identity\", 2, \"nom\", \"Tronche\");");
|
||||
* System.out.println
|
||||
* ("datas.setContent (\"identity\", 2, \"prenom\", \"Christophe\");");
|
||||
*
|
||||
* System.out.println ("+"); System.out.println (htmlSource);
|
||||
* System.out.println ("=>");
|
||||
*
|
||||
*
|
||||
* datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW); System.out.println
|
||||
* ("ONLY_FIRST_ROW:"); html = Presenter.doXid (htmlSource, datas, "",
|
||||
* errorMessage); System.out.println (html);
|
||||
*
|
||||
* datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
* System.out.println ("ONLY_ROWS_WITH_ID:"); html = Presenter.doXid
|
||||
* (htmlSource, datas, "", errorMessage); System.out.println (html);
|
||||
*
|
||||
* datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
* System.out.println ("ONLY_ROWS_WITHOUT_ID:"); html = Presenter.doXid
|
||||
* (htmlSource, datas, "", errorMessage); System.out.println (html);
|
||||
*
|
||||
* datas.setIterationStrategy ("identity",
|
||||
* IdsDataByIndex.IterationStrategy.ALL_ROWS); System.out.println
|
||||
* ("ALL_ROWS:"); html = Presenter.doXid (htmlSource, datas, "",
|
||||
* errorMessage); System.out.println (html);
|
||||
*
|
||||
*
|
||||
*
|
||||
* // Populate attributes of Test 03. System.out.println
|
||||
* ("----------------------------"); datas = new Data ();
|
||||
* datas.setAttribute ("<div>", "class", "aDivClass");
|
||||
* datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
||||
* datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
||||
*
|
||||
* errorMessage = new StringBuffer (); source = new StringBuffer ();
|
||||
* source.append ("<div>\n"); source.append (" <h1>one</h1>\n");
|
||||
* source.append ("</div>\n"); source.append ("<div id=\"number\">\n");
|
||||
* source.append (" <h1>three</h1>\n"); source.append ("</div>");
|
||||
* htmlSource = source.toString (); html = Presenter.doXid (htmlSource,
|
||||
* datas, "", errorMessage);
|
||||
*
|
||||
* System.out.println (htmlSource); System.out.println ("+");
|
||||
* System.out.println ("datas = new Data ();"); System.out.println
|
||||
* ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
||||
* System.out.println (
|
||||
* "datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");"
|
||||
* ); System.out.println (
|
||||
* "datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");"
|
||||
* );
|
||||
*
|
||||
* System.out.println ("=>"); System.out.println (html);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue