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 44f8b3bf28 Issue #6498 (IT fix) (#6734)
44f8b3bf28 is described below

commit 44f8b3bf2889e2624eb7caa5a91d26fa28d83675
Author: Matt Casters <[email protected]>
AuthorDate: Sat Mar 7 16:14:55 2026 +0100

    Issue #6498 (IT fix) (#6734)
---
 .../org/apache/hop/execution/ExecutionState.java   |  4 +
 .../OpenSearchExecutionInfoLocation.java           | 94 ++++++++++------------
 2 files changed, 48 insertions(+), 50 deletions(-)

diff --git a/engine/src/main/java/org/apache/hop/execution/ExecutionState.java 
b/engine/src/main/java/org/apache/hop/execution/ExecutionState.java
index f340bb6f0f..98362a9c3f 100644
--- a/engine/src/main/java/org/apache/hop/execution/ExecutionState.java
+++ b/engine/src/main/java/org/apache/hop/execution/ExecutionState.java
@@ -18,6 +18,7 @@
 
 package org.apache.hop.execution;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -91,6 +92,7 @@ public class ExecutionState {
     this.details = new HashMap<>();
   }
 
+  @JsonIgnore
   public boolean isRunning() {
     if (statusDescription == null) {
       return false;
@@ -99,6 +101,7 @@ public class ExecutionState {
         || statusDescription.toLowerCase().contains("initializing");
   }
 
+  @JsonIgnore
   public boolean isFinished() {
     return executionEndDate != null;
   }
@@ -108,6 +111,7 @@ public class ExecutionState {
    *
    * @return true if the state is stale
    */
+  @JsonIgnore
   public boolean isStale(long loggingInterval) {
     if (isFinished()) {
       // After finishing updates are no longer received.
diff --git 
a/plugins/tech/opensearch/src/main/java/org/apache/hop/execution/opensearch/OpenSearchExecutionInfoLocation.java
 
b/plugins/tech/opensearch/src/main/java/org/apache/hop/execution/opensearch/OpenSearchExecutionInfoLocation.java
index c0d4f0eebb..aa275f69ed 100644
--- 
a/plugins/tech/opensearch/src/main/java/org/apache/hop/execution/opensearch/OpenSearchExecutionInfoLocation.java
+++ 
b/plugins/tech/opensearch/src/main/java/org/apache/hop/execution/opensearch/OpenSearchExecutionInfoLocation.java
@@ -20,7 +20,6 @@ package org.apache.hop.execution.opensearch;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import java.net.URI;
-import java.net.http.HttpRequest;
 import java.text.SimpleDateFormat;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
@@ -360,15 +359,6 @@ public class OpenSearchExecutionInfoLocation extends 
BaseCachingExecutionInfoLoc
             """;
       body = body.replace("executionId", executionId);
 
-      HttpRequest request =
-          HttpRequest.newBuilder()
-              .uri(postUri)
-              .header("Content-Type", "application/json")
-              .header("Accept", "application/json")
-              .header("Authorization", 
getAuthorizationHeaderValue(actualUsername, actualPassword))
-              .POST(HttpRequest.BodyPublishers.ofString(body))
-              .build();
-
       RestCaller restCaller =
           new RestCaller(
               metadataProvider,
@@ -439,39 +429,37 @@ public class OpenSearchExecutionInfoLocation extends 
BaseCachingExecutionInfoLoc
       body = body.replace("__FROM_CLAUSE__", "FROM " + actualIndexName);
 
       String whereClause = "";
-      if (selector != null) {
-        if (selector.startDateFilter() != LastPeriod.NONE) {
-          // OpenSearch uses UTC and the GUI runs in local time.
-          //
-          ZonedDateTime localStartDate =
-              
selector.startDateFilter().calculateStartDate().atZone(ZoneId.systemDefault());
-          Date localStart = new 
Date(localStartDate.toInstant().toEpochMilli());
-
-          SimpleDateFormat whereFormat = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss");
-          whereFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
-          whereClause =
-              addToWhereClause(
-                  whereClause,
-                  "creationDate >= datetime('" + 
whereFormat.format(localStart) + "') ");
+      if (selector != null && selector.startDateFilter() != LastPeriod.NONE) {
+        // OpenSearch uses UTC and the GUI runs in local time.
+        //
+        ZonedDateTime localStartDate =
+            
selector.startDateFilter().calculateStartDate().atZone(ZoneId.systemDefault());
+        Date localStart = new Date(localStartDate.toInstant().toEpochMilli());
+
+        SimpleDateFormat whereFormat = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss");
+        whereFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+        whereClause =
+            addToWhereClause(
+                whereClause, "creationDate >= datetime('" + 
whereFormat.format(localStart) + "') ");
+      }
+
+      /*
+        // OpenSearch throws some errors on these nested conditions
+        //
+        if (selector.isSelectingParents()) {
+          whereClause = addToWhereClause(whereClause, "e.parentId IS NULL ");
+        }
+        if (selector.isSelectingPipelines()) {
+          whereClause = addToWhereClause(whereClause, "e.executionType = 
'Pipeline' ");
         }
+        if (selector.isSelectingWorkflows()) {
+          whereClause = addToWhereClause(whereClause, "e.executionType = 
'Workflows' ");
+        }
+        if (selector.isSelectingFinished()) {
+          whereClause = addToWhereClause(whereClause, "s.statusDescription = 
'Finished' ");
+        }
+      */
 
-        /*
-          // OpenSearch throws some errors on these nested conditions
-          //
-          if (selector.isSelectingParents()) {
-            whereClause = addToWhereClause(whereClause, "e.parentId IS NULL ");
-          }
-          if (selector.isSelectingPipelines()) {
-            whereClause = addToWhereClause(whereClause, "e.executionType = 
'Pipeline' ");
-          }
-          if (selector.isSelectingWorkflows()) {
-            whereClause = addToWhereClause(whereClause, "e.executionType = 
'Workflows' ");
-          }
-          if (selector.isSelectingFinished()) {
-            whereClause = addToWhereClause(whereClause, "s.statusDescription = 
'Finished' ");
-          }
-        */
-      }
       body = body.replace("__WHERE_CLAUSE__", whereClause);
 
       RestCaller restCaller =
@@ -504,11 +492,11 @@ public class OpenSearchExecutionInfoLocation extends 
BaseCachingExecutionInfoLoc
       SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z");
       sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
 
-      for (int r = 0; r < dataRows.size(); r++) {
-        JSONArray dataRow = (JSONArray) dataRows.get(r);
+      for (Object row : dataRows) {
+        JSONArray dataRow = (JSONArray) row;
         String id = (String) dataRow.get(0);
-        String creationDateString = (String) dataRow.get(1);
-        Date creationDate = sdf.parse(creationDateString + " UTC");
+        Long creationEpoch = (Long) dataRow.get(1);
+        Date creationDate = new Date(creationEpoch);
         ids.add(new DatedId(id, creationDate));
       }
     } catch (Exception e) {
@@ -597,11 +585,7 @@ public class OpenSearchExecutionInfoLocation extends 
BaseCachingExecutionInfoLoc
               putBody,
               location.ignoreSsl,
               getHeaders());
-      try {
-        result = restCaller.execute();
-      } catch (Exception e) {
-        result = Const.getSimpleStackTrace(e);
-      }
+      result = getResultFromPipeline(restCaller);
       if (restCaller.getResult() == null || 
restCaller.getResult().getNrErrors() > 0) {
         result += Const.CR + "Logging: " + restCaller.getLoggingText();
       }
@@ -630,6 +614,16 @@ public class OpenSearchExecutionInfoLocation extends 
BaseCachingExecutionInfoLoc
     }
   }
 
+  private static String getResultFromPipeline(RestCaller restCaller) {
+    String result;
+    try {
+      result = restCaller.execute();
+    } catch (Exception e) {
+      result = Const.getSimpleStackTrace(e);
+    }
+    return result;
+  }
+
   @Override
   public String getPluginId() {
     return "opensearch-location";

Reply via email to