merge up to trunk rev 922991

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/branches/solr@922996 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-03-14 22:58:18 +00:00
commit 43924496f8
2 changed files with 12 additions and 4 deletions

View File

@ -261,6 +261,9 @@ Other Changes
* SOLR-1776: DismaxQParser and ExtendedDismaxQParser now use the schema.xml
"defaultSearchField" as the default value for the "qf" param instead of failing
with an error when "qf" is not specified. (hossman)
* SOLR-1821: Fix TimeZone-dependent test failure in TestEvaluatorBag.
(Chris Male via rmuir)
Build
----------------------

View File

@ -123,15 +123,20 @@ public class TestEvaluatorBag {
ContextImpl context = new ContextImpl(null, resolver, null, Context.FULL_DUMP, Collections.EMPTY_MAP, null, null);
Context.CURRENT_CONTEXT.set(context);
try {
long time = System.currentTimeMillis();
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(time - 2*86400*1000)),
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DAY_OF_YEAR, -2);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(calendar.getTime()),
dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH:mm'", Context.CURRENT_CONTEXT.get()));
calendar = new GregorianCalendar();
Date date = calendar.getTime();
Map<String, Object> map = new HashMap<String, Object>();
map.put("key", new Date(time));
map.put("key", date);
resolver.addNamespace("A", map);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(time)),
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date),
dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm'", Context.CURRENT_CONTEXT.get()));
} finally {
Context.CURRENT_CONTEXT.remove();