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 9e16b2b477 Issue #1934 (XML cleanup of Splunk Input) (#6740)
9e16b2b477 is described below

commit 9e16b2b477420a9a8524c453f5160e2dd77f2acf
Author: Matt Casters <[email protected]>
AuthorDate: Mon Mar 9 15:31:09 2026 +0100

    Issue #1934 (XML cleanup of Splunk Input) (#6740)
---
 .../mdi/0033-splunk-input-validate.hpl             | 508 +++++++++++++++++++++
 integration-tests/mdi/0033-splunk-input.hpl        | 277 +++++++++++
 integration-tests/mdi/0033-splunk-template.hpl     |  88 ++++
 .../mdi/datasets/golden-splunk-input.csv           |   5 +
 .../mdi/metadata/dataset/golden-splunk-input.json  |  64 +++
 .../unit-test/0033-splunk-input-validate UNIT.json |  58 +++
 .../transforms/splunkinput/ReturnValue.java        | 114 ++---
 .../transforms/splunkinput/SplunkInputMeta.java    | 140 +-----
 .../splunkinput/messages/messages_en_US.properties |  11 +-
 .../hop/splunk/messages/messages_en_US.properties  |   7 +-
 .../splunkinput/SplunkInputMetaTest.java           |  70 +++
 .../splunk/src/test/resources/transform.xml        |  46 ++
 12 files changed, 1177 insertions(+), 211 deletions(-)

diff --git a/integration-tests/mdi/0033-splunk-input-validate.hpl 
b/integration-tests/mdi/0033-splunk-input-validate.hpl
new file mode 100644
index 0000000000..261bfa0f2b
--- /dev/null
+++ b/integration-tests/mdi/0033-splunk-input-validate.hpl
@@ -0,0 +1,508 @@
+<?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>0033-splunk-input-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>useful bits</from>
+      <to>ignore extras</to>
+      <enabled>Y</enabled>
+    </hop>
+    <hop>
+      <from>ignore extras</from>
+      <to>flatten</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>
+  </order>
+  <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>filename</name>
+    <type>GetVariable</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <fields>
+      <field>
+        <currency/>
+        <decimal/>
+        <format/>
+        <group/>
+        <length>-1</length>
+        <name>filename</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>String</type>
+        <variable>${java.io.tmpdir}/splunk-input-mdi.hpl</variable>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>64</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/returns/return</text>
+              <type>String</type>
+            </value>
+          </condition>
+          <condition>
+            <conditions>
+</conditions>
+            <function>=</function>
+            <leftvalue>xml_parent_path</leftvalue>
+            <negated>N</negated>
+            <operator>OR</operator>
+            <value>
+              <isnull>N</isnull>
+              <length>-1</length>
+              <mask/>
+              <name>constant</name>
+              <precision>-1</precision>
+              <text>/pipeline/transform</text>
+              <type>String</type>
+            </value>
+          </condition>
+        </conditions>
+        <function>STARTS WITH</function>
+        <leftvalue>xml_path</leftvalue>
+        <negated>N</negated>
+        <operator>-</operator>
+        <value>
+          <isnull>N</isnull>
+          <length>-1</length>
+          <mask/>
+          <name>constant</name>
+          <precision>-1</precision>
+          <text>/pipeline/transform</text>
+          <type>String</type>
+        </value>
+      </condition>
+    </compare>
+    <attributes/>
+    <GUI>
+      <xloc>384</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>connection</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>connection</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>query</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>query</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>return_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>returnName</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>return_splunk_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>returnSplunkName</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>return_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>returnType</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>return_length</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>returnLength</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>return_format</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>returnFormat</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>592</xloc>
+      <yloc>64</yloc>
+    </GUI>
+  </transform>
+  <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>
+          <mask/>
+          <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>ignore extras</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>IN LIST</function>
+        <leftvalue>xml_path</leftvalue>
+        <negated>Y</negated>
+        <operator>-</operator>
+        <value>
+          <isnull>N</isnull>
+          <length>-1</length>
+          <mask/>
+          <name>constant</name>
+          <precision>-1</precision>
+          
<text>/pipeline/transform/copies;/pipeline/transform/distribute;/pipeline/transform/type;/pipeline/transform/name</text>
+          <type>String</type>
+        </value>
+      </condition>
+    </compare>
+    <attributes/>
+    <GUI>
+      <xloc>480</xloc>
+      <yloc>64</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>connection</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>query</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>returnName</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>returnSplunkName</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>returnType</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>returnLength</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <field>
+        <length>-2</length>
+        <name>returnFormat</name>
+        <precision>-2</precision>
+        <rename/>
+      </field>
+      <select_unspecified>N</select_unspecified>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>288</xloc>
+      <yloc>160</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_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>
diff --git a/integration-tests/mdi/0033-splunk-input.hpl 
b/integration-tests/mdi/0033-splunk-input.hpl
new file mode 100644
index 0000000000..d3cc680c72
--- /dev/null
+++ b/integration-tests/mdi/0033-splunk-input.hpl
@@ -0,0 +1,277 @@
+<?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>0033-splunk-input</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>connection / query</from>
+      <to>inject into Splunk transform</to>
+      <enabled>Y</enabled>
+    </hop>
+    <hop>
+      <from>Data grid</from>
+      <to>inject into Splunk transform</to>
+      <enabled>Y</enabled>
+    </hop>
+  </order>
+  <transform>
+    <name>Data grid</name>
+    <type>DataGrid</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <data>
+      <line>
+        <item>field1</item>
+        <item>splunkField1</item>
+        <item>String</item>
+        <item>10</item>
+        <item/>
+      </line>
+      <line>
+        <item>field2</item>
+        <item>splunkField2</item>
+        <item>Integer</item>
+        <item>5</item>
+        <item>#</item>
+      </line>
+      <line>
+        <item>field3</item>
+        <item>splunkField3</item>
+        <item>Date</item>
+        <item/>
+        <item>yyyy/MM/dd</item>
+      </line>
+    </data>
+    <fields>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>name</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>splunkName</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>type</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>length</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>format</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>128</xloc>
+      <yloc>256</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>connection / query</name>
+    <type>DataGrid</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <data>
+      <line>
+        <item>SomeConnection</item>
+        <item>SEARCH * | HEAD 100</item>
+      </line>
+    </data>
+    <fields>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>connection</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <currency/>
+        <set_empty_string>N</set_empty_string>
+        <name>query</name>
+        <format/>
+        <group/>
+        <decimal/>
+        <type>String</type>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>144</xloc>
+      <yloc>112</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>inject into Splunk transform</name>
+    <type>MetaInject</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <filename>${PROJECT_HOME}/0033-splunk-template.hpl</filename>
+    <run_configuration>local</run_configuration>
+    <source_transform>/</source_transform>
+    <source_output_fields>    </source_output_fields>
+    <target_file>${java.io.tmpdir}/splunk-input-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>Splunk Input</target_transform_name>
+        <target_attribute_key>query</target_attribute_key>
+        <target_detail>N</target_detail>
+        <source_transform>connection / query</source_transform>
+        <source_field>query</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>return_type</target_attribute_key>
+        <target_detail>Y</target_detail>
+        <source_transform>Data grid</source_transform>
+        <source_field>type</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>return_format</target_attribute_key>
+        <target_detail>Y</target_detail>
+        <source_transform>Data grid</source_transform>
+        <source_field>format</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>return_length</target_attribute_key>
+        <target_detail>Y</target_detail>
+        <source_transform>Data grid</source_transform>
+        <source_field>length</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>return_name</target_attribute_key>
+        <target_detail>Y</target_detail>
+        <source_transform>Data grid</source_transform>
+        <source_field>name</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>return_splunk_name</target_attribute_key>
+        <target_detail>Y</target_detail>
+        <source_transform>Data grid</source_transform>
+        <source_field>splunkName</source_field>
+      </mapping>
+      <mapping>
+        <target_transform_name>Splunk Input</target_transform_name>
+        <target_attribute_key>connection</target_attribute_key>
+        <target_detail>N</target_detail>
+        <source_transform>connection / query</source_transform>
+        <source_field>connection</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/0033-splunk-template.hpl 
b/integration-tests/mdi/0033-splunk-template.hpl
new file mode 100644
index 0000000000..07ca6f4af3
--- /dev/null
+++ b/integration-tests/mdi/0033-splunk-template.hpl
@@ -0,0 +1,88 @@
+<?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>0033-splunk-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>Splunk Input</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>Splunk Input</name>
+    <type>SplunkInput</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <connection/>
+    <query/>
+    <returns>
+</returns>
+    <attributes/>
+    <GUI>
+      <xloc>192</xloc>
+      <yloc>128</yloc>
+    </GUI>
+  </transform>
+  <transform_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>
diff --git a/integration-tests/mdi/datasets/golden-splunk-input.csv 
b/integration-tests/mdi/datasets/golden-splunk-input.csv
new file mode 100644
index 0000000000..5f8f77e83f
--- /dev/null
+++ b/integration-tests/mdi/datasets/golden-splunk-input.csv
@@ -0,0 +1,5 @@
+connection,query,returnName,returnSplunkName,returnType,returnLength,returnFormat
+"",,field3,splunkField3,Date,0,yyyy/MM/dd
+"",,field2,splunkField2,Integer,5,"#"
+"",,field1,splunkField1,String,10,
+SomeConnection,SEARCH * | HEAD 100,,,,,
diff --git a/integration-tests/mdi/metadata/dataset/golden-splunk-input.json 
b/integration-tests/mdi/metadata/dataset/golden-splunk-input.json
new file mode 100644
index 0000000000..0b228094da
--- /dev/null
+++ b/integration-tests/mdi/metadata/dataset/golden-splunk-input.json
@@ -0,0 +1,64 @@
+{
+  "base_filename": "golden-splunk-input.csv",
+  "name": "golden-splunk-input",
+  "description": "",
+  "dataset_fields": [
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "connection",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "query",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "returnName",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "returnSplunkName",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "returnType",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "returnLength",
+      "field_format": ""
+    },
+    {
+      "field_comment": "",
+      "field_length": -1,
+      "field_type": 2,
+      "field_precision": -1,
+      "field_name": "returnFormat",
+      "field_format": ""
+    }
+  ],
+  "folder_name": ""
+}
\ No newline at end of file
diff --git 
a/integration-tests/mdi/metadata/unit-test/0033-splunk-input-validate UNIT.json 
b/integration-tests/mdi/metadata/unit-test/0033-splunk-input-validate UNIT.json
new file mode 100644
index 0000000000..7ca8641469
--- /dev/null
+++ b/integration-tests/mdi/metadata/unit-test/0033-splunk-input-validate 
UNIT.json     
@@ -0,0 +1,58 @@
+{
+  "database_replacements": [],
+  "autoOpening": true,
+  "description": "",
+  "persist_filename": "",
+  "test_type": "UNIT_TEST",
+  "variableValues": [],
+  "basePath": "${HOP_UNIT_TESTS_FOLDER}",
+  "golden_data_sets": [
+    {
+      "field_mappings": [
+        {
+          "transform_field": "connection",
+          "data_set_field": "connection"
+        },
+        {
+          "transform_field": "query",
+          "data_set_field": "query"
+        },
+        {
+          "transform_field": "returnName",
+          "data_set_field": "returnName"
+        },
+        {
+          "transform_field": "returnSplunkName",
+          "data_set_field": "returnSplunkName"
+        },
+        {
+          "transform_field": "returnType",
+          "data_set_field": "returnType"
+        },
+        {
+          "transform_field": "returnLength",
+          "data_set_field": "returnLength"
+        },
+        {
+          "transform_field": "returnFormat",
+          "data_set_field": "returnFormat"
+        }
+      ],
+      "field_order": [
+        "connection",
+        "query",
+        "returnName",
+        "returnSplunkName",
+        "returnType",
+        "returnLength",
+        "returnFormat"
+      ],
+      "data_set_name": "golden-splunk-input",
+      "transform_name": "Validate"
+    }
+  ],
+  "input_data_sets": [],
+  "name": "0033-splunk-input-validate UNIT",
+  "trans_test_tweaks": [],
+  "pipeline_filename": "./0033-splunk-input-validate.hpl"
+}
\ No newline at end of file
diff --git 
a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java
 
b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java
index a5218ed4d4..221d204b2e 100644
--- 
a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java
+++ 
b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/ReturnValue.java
@@ -19,25 +19,45 @@
 package org.apache.hop.pipeline.transforms.splunkinput;
 
 import java.util.Objects;
-import org.apache.hop.core.injection.Injection;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hop.metadata.api.HopMetadataProperty;
 
+@Getter
+@Setter
 public class ReturnValue {
-
-  @Injection(name = "RETURN_NAME", group = "RETURNS")
+  @HopMetadataProperty(
+      key = "return_name",
+      injectionKey = "return_name",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Return.Name")
   private String name;
 
-  @Injection(name = "RETURN_SPLUNK_NAME", group = "RETURNS")
+  @HopMetadataProperty(
+      key = "return_splunk_name",
+      injectionKey = "return_splunk_name",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Return.SplunkName")
   private String splunkName;
 
-  @Injection(name = "RETURN_TYPE", group = "RETURNS")
+  @HopMetadataProperty(
+      key = "return_type",
+      injectionKey = "return_type",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Return.Type")
   private String type;
 
-  @Injection(name = "RETURN_LENGTH", group = "RETURNS")
+  @HopMetadataProperty(
+      key = "return_length",
+      injectionKey = "return_length",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Return.Length")
   private int length;
 
-  @Injection(name = "RETURN_FORMAT", group = "RETURNS")
+  @HopMetadataProperty(
+      key = "return_format",
+      injectionKey = "return_format",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Return.Format")
   private String format;
 
+  public ReturnValue() {}
+
   public ReturnValue(String name, String splunkName, String type, int length, 
String format) {
     this.name = name;
     this.splunkName = splunkName;
@@ -67,84 +87,4 @@ public class ReturnValue {
   public String toString() {
     return "ReturnValue{" + "name='" + name + '\'' + '}';
   }
-
-  /**
-   * Gets name
-   *
-   * @return value of name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * @param name The name to set
-   */
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  /**
-   * Gets splunkName
-   *
-   * @return value of splunkName
-   */
-  public String getSplunkName() {
-    return splunkName;
-  }
-
-  /**
-   * @param splunkName The splunkName to set
-   */
-  public void setSplunkName(String splunkName) {
-    this.splunkName = splunkName;
-  }
-
-  /**
-   * Gets type
-   *
-   * @return value of type
-   */
-  public String getType() {
-    return type;
-  }
-
-  /**
-   * @param type The type to set
-   */
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  /**
-   * Gets length
-   *
-   * @return value of length
-   */
-  public int getLength() {
-    return length;
-  }
-
-  /**
-   * @param length The length to set
-   */
-  public void setLength(int length) {
-    this.length = length;
-  }
-
-  /**
-   * Gets format
-   *
-   * @return value of format
-   */
-  public String getFormat() {
-    return format;
-  }
-
-  /**
-   * @param format The format to set
-   */
-  public void setFormat(String format) {
-    this.format = format;
-  }
 }
diff --git 
a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java
 
b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java
index 121b038838..1154e42765 100644
--- 
a/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java
+++ 
b/plugins/transforms/splunk/src/main/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMeta.java
@@ -20,23 +20,19 @@ package org.apache.hop.pipeline.transforms.splunkinput;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.hop.core.Const;
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.hop.core.annotations.Transform;
 import org.apache.hop.core.exception.HopPluginException;
 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.InjectionDeep;
-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.ValueMetaFactory;
 import org.apache.hop.core.variables.IVariables;
-import org.apache.hop.core.xml.XmlHandler;
+import org.apache.hop.metadata.api.HopMetadataProperty;
 import org.apache.hop.metadata.api.IHopMetadataProvider;
 import org.apache.hop.pipeline.transform.BaseTransformMeta;
 import org.apache.hop.pipeline.transform.TransformMeta;
-import org.w3c.dom.Node;
 
 @Transform(
     id = "SplunkInput",
@@ -46,37 +42,34 @@ import org.w3c.dom.Node;
     categoryDescription = 
"i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Input",
     keywords = "i18n::SplunkInputMeta.keyword",
     documentationUrl = "/pipeline/transforms/splunkinput.html")
-@InjectionSupported(
-    localizationPrefix = "Splunk.Injection.",
-    groups = {"PARAMETERS", "RETURNS"})
+@Getter
+@Setter
 public class SplunkInputMeta extends BaseTransformMeta<SplunkInput, 
SplunkInputData> {
-
-  public static final String CONNECTION = "connection";
-  public static final String QUERY = "query";
-  public static final String RETURNS = "returns";
-  public static final String RETURN = "return";
-  public static final String RETURN_NAME = "return_name";
-  public static final String RETURN_SPLUNK_NAME = "return_splunk_name";
-  public static final String RETURN_TYPE = "return_type";
-  public static final String RETURN_LENGTH = "return_length";
-  public static final String RETURN_FORMAT = "return_format";
-
-  @Injection(name = CONNECTION)
+  @HopMetadataProperty(
+      key = "connection",
+      injectionKey = "connection",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Connection")
   private String connectionName;
 
-  @Injection(name = QUERY)
+  @HopMetadataProperty(
+      key = "query",
+      injectionKey = "query",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Query")
   private String query;
 
-  @InjectionDeep private List<ReturnValue> returnValues;
+  @HopMetadataProperty(
+      groupKey = "returns",
+      injectionGroupKey = "returns",
+      injectionKeyDescription = "SplunkInputMeta.Injection.Returns",
+      key = "return",
+      injectionKey = "return",
+      injectionGroupDescription = "SplunkInputMeta.Injection.Return")
+  private List<ReturnValue> returnValues;
 
   public SplunkInputMeta() {
     super();
     returnValues = new ArrayList<>();
-  }
-
-  @Override
-  public void setDefault() {
-    query = "search * | head 100";
+    this.query = "search * | head 100";
   }
 
   @Override
@@ -106,93 +99,4 @@ public class SplunkInputMeta extends 
BaseTransformMeta<SplunkInput, SplunkInputD
       }
     }
   }
-
-  @Override
-  public String getXml() {
-    StringBuilder xml = new StringBuilder();
-    xml.append(XmlHandler.addTagValue(CONNECTION, connectionName));
-    xml.append(XmlHandler.addTagValue(QUERY, query));
-
-    xml.append(XmlHandler.openTag(RETURNS));
-    for (ReturnValue returnValue : returnValues) {
-      xml.append(XmlHandler.openTag(RETURN));
-      xml.append(XmlHandler.addTagValue(RETURN_NAME, returnValue.getName()));
-      xml.append(XmlHandler.addTagValue(RETURN_SPLUNK_NAME, 
returnValue.getSplunkName()));
-      xml.append(XmlHandler.addTagValue(RETURN_TYPE, returnValue.getType()));
-      xml.append(XmlHandler.addTagValue(RETURN_LENGTH, 
returnValue.getLength()));
-      xml.append(XmlHandler.addTagValue(RETURN_FORMAT, 
returnValue.getFormat()));
-      xml.append(XmlHandler.closeTag(RETURN));
-    }
-    xml.append(XmlHandler.closeTag(RETURNS));
-
-    return xml.toString();
-  }
-
-  @Override
-  public void loadXml(Node stepnode, IHopMetadataProvider provider) throws 
HopXmlException {
-    connectionName = XmlHandler.getTagValue(stepnode, CONNECTION);
-    query = XmlHandler.getTagValue(stepnode, QUERY);
-
-    // Parse return values
-    //
-    Node returnsNode = XmlHandler.getSubNode(stepnode, RETURNS);
-    List<Node> returnNodes = XmlHandler.getNodes(returnsNode, RETURN);
-    returnValues = new ArrayList<>();
-    for (Node returnNode : returnNodes) {
-      String name = XmlHandler.getTagValue(returnNode, RETURN_NAME);
-      String splunkName = XmlHandler.getTagValue(returnNode, 
RETURN_SPLUNK_NAME);
-      String type = XmlHandler.getTagValue(returnNode, RETURN_TYPE);
-      int length = Const.toInt(XmlHandler.getTagValue(returnNode, 
RETURN_LENGTH), -1);
-      String format = XmlHandler.getTagValue(returnNode, RETURN_FORMAT);
-      returnValues.add(new ReturnValue(name, splunkName, type, length, 
format));
-    }
-  }
-
-  /**
-   * Gets connectionName
-   *
-   * @return value of connectionName
-   */
-  public String getConnectionName() {
-    return connectionName;
-  }
-
-  /**
-   * @param connectionName The connectionName to set
-   */
-  public void setConnectionName(String connectionName) {
-    this.connectionName = connectionName;
-  }
-
-  /**
-   * Gets query
-   *
-   * @return value of query
-   */
-  public String getQuery() {
-    return query;
-  }
-
-  /**
-   * @param query The query to set
-   */
-  public void setQuery(String query) {
-    this.query = query;
-  }
-
-  /**
-   * Gets returnValues
-   *
-   * @return value of returnValues
-   */
-  public List<ReturnValue> getReturnValues() {
-    return returnValues;
-  }
-
-  /**
-   * @param returnValues The returnValues to set
-   */
-  public void setReturnValues(List<ReturnValue> returnValues) {
-    this.returnValues = returnValues;
-  }
 }
diff --git 
a/plugins/transforms/splunk/src/main/resources/org/apache/hop/pipeline/transforms/splunkinput/messages/messages_en_US.properties
 
b/plugins/transforms/splunk/src/main/resources/org/apache/hop/pipeline/transforms/splunkinput/messages/messages_en_US.properties
index 51ad79e9cb..53c9fad559 100644
--- 
a/plugins/transforms/splunk/src/main/resources/org/apache/hop/pipeline/transforms/splunkinput/messages/messages_en_US.properties
+++ 
b/plugins/transforms/splunk/src/main/resources/org/apache/hop/pipeline/transforms/splunkinput/messages/messages_en_US.properties
@@ -15,8 +15,17 @@
 # limitations under the License.
 #
 #
-
 QueryDialog.PreviewSize.DialogMessage=How many rows do you want to preview?
 QueryDialog.PreviewSize.DialogTitle=Preview
 SplunkInputMeta.keyword=splunk,input
 SplunkInputDialog.Shell.Title=Splunk Input
+
+SplunkInputMeta.Injection.Connection=Connection
+SplunkInputMeta.Injection.Query=Query
+SplunkInputMeta.Injection.Returns=Return values
+SplunkInputMeta.Injection.Return=Return value
+SplunkInputMeta.Injection.Return.Name = Return value name
+SplunkInputMeta.Injection.Return.SplunkName = Return value Splunk name
+SplunkInputMeta.Injection.Return.Type = Return value type
+SplunkInputMeta.Injection.Return.Length = Return value length
+SplunkInputMeta.Injection.Return.Format = Return value format
\ No newline at end of file
diff --git 
a/plugins/transforms/splunk/src/main/resources/org/apache/hop/splunk/messages/messages_en_US.properties
 
b/plugins/transforms/splunk/src/main/resources/org/apache/hop/splunk/messages/messages_en_US.properties
index 64f18ae406..387e98da3a 100644
--- 
a/plugins/transforms/splunk/src/main/resources/org/apache/hop/splunk/messages/messages_en_US.properties
+++ 
b/plugins/transforms/splunk/src/main/resources/org/apache/hop/splunk/messages/messages_en_US.properties
@@ -16,10 +16,6 @@
 #
 #
 
-
-
-
-
 SplunkConnectionDialog.Hostname.Label=Hostname or IP address
 SplunkConnectionDialog.Name.Label=Connection name
 SplunkConnectionDialog.Password.Label=Password
@@ -27,4 +23,5 @@ SplunkConnectionDialog.Port.Label=Port
 SplunkConnectionDialog.Shell.Title=Splunk Connection
 SplunkConnectionDialog.UserName.Label=Username
 SplunkConnection.name=Splunk Connection
-SplunkConnection.description=This metadata type describes how you can connect 
to Splunk
\ No newline at end of file
+SplunkConnection.description=This metadata type describes how you can connect 
to Splunk
+
diff --git 
a/plugins/transforms/splunk/src/test/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMetaTest.java
 
b/plugins/transforms/splunk/src/test/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMetaTest.java
new file mode 100644
index 0000000000..0153ade179
--- /dev/null
+++ 
b/plugins/transforms/splunk/src/test/java/org/apache/hop/pipeline/transforms/splunkinput/SplunkInputMetaTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.splunkinput;
+
+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.Assertions;
+import org.junit.jupiter.api.Test;
+
+class SplunkInputMetaTest {
+
+  @Test
+  void testLoadSave() throws Exception {
+    Path path = 
Paths.get(Objects.requireNonNull(getClass().getResource("/transform.xml")).toURI());
+    String xml = Files.readString(path);
+    SplunkInputMeta meta = new SplunkInputMeta();
+    XmlMetadataUtil.deSerializeFromXml(
+        XmlHandler.loadXmlString(xml, TransformMeta.XML_TAG),
+        SplunkInputMeta.class,
+        meta,
+        new MemoryMetadataProvider());
+
+    Assertions.assertEquals("SomeConnection", meta.getConnectionName());
+    Assertions.assertEquals("SEARCH * | HEAD 100", meta.getQuery());
+    Assertions.assertEquals(3, meta.getReturnValues().size());
+
+    ReturnValue v1 = meta.getReturnValues().get(0);
+    Assertions.assertEquals("field1", v1.getName());
+    Assertions.assertEquals("splunkField1", v1.getSplunkName());
+    Assertions.assertEquals("String", v1.getType());
+    Assertions.assertEquals(10, v1.getLength());
+    Assertions.assertNull(v1.getFormat());
+
+    ReturnValue v2 = meta.getReturnValues().get(1);
+    Assertions.assertEquals("field2", v2.getName());
+    Assertions.assertEquals("splunkField2", v2.getSplunkName());
+    Assertions.assertEquals("Integer", v2.getType());
+    Assertions.assertEquals(5, v2.getLength());
+    Assertions.assertEquals("#", v2.getFormat());
+
+    ReturnValue v3 = meta.getReturnValues().get(2);
+    Assertions.assertEquals("field3", v3.getName());
+    Assertions.assertEquals("splunkField3", v3.getSplunkName());
+    Assertions.assertEquals("Date", v3.getType());
+    Assertions.assertEquals(-1, v3.getLength());
+    Assertions.assertEquals("yyyy/MM/dd", v3.getFormat());
+  }
+}
diff --git a/plugins/transforms/splunk/src/test/resources/transform.xml 
b/plugins/transforms/splunk/src/test/resources/transform.xml
new file mode 100644
index 0000000000..08464ff9ff
--- /dev/null
+++ b/plugins/transforms/splunk/src/test/resources/transform.xml
@@ -0,0 +1,46 @@
+<?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.
+  ~
+  -->
+
+<transform>
+    <connection>SomeConnection</connection>
+    <query>SEARCH * | HEAD 100</query>
+    <returns>
+        <return>
+            <return_name>field1</return_name>
+            <return_splunk_name>splunkField1</return_splunk_name>
+            <return_type>String</return_type>
+            <return_length>10</return_length>
+            <return_format/>
+        </return>
+        <return>
+            <return_name>field2</return_name>
+            <return_splunk_name>splunkField2</return_splunk_name>
+            <return_type>Integer</return_type>
+            <return_length>5</return_length>
+            <return_format>#</return_format>
+        </return>
+        <return>
+            <return_name>field3</return_name>
+            <return_splunk_name>splunkField3</return_splunk_name>
+            <return_type>Date</return_type>
+            <return_length>-1</return_length>
+            <return_format>yyyy/MM/dd</return_format>
+        </return>
+    </returns>
+</transform>

Reply via email to