This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new edd32517b7 Upgrade Janino library #2660
     new fa411519cb Merge pull request #3386 from nadment/2660
edd32517b7 is described below

commit edd32517b7eec80e7358c68d6d86d7556b62dbc3
Author: Nicolas Adment <[email protected]>
AuthorDate: Mon Nov 13 20:38:43 2023 +0100

    Upgrade Janino library #2660
---
 assemblies/plugins/transforms/janino/pom.xml       |   2 +-
 .../0069-user-defined-java-class-basic.hpl         | 178 +++++++++++++++++++++
 .../main-0069-user-defined-java-class.hwf          | 125 +++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)

diff --git a/assemblies/plugins/transforms/janino/pom.xml 
b/assemblies/plugins/transforms/janino/pom.xml
index 8652a36ef1..a841cd9718 100644
--- a/assemblies/plugins/transforms/janino/pom.xml
+++ b/assemblies/plugins/transforms/janino/pom.xml
@@ -35,7 +35,7 @@
     <description />
 
     <properties>
-        <janino-version>3.1.2</janino-version>
+        <janino-version>3.1.7</janino-version>
     </properties>
 
     <dependencies>
diff --git 
a/integration-tests/transforms/0069-user-defined-java-class-basic.hpl 
b/integration-tests/transforms/0069-user-defined-java-class-basic.hpl
new file mode 100644
index 0000000000..abac7f8ea2
--- /dev/null
+++ b/integration-tests/transforms/0069-user-defined-java-class-basic.hpl
@@ -0,0 +1,178 @@
+<?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>0069-user-java-class-basic</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>2023/03/08 14:23:12.586</created_date>
+    <modified_user>-</modified_user>
+    <modified_date>2023/03/08 14:23:12.586</modified_date>
+  </info>
+  <notepads>
+  </notepads>
+  <order>
+    <hop>
+      <from>sample data</from>
+      <to>User defined Java class</to>
+      <enabled>Y</enabled>
+    </hop>
+  </order>
+  <transform>
+    <name>User defined Java class</name>
+    <type>UserDefinedJavaClass</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <definitions>
+      <definition>
+        <class_type>TRANSFORM_CLASS</class_type>
+        <class_name>Processor</class_name>
+        <class_source>import java.util.function.Function;
+
+public class UpperCase implements Function {
+       public Object apply( Object obj ) {
+          if ( obj==null ) return null;
+          String upper = obj.toString().toUpperCase();
+          return upper;
+       }
+}
+
+
+// Perform the equivalent of processing one row.
+public boolean processRow() throws HopException {
+
+       Object[] row = getRow();
+
+       // Return false when finished processing input rows.
+       if ( row == null ) {
+               setOutputDone();
+               return false;
+       }
+
+       // Get the output row
+       Object[] outputRowData = RowDataUtil.createResizedCopy( row, 
data.outputRowMeta.size() );
+       String string = get( Fields.In, "VALUE" ).getString( row ); 
+
+       UpperCase method = new UpperCase();
+
+       get(Fields.Out, "VALUE").setValue( row, method.apply(string));
+
+       putRow( data.outputRowMeta, row );
+
+       // Return true to represent we have not finsh processing all of the 
input rows  
+       return true;
+
+}
+
+</class_source>
+      </definition>
+    </definitions>
+    <fields>
+    </fields>
+    <clear_result_fields>N</clear_result_fields>
+    <info_transforms/>
+    <target_transforms/>
+    <usage_parameters/>
+    <attributes/>
+    <GUI>
+      <xloc>320</xloc>
+      <yloc>96</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>sample data</name>
+    <type>DataGrid</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <data>
+      <line>
+        <item>aaaaaa</item>
+      </line>
+      <line>
+        <item>cc ddd</item>
+      </line>
+      <line>
+        <item/>
+      </line>
+      <line>
+        <item>This string is too long</item>
+      </line>
+      <line>
+        <item>short</item>
+      </line>
+      <line>
+        <item>  not trimmed </item>
+      </line>
+      <line>
+        <item>gggggg</item>
+      </line>
+      <line>
+        <item>COM comment</item>
+      </line>
+      <line>
+        <item>special end END</item>
+      </line>
+      <line>
+        <item>non-alpha "</item>
+      </line>
+      <line>
+        <item>zzzzzzz</item>
+      </line>
+    </data>
+    <fields>
+      <field>
+        <length>-1</length>
+        <precision>-1</precision>
+        <set_empty_string>N</set_empty_string>
+        <name>VALUE</name>
+        <type>String</type>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>128</xloc>
+      <yloc>96</yloc>
+    </GUI>
+  </transform>
+  <transform_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>
diff --git a/integration-tests/transforms/main-0069-user-defined-java-class.hwf 
b/integration-tests/transforms/main-0069-user-defined-java-class.hwf
new file mode 100644
index 0000000000..927f84804c
--- /dev/null
+++ b/integration-tests/transforms/main-0069-user-defined-java-class.hwf
@@ -0,0 +1,125 @@
+<?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-0069-user-defined-java-class</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description/>
+  <extended_description/>
+  <workflow_version/>
+  <created_user>-</created_user>
+  <created_date>2023/05/13 09:44:37.641</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2023/05/13 09:44:37.641</modified_date>
+  <parameters>
+    </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <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>50</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>0069-user-defined-java-class-basic.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}/0069-user-defined-java-class-basic.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>336</xloc>
+      <yloc>48</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>not ok</name>
+      <description/>
+      <type>ABORT</type>
+      <attributes/>
+      <always_log_rows>N</always_log_rows>
+      <parallel>N</parallel>
+      <xloc>336</xloc>
+      <yloc>160</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>ok</name>
+      <description/>
+      <type>DUMMY</type>
+      <attributes/>
+      <parallel>N</parallel>
+      <xloc>592</xloc>
+      <yloc>48</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>0069-user-defined-java-class-basic.hpl</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>0069-user-defined-java-class-basic.hpl</from>
+      <to>not ok</to>
+      <enabled>Y</enabled>
+      <evaluation>N</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>0069-user-defined-java-class-basic.hpl</from>
+      <to>ok</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>

Reply via email to