|
| 1 | +package io.temporal.client.nexus; |
| 2 | + |
| 3 | +import io.temporal.client.NexusClient; |
| 4 | +import io.temporal.client.NexusClientImpl; |
| 5 | +import io.temporal.client.NexusClientInterceptor; |
| 6 | +import io.temporal.client.NexusClientOperationOptions; |
| 7 | +import io.temporal.testing.internal.SDKTestWorkflowRule; |
| 8 | +import io.temporal.workflow.shared.TestWorkflows; |
| 9 | +import org.junit.Assert; |
| 10 | +import org.junit.Rule; |
| 11 | +import org.junit.Test; |
| 12 | + |
| 13 | +public class NexusClientTest { |
| 14 | + |
| 15 | + @Rule |
| 16 | + public SDKTestWorkflowRule testWorkflowRule = |
| 17 | + SDKTestWorkflowRule.newBuilder() |
| 18 | + .setWorkflowTypes(NexusClientTest.PlaceholderWorkflowImpl.class) |
| 19 | + .build(); |
| 20 | + |
| 21 | + private NexusClient createNexusClient() { |
| 22 | + return NexusClientImpl.newInstance( |
| 23 | + testWorkflowRule.getWorkflowServiceStubs(), |
| 24 | + NexusClientOperationOptions.newBuilder() |
| 25 | + .setNamespace(testWorkflowRule.getWorkflowClient().getOptions().getNamespace()) |
| 26 | + .build()); |
| 27 | + } |
| 28 | + |
| 29 | + @Test |
| 30 | + public void listNexusOperationExecutions() { |
| 31 | + NexusClient client = createNexusClient(); |
| 32 | + NexusClientInterceptor.ListNexusOperationExecutionsInput input = |
| 33 | + new NexusClientInterceptor.ListNexusOperationExecutionsInput(null, 100, null); |
| 34 | + |
| 35 | + NexusClientInterceptor.ListNexusOperationExecutionsOutput output = |
| 36 | + client.listNexusOperationExecutions(input); |
| 37 | + |
| 38 | + Assert.assertNotNull(output); |
| 39 | + Assert.assertNotNull(output.getOperations()); |
| 40 | + Assert.assertNotNull(output.getNextPageToken()); |
| 41 | + } |
| 42 | + |
| 43 | + public static class PlaceholderWorkflowImpl implements TestWorkflows.TestWorkflow1 { |
| 44 | + @Override |
| 45 | + public String execute(String input) { |
| 46 | + return input; |
| 47 | + } |
| 48 | + } |
| 49 | +} |
0 commit comments