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
@@ -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();
+1
View File
@@ -0,0 +1 @@
Test data for com.samskivert.servlet.SiteResourceLoaderTest
@@ -0,0 +1 @@
This is the default body.
@@ -0,0 +1 @@
This is the default footer.
@@ -0,0 +1 @@
This is the default header.
@@ -0,0 +1,3 @@
This is the default header.
This is the default body.
This is the default footer.
Binary file not shown.
@@ -0,0 +1,3 @@
This is the site1 header.
This is the default body.
This is the site1 footer.
Binary file not shown.
@@ -0,0 +1,3 @@
This is the site2 header.
This is the default body.
This is the site2 footer.
@@ -0,0 +1,7 @@
#
# $Id: grandparent.properties,v 1.1 2002/11/25 22:23:21 mdb Exp $
#
# A test properties file
sub.sub1 = 5
sub.sub2 = whee!
+12
View File
@@ -0,0 +1,12 @@
#
# $Id: parent.properties,v 1.1 2002/11/25 22:23:21 mdb Exp $
#
# A test properties file
_extends = util/grandparent.properties
prop1 = 13
prop2 = nine
prop3 = 9, 8, 7, 6
prop4 = one, two, three,, and a half, four
# prop5 = not defined
+9
View File
@@ -0,0 +1,9 @@
#
# $Id: test.properties,v 1.3 2002/11/25 22:23:21 mdb Exp $
#
# A test properties file
_extends = util/parent.properties
prop1 = 25
prop2 = twenty five
+1
View File
@@ -0,0 +1 @@
Hello ${foo}.
+7
View File
@@ -0,0 +1,7 @@
<object>
<intField>5</intField>
<stringField>howdy partner!</stringField>
<integerField>15</integerField>
<intArrayField>1, 2, 3, 4, 5</intArrayField>
<stringArrayField>one, two, three, four, five</stringArrayField>
</object>