EasyMock.expect(context.getSessionScope()).andReturn(
new HashMap<String, Object>()).anyTimes();
EasyMock.expect(context.getRequestLocale()).andReturn(null).anyTimes();
EasyMock.replay(context);
Definition definition = factory.getDefinition("rewrite.test", context);
assertNotNull("rewrite.test definition not found.", definition);
assertEquals("Incorrect initial template value", "/test.jsp",
definition.getTemplateAttribute().getValue());
Refreshable reloadable = (Refreshable) factory;
assertEquals("Factory should be fresh.", false,
reloadable.refreshRequired());
// Make sure the system actually updates the timestamp.
Thread.sleep(SLEEP_MILLIS);
// Set up multiple data sources.
xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
+ "<!DOCTYPE tiles-definitions PUBLIC "
+ "\"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN\" "
+ "\"http://tiles.apache.org/dtds/tiles-config_2_0.dtd\">\n\n"
+ "<tiles-definitions>"
+ "<definition name=\"rewrite.test\" template=\"/newtest.jsp\">"
+ "<put-attribute name=\"testparm\" value=\"testval\"/>"
+ "</definition>"
+ "</tiles-definitions>";
file = new File(uri);
fileOut = new FileOutputStream(file);
writer = new BufferedWriter(new OutputStreamWriter(fileOut));
writer.write(xml);
writer.close();
assertEquals("Factory should be stale.", true,
reloadable.refreshRequired());
reloadable.refresh();
definition = factory.getDefinition("rewrite.test", context);
assertNotNull("rewrite.test definition not found.", definition);
assertEquals("Incorrect initial template value", "/newtest.jsp",
definition.getTemplateAttribute().getValue());
}