Search in sources :

Example 36 with WritableCellFormat

use of jxl.write.WritableCellFormat in project pentaho-kettle by pentaho.

the class ExcelOutputTest method testClosingFile.

@Test
public /**
 * Tests http://jira.pentaho.com/browse/PDI-13487 issue
 */
void testClosingFile() throws Exception {
    ValueMetaInterface vmi = new ValueMetaString("new_row");
    ExcelOutputData data = new ExcelOutputData();
    data.fieldnrs = new int[] { 0 };
    String testColumnName = "testColumnName";
    data.formats.put(testColumnName, new WritableCellFormat());
    RowMeta rowMetaToBeReturned = Mockito.spy(new RowMeta());
    rowMetaToBeReturned.addValueMeta(0, vmi);
    data.previousMeta = rowMetaToBeReturned;
    ExcelOutput excelOutput = Mockito.spy(new ExcelOutput(helper.stepMeta, data, 0, helper.transMeta, helper.trans));
    excelOutput.first = false;
    Object[] row = { new Date() };
    doReturn(row).when(excelOutput).getRow();
    doReturn(rowMetaToBeReturned).when(excelOutput).getInputRowMeta();
    doReturn(1L).when(excelOutput).getLinesOutput();
    String excelFileFullPath = buildFilePath();
    File excelFile = new File(excelFileFullPath);
    excelFile.deleteOnExit();
    ExcelOutputMeta meta = createStepMeta(excelFileFullPath, null, true);
    meta.setSplitEvery(1);
    excelOutput.init(meta, data);
    excelOutput.processRow(meta, data);
    Assert.assertNull(data.formats.get(testColumnName));
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) WritableCellFormat(jxl.write.WritableCellFormat) File(java.io.File) Date(java.util.Date) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Aggregations

WritableCellFormat (jxl.write.WritableCellFormat)36 WritableFont (jxl.write.WritableFont)26 WriteException (jxl.write.WriteException)19 WritableSheet (jxl.write.WritableSheet)11 WorkbookSettings (jxl.WorkbookSettings)7 Label (jxl.write.Label)7 WritableWorkbook (jxl.write.WritableWorkbook)7 IOException (java.io.IOException)5 CellView (jxl.CellView)5 File (java.io.File)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Date (java.util.Date)3 CellFormat (jxl.format.CellFormat)3 TableItem (org.eclipse.swt.widgets.TableItem)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2 BiffException (jxl.read.biff.BiffException)2 DateTime (jxl.write.DateTime)2 KettleException (org.pentaho.di.core.exception.KettleException)2 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)2