diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowDefinition.java b/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowDefinition.java index 770f41367..a4065024d 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowDefinition.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowDefinition.java @@ -129,6 +129,10 @@ public WorkflowInstance instance(Object input) { return new WorkflowMutableInstance(this, application().idFactory().get(), inputModel); } + public WorkflowInstance instance() { + return instance(null); + } + Optional inputSchemaValidator() { return inputSchemaValidator; } diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenAPITest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenAPITest.java index b62d2e471..e7e9a3310 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenAPITest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenAPITest.java @@ -149,7 +149,7 @@ public void testOpenAPIBearerQueryInlinedBodyWithPositiveResponse() throws Excep .setResponseCode(201)); Map result = - app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); + app.workflowDefinition(workflow).instance().start().get().asMap().orElseThrow(); RecordedRequest restRequest = restServer.takeRequest(); assertEquals("POST", restRequest.getMethod()); @@ -194,13 +194,7 @@ public void testOpenAPIBearerQueryInlinedBodyWithNegativeResponse() throws Excep Exception exception = assertThrows( Exception.class, - () -> - app.workflowDefinition(workflow) - .instance(Map.of()) - .start() - .get() - .asMap() - .orElseThrow()); + () -> app.workflowDefinition(workflow).instance().start().get().asMap().orElseThrow()); assertInstanceOf(WorkflowException.class, exception.getCause()); assertTrue(exception.getMessage().contains("status=409")); @@ -244,11 +238,11 @@ public void testOpenAPIGetWithPositiveResponse() throws Exception { .setResponseCode(200)); WorkflowDefinition definition = app.workflowDefinition(workflow); - assertData(definition.instance(Map.of()).start().get().asMap().orElseThrow()); + assertData(definition.instance().start().get().asMap().orElseThrow()); RecordedRequest openAPIRequest = openApiServer.takeRequest(); assertEquals("GET", openAPIRequest.getMethod()); - assertData(definition.instance(Map.of()).start().get().asMap().orElseThrow()); + assertData(definition.instance().start().get().asMap().orElseThrow()); openAPIRequest = openApiServer.takeRequest(); assertEquals("HEAD", openAPIRequest.getMethod()); } diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/SubWorkflowTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/SubWorkflowTest.java index 3a14ceccf..380fb52dd 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/SubWorkflowTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/SubWorkflowTest.java @@ -41,12 +41,7 @@ public void setTest() throws Exception { try (WorkflowApplication app = WorkflowApplication.builder().build()) { app.workflowDefinition(workflowChild); Map result = - app.workflowDefinition(workflowParent) - .instance(Map.of()) - .start() - .join() - .asMap() - .orElseThrow(); + app.workflowDefinition(workflowParent).instance().start().join().asMap().orElseThrow(); assertThat(result.get("counter"), is(equalTo(1))); assertThat(result.get("greeting"), is(equalTo("helloWorld"))); } @@ -62,12 +57,7 @@ public void setBlankInputTest() throws Exception { try (WorkflowApplication app = WorkflowApplication.builder().build()) { app.workflowDefinition(workflowChild); Map result = - app.workflowDefinition(workflowParent) - .instance(Map.of()) - .start() - .join() - .asMap() - .orElseThrow(); + app.workflowDefinition(workflowParent).instance().start().join().asMap().orElseThrow(); assertThat(result.get("counter"), is(equalTo(1))); assertThat(result.get("greeting"), is(equalTo("helloWorld"))); } @@ -153,7 +143,7 @@ public void runSubWorkflowFromDslTest() throws Exception { try (WorkflowApplication app = WorkflowApplication.builder().build()) { app.workflowDefinition(child); Map result = - app.workflowDefinition(parent).instance(Map.of()).start().join().asMap().orElseThrow(); + app.workflowDefinition(parent).instance().start().join().asMap().orElseThrow(); assertThat(result.get("counter"), is(equalTo(1))); assertThat(result.get("greeting"), is(equalTo("helloWorld"))); } @@ -181,7 +171,7 @@ public void runSubWorkflowsFromDslTest() throws Exception { app.workflowDefinition(child); app.workflowDefinition(update); Map result = - app.workflowDefinition(parent).instance(Map.of()).start().join().asMap().orElseThrow(); + app.workflowDefinition(parent).instance().start().join().asMap().orElseThrow(); assertThat(result.get("counter"), is(equalTo(2))); assertThat(result.get("greeting"), is(equalTo("helloWorld"))); }