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