• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #414

31 Oct 2026 05:46AM UTC coverage: 70.518% (+0.3%) from 70.246%
#414

push

github

web-flow
Test sending of paginated workflow task completions (#3178)

Cover the paginated send path in WorkflowWorker, which previously had
no unit tests: intermediate pages are sent in order before the final
page, a completion is sent whole when the namespace does not support
pagination, buffer loss on any page resends every page from the
first, other errors and worker shutdown end the resend loop, and the
gRPC retryer never retries a lost buffer on its own.

8243 of 13748 branches covered (59.96%)

Branch coverage included in aggregate %.

32939 of 44651 relevant lines covered (73.77%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

1.82
/temporal-testing/src/main/java/io/temporal/testing/internal/devserver/SdkJavaTestServerProfile.java
1
package io.temporal.testing.internal.devserver;
2

3
import io.temporal.testing.TemporalDevServer;
4
import io.temporal.testing.TemporalDevServerOptions;
5
import java.io.File;
6
import java.nio.file.Path;
7
import java.util.Arrays;
8
import java.util.List;
9
import javax.annotation.Nonnull;
10

11
/** Configuration and lifecycle used only by sdk-java's Gradle test profile. */
12
public final class SdkJavaTestServerProfile {
13
  public static final String ACTIVE_PROPERTY = "io.temporal.testing.internal.devServerProfile";
14

15
  // This is intentionally the sole Temporal CLI version used by sdk-java repository tests.
16
  private static final String TEST_CLI_VERSION = "1.9.3-nexus-serialization-context";
17
  private static final String TEST_NAMESPACE = "UnitTest";
18
  private static final String DATABASE_FILENAME = "temporal.sqlite";
19

20
  private static TemporalDevServer server;
21
  private static boolean shutdownHookRegistered;
22

23
  private SdkJavaTestServerProfile() {}
24

25
  public static boolean isActive() {
26
    return Boolean.parseBoolean(System.getProperty(ACTIVE_PROPERTY, "false"));
1 ✔
27
  }
28

29
  public static String getTarget() {
30
    if (!isActive()) {
×
31
      return null;
×
32
    }
33
    return "localhost:7233";
×
34
  }
35

36
  public static synchronized String start() {
37
    if (server == null) {
×
38
      File workingDirectory = workingDirectory();
×
39
      cleanDatabase(workingDirectory);
×
40
      try {
41
        server = TemporalDevServer.start(TEST_NAMESPACE, serverOptions(workingDirectory));
×
42
      } catch (RuntimeException | Error failure) {
×
43
        cleanDatabase(workingDirectory);
×
44
        throw failure;
×
45
      }
×
46
      if (!shutdownHookRegistered) {
×
47
        Runtime.getRuntime()
×
48
            .addShutdownHook(
×
49
                new Thread(SdkJavaTestServerProfile::shutdown, "sdk-java-dev-server-shutdown"));
50
        shutdownHookRegistered = true;
×
51
      }
52
    }
53
    return server.getTarget();
×
54
  }
55

56
  public static Path prepare() {
57
    return TemporalDevServerDownloader.prepare(downloadOptions());
×
58
  }
59

60
  public static synchronized void shutdown() {
61
    if (server != null) {
×
62
      server.close();
×
63
      server = null;
×
64
    }
65
    cleanDatabase(workingDirectory());
×
66
  }
×
67

68
  private static TemporalDevServerOptions serverOptions(@Nonnull File workingDirectory) {
69
    return TemporalDevServerOptions.newBuilder(downloadOptions())
×
70
        .setIp("127.0.0.1")
×
71
        .setPort(7233)
×
72
        .setUiEnabled(false)
×
73
        .setDatabaseFilename(DATABASE_FILENAME)
×
74
        .setWorkingDirectory(workingDirectory.getAbsolutePath())
×
75
        .setLogFile(new File(workingDirectory, "server.log").getAbsolutePath())
×
76
        .setExtraArgs(repositoryServerArguments())
×
77
        .build();
×
78
  }
79

80
  private static TemporalDevServerOptions downloadOptions() {
81
    return TemporalDevServerOptions.newBuilder().setDownloadVersion("v" + TEST_CLI_VERSION).build();
×
82
  }
83

84
  private static List<String> repositoryServerArguments() {
85
    return Arrays.asList(
×
86
        "--http-port",
87
        "7243",
88
        "--sqlite-pragma",
89
        "journal_mode=WAL",
90
        "--sqlite-pragma",
91
        "synchronous=OFF",
92
        "--search-attribute",
93
        "CustomKeywordField=Keyword",
94
        "--search-attribute",
95
        "CustomStringField=Text",
96
        "--search-attribute",
97
        "CustomTextField=Text",
98
        "--search-attribute",
99
        "CustomIntField=Int",
100
        "--search-attribute",
101
        "CustomDatetimeField=Datetime",
102
        "--search-attribute",
103
        "CustomDoubleField=Double",
104
        "--search-attribute",
105
        "CustomBoolField=Bool",
106
        "--dynamic-config-value",
107
        "system.enableActivityEagerExecution=true",
108
        "--dynamic-config-value",
109
        "history.MaxBufferedQueryCount=10000",
110
        "--dynamic-config-value",
111
        "frontend.workerVersioningDataAPIs=true",
112
        "--dynamic-config-value",
113
        "history.enableRequestIdRefLinks=true",
114
        "--dynamic-config-value",
115
        "frontend.WorkerHeartbeatsEnabled=true",
116
        "--dynamic-config-value",
117
        "frontend.ListWorkersEnabled=true",
118
        "--dynamic-config-value",
119
        "frontend.enableCancelWorkerPollsOnShutdown=true",
120
        // Matching fan-out poll cancellation can drop a query dispatched while a stopped worker's
121
        // polls are canceled.
122
        "--dynamic-config-value",
123
        "frontend.enableMatchingFanOutForPollCancellation=false",
124
        "--dynamic-config-value",
125
        "component.callbacks.allowedAddresses=[{\"Pattern\":\"localhost:7243\",\"AllowInsecure\":true}]",
126
        "--dynamic-config-value",
127
        "callback.allowedAddresses=[{\"Pattern\":\"localhost:7243\",\"AllowInsecure\":true}]",
128
        "--dynamic-config-value",
129
        "frontend.activityAPIsEnabled=true",
130
        "--dynamic-config-value",
131
        "activity.enableStandalone=true",
132
        "--dynamic-config-value",
133
        "activity.enableCallbacks=true",
134
        "--dynamic-config-value",
135
        "activity.startDelayEnabled=true",
136
        "--dynamic-config-value",
137
        "nexusoperation.enableStandalone=true",
138
        "--dynamic-config-value",
139
        "history.enableChasm=true",
140
        "--dynamic-config-value",
141
        "history.enableCHASMSignalBacklinks=true",
142
        "--dynamic-config-value",
143
        "history.enableUpdateCallbacks=true",
144
        "--dynamic-config-value",
145
        "history.enableCHASMCallbacks=true",
146
        "--dynamic-config-value",
147
        "history.enableTransitionHistory=true",
148
        "--dynamic-config-value",
149
        "frontend.enableCancelWorkerPollsOnShutdown=true",
150
        "--dynamic-config-value",
151
        "frontend.workerCommandsEnabled=true",
152
        "--dynamic-config-value",
153
        "system.enableCancelActivityWorkerCommand=true",
154
        "--dynamic-config-value",
155
        "history.enableWorkflowTaskCompletionPagination=true",
156
        // Pagination clears the gRPC request limit, but the recombined completion still persists as
157
        // one transaction, so the persistence limit must be above it.
158
        "--dynamic-config-value",
159
        "system.transactionSizeLimit=33554432");
160
  }
161

162
  private static File workingDirectory() {
163
    return new File("build", "temporal-cli/server");
×
164
  }
165

166
  private static void cleanDatabase(@Nonnull File workingDirectory) {
167
    for (String name :
168
        Arrays.asList(DATABASE_FILENAME, DATABASE_FILENAME + "-shm", DATABASE_FILENAME + "-wal")) {
×
169
      File file = new File(workingDirectory, name);
×
170
      if (file.exists() && !file.delete()) {
×
171
        System.err.println("Unable to delete Temporal dev-server database file " + file);
×
172
      }
173
    }
×
174
  }
×
175
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc