@@ -0,0 +1,2633 @@
+package com.splicemachine.derby.utils;%0Aimport com.splicemachine.derby.impl.sql.execute.LazyDataValueDescriptor;%0Aimport com.splicemachine.derby.impl.sql.execute.LazyDataValueFactory;%0Aimport com.splicemachine.derby.impl.store.access.hbase.HBaseRowLocation;%0Aimport com.splicemachine.derby.utils.DerbyBytesUtil;%0Aimport com.splicemachine.encoding.MultiFieldEncoder;%0Aimport net.sf.ehcache.config.PinningConfiguration;%0Aimport org.apache.derby.iapi.error.StandardException;%0Aimport org.apache.derby.iapi.services.io.StoredFormatIds;%0Aimport org.apache.derby.iapi.services.monitor.ModuleFactory;%0Aimport org.apache.derby.iapi.services.monitor.Monitor;%0Aimport org.apache.derby.iapi.store.access.ScanController;%0Aimport org.apache.derby.iapi.types.DataValueDescriptor;%0Aimport org.apache.derby.iapi.types.J2SEDataValueFactory;%0Aimport org.apache.derby.iapi.types.StringDataValue;%0Aimport org.apache.hadoop.hbase.util.Bytes;%0Aimport org.junit.Assert;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0Aimport java.io.IOException;%0Aimport java.sql.Date;%0Aimport java.sql.Timestamp;%0Aimport java.util.*;%0A%0Aimport org.apache.derby.iapi.types.SQLDate;%0A/**%0A* Created by yifu on 6/24/14.%0A*/%0Apublic class setFromTest %7B%0A    protected static J2SEDataValueFactory dvf = new J2SEDataValueFactory();%0A%0A    @BeforeClass%0A    public static void startup() throws StandardException %7B%0A        ModuleFactory monitor = Monitor.getMonitorLite();%0A        Monitor.setMonitor(monitor);%0A        monitor.setLocale(new Properties(), Locale.getDefault().toString());%0A        dvf.boot(false, new Properties());%0A    %7D%0A    /*%0A    As the setFrom method is set as protected in derby, we here use the setValue public method which is what setFrom%0A     really invokes in its execution%0A     */%0A    @Test%0A    public void testSetFromMethod()throws Exception%7B%0A        Timestamp ts;%0A        DataValueDescriptor des;%0A        SQLDate test;%0A        for(int i=0;i%3C100000;i++)%7B%0A            test = new SQLDate();%0A            Calendar c = Calendar.getInstance();%0A                c.add(Calendar.DAY_OF_YEAR,i);%0A                ts = new Timestamp(c.getTime().getTime());%0A                des = dvf.getNull(StoredFormatIds.SQL_DATE_ID, StringDataValue.COLLATION_TYPE_UCS_BASIC);%0A                des.setValue(ts);%0A                if(des!=null) %7B%0A                    test.setValue(des);%0A                %7D%0A            /*%0A            Assert timestamp and the SQLdate equals, proving that setValue method always return a value%0A             */%0A            Assert.assertNotNull(test);%0A          Assert.assertEquals((new Date(ts.getTime())).toString(),test.toString());%0A        %7D%0A%0A    %7D%0A%0A%0A%7D%0A

add unit test for setFrom method