This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 53f82ed25e Issue #1940 (code cleanup, extra integration test for MDI,
doc update) (#6758)
53f82ed25e is described below
commit 53f82ed25e72f4f9f8f327e893652df02586489c
Author: Matt Casters <[email protected]>
AuthorDate: Thu Mar 12 08:20:24 2026 +0100
Issue #1940 (code cleanup, extra integration test for MDI, doc update)
(#6758)
* Issue #1940 (code cleanup, extra integration test for MDI, doc update)
* Issue #1940 (code cleanup, extra integration test for MDI, doc update)
---
.../pages/pipeline/transforms/getsystemdata.adoc | 200 +++++++-----
.../mdi/0034-system-info-template.hpl | 86 +++++
.../mdi/0034-system-info-validate.hpl | 345 ++++++++++++++++++++
integration-tests/mdi/0034-system-info.hpl | 160 +++++++++
.../mdi/datasets/golden-system-info.csv | 9 +
integration-tests/mdi/main-0033-splunk-input.hwf | 115 +++++++
integration-tests/mdi/main-0034-system-info.hwf | 113 +++++++
.../mdi/metadata/dataset/golden-system-info.json | 24 ++
.../unit-test/0034-system-info-validate UNIT.json | 33 ++
.../pipeline/transforms/systemdata/Management.java | 17 +-
.../pipeline/transforms/systemdata/SystemData.java | 328 +++++++++----------
.../transforms/systemdata/SystemDataDialog.java | 55 ++--
.../transforms/systemdata/SystemDataMeta.java | 356 ++++++++-------------
.../systemdata/SystemDataMetaFunction.java | 78 -----
.../SystemDataMetaInjectionTypeConverter.java | 37 ---
.../transforms/systemdata/SystemDataType.java | 143 +++++++++
.../transforms/systemdata/SystemDataTypes.java | 165 ----------
.../systemdata/messages/messages_en_US.properties | 2 +
.../systemdata/SystemDataMetaInjectionTest.java | 40 ---
.../transforms/systemdata/SystemDataMetaTest.java | 221 +++++--------
.../transforms/systemdata/SystemDataTest.java | 139 --------
.../systemdata/src/test/resources/transform.xml | 54 ++++
22 files changed, 1591 insertions(+), 1129 deletions(-)
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/getsystemdata.adoc
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/getsystemdata.adoc
index 5f2c421c80..d8b65edfe1 100644
---
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/getsystemdata.adoc
+++
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/getsystemdata.adoc
@@ -57,90 +57,120 @@ It can also accept any number of input streams, aggregate
any fields defined by
[options="header"]
|===
-|Item|Description
-|system date (variable)|System time, changes every time you ask a date.
-|system date (fixed)|System time, determined at the start of the pipeline.
-|start date range (Pipeline)|Start of date range, based upon information in
ETL log table.
-See, also .08 Pipeline Settings.
-|end date range (Pipeline)|End of date range, based upon information in ETL
log table.
-See, also .08 Pipeline Settings.
-|start data range (Workflow)|Start of date range based upon information in the
ETL log table.
-See also .08 Pipeline Settings.
+|Function|Description|Serialization code (for metadata injection)
+
+|System date (variable)|System time, changes every time you ask a date. |
`system date (variable)`
+
+|System date (fixed)|System time, determined at the start of the pipeline. |
`system date (fixed)`
+
+|Start date range (Pipeline)|Start of date range, based upon information in
ETL log table.
+See, also .08 Pipeline Settings. | `start date range`
+
+|End date range (Pipeline)|End of date range, based upon information in ETL
log table.
+See, also .08 Pipeline Settings. | `end date range`
+
+|Start date range (Workflow)|Start of date range based upon information in the
ETL log table.
+See also .08 Pipeline Settings. | `workflow start date range`
+
|End date range (Workflow)|End of date range based upon information in the ETL
log table.
-See also .08 Pipeline Settings.
-|Yesterday 00:00:00|Start of yesterday.
-|Yesterday 23:59:59|End of yesterday.
-|Today 00:00:00|Start of today.
-|Today 23:59:59|End of today.
-|Tomorrow 00:00:00|Start of tomorrow.
-|Tomorrow 23:59:59|End of tomorrow
-|First day of last month 00:00:00|Start of last month.
-|Last day of last month 23:59:59|End of last month.
-|First day of this month 00:00:00|Start of this month.
-|Last day of this month 23:59:59|End of this month.
-|First day of next month 00:00:00|Start of next month.
-|Last day of next month 23:59:59|End of next month.
-|copy of transform|Copy nr of the transform.
-See also Launching several copies of a transform.
-|Pipeline name|Name of the pipeline.
-|Pipeline file name|File name of the pipeline (XML only).
-|User that modified the pipeline last|
-|Date when the pipeline was modified last|
-|Hostname|Returns the hostname of the server.
-|IP address|Returns the IP address of the server.
-|Current process identifier (PID)|The PID under which the Java process is
currently running
-|JVM max memory|
-|JVM total memory|
-|JVM free memory|
-|JVM available memory|
-|Available processors|
-|JVM CPU time (milliseconds)|
-|Total physical memory size (bytes)|
-|Total swap space size (bytes)|
-|Committed virtual size (bytes)|
-|Free physical memory size (bytes)|
-|Free swap space size (bytes)|
-|First day of last week 00:00:00|
-|Last day of last week 23:59:59|
-|Last working day of last week 23:59:59|
-|First day of last week 00:00:00 (US)|
-|Last day of last week 23:59:59 (US)|
-|First day of this week 00:00:00|
-|Last day of this week 23:59:59|
-|Last working day of this week 23:59:59|
-|First day of this week 00:00:00 (US)
-|Last day of this week 23:59:59 (US)
-|First day of next week 00:00:00|
-|Last day of next week 23:59:59|
-|Last working day of next week 23:59:59|
-|First day of next week 00:00:00 (US)|
-|Last day of next week 23:59:59 (US)|
-|First day of last quarter 00:00:00|
-|Last day of last quarter 23:59:59|
-|First day of this quarter 00:00:00|
-|Last day of this quarter 23:59:59|
-|First day of next quarter 00:00:00|
-|Last day of next quarter 23:59:59|
-|First day of last year 00:00:00|
-|Last day of last year 23:59:59|
-|First day of this year 00:00:00|
-|Last day of this year 23:59:59|
-|First day of next year 00:00:00|
-|Last day of next year 23:59:59|
-|Previous workflow action result|
-|Previous workflow action exit status|
-|Previous workflow action nr|
-|Previous workflow action nr errors|
-|Previous workflow action nr lines input|
-|Previous workflow action nr lines output|
-|Previous workflow action nr lines read|
-|Previous workflow action nr lines updated|
-|Previous workflow action nr lines written|
-|Previous workflow action nr lines deleted|
-|Previous workflow action nr lines rejected|
-|Previous workflow action nr rows|
-|Previous workflow action stopped|
-|Previous workflow action nr files|
-|Previous workflow action nr files retrieved|
-|Previous workflow action log text|
+See also .08 Pipeline Settings. | `workflow end date range`
+
+|Yesterday 00:00:00|Start of yesterday. | `yesterday start`
+
+|Yesterday 23:59:59|End of yesterday. | `yesterday end`
+
+|Today 00:00:00|Start of today. | `today start`
+
+|Today 23:59:59|End of today. | `today end`
+
+|Tomorrow 00:00:00|Start of tomorrow. | `tomorrow start`
+
+|Tomorrow 23:59:59|End of tomorrow. | `tomorrow end`
+
+|First day of last month 00:00:00|Start of last month. | `last month start`
+
+|Last day of last month 23:59:59|End of last month. | `last month end`
+
+|First day of this month 00:00:00|Start of this month. | `this month start`
+
+|Last day of this month 23:59:59|End of this month. | `this month end`
+
+|First day of next month 00:00:00|Start of next month. | `next month start`
+
+|Last day of next month 23:59:59|End of next month. | `next month end`
+
+|Copy of transform|Copy nr of the transform.
+See also Launching several copies of a transform. | `copy of transform`
+
+|Pipeline name|Name of the pipeline. | This code has a leading white space:
`{sp}pipeline name`
+
+|Pipeline file name|File name of the pipeline (XML only). | This code has
leading white space : `{sp}pipeline file name`
+
+|User that modified the pipeline last| | `User modified`
+
+|Date when the pipeline was modified last| | `Date modified`
+
+|Hostname (Network setup)|Returns the hostname of the server. | `Hostname`
+
+|Hostname (Real)| | `Hostname real`
+
+|IP address|Returns the IP address of the server. | `IP address`
+
+|Current process identifier (PID)|The PID under which the Java process is
currently running | `Current PID`
+
+|JVM max memory| | `jvm max memory`
+|JVM total memory| | `jvm total memory`
+|JVM free memory| | `jvm free memory`
+|JVM available memory| | `jvm available memory`
+|Available processors| | `available processors`
+|JVM CPU time (milliseconds)| | `jvm cpu time`
+|Total physical memory size (bytes)| | `total physical memory size`
+|Total swap space size (bytes)| | `total swap space size`
+|Committed virtual size (bytes)| | `committed virtual memory size`
+|Free physical memory size (bytes)| | `free physical memory size`
+|Free swap space size (bytes)| | `free swap space size`
+|First day of last week 00:00:00| | `last week start`
+|Last day of last week 23:59:59| | `last week end`
+|Last working day of last week 23:59:59| | `last week open end`
+|First day of last week 00:00:00 (US)| | `last week start us`
+|Last day of last week 23:59:59 (US)| | `last week end us`
+|First day of this week 00:00:00| | `this week start`
+|Last day of this week 23:59:59| | `this week end`
+|Last working day of this week 23:59:59| | `this week open end`
+|First day of this week 00:00:00 (US)| | `this week start us`
+|Last day of this week 23:59:59 (US)| | `this week end us`
+|First day of next week 00:00:00| | `next week start`
+|Last day of next week 23:59:59| | `next week end`
+|Last working day of next week 23:59:59| | `next week open end`
+|First day of next week 00:00:00 (US)| | `next week start us`
+|Last day of next week 23:59:59 (US)| | `next week end us`
+|First day of last quarter 00:00:00| | `prev quarter start`
+|Last day of last quarter 23:59:59| | `prev quarter end`
+|First day of this quarter 00:00:00| | `this quarter start`
+|Last day of this quarter 23:59:59| | `this quarter end`
+|First day of next quarter 00:00:00| | `next quarter start`
+|Last day of next quarter 23:59:59| | `next quarter end`
+|First day of last year 00:00:00| | `prev year start`
+|Last day of last year 23:59:59| | `prev year end`
+|First day of this year 00:00:00| | `this year start`
+|Last day of this year 23:59:59| | `this year end`
+|First day of next year 00:00:00| | `next year start`
+|Last day of next year 23:59:59| | `next year end`
+|Previous action result| | `previous result result`
+|Previous action exit status| | `previous result exist status`
+|Previous action nr| | `previous result entry nr`
+|Previous action nr errors | | `previous result nr errors`
+|Previous action nr lines input | | `previous result nr lines input`
+|Previous action nr lines output | | `previous result nr lines output`
+|Previous action nr lines read | | `previous result nr lines read`
+|Previous action nr lines updated | | `previous result nr lines updated`
+|Previous action nr lines written | | `previous result nr lines written`
+|Previous action nr lines deleted | | `previous result nr lines deleted`
+|Previous action nr lines rejected | | `previous result nr lines rejected`
+|Previous action nr rows| | `previous result nr rows`
+|Previous action stopped | | `previous result is stopped`
+|Previous action nr files | | `previous result nr files`
+|Previous action nr files retrieved | | `previous result nr files retrieved`
+|Previous action log text| | `previous result log text`
+
|===
diff --git a/integration-tests/mdi/0034-system-info-template.hpl
b/integration-tests/mdi/0034-system-info-template.hpl
new file mode 100644
index 0000000000..ec04fd2461
--- /dev/null
+++ b/integration-tests/mdi/0034-system-info-template.hpl
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0034-system-info-template</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/03/08 13:33:04.958</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/03/08 13:33:04.958</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>Get system info</from>
+ <to>Some Output</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>Some Output</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>320</xloc>
+ <yloc>128</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Get system info</name>
+ <type>SystemInfo</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+</fields>
+ <attributes/>
+ <GUI>
+ <xloc>192</xloc>
+ <yloc>128</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/mdi/0034-system-info-validate.hpl
b/integration-tests/mdi/0034-system-info-validate.hpl
new file mode 100644
index 0000000000..8655a80369
--- /dev/null
+++ b/integration-tests/mdi/0034-system-info-validate.hpl
@@ -0,0 +1,345 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0034-system-info-validate</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/03/08 13:53:59.695</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/03/08 13:53:59.695</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>filename</from>
+ <to>parse hop pipeline</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>parse hop pipeline</from>
+ <to>Characters only</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Characters only</from>
+ <to>useful bits</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>flatten</from>
+ <to>cleanup fields</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>cleanup fields</from>
+ <to>Validate</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>useful bits</from>
+ <to>flatten</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>Characters only</name>
+ <type>FilterRows</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <compare>
+ <condition>
+ <conditions>
+</conditions>
+ <function>=</function>
+ <leftvalue>xml_data_type_description</leftvalue>
+ <negated>N</negated>
+ <operator>-</operator>
+ <value>
+ <isnull>N</isnull>
+ <length>-1</length>
+ <name>constant</name>
+ <precision>-1</precision>
+ <text>CHARACTERS</text>
+ <type>String</type>
+ </value>
+ </condition>
+ </compare>
+ <attributes/>
+ <GUI>
+ <xloc>272</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Validate</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>400</xloc>
+ <yloc>160</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>cleanup fields</name>
+ <type>SelectValues</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <length>-2</length>
+ <name>fieldName</name>
+ <precision>-2</precision>
+ <rename/>
+ </field>
+ <field>
+ <length>-2</length>
+ <name>fieldType</name>
+ <precision>-2</precision>
+ <rename/>
+ </field>
+ <select_unspecified>N</select_unspecified>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>288</xloc>
+ <yloc>160</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>filename</name>
+ <type>GetVariable</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <length>-1</length>
+ <name>filename</name>
+ <precision>-1</precision>
+ <trim_type>none</trim_type>
+ <type>String</type>
+ <variable>${java.io.tmpdir}/system-info-mdi.hpl</variable>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>64</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>flatten</name>
+ <type>Denormaliser</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <field_name>xml_data_value</field_name>
+ <key_value>name</key_value>
+ <target_aggregation_type>-</target_aggregation_type>
+ <target_currency_symbol/>
+ <target_decimal_symbol/>
+ <target_format/>
+ <target_grouping_symbol/>
+ <target_length>-1</target_length>
+ <target_name>fieldName</target_name>
+ <target_null_string/>
+ <target_precision>-1</target_precision>
+ <target_type>String</target_type>
+ </field>
+ <field>
+ <field_name>xml_data_value</field_name>
+ <key_value>type</key_value>
+ <target_aggregation_type>-</target_aggregation_type>
+ <target_currency_symbol/>
+ <target_decimal_symbol/>
+ <target_format/>
+ <target_grouping_symbol/>
+ <target_length>-1</target_length>
+ <target_name>fieldType</target_name>
+ <target_null_string/>
+ <target_precision>-1</target_precision>
+ <target_type>String</target_type>
+ </field>
+ </fields>
+ <group>
+ <field>
+ <name>xml_parent_element_id</name>
+ </field>
+ </group>
+ <key_field>xml_data_name</key_field>
+ <attributes/>
+ <GUI>
+ <xloc>512</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>parse hop pipeline</name>
+ <type>XMLInputStream</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <sourceFromInput>N</sourceFromInput>
+ <sourceFieldName/>
+ <filename>filename</filename>
+ <addResultFile>N</addResultFile>
+ <nrRowsToSkip>0</nrRowsToSkip>
+ <rowLimit>0</rowLimit>
+ <defaultStringLen>1024</defaultStringLen>
+ <encoding>UTF-8</encoding>
+ <enableNamespaces>N</enableNamespaces>
+ <enableTrim>Y</enableTrim>
+ <includeFilenameField>N</includeFilenameField>
+ <filenameField>xml_filename</filenameField>
+ <includeRowNumberField>N</includeRowNumberField>
+ <rowNumberField>xml_row_number</rowNumberField>
+ <includeDataTypeNumericField>N</includeDataTypeNumericField>
+ <dataTypeNumericField>xml_data_type_numeric</dataTypeNumericField>
+ <includeDataTypeDescriptionField>Y</includeDataTypeDescriptionField>
+
<dataTypeDescriptionField>xml_data_type_description</dataTypeDescriptionField>
+ <includeXmlLocationLineField>N</includeXmlLocationLineField>
+ <xmlLocationLineField>xml_location_line</xmlLocationLineField>
+ <includeXmlLocationColumnField>N</includeXmlLocationColumnField>
+ <xmlLocationColumnField>xml_location_column</xmlLocationColumnField>
+ <includeXmlElementIDField>Y</includeXmlElementIDField>
+ <xmlElementIDField>xml_element_id</xmlElementIDField>
+ <includeXmlParentElementIDField>Y</includeXmlParentElementIDField>
+ <xmlParentElementIDField>xml_parent_element_id</xmlParentElementIDField>
+ <includeXmlElementLevelField>Y</includeXmlElementLevelField>
+ <xmlElementLevelField>xml_element_level</xmlElementLevelField>
+ <includeXmlPathField>Y</includeXmlPathField>
+ <xmlPathField>xml_path</xmlPathField>
+ <includeXmlParentPathField>Y</includeXmlParentPathField>
+ <xmlParentPathField>xml_parent_path</xmlParentPathField>
+ <includeXmlDataNameField>Y</includeXmlDataNameField>
+ <xmlDataNameField>xml_data_name</xmlDataNameField>
+ <includeXmlDataValueField>Y</includeXmlDataValueField>
+ <xmlDataValueField>xml_data_value</xmlDataValueField>
+ <attributes/>
+ <GUI>
+ <xloc>160</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>useful bits</name>
+ <type>FilterRows</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <compare>
+ <condition>
+ <conditions>
+ <condition>
+ <conditions>
+</conditions>
+ <function>=</function>
+ <leftvalue>xml_parent_path</leftvalue>
+ <negated>N</negated>
+ <operator>-</operator>
+ <value>
+ <isnull>N</isnull>
+ <length>-1</length>
+ <mask/>
+ <name>constant</name>
+ <precision>-1</precision>
+ <text>/pipeline/transform/fields/field</text>
+ <type>String</type>
+ </value>
+ </condition>
+ </conditions>
+ <function>=</function>
+ <leftvalue>xml_parent_path</leftvalue>
+ <negated>N</negated>
+ <operator>-</operator>
+ <value>
+ <isnull>N</isnull>
+ <length>-1</length>
+ <mask/>
+ <name>constant</name>
+ <precision>-1</precision>
+ <text>/pipeline/transform/fields/field</text>
+ <type>String</type>
+ </value>
+ </condition>
+ </compare>
+ <attributes/>
+ <GUI>
+ <xloc>384</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/mdi/0034-system-info.hpl
b/integration-tests/mdi/0034-system-info.hpl
new file mode 100644
index 0000000000..5aeae967cd
--- /dev/null
+++ b/integration-tests/mdi/0034-system-info.hpl
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0034-system-info</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/03/08 13:33:44.544</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/03/08 13:33:44.544</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>fields</from>
+ <to>0034-system-info-template.hpl</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>fields</name>
+ <type>DataGrid</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <data>
+ <line>
+ <item>variable_sysdate</item>
+ <item>system date (variable)</item>
+ </line>
+ <line>
+ <item>fixed_sysdate</item>
+ <item>system date (fixed)</item>
+ </line>
+ <line>
+ <item>JVM max memory</item>
+ <item>jvm max memory</item>
+ </line>
+ <line>
+ <item>IP address</item>
+ <item>IP address</item>
+ </line>
+ <line>
+ <item>real_Hostname</item>
+ <item>Hostname real</item>
+ </line>
+ <line>
+ <item>Network_Hostname</item>
+ <item>Hostname</item>
+ </line>
+ <line>
+ <item>Available Processors</item>
+ <item>available processors</item>
+ </line>
+ <line>
+ <item>JVM Total Memory</item>
+ <item>jvm total memory</item>
+ </line>
+ </data>
+ <fields>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldName</name>
+ <type>String</type>
+ </field>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldTypeCode</name>
+ <type>String</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>128</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>0034-system-info-template.hpl</name>
+ <type>MetaInject</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <filename>${PROJECT_HOME}/0034-system-info-template.hpl</filename>
+ <run_configuration>local</run_configuration>
+ <source_transform>/</source_transform>
+ <source_output_fields> </source_output_fields>
+ <target_file>${java.io.tmpdir}/system-info-mdi.hpl</target_file>
+ <create_parent_folder>Y</create_parent_folder>
+ <no_execution>Y</no_execution>
+ <allow_empty_stream_on_execution>N</allow_empty_stream_on_execution>
+ <stream_source_transform/>
+ <stream_target_transform/>
+ <mappings>
+ <mapping>
+ <target_transform_name>Get system info</target_transform_name>
+ <target_attribute_key>FIELD_TYPE</target_attribute_key>
+ <target_detail>Y</target_detail>
+ <source_transform>fields</source_transform>
+ <source_field>fieldTypeCode</source_field>
+ </mapping>
+ <mapping>
+ <target_transform_name>Get system info</target_transform_name>
+ <target_attribute_key>FIELD_NAME</target_attribute_key>
+ <target_detail>Y</target_detail>
+ <source_transform>fields</source_transform>
+ <source_field>fieldName</source_field>
+ </mapping>
+ </mappings>
+ <attributes/>
+ <GUI>
+ <xloc>352</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/mdi/datasets/golden-system-info.csv
b/integration-tests/mdi/datasets/golden-system-info.csv
new file mode 100644
index 0000000000..37bda6f71b
--- /dev/null
+++ b/integration-tests/mdi/datasets/golden-system-info.csv
@@ -0,0 +1,9 @@
+fieldName,fieldType
+JVM Total Memory,jvm total memory
+Available Processors,available processors
+Network_Hostname,Hostname
+real_Hostname,Hostname real
+IP address,IP address
+JVM max memory,jvm max memory
+fixed_sysdate,system date (fixed)
+variable_sysdate,system date (variable)
diff --git a/integration-tests/mdi/main-0033-splunk-input.hwf
b/integration-tests/mdi/main-0033-splunk-input.hwf
new file mode 100644
index 0000000000..ccddd9b816
--- /dev/null
+++ b/integration-tests/mdi/main-0033-splunk-input.hwf
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+ <name>main-0033-splunk-input</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <workflow_version/>
+ <created_user>-</created_user>
+ <created_date>2025/09/02 11:24:45.914</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2025/09/02 11:24:45.914</modified_date>
+ <parameters>
+ </parameters>
+ <actions>
+ <action>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <DayOfMonth>1</DayOfMonth>
+ <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+ <hour>12</hour>
+ <intervalMinutes>60</intervalMinutes>
+ <intervalSeconds>0</intervalSeconds>
+ <minutes>0</minutes>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <weekDay>1</weekDay>
+ <parallel>N</parallel>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>0033-splunk-input.hpl</name>
+ <description/>
+ <type>PIPELINE</type>
+ <attributes/>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <clear_files>N</clear_files>
+ <clear_rows>N</clear_rows>
+ <create_parent_folder>N</create_parent_folder>
+ <exec_per_row>N</exec_per_row>
+ <filename>${PROJECT_HOME}/0033-splunk-input.hpl</filename>
+ <logext/>
+ <logfile/>
+ <loglevel>Basic</loglevel>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <params_from_previous>N</params_from_previous>
+ <run_configuration>local</run_configuration>
+ <set_append_logfile>N</set_append_logfile>
+ <set_logfile>N</set_logfile>
+ <wait_until_finished>Y</wait_until_finished>
+ <parallel>N</parallel>
+ <xloc>256</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Run Pipeline Unit Tests</name>
+ <description/>
+ <type>RunPipelineTests</type>
+ <attributes/>
+ <test_names>
+ <test_name>
+ <name>0033-splunk-input-validate UNIT</name>
+ </test_name>
+ </test_names>
+ <parallel>N</parallel>
+ <xloc>416</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>0033-splunk-input.hpl</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>0033-splunk-input.hpl</from>
+ <to>Run Pipeline Unit Tests</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ </hops>
+ <notepads>
+ </notepads>
+ <attributes/>
+</workflow>
diff --git a/integration-tests/mdi/main-0034-system-info.hwf
b/integration-tests/mdi/main-0034-system-info.hwf
new file mode 100644
index 0000000000..af09df3aca
--- /dev/null
+++ b/integration-tests/mdi/main-0034-system-info.hwf
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+ <name>main-0034-system-info</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <workflow_version/>
+ <created_user>-</created_user>
+ <created_date>2025/09/02 11:24:45.914</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2025/09/02 11:24:45.914</modified_date>
+ <parameters>
+ </parameters>
+ <actions>
+ <action>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <DayOfMonth>1</DayOfMonth>
+ <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+ <hour>12</hour>
+ <intervalMinutes>60</intervalMinutes>
+ <intervalSeconds>0</intervalSeconds>
+ <minutes>0</minutes>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <weekDay>1</weekDay>
+ <parallel>N</parallel>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>0034-system-info</name>
+ <description/>
+ <type>PIPELINE</type>
+ <attributes/>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <clear_files>N</clear_files>
+ <clear_rows>N</clear_rows>
+ <create_parent_folder>N</create_parent_folder>
+ <exec_per_row>N</exec_per_row>
+ <filename>${PROJECT_HOME}/0034-system-info.hpl</filename>
+ <loglevel>Basic</loglevel>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <params_from_previous>N</params_from_previous>
+ <run_configuration>local</run_configuration>
+ <set_append_logfile>N</set_append_logfile>
+ <set_logfile>N</set_logfile>
+ <wait_until_finished>Y</wait_until_finished>
+ <parallel>N</parallel>
+ <xloc>256</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Run Pipeline Unit Tests</name>
+ <description/>
+ <type>RunPipelineTests</type>
+ <attributes/>
+ <test_names>
+ <test_name>
+ <name>0034-system-info-validate UNIT</name>
+ </test_name>
+ </test_names>
+ <parallel>N</parallel>
+ <xloc>384</xloc>
+ <yloc>80</yloc>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>0034-system-info</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>0034-system-info</from>
+ <to>Run Pipeline Unit Tests</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ </hops>
+ <notepads>
+ </notepads>
+ <attributes/>
+</workflow>
diff --git a/integration-tests/mdi/metadata/dataset/golden-system-info.json
b/integration-tests/mdi/metadata/dataset/golden-system-info.json
new file mode 100644
index 0000000000..38274d48dd
--- /dev/null
+++ b/integration-tests/mdi/metadata/dataset/golden-system-info.json
@@ -0,0 +1,24 @@
+{
+ "base_filename": "golden-system-info.csv",
+ "name": "golden-system-info",
+ "description": "",
+ "dataset_fields": [
+ {
+ "field_comment": "",
+ "field_length": -1,
+ "field_type": 2,
+ "field_precision": -1,
+ "field_name": "fieldName",
+ "field_format": ""
+ },
+ {
+ "field_comment": "",
+ "field_length": -1,
+ "field_type": 2,
+ "field_precision": -1,
+ "field_name": "fieldType",
+ "field_format": ""
+ }
+ ],
+ "folder_name": ""
+}
\ No newline at end of file
diff --git a/integration-tests/mdi/metadata/unit-test/0034-system-info-validate
UNIT.json b/integration-tests/mdi/metadata/unit-test/0034-system-info-validate
UNIT.json
new file mode 100644
index 0000000000..0b8fee024b
--- /dev/null
+++ b/integration-tests/mdi/metadata/unit-test/0034-system-info-validate
UNIT.json
@@ -0,0 +1,33 @@
+{
+ "database_replacements": [],
+ "autoOpening": true,
+ "description": "",
+ "persist_filename": "",
+ "test_type": "UNIT_TEST",
+ "variableValues": [],
+ "basePath": "${HOP_UNIT_TESTS_FOLDER}",
+ "golden_data_sets": [
+ {
+ "field_mappings": [
+ {
+ "transform_field": "fieldName",
+ "data_set_field": "fieldName"
+ },
+ {
+ "transform_field": "fieldType",
+ "data_set_field": "fieldType"
+ }
+ ],
+ "field_order": [
+ "fieldName",
+ "fieldType"
+ ],
+ "data_set_name": "golden-system-info",
+ "transform_name": "Validate"
+ }
+ ],
+ "input_data_sets": [],
+ "name": "0034-system-info-validate UNIT",
+ "trans_test_tweaks": [],
+ "pipeline_filename": "./0034-system-info-validate.hpl"
+}
\ No newline at end of file
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java
index 32ed2108ac..de08f7da52 100644
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java
+++
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/Management.java
@@ -23,12 +23,13 @@ import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadMXBean;
import org.apache.hop.core.Const;
+/** Return infos like current PID, JVM memory, ... */
public class Management {
private static RuntimeMXBean mx = null;
private static OperatingSystemMXBean bean = null;
- private static ThreadMXBean tbean = null;
+ private static ThreadMXBean threadBean = null;
- /** Return infos like current PID, JVM memory, ... */
+ private Management() {}
/**
* @return Process CPU time in nanoseconds
@@ -60,7 +61,7 @@ public class Management {
*/
public static long getFreePhysicalMemorySize() {
setOperatingSystemMXBean();
- return bean.getFreePhysicalMemorySize();
+ return bean.getFreeMemorySize();
}
/**
@@ -76,7 +77,7 @@ public class Management {
*/
public static long getTotalPhysicalMemorySize() {
setOperatingSystemMXBean();
- return bean.getTotalPhysicalMemorySize();
+ return bean.getTotalMemorySize();
}
/**
@@ -101,10 +102,10 @@ public class Management {
*/
public static long getCpuTime(long id) {
setThreadMXBean();
- if (!tbean.isThreadCpuTimeSupported()) {
+ if (!threadBean.isThreadCpuTimeSupported()) {
return 0L;
}
- return tbean.getThreadCpuTime(id);
+ return threadBean.getThreadCpuTime(id);
}
private static void setOperatingSystemMXBean() {
@@ -114,8 +115,8 @@ public class Management {
}
private static void setThreadMXBean() {
- if (tbean == null) {
- tbean = ManagementFactory.getThreadMXBean();
+ if (threadBean == null) {
+ threadBean = ManagementFactory.getThreadMXBean();
}
}
}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java
index 3e73bf8415..f9056bf80c 100644
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java
+++
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemData.java
@@ -26,6 +26,7 @@ import org.apache.hop.core.Const;
import org.apache.hop.core.Result;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.row.IRowMeta;
+import org.apache.hop.core.row.RowDataUtil;
import org.apache.hop.core.row.RowMeta;
import org.apache.hop.core.util.Utils;
import org.apache.hop.execution.Execution;
@@ -40,7 +41,6 @@ import org.apache.hop.pipeline.transform.TransformMeta;
/** Get information from the System or the supervising pipeline. */
public class SystemData extends BaseTransform<SystemDataMeta, SystemDataData> {
-
public SystemData(
TransformMeta transformMeta,
SystemDataMeta meta,
@@ -52,27 +52,27 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
}
private Object[] getSystemData(IRowMeta inputRowMeta, Object[] inputRowData)
throws HopException {
- Object[] row = new Object[data.outputRowMeta.size()];
- // no data is changed, clone is not needed here.
- if (!inputRowMeta.isEmpty()) System.arraycopy(inputRowData, 0, row, 0,
inputRowMeta.size());
- for (int i = 0, index = inputRowMeta.size(); i <
meta.getFieldName().length; i++, index++) {
+ Object[] row = RowDataUtil.createResizedCopy(inputRowData,
data.outputRowMeta.size());
+
+ for (int i = 0, index = inputRowMeta.size(); i < meta.getFields().size();
i++, index++) {
+ SystemDataMeta.SystemInfoField field = meta.getFields().get(i);
Calendar cal;
- switch (meta.getFieldType()[i]) {
- case TYPE_SYSTEM_INFO_SYSTEM_START, TYPE_SYSTEM_INFO_PIPELINE_DATE_TO:
+ switch (field.getFieldType()) {
+ case SYSTEM_START, PIPELINE_DATE_TO:
row[index] = getPipeline().getExecutionStartDate();
break;
- case TYPE_SYSTEM_INFO_SYSTEM_DATE:
+ case SYSTEM_DATE:
row[index] = new Date();
break;
- case TYPE_SYSTEM_INFO_PIPELINE_DATE_FROM:
+ case PIPELINE_DATE_FROM:
row[index] =
calculateStartRange(
getPipeline().getPipelineRunConfiguration().getExecutionInfoLocationName(),
ExecutionType.Pipeline,
getPipeline().getPipelineMeta().getName());
break;
- case TYPE_SYSTEM_INFO_WORKFLOW_DATE_FROM:
+ case WORKFLOW_DATE_FROM:
if (getPipeline().getParentWorkflow() != null) {
row[index] =
calculateStartRange(
@@ -84,10 +84,10 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
getPipeline().getParentWorkflow().getWorkflowMeta().getName());
}
break;
- case TYPE_SYSTEM_INFO_WORKFLOW_DATE_TO:
+ case WORKFLOW_DATE_TO:
row[index] =
getPipeline().getParentWorkflow().getExecutionStartDate();
break;
- case TYPE_SYSTEM_INFO_PREV_DAY_START:
+ case PREV_DAY_START:
cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -1);
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -96,7 +96,7 @@ public class SystemData extends BaseTransform<SystemDataMeta,
SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_DAY_END:
+ case PREV_DAY_END:
cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -1);
cal.set(Calendar.HOUR_OF_DAY, 23);
@@ -105,7 +105,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_DAY_START:
+ case THIS_DAY_START:
cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
@@ -113,7 +113,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_DAY_END:
+ case THIS_DAY_END:
cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
@@ -121,7 +121,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_DAY_START:
+ case NEXT_DAY_START:
cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -130,7 +130,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_DAY_END:
+ case NEXT_DAY_END:
cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 23);
@@ -139,7 +139,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_MONTH_START:
+ case PREV_MONTH_START:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1);
cal.set(Calendar.DAY_OF_MONTH, 1);
@@ -149,7 +149,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_MONTH_END:
+ case PREV_MONTH_END:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1);
cal.set(Calendar.DAY_OF_MONTH,
cal.getActualMaximum(Calendar.DAY_OF_MONTH));
@@ -159,7 +159,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_MONTH_START:
+ case THIS_MONTH_START:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -168,7 +168,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_MONTH_END:
+ case THIS_MONTH_END:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH,
cal.getActualMaximum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, 23);
@@ -177,7 +177,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_MONTH_START:
+ case NEXT_MONTH_START:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);
cal.set(Calendar.DAY_OF_MONTH, 1);
@@ -187,7 +187,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_MONTH_END:
+ case NEXT_MONTH_END:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);
cal.set(Calendar.DAY_OF_MONTH,
cal.getActualMaximum(Calendar.DAY_OF_MONTH));
@@ -197,73 +197,73 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_COPYNR:
+ case COPYNR:
row[index] = (long) getCopy();
break;
- case TYPE_SYSTEM_INFO_PIPELINE_NAME:
+ case PIPELINE_NAME:
row[index] = getPipelineMeta().getName();
break;
- case TYPE_SYSTEM_INFO_MODIFIED_USER:
+ case MODIFIED_USER:
row[index] = getPipelineMeta().getModifiedUser();
break;
- case TYPE_SYSTEM_INFO_MODIFIED_DATE:
+ case MODIFIED_DATE:
row[index] = getPipelineMeta().getModifiedDate();
break;
- case TYPE_SYSTEM_INFO_HOSTNAME_REAL:
+ case HOSTNAME_REAL:
row[index] = Const.getHostnameReal();
break;
- case TYPE_SYSTEM_INFO_HOSTNAME:
+ case HOSTNAME:
row[index] = Const.getHostname();
break;
- case TYPE_SYSTEM_INFO_IP_ADDRESS:
+ case IP_ADDRESS:
try {
row[index] = Const.getIPAddress();
} catch (Exception e) {
throw new HopException(e);
}
break;
- case TYPE_SYSTEM_INFO_FILENAME:
+ case FILENAME:
row[index] = getPipelineMeta().getFilename();
break;
- case TYPE_SYSTEM_INFO_CURRENT_PID:
+ case CURRENT_PID:
row[index] = Management.getPID();
break;
- case TYPE_SYSTEM_INFO_JVM_TOTAL_MEMORY:
+ case JVM_TOTAL_MEMORY:
row[index] = Runtime.getRuntime().totalMemory();
break;
- case TYPE_SYSTEM_INFO_JVM_FREE_MEMORY:
+ case JVM_FREE_MEMORY:
row[index] = Runtime.getRuntime().freeMemory();
break;
- case TYPE_SYSTEM_INFO_JVM_MAX_MEMORY:
+ case JVM_MAX_MEMORY:
row[index] = Runtime.getRuntime().maxMemory();
break;
- case TYPE_SYSTEM_INFO_JVM_AVAILABLE_MEMORY:
+ case JVM_AVAILABLE_MEMORY:
Runtime rt = Runtime.getRuntime();
row[index] = rt.freeMemory() + (rt.maxMemory() - rt.totalMemory());
break;
- case TYPE_SYSTEM_INFO_AVAILABLE_PROCESSORS:
+ case AVAILABLE_PROCESSORS:
row[index] = (long) Runtime.getRuntime().availableProcessors();
break;
- case TYPE_SYSTEM_INFO_JVM_CPU_TIME:
+ case JVM_CPU_TIME:
row[index] = Management.getJVMCpuTime() / 1000000;
break;
- case TYPE_SYSTEM_INFO_TOTAL_PHYSICAL_MEMORY_SIZE:
+ case TOTAL_PHYSICAL_MEMORY_SIZE:
row[index] = Management.getTotalPhysicalMemorySize();
break;
- case TYPE_SYSTEM_INFO_TOTAL_SWAP_SPACE_SIZE:
+ case TOTAL_SWAP_SPACE_SIZE:
row[index] = Management.getTotalSwapSpaceSize();
break;
- case TYPE_SYSTEM_INFO_COMMITTED_VIRTUAL_MEMORY_SIZE:
+ case COMMITTED_VIRTUAL_MEMORY_SIZE:
row[index] = Management.getCommittedVirtualMemorySize();
break;
- case TYPE_SYSTEM_INFO_FREE_PHYSICAL_MEMORY_SIZE:
+ case FREE_PHYSICAL_MEMORY_SIZE:
row[index] = Management.getFreePhysicalMemorySize();
break;
- case TYPE_SYSTEM_INFO_FREE_SWAP_SPACE_SIZE:
+ case FREE_SWAP_SPACE_SIZE:
row[index] = Management.getFreeSwapSpaceSize();
break;
- case TYPE_SYSTEM_INFO_PREV_WEEK_START:
+ case PREV_WEEK_START:
cal = Calendar.getInstance();
cal.add(Calendar.WEEK_OF_YEAR, -1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -273,7 +273,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_WEEK_END:
+ case PREV_WEEK_END:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -282,7 +282,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_WEEK_OPEN_END:
+ case PREV_WEEK_OPEN_END:
cal = Calendar.getInstance(Locale.ROOT);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -292,7 +292,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.add(Calendar.DAY_OF_WEEK, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_WEEK_START_US:
+ case PREV_WEEK_START_US:
cal = Calendar.getInstance(Locale.US);
cal.add(Calendar.WEEK_OF_YEAR, -1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -302,7 +302,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_WEEK_END_US:
+ case PREV_WEEK_END_US:
cal = Calendar.getInstance(Locale.US);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -311,7 +311,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_WEEK_START:
+ case THIS_WEEK_START:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -320,7 +320,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_WEEK_END:
+ case THIS_WEEK_END:
cal = Calendar.getInstance();
cal.add(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -330,7 +330,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_WEEK_OPEN_END:
+ case THIS_WEEK_OPEN_END:
cal = Calendar.getInstance(Locale.ROOT);
cal.add(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -341,7 +341,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.add(Calendar.DAY_OF_WEEK, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_WEEK_START_US:
+ case THIS_WEEK_START_US:
cal = Calendar.getInstance(Locale.US);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -350,7 +350,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_WEEK_END_US:
+ case THIS_WEEK_END_US:
cal = Calendar.getInstance(Locale.US);
cal.add(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -360,7 +360,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_WEEK_START:
+ case NEXT_WEEK_START:
cal = Calendar.getInstance();
cal.add(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -370,7 +370,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_WEEK_END:
+ case NEXT_WEEK_END:
cal = Calendar.getInstance();
cal.add(Calendar.WEEK_OF_YEAR, 2);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -380,7 +380,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_WEEK_OPEN_END:
+ case NEXT_WEEK_OPEN_END:
cal = Calendar.getInstance(Locale.ROOT);
cal.add(Calendar.WEEK_OF_YEAR, 2);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -391,7 +391,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.add(Calendar.DAY_OF_WEEK, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_WEEK_START_US:
+ case NEXT_WEEK_START_US:
cal = Calendar.getInstance(Locale.US);
cal.add(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -401,7 +401,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_WEEK_END_US:
+ case NEXT_WEEK_END_US:
cal = Calendar.getInstance(Locale.US);
cal.add(Calendar.WEEK_OF_YEAR, 2);
cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
@@ -411,7 +411,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, -1);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_QUARTER_START:
+ case PREV_QUARTER_START:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -3 - (cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, 1);
@@ -421,7 +421,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_QUARTER_END:
+ case PREV_QUARTER_END:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1 - (cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
@@ -431,7 +431,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_QUARTER_START:
+ case THIS_QUARTER_START:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -(cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, 1);
@@ -441,7 +441,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_QUARTER_END:
+ case THIS_QUARTER_END:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 2 - (cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
@@ -451,7 +451,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_QUARTER_START:
+ case NEXT_QUARTER_START:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 3 - (cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, 1);
@@ -461,7 +461,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_QUARTER_END:
+ case NEXT_QUARTER_END:
cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 5 - (cal.get(Calendar.MONTH) % 3));
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
@@ -471,7 +471,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_YEAR_START:
+ case PREV_YEAR_START:
cal = Calendar.getInstance();
cal.add(Calendar.YEAR, -1);
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
@@ -481,7 +481,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREV_YEAR_END:
+ case PREV_YEAR_END:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
cal.add(Calendar.DAY_OF_YEAR, -1);
@@ -491,7 +491,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_YEAR_START:
+ case THIS_YEAR_START:
cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -500,7 +500,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_THIS_YEAR_END:
+ case THIS_YEAR_END:
cal = Calendar.getInstance();
cal.add(Calendar.YEAR, 1);
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
@@ -511,7 +511,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_YEAR_START:
+ case NEXT_YEAR_START:
cal = Calendar.getInstance();
cal.add(Calendar.YEAR, 1);
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
@@ -521,7 +521,7 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 0);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_NEXT_YEAR_END:
+ case NEXT_YEAR_END:
cal = Calendar.getInstance();
cal.add(Calendar.YEAR, 2);
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DATE));
@@ -532,136 +532,134 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
cal.set(Calendar.MILLISECOND, 999);
row[index] = cal.getTime();
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_RESULT:
- Result previousResult = getPipeline().getPreviousResult();
+ case PREVIOUS_RESULT_RESULT:
+ Result previousResultResult = getPipeline().getPreviousResult();
boolean result = false;
- if (previousResult != null) {
- result = previousResult.isResult();
+ if (previousResultResult != null) {
+ result = previousResultResult.isResult();
}
row[index] = result;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_EXIT_STATUS:
- previousResult = getPipeline().getPreviousResult();
- long value = 0;
- if (previousResult != null) {
- value = previousResult.getExitStatus();
+ case PREVIOUS_RESULT_EXIT_STATUS:
+ Result previousResultExitStatus = getPipeline().getPreviousResult();
+ long exitStatus = 0;
+ if (previousResultExitStatus != null) {
+ exitStatus = previousResultExitStatus.getExitStatus();
}
- row[index] = value;
+ row[index] = exitStatus;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_ENTRY_NR:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getEntryNr();
+ case PREVIOUS_RESULT_ENTRY_NR:
+ Result previousResultEntryNr = getPipeline().getPreviousResult();
+ long entryNr = 0;
+ if (previousResultEntryNr != null) {
+ entryNr = previousResultEntryNr.getEntryNr();
}
- row[index] = value;
+ row[index] = entryNr;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
-
- if (previousResult != null) {
- value = previousResult.getResultFiles().size();
+ case PREVIOUS_RESULT_NR_FILES:
+ Result previousResultNrFiles = getPipeline().getPreviousResult();
+ long nrFiles = 0;
+ if (previousResultNrFiles != null) {
+ nrFiles = previousResultNrFiles.getResultFiles().size();
}
- row[index] = value;
+ row[index] = nrFiles;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES_RETRIEVED:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrFilesRetrieved();
+ case PREVIOUS_RESULT_NR_FILES_RETRIEVED:
+ Result previousResultNrFilesRetrieves =
getPipeline().getPreviousResult();
+ long nrFilesRetrieved = 0;
+ if (previousResultNrFilesRetrieves != null) {
+ nrFilesRetrieved =
previousResultNrFilesRetrieves.getNrFilesRetrieved();
}
- row[index] = value;
+ row[index] = nrFilesRetrieved;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_DELETED:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesDeleted();
+ case PREVIOUS_RESULT_NR_LINES_DELETED:
+ Result previousResultNrLinesDeleted =
getPipeline().getPreviousResult();
+ long nrLinesDeleted = 0;
+ if (previousResultNrLinesDeleted != null) {
+ nrLinesDeleted = previousResultNrLinesDeleted.getNrLinesDeleted();
}
- row[index] = value;
+ row[index] = nrLinesDeleted;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_INPUT:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesInput();
+ case PREVIOUS_RESULT_NR_LINES_INPUT:
+ Result previousResultNrLinesInput =
getPipeline().getPreviousResult();
+ long nrLinesInput = 0;
+ if (previousResultNrLinesInput != null) {
+ nrLinesInput = previousResultNrLinesInput.getNrLinesInput();
}
- row[index] = value;
+ row[index] = nrLinesInput;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_OUTPUT:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesOutput();
+ case PREVIOUS_RESULT_NR_LINES_OUTPUT:
+ Result previousResultNrLinesOutput =
getPipeline().getPreviousResult();
+ long nrLinesOutput = 0;
+ if (previousResultNrLinesOutput != null) {
+ nrLinesOutput = previousResultNrLinesOutput.getNrLinesOutput();
}
- row[index] = value;
+ row[index] = nrLinesOutput;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_READ:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesRead();
+ case PREVIOUS_RESULT_NR_LINES_READ:
+ Result previousResultNrLinesRead = getPipeline().getPreviousResult();
+ long nrLinesRead = 0;
+ if (previousResultNrLinesRead != null) {
+ nrLinesRead = previousResultNrLinesRead.getNrLinesRead();
}
- row[index] = value;
+ row[index] = nrLinesRead;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_REJECTED:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesRejected();
+ case PREVIOUS_RESULT_NR_LINES_REJECTED:
+ Result previousResultNrLinesRejected =
getPipeline().getPreviousResult();
+ long nrLinesRejected = 0;
+ if (previousResultNrLinesRejected != null) {
+ nrLinesRejected =
previousResultNrLinesRejected.getNrLinesRejected();
}
- row[index] = value;
+ row[index] = nrLinesRejected;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_UPDATED:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesUpdated();
+ case PREVIOUS_RESULT_NR_LINES_UPDATED:
+ Result previousResultNrLinesUpdated =
getPipeline().getPreviousResult();
+ long nrLinesUpdated = 0;
+ if (previousResultNrLinesUpdated != null) {
+ nrLinesUpdated = previousResultNrLinesUpdated.getNrLinesUpdated();
}
- row[index] = value;
+ row[index] = nrLinesUpdated;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_WRITTEN:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrLinesWritten();
+ case PREVIOUS_RESULT_NR_LINES_WRITTEN:
+ Result previousResultNrLinesWritten =
getPipeline().getPreviousResult();
+ long nrLinesWritten = 0;
+ if (previousResultNrLinesWritten != null) {
+ nrLinesWritten = previousResultNrLinesWritten.getNrLinesWritten();
}
- row[index] = value;
+ row[index] = nrLinesWritten;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ROWS:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getRows().size();
+ case PREVIOUS_RESULT_NR_ROWS:
+ Result previousResultNrRows = getPipeline().getPreviousResult();
+ long nrRows = 0;
+ if (previousResultNrRows != null) {
+ nrRows = previousResultNrRows.getRows().size();
}
- row[index] = value;
+ row[index] = nrRows;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_IS_STOPPED:
- previousResult = getPipeline().getPreviousResult();
+ case PREVIOUS_RESULT_IS_STOPPED:
+ Result previousResultIsStopped = getPipeline().getPreviousResult();
boolean stop = false;
- if (previousResult != null) {
- stop = previousResult.isStopped();
+ if (previousResultIsStopped != null) {
+ stop = previousResultIsStopped.isStopped();
}
row[index] = stop;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ERRORS:
- previousResult = getPipeline().getPreviousResult();
- value = 0;
- if (previousResult != null) {
- value = previousResult.getNrErrors();
+ case PREVIOUS_RESULT_NR_ERRORS:
+ Result previousResultNrErrors = getPipeline().getPreviousResult();
+ long nrErrors = 0;
+ if (previousResultNrErrors != null) {
+ nrErrors = previousResultNrErrors.getNrErrors();
}
- row[index] = value;
+ row[index] = nrErrors;
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_LOG_TEXT:
- previousResult = getPipeline().getPreviousResult();
+ case PREVIOUS_RESULT_LOG_TEXT:
+ Result previousResultLogText = getPipeline().getPreviousResult();
String errorReason = null;
- if (previousResult != null) {
- errorReason = previousResult.getLogText();
+ if (previousResultLogText != null) {
+ errorReason = previousResultLogText.getLogText();
}
row[index] = errorReason;
break;
-
default:
break;
}
@@ -757,7 +755,6 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
@Override
public boolean init() {
-
if (super.init()) {
List<TransformMeta> previous =
getPipelineMeta().findPreviousTransforms(getTransformMeta());
if (!Utils.isEmpty(previous)) {
@@ -768,9 +765,4 @@ public class SystemData extends
BaseTransform<SystemDataMeta, SystemDataData> {
}
return false;
}
-
- @Override
- public void dispose() {
- super.dispose();
- }
}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java
index 1c01c39c1e..d4349075dd 100644
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java
+++
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataDialog.java
@@ -17,6 +17,7 @@
package org.apache.hop.pipeline.transforms.systemdata;
+import org.apache.hop.core.Const;
import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
@@ -79,32 +80,27 @@ public class SystemDataDialog extends BaseTransformDialog {
wlFields.setLayoutData(fdlFields);
final int FieldsCols = 2;
- final int FieldsRows = input.getFieldName().length;
+ final int FieldsRows = 1;
- final String[] functionDesc = new String[SystemDataTypes.values().length -
1];
- for (int i = 1; i < SystemDataTypes.values().length; i++) {
- functionDesc[i - 1] = SystemDataTypes.values()[i].getDescription();
- }
-
- ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
- colinf[0] =
+ ColumnInfo[] viewColumns = new ColumnInfo[FieldsCols];
+ viewColumns[0] =
new ColumnInfo(
BaseMessages.getString(PKG, "SystemDataDialog.NameColumn.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false);
- colinf[1] =
+ viewColumns[1] =
new ColumnInfo(
BaseMessages.getString(PKG, "SystemDataDialog.TypeColumn.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false);
- colinf[1].setSelectionAdapter(
+ viewColumns[1].setSelectionAdapter(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
EnterSelectionDialog esd =
new EnterSelectionDialog(
shell,
- functionDesc,
+ SystemDataType.getDescriptions(),
BaseMessages.getString(PKG,
"SystemDataDialog.SelectInfoType.DialogTitle"),
BaseMessages.getString(PKG,
"SystemDataDialog.SelectInfoType.DialogMessage"));
String string = esd.open();
@@ -121,7 +117,7 @@ public class SystemDataDialog extends BaseTransformDialog {
variables,
shell,
SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
- colinf,
+ viewColumns,
FieldsRows,
null,
props);
@@ -143,21 +139,12 @@ public class SystemDataDialog extends BaseTransformDialog
{
/** Copy information from the meta-data input to the dialog fields. */
public void getData() {
- for (int i = 0; i < input.getFieldName().length; i++) {
- TableItem item = wFields.table.getItem(i);
- String name = input.getFieldName()[i];
- String type = input.getFieldType()[i].getDescription();
-
- if (name != null) {
- item.setText(1, name);
- }
- if (type != null) {
- item.setText(2, type);
- }
+ for (SystemDataMeta.SystemInfoField field : input.getFields()) {
+ TableItem item = new TableItem(wFields.table, SWT.NONE);
+ item.setText(1, Const.NVL(field.getFieldName(), ""));
+ item.setText(2, Const.NVL(field.getFieldType().getDescription(), ""));
}
-
- wFields.setRowNums();
- wFields.optWidth(true);
+ wFields.optimizeTableView();
}
private void cancel() {
@@ -184,15 +171,15 @@ public class SystemDataDialog extends BaseTransformDialog
{
}
private void getInfo(SystemDataMeta in) {
-
transformName = wTransformName.getText(); // return value
- int count = wFields.nrNonEmpty();
- in.allocate(count);
-
- for (int i = 0; i < count; i++) {
- TableItem item = wFields.getNonEmpty(i);
- in.getFieldName()[i] = item.getText(1);
- in.getFieldType()[i] =
SystemDataTypes.getTypeFromString(item.getText(2));
+ in.getFields().clear();
+ for (TableItem item : wFields.getNonEmptyItems()) {
+ String name = item.getText(1);
+ String typeDescription = item.getText(2);
+ SystemDataMeta.SystemInfoField field = new
SystemDataMeta.SystemInfoField();
+ field.setFieldName(name);
+ field.setFieldType(SystemDataType.lookupDescription(typeDescription));
+ in.getFields().add(field);
}
}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java
index 9263653f52..9869683b62 100644
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java
+++
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMeta.java
@@ -17,16 +17,14 @@
package org.apache.hop.pipeline.transforms.systemdata;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.hop.core.CheckResult;
-import org.apache.hop.core.Const;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.exception.HopTransformException;
-import org.apache.hop.core.exception.HopXmlException;
-import org.apache.hop.core.injection.Injection;
-import org.apache.hop.core.injection.InjectionSupported;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.row.value.ValueMetaBoolean;
@@ -35,15 +33,13 @@ import org.apache.hop.core.row.value.ValueMetaInteger;
import org.apache.hop.core.row.value.ValueMetaNone;
import org.apache.hop.core.row.value.ValueMetaString;
import org.apache.hop.core.variables.IVariables;
-import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
import org.apache.hop.pipeline.transform.TransformMeta;
-import org.w3c.dom.Node;
-@InjectionSupported(localizationPrefix = "SystemDataMeta.Injection.")
@Transform(
id = "SystemInfo",
image = "systeminfo.svg",
@@ -52,103 +48,33 @@ import org.w3c.dom.Node;
categoryDescription =
"i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input",
keywords = "i18n::SystemDataMeta.keyword",
documentationUrl = "/pipeline/transforms/getsystemdata.html")
+@Getter
+@Setter
public class SystemDataMeta extends BaseTransformMeta<SystemData,
SystemDataData> {
private static final Class<?> PKG = SystemDataMeta.class;
- public static final String CONST_FIELD = "field";
- @Injection(name = "FIELD_NAME")
- private String[] fieldName;
-
- @Injection(name = "FIELD_TYPE", converter =
SystemDataMetaInjectionTypeConverter.class)
- private SystemDataTypes[] fieldType;
+ @HopMetadataProperty(
+ groupKey = "fields",
+ injectionGroupKey = "FIELDS",
+ injectionGroupDescription = "SystemDataMeta.Injection.FIELDS",
+ key = "field",
+ injectionKey = "FIELD",
+ injectionKeyDescription = "SystemDataMeta.Injection.FIELD")
+ private List<SystemInfoField> fields;
public SystemDataMeta() {
- super(); // allocate BaseTransformMeta
- }
-
- /**
- * @return Returns the fieldName.
- */
- public String[] getFieldName() {
- return fieldName;
- }
-
- /**
- * @param fieldName The fieldName to set.
- */
- public void setFieldName(String[] fieldName) {
- this.fieldName = fieldName;
- }
-
- /**
- * @return Returns the fieldType.
- */
- public SystemDataTypes[] getFieldType() {
- return fieldType;
- }
-
- /**
- * @param fieldType The fieldType to set.
- */
- public void setFieldType(SystemDataTypes[] fieldType) {
- this.fieldType = fieldType;
- }
-
- @Override
- public void loadXml(Node transformNode, IHopMetadataProvider
metadataProvider)
- throws HopXmlException {
- readData(transformNode);
- }
-
- public void allocate(int count) {
- fieldName = new String[count];
- fieldType = new SystemDataTypes[count];
+ super();
+ fields = new ArrayList<>();
}
@Override
public Object clone() {
- SystemDataMeta retval = (SystemDataMeta) super.clone();
-
- int count = fieldName.length;
-
- retval.allocate(count);
-
- System.arraycopy(fieldName, 0, retval.fieldName, 0, count);
- System.arraycopy(fieldType, 0, retval.fieldType, 0, count);
-
- return retval;
+ return new SystemDataMeta(this);
}
- private void readData(Node transformNode) throws HopXmlException {
- try {
- Node fields = XmlHandler.getSubNode(transformNode, "fields");
- int count = XmlHandler.countNodes(fields, CONST_FIELD);
- String type;
-
- allocate(count);
-
- for (int i = 0; i < count; i++) {
- Node fnode = XmlHandler.getSubNodeByNr(fields, CONST_FIELD, i);
-
- fieldName[i] = XmlHandler.getTagValue(fnode, "name");
- type = XmlHandler.getTagValue(fnode, "type");
- fieldType[i] = SystemDataTypes.getTypeFromString(type);
- }
- } catch (Exception e) {
- throw new HopXmlException("Unable to read transform information from
XML", e);
- }
- }
-
- @Override
- public void setDefault() {
- int count = 0;
-
- allocate(count);
-
- for (int i = 0; i < count; i++) {
- fieldName[i] = CONST_FIELD + i;
- fieldType[i] = SystemDataTypes.TYPE_SYSTEM_INFO_SYSTEM_DATE;
- }
+ public SystemDataMeta(SystemDataMeta m) {
+ this();
+ m.fields.forEach(f -> fields.add(new SystemInfoField(f)));
}
@Override
@@ -160,100 +86,100 @@ public class SystemDataMeta extends
BaseTransformMeta<SystemData, SystemDataData
IVariables variables,
IHopMetadataProvider metadataProvider)
throws HopTransformException {
- for (int i = 0; i < fieldName.length; i++) {
+ for (SystemInfoField field : fields) {
IValueMeta v;
- switch (fieldType[i]) {
- case TYPE_SYSTEM_INFO_SYSTEM_START,
- TYPE_SYSTEM_INFO_SYSTEM_DATE,
- TYPE_SYSTEM_INFO_PIPELINE_DATE_FROM,
- TYPE_SYSTEM_INFO_PIPELINE_DATE_TO,
- TYPE_SYSTEM_INFO_WORKFLOW_DATE_FROM,
- TYPE_SYSTEM_INFO_WORKFLOW_DATE_TO,
- TYPE_SYSTEM_INFO_PREV_DAY_START,
- TYPE_SYSTEM_INFO_PREV_DAY_END,
- TYPE_SYSTEM_INFO_THIS_DAY_START,
- TYPE_SYSTEM_INFO_THIS_DAY_END,
- TYPE_SYSTEM_INFO_NEXT_DAY_START,
- TYPE_SYSTEM_INFO_NEXT_DAY_END,
- TYPE_SYSTEM_INFO_PREV_MONTH_START,
- TYPE_SYSTEM_INFO_PREV_MONTH_END,
- TYPE_SYSTEM_INFO_THIS_MONTH_START,
- TYPE_SYSTEM_INFO_THIS_MONTH_END,
- TYPE_SYSTEM_INFO_NEXT_MONTH_START,
- TYPE_SYSTEM_INFO_NEXT_MONTH_END,
- TYPE_SYSTEM_INFO_MODIFIED_DATE,
- TYPE_SYSTEM_INFO_PREV_WEEK_START,
- TYPE_SYSTEM_INFO_PREV_WEEK_END,
- TYPE_SYSTEM_INFO_PREV_WEEK_OPEN_END,
- TYPE_SYSTEM_INFO_PREV_WEEK_START_US,
- TYPE_SYSTEM_INFO_PREV_WEEK_END_US,
- TYPE_SYSTEM_INFO_THIS_WEEK_START,
- TYPE_SYSTEM_INFO_THIS_WEEK_END,
- TYPE_SYSTEM_INFO_THIS_WEEK_OPEN_END,
- TYPE_SYSTEM_INFO_THIS_WEEK_START_US,
- TYPE_SYSTEM_INFO_THIS_WEEK_END_US,
- TYPE_SYSTEM_INFO_NEXT_WEEK_START,
- TYPE_SYSTEM_INFO_NEXT_WEEK_END,
- TYPE_SYSTEM_INFO_NEXT_WEEK_OPEN_END,
- TYPE_SYSTEM_INFO_NEXT_WEEK_START_US,
- TYPE_SYSTEM_INFO_NEXT_WEEK_END_US,
- TYPE_SYSTEM_INFO_PREV_QUARTER_START,
- TYPE_SYSTEM_INFO_PREV_QUARTER_END,
- TYPE_SYSTEM_INFO_THIS_QUARTER_START,
- TYPE_SYSTEM_INFO_THIS_QUARTER_END,
- TYPE_SYSTEM_INFO_NEXT_QUARTER_START,
- TYPE_SYSTEM_INFO_NEXT_QUARTER_END,
- TYPE_SYSTEM_INFO_PREV_YEAR_START,
- TYPE_SYSTEM_INFO_PREV_YEAR_END,
- TYPE_SYSTEM_INFO_THIS_YEAR_START,
- TYPE_SYSTEM_INFO_THIS_YEAR_END,
- TYPE_SYSTEM_INFO_NEXT_YEAR_START,
- TYPE_SYSTEM_INFO_NEXT_YEAR_END:
- v = new ValueMetaDate(fieldName[i]);
+ switch (field.getFieldType()) {
+ case SYSTEM_START,
+ SYSTEM_DATE,
+ PIPELINE_DATE_FROM,
+ PIPELINE_DATE_TO,
+ WORKFLOW_DATE_FROM,
+ WORKFLOW_DATE_TO,
+ PREV_DAY_START,
+ PREV_DAY_END,
+ THIS_DAY_START,
+ THIS_DAY_END,
+ NEXT_DAY_START,
+ NEXT_DAY_END,
+ PREV_MONTH_START,
+ PREV_MONTH_END,
+ THIS_MONTH_START,
+ THIS_MONTH_END,
+ NEXT_MONTH_START,
+ NEXT_MONTH_END,
+ MODIFIED_DATE,
+ PREV_WEEK_START,
+ PREV_WEEK_END,
+ PREV_WEEK_OPEN_END,
+ PREV_WEEK_START_US,
+ PREV_WEEK_END_US,
+ THIS_WEEK_START,
+ THIS_WEEK_END,
+ THIS_WEEK_OPEN_END,
+ THIS_WEEK_START_US,
+ THIS_WEEK_END_US,
+ NEXT_WEEK_START,
+ NEXT_WEEK_END,
+ NEXT_WEEK_OPEN_END,
+ NEXT_WEEK_START_US,
+ NEXT_WEEK_END_US,
+ PREV_QUARTER_START,
+ PREV_QUARTER_END,
+ THIS_QUARTER_START,
+ THIS_QUARTER_END,
+ NEXT_QUARTER_START,
+ NEXT_QUARTER_END,
+ PREV_YEAR_START,
+ PREV_YEAR_END,
+ THIS_YEAR_START,
+ THIS_YEAR_END,
+ NEXT_YEAR_START,
+ NEXT_YEAR_END:
+ v = new ValueMetaDate(field.getFieldName());
break;
- case TYPE_SYSTEM_INFO_PIPELINE_NAME,
- TYPE_SYSTEM_INFO_FILENAME,
- TYPE_SYSTEM_INFO_MODIFIED_USER,
- TYPE_SYSTEM_INFO_HOSTNAME,
- TYPE_SYSTEM_INFO_HOSTNAME_REAL,
- TYPE_SYSTEM_INFO_IP_ADDRESS,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_LOG_TEXT:
- v = new ValueMetaString(fieldName[i]);
+ case PIPELINE_NAME,
+ FILENAME,
+ MODIFIED_USER,
+ HOSTNAME,
+ HOSTNAME_REAL,
+ IP_ADDRESS,
+ PREVIOUS_RESULT_LOG_TEXT:
+ v = new ValueMetaString(field.getFieldName());
break;
- case TYPE_SYSTEM_INFO_COPYNR,
- TYPE_SYSTEM_INFO_CURRENT_PID,
- TYPE_SYSTEM_INFO_JVM_TOTAL_MEMORY,
- TYPE_SYSTEM_INFO_JVM_FREE_MEMORY,
- TYPE_SYSTEM_INFO_JVM_MAX_MEMORY,
- TYPE_SYSTEM_INFO_JVM_AVAILABLE_MEMORY,
- TYPE_SYSTEM_INFO_AVAILABLE_PROCESSORS,
- TYPE_SYSTEM_INFO_JVM_CPU_TIME,
- TYPE_SYSTEM_INFO_TOTAL_PHYSICAL_MEMORY_SIZE,
- TYPE_SYSTEM_INFO_TOTAL_SWAP_SPACE_SIZE,
- TYPE_SYSTEM_INFO_COMMITTED_VIRTUAL_MEMORY_SIZE,
- TYPE_SYSTEM_INFO_FREE_PHYSICAL_MEMORY_SIZE,
- TYPE_SYSTEM_INFO_FREE_SWAP_SPACE_SIZE,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_EXIT_STATUS,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_ENTRY_NR,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ERRORS,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES_RETRIEVED,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_DELETED,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_INPUT,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_OUTPUT,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_READ,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_REJECTED,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_UPDATED,
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_WRITTEN:
- v = new ValueMetaInteger(fieldName[i]);
+ case COPYNR,
+ CURRENT_PID,
+ JVM_TOTAL_MEMORY,
+ JVM_FREE_MEMORY,
+ JVM_MAX_MEMORY,
+ JVM_AVAILABLE_MEMORY,
+ AVAILABLE_PROCESSORS,
+ JVM_CPU_TIME,
+ TOTAL_PHYSICAL_MEMORY_SIZE,
+ TOTAL_SWAP_SPACE_SIZE,
+ COMMITTED_VIRTUAL_MEMORY_SIZE,
+ FREE_PHYSICAL_MEMORY_SIZE,
+ FREE_SWAP_SPACE_SIZE,
+ PREVIOUS_RESULT_EXIT_STATUS,
+ PREVIOUS_RESULT_ENTRY_NR,
+ PREVIOUS_RESULT_NR_ERRORS,
+ PREVIOUS_RESULT_NR_FILES,
+ PREVIOUS_RESULT_NR_FILES_RETRIEVED,
+ PREVIOUS_RESULT_NR_LINES_DELETED,
+ PREVIOUS_RESULT_NR_LINES_INPUT,
+ PREVIOUS_RESULT_NR_LINES_OUTPUT,
+ PREVIOUS_RESULT_NR_LINES_READ,
+ PREVIOUS_RESULT_NR_LINES_REJECTED,
+ PREVIOUS_RESULT_NR_LINES_UPDATED,
+ PREVIOUS_RESULT_NR_LINES_WRITTEN:
+ v = new ValueMetaInteger(field.getFieldName());
v.setLength(IValueMeta.DEFAULT_INTEGER_LENGTH, 0);
break;
- case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_RESULT,
TYPE_SYSTEM_INFO_PREVIOUS_RESULT_IS_STOPPED:
- v = new ValueMetaBoolean(fieldName[i]);
+ case PREVIOUS_RESULT_RESULT, PREVIOUS_RESULT_IS_STOPPED:
+ v = new ValueMetaBoolean(field.getFieldName());
break;
default:
- v = new ValueMetaNone(fieldName[i]);
+ v = new ValueMetaNone(field.getFieldName());
break;
}
v.setOrigin(name);
@@ -261,25 +187,6 @@ public class SystemDataMeta extends
BaseTransformMeta<SystemData, SystemDataData
}
}
- @Override
- public String getXml() {
- StringBuilder retval = new StringBuilder();
-
- retval.append(" <fields>" + Const.CR);
-
- for (int i = 0; i < fieldName.length; i++) {
- retval.append(" <field>" + Const.CR);
- retval.append(" " + XmlHandler.addTagValue("name", fieldName[i]));
- retval.append(
- " "
- + XmlHandler.addTagValue("type", fieldType[i] != null ?
fieldType[i].getCode() : ""));
- retval.append(" </field>" + Const.CR);
- }
- retval.append(" </fields>" + Const.CR);
-
- return retval.toString();
- }
-
@Override
public void check(
List<ICheckResult> remarks,
@@ -293,13 +200,13 @@ public class SystemDataMeta extends
BaseTransformMeta<SystemData, SystemDataData
IHopMetadataProvider metadataProvider) {
// See if we have input streams leading to this transform!
int nrRemarks = remarks.size();
- for (int i = 0; i < fieldName.length; i++) {
- if (fieldType[i].ordinal() <=
SystemDataTypes.TYPE_SYSTEM_INFO_NONE.ordinal()) {
+ for (SystemInfoField field : fields) {
+ if (field.getFieldType().getIndex() <= SystemDataType.NONE.getIndex()) {
CheckResult cr =
new CheckResult(
ICheckResult.TYPE_RESULT_ERROR,
BaseMessages.getString(
- PKG, "SystemDataMeta.CheckResult.FieldHasNoType",
fieldName[i]),
+ PKG, "SystemDataMeta.CheckResult.FieldHasNoType",
field.getFieldName()),
transformMeta);
remarks.add(cr);
}
@@ -314,30 +221,27 @@ public class SystemDataMeta extends
BaseTransformMeta<SystemData, SystemDataData
}
}
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof SystemDataMeta)) {
- return false;
- }
- SystemDataMeta that = (SystemDataMeta) o;
-
- if (!Arrays.equals(fieldName, that.fieldName)) {
- return false;
+ @Getter
+ @Setter
+ public static class SystemInfoField {
+ @HopMetadataProperty(
+ key = "name",
+ injectionKey = "FIELD_NAME",
+ injectionKeyDescription = "SystemDataMeta.Injection.FIELD_NAME")
+ private String fieldName;
+
+ @HopMetadataProperty(
+ key = "type",
+ injectionKey = "FIELD_TYPE",
+ injectionKeyDescription = "SystemDataMeta.Injection.FIELD_TYPE",
+ storeWithCode = true)
+ private SystemDataType fieldType;
+
+ public SystemInfoField() {}
+
+ public SystemInfoField(SystemInfoField f) {
+ this.fieldName = f.fieldName;
+ this.fieldType = f.fieldType;
}
- if (!Arrays.equals(fieldType, that.fieldType)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = Arrays.hashCode(fieldName);
- result = 31 * result + Arrays.hashCode(fieldType);
- return result;
}
}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java
deleted file mode 100644
index 70b49c84af..0000000000
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaFunction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hop.pipeline.transforms.systemdata;
-
-public class SystemDataMetaFunction {
- int type;
- String code;
- String description;
-
- /**
- * @param type
- * @param code
- * @param description
- */
- public SystemDataMetaFunction(int type, String code, String description) {
- super();
- this.type = type;
- this.code = code;
- this.description = description;
- }
-
- /**
- * @return the code
- */
- public String getCode() {
- return code;
- }
-
- /**
- * @param code the code to set
- */
- public void setCode(String code) {
- this.code = code;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the type
- */
- public int getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(int type) {
- this.type = type;
- }
-}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTypeConverter.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTypeConverter.java
deleted file mode 100644
index 93d9d31e0c..0000000000
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTypeConverter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hop.pipeline.transforms.systemdata;
-
-import org.apache.hop.core.exception.HopValueException;
-import org.apache.hop.core.injection.InjectionTypeConverter;
-
-public class SystemDataMetaInjectionTypeConverter extends
InjectionTypeConverter {
-
- @Override
- public Enum<?> string2enum(Class<?> enumClass, String v) throws
HopValueException {
- // For SystemDataMeta, enum should be a SystemDataTypes
- SystemDataTypes type = SystemDataTypes.getTypeFromString(v);
- if (!SystemDataTypes.TYPE_SYSTEM_INFO_NONE.toString().equals(v)
- && type == SystemDataTypes.TYPE_SYSTEM_INFO_NONE) {
- // Throw exception to let user know entered string was not valid
SystemDataType
- throw new HopValueException("Unknown value '" + v + "' for enum " +
enumClass);
- } else {
- return type;
- }
- }
-}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataType.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataType.java
new file mode 100644
index 0000000000..ab87f8bae8
--- /dev/null
+++
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataType.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.pipeline.transforms.systemdata;
+
+import lombok.Getter;
+import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.IEnumHasCodeAndDescription;
+
+@Getter
+public enum SystemDataType implements IEnumHasCodeAndDescription {
+ NONE("", ""),
+ SYSTEM_DATE("system date (variable)", "SystemDateVariable"),
+ SYSTEM_START("system date (fixed)", "SystemDateFixed"),
+ PIPELINE_DATE_FROM("start date range", "StartDateRange"),
+ PIPELINE_DATE_TO("end date range", "EndDateRange"),
+ WORKFLOW_DATE_FROM("workflow start date range", "JobStartDateRange"),
+ WORKFLOW_DATE_TO("workflow end date range", "JobEndDateRange"),
+ PREV_DAY_START("yesterday start", "YesterdayStart"),
+ PREV_DAY_END("yesterday end", "YesterdayEnd"),
+ THIS_DAY_START("today start", "TodayStart"),
+ THIS_DAY_END("today end", "TodayEnd"),
+ NEXT_DAY_START("tomorrow start", "TomorrowStart"),
+ NEXT_DAY_END("tomorrow end", "TomorrowEnd"),
+ PREV_MONTH_START("last month start", "LastMonthStart"),
+ PREV_MONTH_END("last month end", "LastMonthEnd"),
+ THIS_MONTH_START("this month start", "ThisMonthStart"),
+ THIS_MONTH_END("this month end", "ThisMonthEnd"),
+ NEXT_MONTH_START("next month start", "NextMonthStart"),
+ NEXT_MONTH_END("next month end", "NextMonthEnd"),
+ COPYNR("copy of transform", "CopyOfTransform"),
+ PIPELINE_NAME(" pipeline name", "PipelineName"),
+ FILENAME(" pipeline file name", "PipelineFileName"),
+ MODIFIED_USER("User modified", "UserModified"),
+ MODIFIED_DATE("Date modified", "DateModified"),
+ HOSTNAME("Hostname", "HostnameNetworkSetup"),
+ HOSTNAME_REAL("Hostname real", "Hostname"),
+ IP_ADDRESS("IP address", "IPAddress"),
+ CURRENT_PID("Current PID", "CurrentPID"),
+
+ JVM_MAX_MEMORY("jvm max memory", "JVMMaxMemory"),
+ JVM_TOTAL_MEMORY("jvm total memory", "JVMTotalMemory"),
+ JVM_FREE_MEMORY("jvm free memory", "JVMFreeMemory"),
+ JVM_AVAILABLE_MEMORY("jvm available memory", "JVMAvailableMemory"),
+ AVAILABLE_PROCESSORS("available processors", "AvailableProcessors"),
+ JVM_CPU_TIME("jvm cpu time", "JVMCPUTime"),
+ TOTAL_PHYSICAL_MEMORY_SIZE("total physical memory size",
"TotalPhysicalMemorySize"),
+ TOTAL_SWAP_SPACE_SIZE("total swap space size", "TotalSwapSpaceSize"),
+ COMMITTED_VIRTUAL_MEMORY_SIZE("committed virtual memory size",
"CommittedVirtualMemorySize"),
+ FREE_PHYSICAL_MEMORY_SIZE("free physical memory size",
"FreePhysicalMemorySize"),
+ FREE_SWAP_SPACE_SIZE("free swap space size", "FreeSwapSpaceSize"),
+
+ PREV_WEEK_START("last week start", "LastWeekStart"),
+ PREV_WEEK_END("last week end", "LastWeekEnd"),
+ PREV_WEEK_OPEN_END("last week open end", "LastWeekOpenEnd"),
+
+ PREV_WEEK_START_US("last week start us", "LastWeekStartUS"),
+ PREV_WEEK_END_US("last week end us", "LastWeekEndUS"),
+
+ THIS_WEEK_START("this week start", "ThisWeekStart"),
+ THIS_WEEK_END("this week end", "ThisWeekEnd"),
+ THIS_WEEK_OPEN_END("this week open end", "ThisWeekOpenEnd"),
+
+ THIS_WEEK_START_US("this week start us", "ThisWeekStartUS"),
+ THIS_WEEK_END_US("this week end us", "ThisWeekEndUS"),
+
+ NEXT_WEEK_START("next week start", "NextWeekStart"),
+ NEXT_WEEK_END("next week end", "NextWeekEnd"),
+ NEXT_WEEK_OPEN_END("next week open end", "NextWeekOpenEnd"),
+
+ NEXT_WEEK_START_US("next week start us", "NextWeekStartUS"),
+ NEXT_WEEK_END_US("next week end us", "NextWeekEndUS"),
+
+ PREV_QUARTER_START("prev quarter start", "PrevQuarterStart"),
+ PREV_QUARTER_END("prev quarter end", "PrevQuarterEnd"),
+
+ THIS_QUARTER_START("this quarter start", "ThisQuarterStart"),
+ THIS_QUARTER_END("this quarter end", "ThisQuarterEnd"),
+
+ NEXT_QUARTER_START("next quarter start", "NextQuarterStart"),
+ NEXT_QUARTER_END("next quarter end", "NextQuarterEnd"),
+
+ PREV_YEAR_START("prev year start", "PrevYearStart"),
+ PREV_YEAR_END("prev year end", "PrevYearEnd"),
+
+ THIS_YEAR_START("this year start", "ThisYearStart"),
+ THIS_YEAR_END("this year end", "ThisYearEnd"),
+ NEXT_YEAR_START("next year start", "NextYearStart"),
+ NEXT_YEAR_END("next year end", "NextYearEnd"),
+
+ PREVIOUS_RESULT_RESULT("previous result result", "PreviousResultResult"),
+ PREVIOUS_RESULT_EXIT_STATUS("previous result exist status",
"PreviousResultExitStatus"),
+ PREVIOUS_RESULT_ENTRY_NR("previous result entry nr",
"PreviousResultEntryNr"),
+ PREVIOUS_RESULT_NR_ERRORS("previous result nr errors",
"PreviousResultNrErrors"),
+ PREVIOUS_RESULT_NR_LINES_INPUT("previous result nr lines input",
"PreviousResultNrLinesInput"),
+ PREVIOUS_RESULT_NR_LINES_OUTPUT("previous result nr lines output",
"PreviousResultNrLinesOutput"),
+ PREVIOUS_RESULT_NR_LINES_READ("previous result nr lines read",
"PreviousResultNrLinesRead"),
+ PREVIOUS_RESULT_NR_LINES_UPDATED(
+ "previous result nr lines updated", "PreviousResultNrLinesUpdated"),
+ PREVIOUS_RESULT_NR_LINES_WRITTEN(
+ "previous result nr lines written", "PreviousResultNrLinesWritten"),
+ PREVIOUS_RESULT_NR_LINES_DELETED(
+ "previous result nr lines deleted", "PreviousResultNrLinesDeleted"),
+ PREVIOUS_RESULT_NR_LINES_REJECTED(
+ "previous result nr lines rejected", "PreviousResultNrLinesRejected"),
+ PREVIOUS_RESULT_NR_ROWS("previous result nr rows",
"PreviousResultNrLinesNrRows"),
+ PREVIOUS_RESULT_IS_STOPPED("previous result is stopped",
"PreviousResultIsStopped"),
+ PREVIOUS_RESULT_NR_FILES("previous result nr files",
"PreviousResultNrFiles"),
+ PREVIOUS_RESULT_NR_FILES_RETRIEVED(
+ "previous result nr files retrieved", "PreviousResultNrFilesRetrieved"),
+ PREVIOUS_RESULT_LOG_TEXT("previous result log text",
"PreviousResultLogText");
+
+ private final String code;
+ private final String description;
+
+ public static SystemDataType lookupDescription(String description) {
+ return IEnumHasCodeAndDescription.lookupDescription(SystemDataType.class,
description, NONE);
+ }
+
+ public static String[] getDescriptions() {
+ return IEnumHasCodeAndDescription.getDescriptions(SystemDataType.class);
+ }
+
+ SystemDataType(String code, String descriptionName) {
+ this.code = code;
+ this.description =
+ BaseMessages.getString(SystemDataType.class,
"SystemDataMeta.TypeDesc." + descriptionName);
+ }
+}
diff --git
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTypes.java
b/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTypes.java
deleted file mode 100644
index b096ca7a54..0000000000
---
a/plugins/transforms/systemdata/src/main/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTypes.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hop.pipeline.transforms.systemdata;
-
-import org.apache.hop.i18n.BaseMessages;
-
-public enum SystemDataTypes {
- TYPE_SYSTEM_INFO_NONE("", ""),
- TYPE_SYSTEM_INFO_SYSTEM_DATE("system date (variable)", "SystemDateVariable"),
- TYPE_SYSTEM_INFO_SYSTEM_START("system date (fixed)", "SystemDateFixed"),
- TYPE_SYSTEM_INFO_PIPELINE_DATE_FROM("start date range", "StartDateRange"),
- TYPE_SYSTEM_INFO_PIPELINE_DATE_TO("end date range", "EndDateRange"),
- TYPE_SYSTEM_INFO_WORKFLOW_DATE_FROM("workflow start date range",
"JobStartDateRange"),
- TYPE_SYSTEM_INFO_WORKFLOW_DATE_TO("workflow end date range",
"JobEndDateRange"),
- TYPE_SYSTEM_INFO_PREV_DAY_START("yesterday start", "YesterdayStart"),
- TYPE_SYSTEM_INFO_PREV_DAY_END("yesterday end", "YesterdayEnd"),
- TYPE_SYSTEM_INFO_THIS_DAY_START("today start", "TodayStart"),
- TYPE_SYSTEM_INFO_THIS_DAY_END("today end", "TodayEnd"),
- TYPE_SYSTEM_INFO_NEXT_DAY_START("tomorrow start", "TomorrowStart"),
- TYPE_SYSTEM_INFO_NEXT_DAY_END("tomorrow end", "TomorrowEnd"),
- TYPE_SYSTEM_INFO_PREV_MONTH_START("last month start", "LastMonthStart"),
- TYPE_SYSTEM_INFO_PREV_MONTH_END("last month end", "LastMonthEnd"),
- TYPE_SYSTEM_INFO_THIS_MONTH_START("this month start", "ThisMonthStart"),
- TYPE_SYSTEM_INFO_THIS_MONTH_END("this month end", "ThisMonthEnd"),
- TYPE_SYSTEM_INFO_NEXT_MONTH_START("next month start", "NextMonthStart"),
- TYPE_SYSTEM_INFO_NEXT_MONTH_END("next month end", "NextMonthEnd"),
- TYPE_SYSTEM_INFO_COPYNR("copy of transform", "CopyOfTransform"),
- TYPE_SYSTEM_INFO_PIPELINE_NAME(" pipeline name", "PipelineName"),
- TYPE_SYSTEM_INFO_FILENAME(" pipeline file name", "PipelineFileName"),
- TYPE_SYSTEM_INFO_MODIFIED_USER("User modified", "UserModified"),
- TYPE_SYSTEM_INFO_MODIFIED_DATE("Date modified", "DateModified"),
- TYPE_SYSTEM_INFO_HOSTNAME("Hostname", "HostnameNetworkSetup"),
- TYPE_SYSTEM_INFO_HOSTNAME_REAL("Hostname real", "Hostname"),
- TYPE_SYSTEM_INFO_IP_ADDRESS("IP address", "IPAddress"),
- TYPE_SYSTEM_INFO_CURRENT_PID("Current PID", "CurrentPID"),
-
- TYPE_SYSTEM_INFO_JVM_MAX_MEMORY("jvm max memory", "JVMMaxMemory"),
- TYPE_SYSTEM_INFO_JVM_TOTAL_MEMORY("jvm total memory", "JVMTotalMemory"),
- TYPE_SYSTEM_INFO_JVM_FREE_MEMORY("jvm free memory", "JVMFreeMemory"),
- TYPE_SYSTEM_INFO_JVM_AVAILABLE_MEMORY("jvm available memory",
"JVMAvailableMemory"),
- TYPE_SYSTEM_INFO_AVAILABLE_PROCESSORS("available processors",
"AvailableProcessors"),
- TYPE_SYSTEM_INFO_JVM_CPU_TIME("jvm cpu time", "JVMCPUTime"),
- TYPE_SYSTEM_INFO_TOTAL_PHYSICAL_MEMORY_SIZE(
- "total physical memory size", "TotalPhysicalMemorySize"),
- TYPE_SYSTEM_INFO_TOTAL_SWAP_SPACE_SIZE("total swap space size",
"TotalSwapSpaceSize"),
- TYPE_SYSTEM_INFO_COMMITTED_VIRTUAL_MEMORY_SIZE(
- "committed virtual memory size", "CommittedVirtualMemorySize"),
- TYPE_SYSTEM_INFO_FREE_PHYSICAL_MEMORY_SIZE("free physical memory size",
"FreePhysicalMemorySize"),
- TYPE_SYSTEM_INFO_FREE_SWAP_SPACE_SIZE("free swap space size",
"FreeSwapSpaceSize"),
-
- TYPE_SYSTEM_INFO_PREV_WEEK_START("last week start", "LastWeekStart"),
- TYPE_SYSTEM_INFO_PREV_WEEK_END("last week end", "LastWeekEnd"),
- TYPE_SYSTEM_INFO_PREV_WEEK_OPEN_END("last week open end", "LastWeekOpenEnd"),
-
- TYPE_SYSTEM_INFO_PREV_WEEK_START_US("last week start us", "LastWeekStartUS"),
- TYPE_SYSTEM_INFO_PREV_WEEK_END_US("last week end us", "LastWeekEndUS"),
-
- TYPE_SYSTEM_INFO_THIS_WEEK_START("this week start", "ThisWeekStart"),
- TYPE_SYSTEM_INFO_THIS_WEEK_END("this week end", "ThisWeekEnd"),
- TYPE_SYSTEM_INFO_THIS_WEEK_OPEN_END("this week open end", "ThisWeekOpenEnd"),
-
- TYPE_SYSTEM_INFO_THIS_WEEK_START_US("this week start us", "ThisWeekStartUS"),
- TYPE_SYSTEM_INFO_THIS_WEEK_END_US("this week end us", "ThisWeekEndUS"),
-
- TYPE_SYSTEM_INFO_NEXT_WEEK_START("next week start", "NextWeekStart"),
- TYPE_SYSTEM_INFO_NEXT_WEEK_END("next week end", "NextWeekEnd"),
- TYPE_SYSTEM_INFO_NEXT_WEEK_OPEN_END("next week open end", "NextWeekOpenEnd"),
-
- TYPE_SYSTEM_INFO_NEXT_WEEK_START_US("next week start us", "NextWeekStartUS"),
- TYPE_SYSTEM_INFO_NEXT_WEEK_END_US("next week end us", "NextWeekEndUS"),
-
- TYPE_SYSTEM_INFO_PREV_QUARTER_START("prev quarter start",
"PrevQuarterStart"),
- TYPE_SYSTEM_INFO_PREV_QUARTER_END("prev quarter end", "PrevQuarterEnd"),
-
- TYPE_SYSTEM_INFO_THIS_QUARTER_START("this quarter start",
"ThisQuarterStart"),
- TYPE_SYSTEM_INFO_THIS_QUARTER_END("this quarter end", "ThisQuarterEnd"),
-
- TYPE_SYSTEM_INFO_NEXT_QUARTER_START("next quarter start",
"NextQuarterStart"),
- TYPE_SYSTEM_INFO_NEXT_QUARTER_END("next quarter end", "NextQuarterEnd"),
-
- TYPE_SYSTEM_INFO_PREV_YEAR_START("prev year start", "PrevYearStart"),
- TYPE_SYSTEM_INFO_PREV_YEAR_END("prev year end", "PrevYearEnd"),
-
- TYPE_SYSTEM_INFO_THIS_YEAR_START("this year start", "ThisYearStart"),
- TYPE_SYSTEM_INFO_THIS_YEAR_END("this year end", "ThisYearEnd"),
- TYPE_SYSTEM_INFO_NEXT_YEAR_START("next year start", "NextYearStart"),
- TYPE_SYSTEM_INFO_NEXT_YEAR_END("next year end", "NextYearEnd"),
-
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_RESULT("previous result result",
"PreviousResultResult"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_EXIT_STATUS(
- "previous result exist status", "PreviousResultExitStatus"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_ENTRY_NR("previous result entry nr",
"PreviousResultEntryNr"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ERRORS("previous result nr errors",
"PreviousResultNrErrors"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_INPUT(
- "previous result nr lines input", "PreviousResultNrLinesInput"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_OUTPUT(
- "previous result nr lines output", "PreviousResultNrLinesOutput"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_READ(
- "previous result nr lines read", "PreviousResultNrLinesRead"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_UPDATED(
- "previous result nr lines updated", "PreviousResultNrLinesUpdated"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_WRITTEN(
- "previous result nr lines written", "PreviousResultNrLinesWritten"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_DELETED(
- "previous result nr lines deleted", "PreviousResultNrLinesDeleted"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_REJECTED(
- "previous result nr lines rejected", "PreviousResultNrLinesRejected"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ROWS(
- "previous result nr rows", "PreviousResultNrLinesNrRows"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_IS_STOPPED(
- "previous result is stopped", "PreviousResultIsStopped"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES("previous result nr files",
"PreviousResultNrFiles"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES_RETRIEVED(
- "previous result nr files retrieved", "PreviousResultNrFilesRetrieved"),
- TYPE_SYSTEM_INFO_PREVIOUS_RESULT_LOG_TEXT("previous result log text",
"PreviousResultLogText");
-
- private final String code;
- private final String description;
-
- public String getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-
- public static SystemDataTypes getTypeFromString(String typeStr) {
- for (SystemDataTypes type : SystemDataTypes.values()) {
- // attempting to purge this typo from KTRs
- if ("previous result nr lines rejeted".equalsIgnoreCase(typeStr)) {
- typeStr = "previous result nr lines rejected";
- }
-
- if (type.toString().equals(typeStr)
- || type.code.equalsIgnoreCase(typeStr)
- || type.description.equalsIgnoreCase(typeStr)) {
- return type;
- }
- }
-
- return TYPE_SYSTEM_INFO_NONE;
- }
-
- SystemDataTypes(String code, String descriptionName) {
- this.code = code;
- this.description =
- BaseMessages.getString(SystemDataTypes.class,
"SystemDataMeta.TypeDesc." + descriptionName);
- }
-}
diff --git
a/plugins/transforms/systemdata/src/main/resources/org/apache/hop/pipeline/transforms/systemdata/messages/messages_en_US.properties
b/plugins/transforms/systemdata/src/main/resources/org/apache/hop/pipeline/transforms/systemdata/messages/messages_en_US.properties
index 4f17142d05..302e002d8d 100644
---
a/plugins/transforms/systemdata/src/main/resources/org/apache/hop/pipeline/transforms/systemdata/messages/messages_en_US.properties
+++
b/plugins/transforms/systemdata/src/main/resources/org/apache/hop/pipeline/transforms/systemdata/messages/messages_en_US.properties
@@ -33,6 +33,8 @@ SystemDataDialog.SelectInfoType.DialogTitle=Select info type
SystemDataDialog.TypeColumn.Column=Type
SystemDataMeta.CheckResult.AllTypesSpecified=All fields have a system info
type.
SystemDataMeta.CheckResult.FieldHasNoType=There is no type specified for field
[{0}]\!
+SystemDataMeta.Injection.FIELDS=Fields to inject
+SystemDataMeta.Injection.FIELD=Field to inject
SystemDataMeta.Injection.FIELD_NAME=Specify the display name of the system
information that will be converted.
SystemDataMeta.Injection.FIELD_TYPE=Specify the type of system information
that will be converted.
SystemDataMeta.keyword=system,data
diff --git
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTest.java
b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTest.java
deleted file mode 100644
index 90ce138bab..0000000000
---
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaInjectionTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hop.pipeline.transforms.systemdata;
-
-import org.apache.hop.core.injection.BaseMetadataInjectionTestJunit5;
-import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-class SystemDataMetaInjectionTest extends
BaseMetadataInjectionTestJunit5<SystemDataMeta> {
- @RegisterExtension
- static RestoreHopEngineEnvironmentExtension env = new
RestoreHopEngineEnvironmentExtension();
-
- @BeforeEach
- void setup() throws Exception {
- setup(new SystemDataMeta());
- }
-
- @Test
- void test() throws Exception {
- check("FIELD_NAME", () -> meta.getFieldName()[0]);
- check("FIELD_TYPE", () -> meta.getFieldType()[0], SystemDataTypes.class);
- }
-}
diff --git
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java
b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java
index 733936ad24..4f50786adb 100644
---
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java
+++
b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataMetaTest.java
@@ -18,159 +18,82 @@
package org.apache.hop.pipeline.transforms.systemdata;
import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.hop.core.HopEnvironment;
-import org.apache.hop.core.exception.HopException;
-import org.apache.hop.core.plugins.PluginRegistry;
-import org.apache.hop.core.xml.XmlParserFactoryProducer;
-import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
-import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester;
-import org.apache.hop.pipeline.transforms.loadsave.initializer.IInitializer;
-import
org.apache.hop.pipeline.transforms.loadsave.validator.ArrayLoadSaveValidator;
-import
org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator;
-import
org.apache.hop.pipeline.transforms.loadsave.validator.StringLoadSaveValidator;
-import org.junit.jupiter.api.BeforeEach;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Objects;
+import org.apache.hop.core.xml.XmlHandler;
+import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.metadata.serializer.xml.XmlMetadataUtil;
+import org.apache.hop.pipeline.transform.TransformMeta;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/** User: Dzmitry Stsiapanau Date: 1/20/14 Time: 3:04 PM */
-class SystemDataMetaTest implements IInitializer<SystemDataMeta> {
- @RegisterExtension
- static RestoreHopEngineEnvironmentExtension env = new
RestoreHopEngineEnvironmentExtension();
-
- LoadSaveTester loadSaveTester;
- Class<SystemDataMeta> testMetaClass = SystemDataMeta.class;
- SystemDataMeta expectedSystemDataMeta;
- String expectedXML =
- " <fields>\n"
- + " <field>\n"
- + " <name>hostname_real</name>\n"
- + " <type>Hostname real</type>\n"
- + " </field>\n"
- + " <field>\n"
- + " <name>hostname</name>\n"
- + " <type>Hostname</type>\n"
- + " </field>\n"
- + " </fields>\n";
-
- @BeforeEach
- void setUp() throws Exception {
- expectedSystemDataMeta = new SystemDataMeta();
- expectedSystemDataMeta.allocate(2);
- String[] names = expectedSystemDataMeta.getFieldName();
- SystemDataTypes[] types = expectedSystemDataMeta.getFieldType();
- names[0] = "hostname_real";
- names[1] = "hostname";
- types[0] =
- SystemDataTypes.getTypeFromString(
- SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME_REAL.getDescription());
- types[1] =
- SystemDataTypes.getTypeFromString(
- SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME.getDescription());
- }
-
- @Test
- void testLoadXml() throws Exception {
- SystemDataMeta systemDataMeta = new SystemDataMeta();
- DocumentBuilderFactory documentBuilderFactory =
- XmlParserFactoryProducer.createSecureDocBuilderFactory();
- DocumentBuilder documentBuilder =
documentBuilderFactory.newDocumentBuilder();
- Node node = documentBuilder.parse(new InputSource(new
StringReader(expectedXML)));
- systemDataMeta.loadXml(node, null);
- assertEquals(expectedSystemDataMeta, systemDataMeta);
- }
-
- @Test
- void testGetXml() throws Exception {
- String generatedXML = expectedSystemDataMeta.getXml();
- assertEquals(
- expectedXML.replaceAll("\n", "").replaceAll("\r", ""),
- generatedXML.replaceAll("\n", "").replaceAll("\r", ""));
- }
-
- @BeforeEach
- void setUpLoadSave() throws Exception {
- HopEnvironment.init();
- PluginRegistry.init();
- List<String> attributes = Arrays.asList("fieldName", "fieldType");
-
- Map<String, String> getterMap =
- new HashMap<>() {
- {
- put("fieldName", "getFieldName");
- put("fieldType", "getFieldType");
- }
- };
- Map<String, String> setterMap =
- new HashMap<>() {
- {
- put("fieldName", "setFieldName");
- put("fieldType", "setFieldType");
- }
- };
- IFieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
- new ArrayLoadSaveValidator<>(new StringLoadSaveValidator(), 5);
-
- IFieldLoadSaveValidator<SystemDataTypes[]> sdtArrayLoadSaveValidator =
- new ArrayLoadSaveValidator<>(new SystemDataTypesLoadSaveValidator(),
5);
-
- Map<String, IFieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<>();
- attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
- attrValidatorMap.put("fieldType", sdtArrayLoadSaveValidator);
-
- Map<String, IFieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<>();
-
- loadSaveTester =
- new LoadSaveTester(
- testMetaClass,
- attributes,
- getterMap,
- setterMap,
- attrValidatorMap,
- typeValidatorMap,
- this);
- }
-
- // Call the allocate method on the LoadSaveTester meta class
- @Override
- public void modify(SystemDataMeta someMeta) {
- if (someMeta instanceof SystemDataMeta) {
- ((SystemDataMeta) someMeta).allocate(5);
- }
- }
+class SystemDataMetaTest {
@Test
- void testSerialization() throws HopException {
- loadSaveTester.testSerialization();
+ void testLoadSave() throws Exception {
+ Path path =
Paths.get(Objects.requireNonNull(getClass().getResource("/transform.xml")).toURI());
+ String xml = Files.readString(path);
+ SystemDataMeta meta = new SystemDataMeta();
+ XmlMetadataUtil.deSerializeFromXml(
+ XmlHandler.loadXmlString(xml, TransformMeta.XML_TAG),
+ SystemDataMeta.class,
+ meta,
+ new MemoryMetadataProvider());
+
+ validate(meta);
+
+ // Do a round trip:
+ //
+ String xmlCopy =
+ XmlHandler.openTag(TransformMeta.XML_TAG)
+ + XmlMetadataUtil.serializeObjectToXml(meta)
+ + XmlHandler.closeTag(TransformMeta.XML_TAG);
+ SystemDataMeta metaCopy = new SystemDataMeta();
+ XmlMetadataUtil.deSerializeFromXml(
+ XmlHandler.loadXmlString(xmlCopy, TransformMeta.XML_TAG),
+ SystemDataMeta.class,
+ metaCopy,
+ new MemoryMetadataProvider());
+ validate(metaCopy);
}
- public class SystemDataTypesLoadSaveValidator
- implements IFieldLoadSaveValidator<SystemDataTypes> {
- final Random rand = new Random();
-
- @Override
- public SystemDataTypes getTestObject() {
- SystemDataTypes[] allTypes = SystemDataTypes.values();
- return allTypes[rand.nextInt(allTypes.length)];
- }
-
- @Override
- public boolean validateTestObject(SystemDataTypes testObject, Object
actual) {
- if (!(actual instanceof SystemDataTypes)) {
- return false;
- }
- SystemDataTypes actualInput = (SystemDataTypes) actual;
- return (testObject.toString().equals(actualInput.toString()));
- }
+ private static void validate(SystemDataMeta meta) {
+ assertNotNull(meta.getFields());
+ assertFalse(meta.getFields().isEmpty());
+ assertEquals(8, meta.getFields().size());
+ SystemDataMeta.SystemInfoField f1 = meta.getFields().get(0);
+ assertEquals("variable_sysdate", f1.getFieldName());
+ assertEquals(SystemDataType.SYSTEM_DATE, f1.getFieldType());
+
+ SystemDataMeta.SystemInfoField f2 = meta.getFields().get(1);
+ assertEquals("fixed_sysdate", f2.getFieldName());
+ assertEquals(SystemDataType.SYSTEM_START, f2.getFieldType());
+
+ SystemDataMeta.SystemInfoField f3 = meta.getFields().get(2);
+ assertEquals("JVM max memory", f3.getFieldName());
+ assertEquals(SystemDataType.JVM_MAX_MEMORY, f3.getFieldType());
+
+ SystemDataMeta.SystemInfoField f4 = meta.getFields().get(3);
+ assertEquals("IP address", f4.getFieldName());
+ assertEquals(SystemDataType.IP_ADDRESS, f4.getFieldType());
+
+ SystemDataMeta.SystemInfoField f5 = meta.getFields().get(4);
+ assertEquals("real_Hostname", f5.getFieldName());
+ assertEquals(SystemDataType.HOSTNAME_REAL, f5.getFieldType());
+
+ SystemDataMeta.SystemInfoField f6 = meta.getFields().get(5);
+ assertEquals("Network_Hostname", f6.getFieldName());
+ assertEquals(SystemDataType.HOSTNAME, f6.getFieldType());
+
+ SystemDataMeta.SystemInfoField f7 = meta.getFields().get(6);
+ assertEquals("Available Processors", f7.getFieldName());
+ assertEquals(SystemDataType.AVAILABLE_PROCESSORS, f7.getFieldType());
+
+ SystemDataMeta.SystemInfoField f8 = meta.getFields().get(7);
+ assertEquals("JVM Total Memory", f8.getFieldName());
+ assertEquals(SystemDataType.JVM_TOTAL_MEMORY, f8.getFieldType());
}
}
diff --git
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java
b/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java
deleted file mode 100644
index dcdd1826cd..0000000000
---
a/plugins/transforms/systemdata/src/test/java/org/apache/hop/pipeline/transforms/systemdata/SystemDataTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hop.pipeline.transforms.systemdata;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.exception.HopException;
-import org.apache.hop.core.exception.HopTransformException;
-import org.apache.hop.core.logging.ILoggingObject;
-import org.apache.hop.core.row.IRowMeta;
-import org.apache.hop.pipeline.Pipeline;
-import org.apache.hop.pipeline.PipelineMeta;
-import org.apache.hop.pipeline.transform.TransformMeta;
-import org.apache.hop.pipeline.transforms.mock.TransformMockHelper;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-/** User: Dzmitry Stsiapanau Date: 1/20/14 Time: 12:12 PM */
-class SystemDataTest {
- private class SystemDataHandler extends SystemData {
-
- Object[] row = new Object[] {"anyData"};
- Object[] outputRow;
-
- public SystemDataHandler(
- TransformMeta transformMeta,
- SystemDataMeta meta,
- SystemDataData data,
- int copyNr,
- PipelineMeta pipelineMeta,
- Pipeline pipeline) {
- super(transformMeta, meta, data, copyNr, pipelineMeta, pipeline);
- }
-
- public void setRow(Object[] row) {
- this.row = row;
- }
-
- /**
- * In case of getRow, we receive data from previous transforms through the
input rowset. In case
- * we split the stream, we have to copy the data to the alternate splits:
rowsets 1 through n.
- */
- @Override
- public Object[] getRow() throws HopException {
- return row;
- }
-
- /**
- * putRow is used to copy a row, to the alternate rowset(s) This should
get priority over
- * everything else! (synchronized) If distribute is true, a row is copied
only once to the
- * output rowsets, otherwise copies are sent to each rowset!
- *
- * @param row The row to put to the destination rowset(s).
- * @throws HopTransformException
- */
- @Override
- public void putRow(IRowMeta rowMeta, Object[] row) throws
HopTransformException {
- outputRow = row;
- }
-
- public Object[] getOutputRow() {
- return outputRow;
- }
- }
-
- private TransformMockHelper<SystemDataMeta, SystemDataData>
transformMockHelper;
-
- @BeforeEach
- void setUp() throws Exception {
- transformMockHelper =
- new TransformMockHelper<>("SYSTEM_DATA TEST", SystemDataMeta.class,
SystemDataData.class);
- when(transformMockHelper.logChannelFactory.create(any(),
any(ILoggingObject.class)))
- .thenReturn(transformMockHelper.iLogChannel);
- when(transformMockHelper.pipeline.isRunning()).thenReturn(true);
- verify(transformMockHelper.pipeline, never()).stopAll();
- }
-
- @AfterEach
- void tearDown() throws Exception {
- transformMockHelper.cleanUp();
- }
-
- @Test
- @Disabled("This test needs to be reviewed")
- void testProcessRow() throws Exception {
- SystemDataData systemDataData = new SystemDataData();
- SystemDataMeta systemDataMeta = new SystemDataMeta();
- systemDataMeta.allocate(2);
- systemDataMeta.setFieldName(new String[] {"hostname", "hostname_real"});
- systemDataMeta.setFieldType(
- new SystemDataTypes[] {
- SystemDataTypes.getTypeFromString(
- SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME.getDescription()),
- SystemDataTypes.getTypeFromString(
- SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME_REAL.getDescription())
- });
- SystemDataHandler systemData =
- new SystemDataHandler(
- transformMockHelper.transformMeta,
- systemDataMeta,
- systemDataData,
- 0,
- transformMockHelper.pipelineMeta,
- transformMockHelper.pipeline);
- Object[] expectedRow = new Object[] {Const.getHostname(),
Const.getHostnameReal()};
- IRowMeta inputRowMeta = mock(IRowMeta.class);
- when(inputRowMeta.clone()).thenReturn(inputRowMeta);
- when(inputRowMeta.size()).thenReturn(2);
- systemDataData.outputRowMeta = inputRowMeta;
- systemData.init();
- assertFalse(systemData.processRow());
- Object[] out = systemData.getOutputRow();
- assertArrayEquals(expectedRow, out);
- }
-}
diff --git a/plugins/transforms/systemdata/src/test/resources/transform.xml
b/plugins/transforms/systemdata/src/test/resources/transform.xml
new file mode 100644
index 0000000000..58250a3311
--- /dev/null
+++ b/plugins/transforms/systemdata/src/test/resources/transform.xml
@@ -0,0 +1,54 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<transform>
+ <fields>
+ <field>
+ <name>variable_sysdate</name>
+ <type>system date (variable)</type>
+ </field>
+ <field>
+ <name>fixed_sysdate</name>
+ <type>system date (fixed)</type>
+ </field>
+ <field>
+ <name>JVM max memory</name>
+ <type>jvm max memory</type>
+ </field>
+ <field>
+ <name>IP address</name>
+ <type>IP address</type>
+ </field>
+ <field>
+ <name>real_Hostname</name>
+ <type>Hostname real</type>
+ </field>
+ <field>
+ <name>Network_Hostname</name>
+ <type>Hostname</type>
+ </field>
+ <field>
+ <name>Available Processors</name>
+ <type>available processors</type>
+ </field>
+ <field>
+ <name>JVM Total Memory</name>
+ <type>jvm total memory</type>
+ </field>
+ </fields>
+</transform>
\ No newline at end of file