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

temporalio / sdk-java / #166

pending completion
#166

push

github-actions

web-flow
Add comment on Workflow#newQueue (#1747)

17109 of 20962 relevant lines covered (81.62%)

0.82 hits per line

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

34.33
/temporal-testing/src/main/java/io/temporal/internal/sync/DummySyncWorkflowContext.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.internal.sync;
22

23
import com.uber.m3.tally.NoopScope;
24
import com.uber.m3.tally.Scope;
25
import io.temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributes;
26
import io.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributes;
27
import io.temporal.api.common.v1.Payload;
28
import io.temporal.api.common.v1.Payloads;
29
import io.temporal.api.common.v1.SearchAttributes;
30
import io.temporal.api.common.v1.WorkflowExecution;
31
import io.temporal.api.common.v1.WorkflowType;
32
import io.temporal.api.failure.v1.Failure;
33
import io.temporal.common.converter.DefaultDataConverter;
34
import io.temporal.failure.CanceledFailure;
35
import io.temporal.internal.replay.ReplayWorkflowContext;
36
import io.temporal.internal.statemachines.ExecuteActivityParameters;
37
import io.temporal.internal.statemachines.ExecuteLocalActivityParameters;
38
import io.temporal.internal.statemachines.LocalActivityCallback;
39
import io.temporal.internal.statemachines.StartChildWorkflowExecutionParameters;
40
import io.temporal.workflow.Functions;
41
import java.time.Duration;
42
import java.util.*;
43
import javax.annotation.Nonnull;
44
import javax.annotation.Nullable;
45

46
public class DummySyncWorkflowContext {
×
47
  public static SyncWorkflowContext newDummySyncWorkflowContext() {
48
    SyncWorkflowContext context =
1✔
49
        new SyncWorkflowContext(
50
            "dummy",
51
            WorkflowExecution.newBuilder().setWorkflowId("dummy").setRunId("dummy").build(),
1✔
52
            new SignalDispatcher(DefaultDataConverter.STANDARD_INSTANCE),
53
            new QueryDispatcher(DefaultDataConverter.STANDARD_INSTANCE),
54
            null,
55
            DefaultDataConverter.STANDARD_INSTANCE,
56
            null);
57
    context.setReplayContext(new DummyReplayWorkflowContext());
1✔
58
    context.initHeadOutboundCallsInterceptor(context);
1✔
59
    context.initHeadInboundCallsInterceptor(
1✔
60
        new BaseRootWorkflowInboundCallsInterceptor(context) {
1✔
61
          @Override
62
          public WorkflowOutput execute(WorkflowInput input) {
63
            throw new UnsupportedOperationException(
×
64
                "#execute is not implemented or needed for low level DeterministicRunner tests");
65
          }
66
        });
67
    return context;
1✔
68
  }
69

70
  private static final class DummyReplayWorkflowContext implements ReplayWorkflowContext {
1✔
71

72
    private final Timer timer = new Timer();
1✔
73

74
    @Override
75
    public WorkflowExecution getWorkflowExecution() {
76
      throw new UnsupportedOperationException("not implemented");
×
77
    }
78

79
    @Override
80
    public WorkflowExecution getParentWorkflowExecution() {
81
      throw new UnsupportedOperationException("not implemented");
×
82
    }
83

84
    @Override
85
    public WorkflowType getWorkflowType() {
86
      return WorkflowType.newBuilder().setName("dummy-workflow").build();
1✔
87
    }
88

89
    @Override
90
    public boolean isCancelRequested() {
91
      throw new UnsupportedOperationException("not implemented");
×
92
    }
93

94
    @Override
95
    public void setCancelRequested() {
96
      throw new UnsupportedOperationException("not implemented");
×
97
    }
98

99
    @Override
100
    public boolean isWorkflowMethodCompleted() {
101
      throw new UnsupportedOperationException("not implemented");
×
102
    }
103

104
    @Override
105
    public void setWorkflowMethodCompleted() {
106
      throw new UnsupportedOperationException("not implemented");
×
107
    }
108

109
    @Override
110
    public ContinueAsNewWorkflowExecutionCommandAttributes getContinueAsNewOnCompletion() {
111
      throw new UnsupportedOperationException("not implemented");
×
112
    }
113

114
    @Override
115
    public String getTaskQueue() {
116
      return "dummy-task-queue";
1✔
117
    }
118

119
    @Override
120
    public String getNamespace() {
121
      return "dummy-namespace";
1✔
122
    }
123

124
    @Override
125
    public String getWorkflowId() {
126
      return "dummy-workflow-id";
1✔
127
    }
128

129
    @Nonnull
130
    @Override
131
    public String getRunId() {
132
      return "dummy-run-id";
1✔
133
    }
134

135
    @Nonnull
136
    @Override
137
    public String getFirstExecutionRunId() {
138
      throw new UnsupportedOperationException("not implemented");
×
139
    }
140

141
    @Override
142
    public Optional<String> getContinuedExecutionRunId() {
143
      throw new UnsupportedOperationException("not implemented");
×
144
    }
145

146
    @Nonnull
147
    @Override
148
    public String getOriginalExecutionRunId() {
149
      throw new UnsupportedOperationException("not implemented");
×
150
    }
151

152
    @Override
153
    public Duration getWorkflowRunTimeout() {
154
      throw new UnsupportedOperationException("not implemented");
×
155
    }
156

157
    @Override
158
    public Duration getWorkflowExecutionTimeout() {
159
      return Duration.ZERO;
×
160
    }
161

162
    @Override
163
    public long getRunStartedTimestampMillis() {
164
      return 0;
×
165
    }
166

167
    @Nonnull
168
    @Override
169
    public Duration getWorkflowTaskTimeout() {
170
      throw new UnsupportedOperationException("not implemented");
×
171
    }
172

173
    @Override
174
    public Payload getMemo(String key) {
175
      throw new UnsupportedOperationException("not implemented");
×
176
    }
177

178
    @Override
179
    @Nullable
180
    public SearchAttributes getSearchAttributes() {
181
      throw new UnsupportedOperationException("not implemented");
×
182
    }
183

184
    @Override
185
    public ScheduleActivityTaskOutput scheduleActivityTask(
186
        ExecuteActivityParameters parameters,
187
        Functions.Proc2<Optional<Payloads>, Failure> callback) {
188
      throw new UnsupportedOperationException("not implemented");
×
189
    }
190

191
    @Override
192
    public Functions.Proc scheduleLocalActivityTask(
193
        ExecuteLocalActivityParameters parameters, LocalActivityCallback callback) {
194
      throw new UnsupportedOperationException("not implemented");
×
195
    }
196

197
    @Override
198
    public Functions.Proc1<Exception> startChildWorkflow(
199
        StartChildWorkflowExecutionParameters parameters,
200
        Functions.Proc2<WorkflowExecution, Exception> executionCallback,
201
        Functions.Proc2<Optional<Payloads>, Exception> callback) {
202
      throw new UnsupportedOperationException("not implemented");
×
203
    }
204

205
    @Override
206
    public Functions.Proc1<Exception> signalExternalWorkflowExecution(
207
        SignalExternalWorkflowExecutionCommandAttributes.Builder attributes,
208
        Functions.Proc2<Void, Failure> callback) {
209
      throw new UnsupportedOperationException("not implemented");
×
210
    }
211

212
    @Override
213
    public void requestCancelExternalWorkflowExecution(
214
        WorkflowExecution execution, Functions.Proc2<Void, RuntimeException> callback) {
215
      throw new UnsupportedOperationException("not implemented");
×
216
    }
217

218
    @Override
219
    public void continueAsNewOnCompletion(
220
        ContinueAsNewWorkflowExecutionCommandAttributes attributes) {
221
      throw new UnsupportedOperationException("not implemented");
×
222
    }
223

224
    @Override
225
    public Throwable getWorkflowTaskFailure() {
226
      throw new UnsupportedOperationException("not implemented");
×
227
    }
228

229
    @Override
230
    public void failWorkflowTask(Throwable failure) {
231
      throw new UnsupportedOperationException("not implemented");
×
232
    }
233

234
    @Override
235
    public long currentTimeMillis() {
236
      return System.currentTimeMillis();
×
237
    }
238

239
    @Override
240
    public Functions.Proc1<RuntimeException> newTimer(
241
        Duration delay, Functions.Proc1<RuntimeException> callback) {
242
      timer.schedule(
1✔
243
          new TimerTask() {
1✔
244
            @Override
245
            public void run() {
246
              callback.apply(null);
1✔
247
            }
1✔
248
          },
249
          delay.toMillis());
1✔
250
      return (e) -> {
1✔
251
        callback.apply(new CanceledFailure(null));
1✔
252
      };
1✔
253
    }
254

255
    @Override
256
    public void sideEffect(
257
        Functions.Func<Optional<Payloads>> func, Functions.Proc1<Optional<Payloads>> callback) {
258
      callback.apply(func.apply());
×
259
    }
×
260

261
    @Override
262
    public void mutableSideEffect(
263
        String id,
264
        Functions.Func1<Optional<Payloads>, Optional<Payloads>> func,
265
        Functions.Proc1<Optional<Payloads>> callback) {
266
      callback.apply(func.apply(Optional.empty()));
×
267
    }
×
268

269
    @Override
270
    public boolean isReplaying() {
271
      return false;
1✔
272
    }
273

274
    @Override
275
    public void getVersion(
276
        String changeId,
277
        int minSupported,
278
        int maxSupported,
279
        Functions.Proc2<Integer, RuntimeException> callback) {
280
      throw new UnsupportedOperationException("not implemented");
×
281
    }
282

283
    @Override
284
    public Random newRandom() {
285
      throw new UnsupportedOperationException("not implemented");
×
286
    }
287

288
    @Override
289
    public Scope getMetricsScope() {
290
      return new NoopScope();
×
291
    }
292

293
    @Override
294
    public boolean getEnableLoggingInReplay() {
295
      return false;
×
296
    }
297

298
    @Override
299
    public UUID randomUUID() {
300
      return UUID.randomUUID();
×
301
    }
302

303
    @Override
304
    public void upsertSearchAttributes(@Nonnull SearchAttributes searchAttributes) {
305
      throw new UnsupportedOperationException("not implemented");
×
306
    }
307

308
    @Override
309
    public int getAttempt() {
310
      return 1;
×
311
    }
312

313
    @Override
314
    public String getCronSchedule() {
315
      return "dummy-cron-schedule";
×
316
    }
317

318
    @Nullable
319
    @Override
320
    public Payloads getLastCompletionResult() {
321
      return null;
×
322
    }
323

324
    @Nullable
325
    @Override
326
    public Failure getPreviousRunFailure() {
327
      return null;
×
328
    }
329

330
    @Nullable
331
    @Override
332
    public String getFullReplayDirectQueryName() {
333
      return null;
×
334
    }
335

336
    @Override
337
    public Map<String, Payload> getHeader() {
338
      return null;
×
339
    }
340

341
    @Override
342
    public long getCurrentWorkflowTaskStartedEventId() {
343
      return 0;
×
344
    }
345
  }
346
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc