• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

temporalio / sdk-java / #292

31 Jul 2024 04:22PM UTC coverage: 77.571% (-0.005%) from 77.576%
#292

push

github

web-flow
Add support for query in listSchedules (#2163)

0 of 16 new or added lines in 4 files covered. (0.0%)

1 existing line in 1 file now uncovered.

19724 of 25427 relevant lines covered (77.57%)

0.78 hits per line

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

60.71
/temporal-sdk/src/main/java/io/temporal/client/schedules/ScheduleClientImpl.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.client.schedules;
22

23
import static io.temporal.internal.WorkflowThreadMarker.enforceNonWorkflowThread;
24

25
import com.uber.m3.tally.Scope;
26
import io.temporal.common.interceptors.ScheduleClientCallsInterceptor;
27
import io.temporal.common.interceptors.ScheduleClientInterceptor;
28
import io.temporal.internal.WorkflowThreadMarker;
29
import io.temporal.internal.client.RootScheduleClientInvoker;
30
import io.temporal.internal.client.external.GenericWorkflowClient;
31
import io.temporal.internal.client.external.GenericWorkflowClientImpl;
32
import io.temporal.serviceclient.MetricsTag;
33
import io.temporal.serviceclient.WorkflowServiceStubs;
34
import java.util.List;
35
import java.util.stream.Stream;
36
import javax.annotation.Nullable;
37

38
final class ScheduleClientImpl implements ScheduleClient {
39
  private final WorkflowServiceStubs workflowServiceStubs;
40
  private final ScheduleClientOptions options;
41
  private final GenericWorkflowClient genericClient;
42
  private final Scope metricsScope;
43
  private final ScheduleClientCallsInterceptor scheduleClientCallsInvoker;
44
  private final List<ScheduleClientInterceptor> interceptors;
45

46
  /**
47
   * Creates client that connects to an instance of the Temporal Service. Cannot be used from within
48
   * workflow code.
49
   *
50
   * @param service client to the Temporal Service endpoint.
51
   * @param options Options (like {@link io.temporal.common.converter.DataConverter} override) for
52
   *     configuring client.
53
   * @return client to interact with schedules
54
   */
55
  public static ScheduleClient newInstance(
56
      WorkflowServiceStubs service, ScheduleClientOptions options) {
57
    enforceNonWorkflowThread();
1✔
58
    return WorkflowThreadMarker.protectFromWorkflowThread(
1✔
59
        new ScheduleClientImpl(service, options), ScheduleClient.class);
60
  }
61

62
  ScheduleClientImpl(WorkflowServiceStubs workflowServiceStubs, ScheduleClientOptions options) {
1✔
63
    this.workflowServiceStubs = workflowServiceStubs;
1✔
64
    this.options = options;
1✔
65
    this.metricsScope =
1✔
66
        workflowServiceStubs
67
            .getOptions()
1✔
68
            .getMetricsScope()
1✔
69
            .tagged(MetricsTag.defaultTags(options.getNamespace()));
1✔
70
    this.genericClient = new GenericWorkflowClientImpl(workflowServiceStubs, metricsScope);
1✔
71
    this.interceptors = options.getInterceptors();
1✔
72
    this.scheduleClientCallsInvoker = initializeClientInvoker();
1✔
73
  }
1✔
74

75
  private ScheduleClientCallsInterceptor initializeClientInvoker() {
76
    ScheduleClientCallsInterceptor scheduleClientInvoker =
1✔
77
        new RootScheduleClientInvoker(genericClient, options);
78
    for (ScheduleClientInterceptor clientInterceptor : interceptors) {
1✔
79
      scheduleClientInvoker =
×
80
          clientInterceptor.scheduleClientCallsInterceptor(scheduleClientInvoker);
×
81
    }
×
82
    return scheduleClientInvoker;
1✔
83
  }
84

85
  @Override
86
  public ScheduleHandle createSchedule(
87
      String scheduleID, Schedule schedule, ScheduleOptions options) {
88
    scheduleClientCallsInvoker.createSchedule(
×
89
        new ScheduleClientCallsInterceptor.CreateScheduleInput(scheduleID, schedule, options));
90
    return new ScheduleHandleImpl(scheduleClientCallsInvoker, scheduleID);
×
91
  }
92

93
  @Override
94
  public ScheduleHandle getHandle(String scheduleID) {
95
    return new ScheduleHandleImpl(scheduleClientCallsInvoker, scheduleID);
1✔
96
  }
97

98
  @Override
99
  public Stream<ScheduleListDescription> listSchedules() {
NEW
100
    return this.listSchedules(null, null);
×
101
  }
102

103
  @Override
104
  public Stream<ScheduleListDescription> listSchedules(@Nullable Integer pageSize) {
NEW
105
    return this.listSchedules(null, pageSize);
×
106
  }
107

108
  @Override
109
  public Stream<ScheduleListDescription> listSchedules(
110
      @Nullable String query, @Nullable Integer pageSize) {
111
    return scheduleClientCallsInvoker
×
112
        .listSchedules(
×
113
            new ScheduleClientCallsInterceptor.ListSchedulesInput(
NEW
114
                query, pageSize == null ? 100 : pageSize))
×
115
        .getStream();
×
116
  }
117
}
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