|
|
|
@ -2,13 +2,10 @@ package com.fanruan.api.data;
|
|
|
|
|
|
|
|
|
|
import com.fanruan.api.Prepare; |
|
|
|
|
import com.fr.base.TableData; |
|
|
|
|
import com.fr.config.Configuration; |
|
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
|
import com.fr.file.TableDataConfig; |
|
|
|
|
import com.fr.main.impl.WorkBook; |
|
|
|
|
import com.fr.script.Calculator; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
|
import com.fr.transaction.Worker; |
|
|
|
|
import org.junit.Assert; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
@ -22,17 +19,7 @@ public class TableDataKitTest extends Prepare {
|
|
|
|
|
@Test |
|
|
|
|
public void getTableData() { |
|
|
|
|
TestTD td = new TestTD(); |
|
|
|
|
Configurations.update(new Worker() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
TableDataConfig.getInstance().addTableData("first", td); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Class<? extends Configuration>[] targets() { |
|
|
|
|
return new Class[]{TableDataConfig.class}; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
TableDataConfig.getInstance().addTableData("first", td); |
|
|
|
|
Calculator calculator = Calculator.createCalculator(); |
|
|
|
|
calculator.setAttribute(TableDataSource.KEY, new WorkBook()); |
|
|
|
|
TableData r = TableDataKit.getTableData(calculator, "first"); |
|
|
|
@ -42,11 +29,9 @@ public class TableDataKitTest extends Prepare {
|
|
|
|
|
@Test |
|
|
|
|
public void testGetTableData() { |
|
|
|
|
TestTD td = new TestTD(); |
|
|
|
|
Calculator calculator = Calculator.createCalculator(); |
|
|
|
|
WorkBook workBook = new WorkBook(); |
|
|
|
|
workBook.putTableData("test", td); |
|
|
|
|
calculator.setAttribute(TableDataSource.KEY, workBook); |
|
|
|
|
TableData r = TableDataKit.getTableData(calculator, "test"); |
|
|
|
|
TableData r = TableDataKit.getTableData(workBook, "test"); |
|
|
|
|
Assert.assertEquals(td, r); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|