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

temporalio / sdk-java / #351

04 Aug 2026 11:58PM UTC coverage: 67.781% (-0.5%) from 68.245%
#351

push

github

web-flow
Add dev server downloader & runner to testing package (#2982)

7311 of 12876 branches covered (56.78%)

Branch coverage included in aggregate %.

331 of 703 new or added lines in 12 files covered. (47.08%)

28 existing lines in 13 files now uncovered.

30207 of 42476 relevant lines covered (71.12%)

0.71 hits per line

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

0.0
/temporal-testing/src/main/java/io/temporal/testing/TemporalDevServer.java
1
package io.temporal.testing;
2

3
import io.temporal.common.Experimental;
4
import io.temporal.testing.internal.devserver.TemporalDevServerLauncher;
5
import javax.annotation.Nonnull;
6

7
/**
8
 * A local Temporal dev server owned by the calling process.
9
 *
10
 * <pre>{@code
11
 * try (TemporalDevServer server = TemporalDevServer.start()) {
12
 *   WorkflowServiceStubs stubs =
13
 *       WorkflowServiceStubs.newServiceStubs(
14
 *           WorkflowServiceStubsOptions.newBuilder().setTarget(server.getTarget()).build());
15
 *   // Use stubs against server.getNamespace().
16
 * }
17
 * }</pre>
18
 */
19
@Experimental
20
public final class TemporalDevServer implements AutoCloseable {
21
  private final String target;
22
  private final String namespace;
23
  private final AutoCloseable owner;
24

25
  private TemporalDevServer(
NEW
26
      @Nonnull String target, @Nonnull String namespace, @Nonnull AutoCloseable owner) {
×
NEW
27
    this.target = target;
×
NEW
28
    this.namespace = namespace;
×
NEW
29
    this.owner = owner;
×
NEW
30
  }
×
31

32
  /** Starts a dev server in namespace {@code default} with default options. */
33
  public static TemporalDevServer start() {
NEW
34
    return start("default", TemporalDevServerOptions.getDefaultInstance());
×
35
  }
36

37
  /** Starts a dev server in namespace {@code default} with the supplied options. */
38
  public static TemporalDevServer start(@Nonnull TemporalDevServerOptions options) {
NEW
39
    return start("default", options);
×
40
  }
41

42
  /** Starts a dev server for the supplied namespace and options. */
43
  public static TemporalDevServer start(
44
      @Nonnull String namespace, @Nonnull TemporalDevServerOptions options) {
NEW
45
    if (namespace == null || namespace.trim().isEmpty()) {
×
NEW
46
      throw new IllegalArgumentException("namespace cannot be blank");
×
47
    }
NEW
48
    if (options == null) {
×
NEW
49
      throw new NullPointerException("options");
×
50
    }
NEW
51
    TemporalDevServerLauncher.RunningServer running =
×
NEW
52
        TemporalDevServerLauncher.start(namespace, options);
×
NEW
53
    return new TemporalDevServer(running.getTarget(), namespace, running);
×
54
  }
55

56
  /** Returns the usable {@code host:port} gRPC target. */
57
  public String getTarget() {
NEW
58
    return target;
×
59
  }
60

61
  /** Returns the namespace created by the dev server. */
62
  public String getNamespace() {
NEW
63
    return namespace;
×
64
  }
65

66
  /** Stops the owned process. This method is idempotent. */
67
  @Override
68
  public void close() {
69
    try {
NEW
70
      owner.close();
×
NEW
71
    } catch (RuntimeException e) {
×
NEW
72
      throw e;
×
NEW
73
    } catch (Exception e) {
×
NEW
74
      throw new IllegalStateException("Failed stopping Temporal dev server at " + target, e);
×
NEW
75
    }
×
NEW
76
  }
×
77
}
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