From 1a7f5c1fbc441dfd28760bfd01d81633f97a751b Mon Sep 17 00:00:00 2001 From: sramazzina Date: Wed, 25 Jan 2023 18:15:46 +0100 Subject: [PATCH] fix #2142 : import pentaho ktr to apache hop 'TypeExitExcelWriterTransform' transform --- .../0065-check-excel-file-exists.hpl | 175 ++++++++++++++++ .../transforms/0065-create-excel-file.hpl | 153 ++++++++++++++ .../main-0065-excel-writer-output-basic.hwf | 187 ++++++++++++++++++ .../hop/imports/kettle/KettleConst.java | 10 +- 4 files changed, 519 insertions(+), 6 deletions(-) create mode 100644 integration-tests/transforms/0065-check-excel-file-exists.hpl create mode 100644 integration-tests/transforms/0065-create-excel-file.hpl create mode 100644 integration-tests/transforms/main-0065-excel-writer-output-basic.hwf diff --git a/integration-tests/transforms/0065-check-excel-file-exists.hpl b/integration-tests/transforms/0065-check-excel-file-exists.hpl new file mode 100644 index 00000000000..5b54be5913a --- /dev/null +++ b/integration-tests/transforms/0065-check-excel-file-exists.hpl @@ -0,0 +1,175 @@ + + + + + 0064-check-excel-file-exists.hpl + Y + + + + Normal + + + N + 1000 + 100 + - + 2023/01/12 09:32:57.327 + - + 2023/01/12 09:32:57.327 + + + + + + File exists! + Cleanup temporary file + Y + + + Look for test file in target dir + Detect empty stream + Y + + + Detect empty stream + Abort because expected file not found! + Y + + + Look for test file in target dir + File exists! + Y + + + + Abort because expected file not found! + Abort + + Y + + 1 + + none + + + ABORT_WITH_ERROR + Y + Expected file not found! + 0 + + + 336 + 368 + + + + Cleanup temporary file + ProcessFiles + + Y + + 1 + + none + + + N + N + delete + N + N + filename + + + 720 + 144 + + + + Detect empty stream + DetectEmptyStream + + Y + + 1 + + none + + + + + 336 + 256 + + + + File exists! + Dummy + + Y + + 1 + + none + + + + + 560 + 144 + + + + Look for test file in target dir + GetFileNames + + N + + 1 + + none + + + N + N + + N + N + ${PROJECT_HOME}/files/excel/temp-excel-output.xlsx + + N + + all_files + + Y + 0 + N + N + + + 336 + 144 + + + + + + diff --git a/integration-tests/transforms/0065-create-excel-file.hpl b/integration-tests/transforms/0065-create-excel-file.hpl new file mode 100644 index 00000000000..dda0d7c02e5 --- /dev/null +++ b/integration-tests/transforms/0065-create-excel-file.hpl @@ -0,0 +1,153 @@ + + + + + 0064-create-excel-file.hpl + Y + + + + Normal + + + N + 1000 + 100 + - + 2023/01/12 09:30:06.480 + - + 2023/01/12 09:30:06.480 + + + + + + Data grid + Write test excel file + Y + + + + Data grid + DataGrid + + Y + + 1 + + none + + + + + A + + + + + -1 + -1 + N + f1 + String + + + + + 256 + 192 + + + + Write test excel file + TypeExitExcelWriterTransform + + Y + + 1 + + none + + + Y + 0 + N + 0 + N + + + + + + N + + f1 + + f1 + + String + + + + N + N + N + N + Y + + Y + xlsx + + N + new + new + ${PROJECT_HOME}/files/excel/temp-excel-output + + N + + Sheet1 + N + 0 + N + +
N
+ N +
Y
+ N + Y + overwrite + A1 + + + + 448 + 192 + +
+ + + +
diff --git a/integration-tests/transforms/main-0065-excel-writer-output-basic.hwf b/integration-tests/transforms/main-0065-excel-writer-output-basic.hwf new file mode 100644 index 00000000000..604b37be9c1 --- /dev/null +++ b/integration-tests/transforms/main-0065-excel-writer-output-basic.hwf @@ -0,0 +1,187 @@ + + + + main-0065-excel-writer-output-basic + Y + + + + - + 2023/01/12 09:24:03.397 + - + 2023/01/12 09:24:03.397 + + + + + Start + + SPECIAL + + 1 + 12 + 60 + 0 + 0 + N + 0 + 1 + N + 208 + 96 + + + + 0065-create-excel-file.hpl + + PIPELINE + + ${PROJECT_HOME}/0065-create-excel-file.hpl + N + N + N + N + N + + + N + N + Basic + N + Y + N + local + + Y + + N + 368 + 96 + + + + 0065-check-excel-file-exists.hpl + + PIPELINE + + ${PROJECT_HOME}/0065-check-excel-file-exists.hpl + N + N + N + N + N + + + N + N + Basic + N + Y + N + local + + Y + + N + 592 + 96 + + + + Dummy + + DUMMY + + N + 464 + 208 + + + + Success + + SUCCESS + + N + 752 + 96 + + + + Error + + ABORT + + N + Something wrong happened! + N + 464 + 320 + + + + + + Start + 0065-create-excel-file.hpl + Y + Y + Y + + + 0065-create-excel-file.hpl + 0065-check-excel-file-exists.hpl + Y + Y + N + + + 0065-create-excel-file.hpl + Dummy + Y + N + N + + + 0065-check-excel-file-exists.hpl + Dummy + Y + N + N + + + Dummy + Error + Y + Y + Y + + + 0065-check-excel-file-exists.hpl + Success + Y + Y + N + + + + + + diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java index 2591eae639e..b786883781b 100644 --- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java +++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java @@ -67,6 +67,8 @@ public class KettleConst { {"step_tag", "transform_tag"}, {"step_name", "transform_name"}, {"step_description", "transform_description"}, + // ExcelWriter + {"extention", "extension"} }) .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); @@ -181,16 +183,12 @@ public class KettleConst { {"INC_STEPNR_IN_FILENAME", "INC_TRANSFORMNR_IN_FILENAME"}, // jsonoutput & xmloutput {"SOURCE_XML_STEP", "SOURCE_XML_TRANSFORM"}, // xmljoin {"TARGET_XML_STEP", "TARGET_XML_TRANSFORM"}, // xmljoin - { - "OUTPUT_INCLUDE_STEPNR", "OUTPUT_INCLUDE_TRANSFORMNR" - }, // webservice + {"OUTPUT_INCLUDE_STEPNR", "OUTPUT_INCLUDE_TRANSFORMNR"}, // webservice { "SWITCH_CASE_TARGET.CASE_TARGET_STEP_NAME", "SWITCH_CASE_TARGET.CASE_TARGET_TRANSFORM_NAME" }, // switchcase - { - "DEFAULT_TARGET_STEP_NAME", "DEFAULT_TARGET_TRANSFORM_NAME" - } // switchcase + {"DEFAULT_TARGET_STEP_NAME", "DEFAULT_TARGET_TRANSFORM_NAME"} // switchcase }) .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1]));