lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r820241 - /lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java
Date Wed, 30 Sep 2009 10:55:55 GMT
Author: shalin
Date: Wed Sep 30 10:55:55 2009
New Revision: 820241

URL: http://svn.apache.org/viewvc?rev=820241&view=rev
Log:
Fix test by using a fixed date instead of NOW for comparisons

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java?rev=820241&r1=820240&r2=820241&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java
Wed Sep 30 10:55:55 2009
@@ -117,14 +117,15 @@
     Evaluator dateFormatEval = EvaluatorBag.getDateFormatEvaluator();
     resolver.context = new ContextImpl(null, resolver, null, Context.FULL_DUMP, Collections.EMPTY_MAP,
null, null);
 
-    assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()),
-            dateFormatEval.evaluate("'NOW','yyyy-MM-dd HH:mm'", resolver.context));
+    long time = System.currentTimeMillis();
+    assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(time - 2*86400*1000)),
+            dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH:mm'", resolver.context));
 
     Map<String, Object> map = new HashMap<String, Object>();
-    map.put("key", new Date());
+    map.put("key", new Date(time));
     resolver.addNamespace("A", map);
 
-    assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()),
+    assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(time)),
             dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm'", resolver.context));
   }
 



Mime
View raw message