Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public Builder setOverlap(ScheduleOverlapPolicy overlap) {

/**
* Set the amount of time in the past to execute missed actions after a Temporal server is
* unavailable.
* unavailable. If unset, the request omits this value and the Temporal Server applies its
* default (currently one year).
*/
public Builder setCatchupWindow(Duration catchupWindow) {
this.catchupWindow = catchupWindow;
Expand Down Expand Up @@ -81,7 +82,8 @@ public ScheduleOverlapPolicy getOverlap() {

/**
* Gets the amount of time in the past to execute missed actions after a Temporal server is
* unavailable.
* unavailable. A {@code null} value is omitted from requests so the Temporal Server applies its
* default (currently one year).
*
* @return the schedules catchup window
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public void createSchedule() {
ScheduleHandle handle = client.createSchedule(scheduleId, schedule, options);
ScheduleDescription description = handle.describe();
Assert.assertEquals(scheduleId, description.getId());
Assert.assertEquals(
Duration.ofDays(365), description.getSchedule().getPolicy().getCatchupWindow());
// Verify the schedule description has the correct (i.e. no) memo
Assert.assertNull(description.getMemo("memokey1", String.class));
// Try to create a schedule that already exists
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.temporal.internal.client;

import io.temporal.client.schedules.SchedulePolicy;
import java.time.Duration;
import org.junit.Assert;
import org.junit.Test;

public class ScheduleProtoUtilTest {
private final ScheduleProtoUtil util = new ScheduleProtoUtil(null, null);

@Test
public void policyToProtoOmitsDefaultCatchupWindow() {
Assert.assertFalse(util.policyToProto(SchedulePolicy.newBuilder().build()).hasCatchupWindow());
}

@Test
public void policyToProtoIncludesExplicitCatchupWindow() {
Assert.assertEquals(
300L,
util.policyToProto(
SchedulePolicy.newBuilder().setCatchupWindow(Duration.ofMinutes(5)).build())
.getCatchupWindow()
.getSeconds());
}
}
Loading