-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
110 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 11 additions & 5 deletions
16
inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/Result.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
package com.inngest.springbootdemo; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
public class Result { | ||
@JsonProperty("sum") | ||
public final int sum; | ||
@Getter | ||
@Setter | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@NoArgsConstructor | ||
class Result { | ||
int sum; | ||
|
||
public Result(@JsonProperty("sum") int sum) { | ||
Result(int sum) { | ||
this.sum = sum; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...g-boot-demo/src/test/java/com/inngest/springbootdemo/CustomStepResultIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.inngest.springbootdemo; | ||
|
||
import com.inngest.CommHandler; | ||
import com.inngest.Inngest; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.parallel.Execution; | ||
import org.junit.jupiter.api.parallel.ExecutionMode; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@IntegrationTest | ||
@Execution(ExecutionMode.CONCURRENT) | ||
class CustomStepResultIntegrationTest { | ||
@BeforeAll | ||
static void setup(@Autowired CommHandler handler) { | ||
handler.register(); | ||
} | ||
|
||
@Autowired | ||
private DevServerComponent devServer; | ||
|
||
static int sleepTime = 5000; | ||
|
||
@Autowired | ||
private Inngest client; | ||
|
||
|
||
@Test | ||
void testMultiStepsFunctionWithClassResultStep() throws Exception { | ||
String eventId = InngestFunctionTestHelpers.sendEvent(client, "test/custom.result.step").first(); | ||
|
||
Thread.sleep(sleepTime); | ||
|
||
RunEntry<Object> run = devServer.runsByEvent(eventId).first(); | ||
RunEntry<Result> runWithOutput = devServer.runById(run.getRun_id(), Result.class).getData(); | ||
|
||
assertEquals(runWithOutput.getStatus(), "Completed"); | ||
assertEquals(runWithOutput.getOutput().getSum(), (new Result(5).getSum())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters