Handle test resources in a more standard way as well.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2810 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2010-08-27 00:51:49 +00:00
parent 83e1c95c34
commit 08fa16d2d8
20 changed files with 13 additions and 12 deletions
+4 -2
View File
@@ -40,6 +40,9 @@
<fileset dir="${src.dir}" includes="**/*.properties"/>
<fileset dir="${src.dir}" includes="**/*.tmpl"/>
</copy>
<copy todir="${tclasses.dir}">
<fileset dir="src/test/resources" includes="**"/>
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset refid="${app.name}.libs"/>
</copy>
@@ -142,11 +145,10 @@
<classpath>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
<pathelement location="${basedir}"/> <!-- for rsrc/ -->
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
<fileset dir="lib/test" includes="*.jar"/>
</classpath>
<sysproperty key="test_dir" value="${basedir}"/>
<sysproperty key="test_dir" value="${tclasses.dir}"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${test.dir}">
@@ -44,7 +44,7 @@ public class SiteResourceLoaderTest
// now create a resource loader and load up some resources
SiteResourceLoader loader = new SiteResourceLoader(
ident, TestUtil.getResourcePath("rsrc/servlet/srl"));
ident, TestUtil.getResourcePath("servlet/srl"));
try {
testResourceLoader(SiteIdentifier.DEFAULT_SITE_ID,
@@ -67,7 +67,7 @@ public class SiteResourceLoaderTest
appendResource(siteId, gen, loader, "/footer.txt");
StringBuffer cmp = new StringBuffer();
compareFile = "rsrc/servlet/srl/" + compareFile;
compareFile = "servlet/srl/" + compareFile;
InputStream cin = TestUtil.getResourceAsStream(compareFile);
if (cin == null) {
throw new IOException("Unable to load " + compareFile);
@@ -96,7 +96,7 @@ public class SiteResourceLoaderTest
if (rin == null) {
// fall back to the "default" resource if we couldn't load a
// site-specific version
String rpath = "rsrc/servlet/srl/default/" + path;
String rpath = "servlet/srl/default/" + path;
rpath = TestUtil.getResourcePath(rpath);
rin = new FileInputStream(rpath);
}
@@ -34,7 +34,7 @@ public class ConfigTest
@Test
public void runTest ()
{
PrefsConfig config = new PrefsConfig("rsrc/util/test");
PrefsConfig config = new PrefsConfig("util/test");
System.out.println("prop1: " + config.getValue("prop1", 1));
System.out.println("prop2: " + config.getValue("prop2", "two"));
@@ -70,7 +70,7 @@ public class ConfigUtilTest
public void runTest ()
{
try {
String path = "rsrc/util/test.properties";
String path = "util/test.properties";
Properties props = ConfigUtil.loadInheritedProperties(path);
assertTrue("props valid", props.toString().equals(DUMP));
@@ -42,7 +42,7 @@ public class VelocityTest
StringWriter writer = new StringWriter();
VelocityEngine engine = VelocityUtil.createEngine();
engine.mergeTemplate("com/samskivert/velocity/tests/test.tmpl", "UTF-8", ctx, writer);
engine.mergeTemplate("velocity/test.tmpl", "UTF-8", ctx, writer);
assertTrue(writer.toString().trim().equals("Hello bar."));
}
@@ -67,8 +67,7 @@ public class SetFieldRuleTest
digester.addRule("object/stringArrayField", new SetFieldRule("stringArrayField"));
try {
String xmlpath =
TestUtil.getResourcePath("rsrc/xml/setfieldtest.xml");
String xmlpath = TestUtil.getResourcePath("xml/setfieldtest.xml");
InputStream input = new FileInputStream(xmlpath);
digester.parse(input);
input.close();
@@ -3,7 +3,7 @@
#
# A test properties file
_extends = rsrc/util/grandparent.properties
_extends = util/grandparent.properties
prop1 = 13
prop2 = nine
@@ -3,7 +3,7 @@
#
# A test properties file
_extends = rsrc/util/parent.properties
_extends = util/parent.properties
prop1 = 25
prop2 = twenty five