This is an automated email from the ASF dual-hosted git repository.
mattcasters 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 a4ceecbf39 Fix REST client behavior with disabled input hop (#8749)
a4ceecbf39 is described below
commit a4ceecbf397519a98a8a0a234678ef8b65d81d8d
Author: Gabriel Dutra <[email protected]>
AuthorDate: Mon Oct 5 12:13:38 2026 -0700
Fix REST client behavior with disabled input hop (#8749)
---
.../apache/hop/pipeline/transforms/rest/Rest.java | 7 +++--
.../transforms/rest/RestNoInputRowsTest.java | 30 +++++++++++++++++++++-
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git
a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java
b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java
index ac75b8d49b..2f2f827b8f 100644
---
a/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java
+++
b/plugins/transforms/rest/src/main/java/org/apache/hop/pipeline/transforms/rest/Rest.java
@@ -2187,10 +2187,9 @@ public class Rest extends BaseTransform<RestMeta,
RestData> {
if (super.init()) {
- // Decided from the pipeline layout rather than from what arrives at
runtime: a hop that
- // happens to carry zero rows must stay a no-op, while no hop at all
means this transform
- // starts the work itself.
- data.readsRows =
!Utils.isEmpty(getPipelineMeta().findPreviousTransforms(getTransformMeta()));
+ // Decided from the pipeline layout rather than from what arrives at
runtime: an incoming hop,
+ // including a disabled one, must keep this transform from becoming a
starting point.
+ data.readsRows = getPipelineMeta().findPipelineHopTo(getTransformMeta())
!= null;
// use the information from the selection line if we have one.
data.connectionName = resolve(meta.getConnectionName());
diff --git
a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestNoInputRowsTest.java
b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestNoInputRowsTest.java
index a297a41482..9aec7770b7 100644
---
a/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestNoInputRowsTest.java
+++
b/plugins/transforms/rest/src/test/java/org/apache/hop/pipeline/transforms/rest/RestNoInputRowsTest.java
@@ -113,6 +113,24 @@ class RestNoInputRowsTest {
assertTrue(rest.emittedRows.isEmpty());
}
+ @Test
+ void aDisabledIncomingHopDoesNotTurnTheTransformIntoAStartingPoint() throws
Exception {
+ RecordingRest rest =
+ build(
+ true,
+ false,
+ meta -> {
+ meta.setUrlInField(true);
+ meta.setUrlField("urlField");
+ });
+
+ assertTrue(rest.init());
+ assertFalse(rest.processRow());
+
+ assertEquals(0, RestNoInputRowsTest.requestCount(rest));
+ assertTrue(rest.emittedRows.isEmpty());
+ }
+
@Test
void anOptionThatNeedsAFieldIsRejectedWithoutAnIncomingHop() throws
Exception {
RecordingRest rest =
@@ -152,6 +170,14 @@ class RestNoInputRowsTest {
*/
private RecordingRest build(boolean withIncomingHop,
java.util.function.Consumer<RestMeta> tweak)
throws HopException {
+ return build(withIncomingHop, true, tweak);
+ }
+
+ private RecordingRest build(
+ boolean withIncomingHop,
+ boolean incomingHopEnabled,
+ java.util.function.Consumer<RestMeta> tweak)
+ throws HopException {
PipelineMeta pipelineMeta = new PipelineMeta();
pipelineMeta.setName("TestRest");
@@ -181,7 +207,9 @@ class RestNoInputRowsTest {
// layout, and that is what decides whether this transform waits for
rows.
TransformMeta upstream = new TransformMeta("upstream", new DummyMeta());
pipelineMeta.addTransform(upstream);
- pipelineMeta.addPipelineHop(new PipelineHopMeta(upstream,
restTransformMeta));
+ PipelineHopMeta incomingHop = new PipelineHopMeta(upstream,
restTransformMeta);
+ incomingHop.setEnabled(incomingHopEnabled);
+ pipelineMeta.addPipelineHop(incomingHop);
}
return rest;
}