@@ -0,0 +1,2903 @@
+package org.apache.solr.handler.dataimport;%0A%0A/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Aimport com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;%0Aimport com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;%0Aimport com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;%0Aimport com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies;%0Aimport org.apache.solr.SolrTestCaseJ4;%0A%0Aimport java.sql.DriverManager;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0A@ThreadLeakAction(%7BThreadLeakAction.Action.WARN%7D)%0A@ThreadLeakLingering(linger = 0)%0A@ThreadLeakZombies(ThreadLeakZombies.Consequence.CONTINUE)%0A@ThreadLeakScope(ThreadLeakScope.Scope.NONE)%0Apublic class TestJdbcDataSourceConvertType extends AbstractDataImportHandlerTestCase %7B%0A  public void testConvertType() throws Throwable %7B%0A    // ironically convertType=false causes BigDecimal to String conversion%0A    convertTypeTest(%22false%22, String.class);%0A%0A    // convertType=true uses the %22long%22 conversion (see mapping of some_i to %22long%22)%0A    convertTypeTest(%22true%22, Long.class);%0A  %7D%0A%0A  private void convertTypeTest(String convertType, Class resultClass) throws Throwable %7B%0A    JdbcDataSource dataSource = new JdbcDataSource();%0A    Properties p = new Properties();%0A    p.put(%22driver%22, %22org.apache.derby.jdbc.EmbeddedDriver%22);%0A    p.put(%22url%22, %22jdbc:derby:memory:tempDB;create=true%22);%0A    p.put(%22convertType%22, convertType);%0A%0A    List%3CMap%3CString, String%3E%3E flds = new ArrayList%3C%3E();%0A    Map%3CString, String%3E f = new HashMap%3C%3E();%0A    f.put(%22column%22, %22some_i%22);%0A    f.put(%22type%22, %22long%22);%0A    flds.add(f);%0A%0A    Context c = getContext(null, null,%0A        dataSource, Context.FULL_DUMP, flds, null);%0A    dataSource.init(c, p);%0A    Iterator%3CMap%3CString, Object%3E%3E i = dataSource%0A        .getData(%22select 1 as id, CAST(9999 AS DECIMAL) as %5C%22some_i%5C%22 from sysibm.sysdummy1%22);%0A    assertTrue(i.hasNext());%0A    Map%3CString, Object%3E map = i.next();%0A    Object val = map.get(%22some_i%22);%0A    assertEquals(resultClass, val.getClass());%0A%0A    dataSource.close();%0A  %7D%0A%7D%0A

Add tests for convertType and BigDecimal implicit conversion