Apache Lucene open-source search software
SOLR-4086: remove tabs
James Dyer11071d5631e1
diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.javaindex f99a71f1e18..53c1bf1cd0f 100644--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java@@ -26,132 +26,141 @@ import java.util.*;* <p>* Test for VariableResolver* </p>- *- *+ *+ ** @since solr 1.3*/public class TestVariableResolver extends AbstractDataImportHandlerTestCase {-+@Testpublic void testSimpleNamespace() {VariableResolver vri = new VariableResolver();- Map<String, Object> ns = new HashMap<String, Object>();+ Map<String,Object> ns = new HashMap<String,Object>();ns.put("world", "WORLD");vri.addNamespace("hello", ns);assertEquals("WORLD", vri.resolve("hello.world"));}-+@Test- public void testDefaults(){+ public void testDefaults() {// System.out.println(System.setProperty(TestVariableResolver.class.getName(),"hello"));- System.setProperty(TestVariableResolver.class.getName(),"hello");- // System.out.println("s.gP()"+ System.getProperty(TestVariableResolver.class.getName()));-+ System.setProperty(TestVariableResolver.class.getName(), "hello");+ // System.out.println("s.gP()"++ // System.getProperty(TestVariableResolver.class.getName()));+Properties p = new Properties();- p.put("hello","world");+ p.put("hello", "world");VariableResolver vri = new VariableResolver(p);Object val = vri.resolve(TestVariableResolver.class.getName());// System.out.println("val = " + val);assertEquals("hello", val);- assertEquals("world",vri.resolve("hello"));+ assertEquals("world", vri.resolve("hello"));}-+@Testpublic void testNestedNamespace() {VariableResolver vri = new VariableResolver();- Map<String, Object> ns = new HashMap<String, Object>();+ Map<String,Object> ns = new HashMap<String,Object>();ns.put("world", "WORLD");vri.addNamespace("hello", ns);- ns = new HashMap<String, Object>();+ ns = new HashMap<String,Object>();ns.put("world1", "WORLD1");vri.addNamespace("hello.my", ns);assertEquals("WORLD1", vri.resolve("hello.my.world1"));}-+@Testpublic void test3LevelNestedNamespace() {VariableResolver vri = new VariableResolver();- Map<String, Object> ns = new HashMap<String, Object>();+ Map<String,Object> ns = new HashMap<String,Object>();ns.put("world", "WORLD");vri.addNamespace("hello", ns);- ns = new HashMap<String, Object>();+ ns = new HashMap<String,Object>();ns.put("world1", "WORLD1");vri.addNamespace("hello.my.new", ns);assertEquals("WORLD1", vri.resolve("hello.my.new.world1"));}-+@Testpublic void dateNamespaceWithValue() {VariableResolver vri = new VariableResolver();- vri.setEvaluators(new DataImporter().getEvaluators(Collections.<Map<String,String>>emptyList()));- Map<String, Object> ns = new HashMap<String, Object>();+ vri.setEvaluators(new DataImporter().getEvaluators(Collections+ .<Map<String,String>> emptyList()));+ Map<String,Object> ns = new HashMap<String,Object>();Date d = new Date();ns.put("dt", d);vri.addNamespace("A", ns);- assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d),- vri.replaceTokens("${dataimporter.functions.formatDate(A.dt,'yyyy-MM-dd HH:mm:ss')}"));+ assertEquals(+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d),+ vri.replaceTokens("${dataimporter.functions.formatDate(A.dt,'yyyy-MM-dd HH:mm:ss')}"));}-+@Testpublic void dateNamespaceWithExpr() throws Exception {VariableResolver vri = new VariableResolver();- vri.setEvaluators(new DataImporter().getEvaluators(Collections.<Map<String,String>>emptyList()));+ vri.setEvaluators(new DataImporter().getEvaluators(Collections+ .<Map<String,String>> emptyList()));SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");format.setTimeZone(TimeZone.getTimeZone("UTC"));- DateMathParser dmp = new DateMathParser(TimeZone.getDefault(), Locale.getDefault());-- String s = vri.replaceTokens("${dataimporter.functions.formatDate('NOW/DAY','yyyy-MM-dd HH:mm')}");- assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(dmp.parseMath("/DAY")), s);+ DateMathParser dmp = new DateMathParser(TimeZone.getDefault(),+ Locale.getDefault());++ String s = vri+ .replaceTokens("${dataimporter.functions.formatDate('NOW/DAY','yyyy-MM-dd HH:mm')}");+ assertEquals(+ new SimpleDateFormat("yyyy-MM-dd HH:mm").format(dmp.parseMath("/DAY")),+ s);}-+@Testpublic void testDefaultNamespace() {VariableResolver vri = new VariableResolver();- Map<String, Object> ns = new HashMap<String, Object>();+ Map<String,Object> ns = new HashMap<String,Object>();ns.put("world", "WORLD");vri.addNamespace(null, ns);assertEquals("WORLD", vri.resolve("world"));}-+@Testpublic void testDefaultNamespace1() {VariableResolver vri = new VariableResolver();- Map<String, Object> ns = new HashMap<String, Object>();+ Map<String,Object> ns = new HashMap<String,Object>();ns.put("world", "WORLD");vri.addNamespace(null, ns);assertEquals("WORLD", vri.resolve("world"));}-+@Testpublic void testFunctionNamespace1() throws Exception {VariableResolver resolver = new VariableResolver();- final List<Map<String ,String >> l = new ArrayList<Map<String, String>>();- Map<String ,String > m = new HashMap<String, String>();- m.put("name","test");- m.put("class",E.class.getName());+ final List<Map<String,String>> l = new ArrayList<Map<String,String>>();+ Map<String,String> m = new HashMap<String,String>();+ m.put("name", "test");+ m.put("class", E.class.getName());l.add(m);resolver.setEvaluators(new DataImporter().getEvaluators(l));- ContextImpl context = new ContextImpl(null, resolver, null, Context.FULL_DUMP, Collections.EMPTY_MAP, null, null);+ ContextImpl context = new ContextImpl(null, resolver, null,+ Context.FULL_DUMP, Collections.EMPTY_MAP, null, null);-SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");format.setTimeZone(TimeZone.getTimeZone("UTC"));- DateMathParser dmp = new DateMathParser(TimeZone.getDefault(), Locale.getDefault());-- String s = resolver- .replaceTokens("${dataimporter.functions.formatDate('NOW/DAY','yyyy-MM-dd HH:mm')}");- assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm")- .format(dmp.parseMath("/DAY")), s);- assertEquals("Hello World", resolver- .replaceTokens("${dataimporter.functions.test('TEST')}"));+ DateMathParser dmp = new DateMathParser(TimeZone.getDefault(),+ Locale.getDefault());++ String s = resolver+ .replaceTokens("${dataimporter.functions.formatDate('NOW/DAY','yyyy-MM-dd HH:mm')}");+ assertEquals(+ new SimpleDateFormat("yyyy-MM-dd HH:mm").format(dmp.parseMath("/DAY")),+ s);+ assertEquals("Hello World",+ resolver.replaceTokens("${dataimporter.functions.test('TEST')}"));}-- public static class E extends Evaluator{- @Override- public String evaluate(String expression, Context context) {- return "Hello World";- }++ public static class E extends Evaluator {+ @Override+ public String evaluate(String expression, Context context) {+ return "Hello World";+ }}-}