mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
refactor: replace deprecated Property(String) constructor with Property.ofValue / Property.ofExpression (#12202)
This commit is contained in:
@@ -59,7 +59,8 @@ class AssertionTest {
|
||||
@Test
|
||||
void shouldBrokenAssert_returnError() {
|
||||
var assertion = Assertion.builder()
|
||||
.value(new Property<>("{{ invalid-pebble-expression() }}"))
|
||||
.value(Property.ofExpression("{{ invalid-pebble-expression() }}")
|
||||
)
|
||||
.equalTo(Property.ofValue("value"))
|
||||
.build();
|
||||
|
||||
@@ -78,7 +79,7 @@ class AssertionTest {
|
||||
@Test
|
||||
void shouldRender_values_fromTaskOutputs() {
|
||||
var assertion = Assertion.builder()
|
||||
.value(new Property<>("{{ outputs.my_task.res }}"))
|
||||
.value(Property.ofExpression("{{ outputs.my_task.res }}"))
|
||||
.equalTo(Property.ofValue("value1"))
|
||||
.build();
|
||||
var runContext = runContextFactory.of(Map.of("outputs", Map.of("my_task", Map.of("res", "value1"))));
|
||||
@@ -92,7 +93,7 @@ class AssertionTest {
|
||||
@Test
|
||||
void shouldRender_values_fromTaskOutputs_and_produce_defaultErrorMessage() {
|
||||
var assertion = Assertion.builder()
|
||||
.value(new Property<>("{{ outputs.my_task.res }}"))
|
||||
.value(Property.ofExpression("{{ outputs.my_task.res }}"))
|
||||
.equalTo(Property.ofValue("expectedValue2"))
|
||||
.build();
|
||||
var runContext = runContextFactory.of(Map.of("outputs", Map.of("my_task", Map.of("res", "actualValue1"))));
|
||||
@@ -411,4 +412,4 @@ class AssertionTest {
|
||||
.first()
|
||||
.extracting(AssertionResult::isSuccess).isEqualTo(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class FlowTopologyServiceTest {
|
||||
.in(Property.ofValue(List.of(State.Type.SUCCESS)))
|
||||
.build(),
|
||||
"variables", Expression.builder()
|
||||
.expression(new Property<>("{{ true }}"))
|
||||
.expression(Property.ofExpression("{{ true }}"))
|
||||
.build()
|
||||
))
|
||||
.build()
|
||||
|
||||
@@ -194,8 +194,8 @@ class SetTest {
|
||||
KVStoreException exception = Assertions.assertThrows(KVStoreException.class, () -> Set.builder()
|
||||
.id(Set.class.getSimpleName())
|
||||
.type(Set.class.getName())
|
||||
.key(new Property<>("{{ inputs.key }}"))
|
||||
.value(new Property<>("{{ inputs.value }}"))
|
||||
.key(Property.ofExpression("{{ inputs.key }}"))
|
||||
.value(Property.ofExpression("{{ inputs.value }}"))
|
||||
.overwrite(Property.ofValue(false))
|
||||
.build().run(runContext));
|
||||
assertThat(exception.getMessage()).isEqualTo("Cannot set value for key '%s'. Key already exists and `overwrite` is set to `false`.".formatted(key));
|
||||
@@ -239,4 +239,4 @@ class SetTest {
|
||||
set.run(runContext);
|
||||
return runContext.namespaceKv(runContext.flowInfo().namespace());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class SchedulerPollingTriggerTest extends AbstractSchedulerTest {
|
||||
List.of(
|
||||
Expression.builder()
|
||||
.type(Expression.class.getName())
|
||||
.expression(new Property<>("{{ trigger.date | date() < now() }}"))
|
||||
.expression(Property.ofExpression("{{ trigger.date | date() < now() }}"))
|
||||
.build()
|
||||
))
|
||||
.build();
|
||||
@@ -290,4 +290,4 @@ public class SchedulerPollingTriggerTest extends AbstractSchedulerTest {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ public class SchedulerScheduleTest extends AbstractSchedulerTest {
|
||||
List.of(
|
||||
Expression.builder()
|
||||
.type(Expression.class.getName())
|
||||
.expression(new Property<>("{{ trigger.date | date() < now() }}"))
|
||||
.expression(Property.ofExpression("{{ trigger.date | date() < now() }}"))
|
||||
.build()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -80,7 +80,7 @@ public class SchedulerTriggerChangeTest extends AbstractSchedulerTest {
|
||||
.tasks(Collections.singletonList(Return.builder()
|
||||
.id("test")
|
||||
.type(Return.class.getName())
|
||||
.format(new Property<>("{{ inputs.testInputs }}"))
|
||||
.format(Property.ofExpression("{{ inputs.testInputs }}"))
|
||||
.build())
|
||||
)
|
||||
.build();
|
||||
@@ -181,4 +181,4 @@ public class SchedulerTriggerChangeTest extends AbstractSchedulerTest {
|
||||
return Optional.of(TriggerService.generateExecution(this, conditionContext, context, Map.of("sleep", sleep.toString())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ class FlowControllerTest {
|
||||
return Return.builder()
|
||||
.id(id)
|
||||
.type(Return.class.getName())
|
||||
.format(new Property<>(format))
|
||||
.format(Property.ofValue(format))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1133,4 +1133,4 @@ class FlowControllerTest {
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user