Skip to content

Commit

Permalink
Merge pull request #169 from orkes-io/feature/zoneid_support
Browse files Browse the repository at this point in the history
Added `zoneId` field to Schedule
  • Loading branch information
jmigueprieto authored Aug 8, 2024
2 parents 524f0bf + 90caa41 commit 02e7724
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/intgtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ jobs:
USER2_APPLICATION_ID: ${{ secrets.USER2_APPLICATION_ID }}
USER2_KEY_ID: ${{ secrets.USER2_KEY_ID }}
USER2_SECRET: ${{ secrets.USER2_SECRET }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class SaveScheduleRequest {
@SerializedName("updatedBy")
private String updatedBy = null;

@SerializedName("zoneId") // This is just a leftover having used GSON.
private String zoneId;

public SaveScheduleRequest createdBy(String createdBy) {
this.createdBy = createdBy;
return this;
Expand Down Expand Up @@ -219,6 +222,14 @@ public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}

public String getZoneId() {
return zoneId;
}

public SaveScheduleRequest setZoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class WorkflowSchedule {
@SerializedName("updatedTime")
private Long updatedTime = null;

@SerializedName("zoneId") // This is just a leftover having used GSON.
private String zoneId;

public WorkflowSchedule createTime(Long createTime) {
this.createTime = createTime;
return this;
Expand Down Expand Up @@ -263,6 +266,15 @@ public void setUpdatedTime(Long updatedTime) {
this.updatedTime = updatedTime;
}

public String getZoneId() {
return zoneId;
}

public WorkflowSchedule setZoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

import java.util.List;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import io.orkes.conductor.client.SchedulerClient;
Expand All @@ -34,9 +38,18 @@ public SchedulerClientTests() {
schedulerClient = orkesClients.getSchedulerClient();
}

@BeforeEach
void beforeEach() {
schedulerClient.deleteSchedule(NAME);
}

@AfterEach
void afterEach() {
schedulerClient.deleteSchedule(NAME);
}

@Test
void testMethods() {
schedulerClient.deleteSchedule(NAME);
assertTrue(schedulerClient.getNextFewSchedules(CRON_EXPRESSION, 0L, 0L, 0).isEmpty());
schedulerClient.saveSchedule(getSaveScheduleRequest());
assertTrue(schedulerClient.getAllSchedules(Commons.WORKFLOW_NAME).size() > 0);
Expand All @@ -54,7 +67,6 @@ void testMethods() {
schedulerClient.resumeSchedule(NAME);
workflowSchedule = schedulerClient.getSchedule(NAME);
assertFalse(workflowSchedule.isPaused());
schedulerClient.deleteSchedule(NAME);
}

@Test
Expand All @@ -64,6 +76,19 @@ void testDebugMethods() {
schedulerClient.requeueAllExecutionRecords();
}

@Test
@DisplayName("It should set the timezone to Europe/Madrid")
void testTimeZoneId() {
var schedule = new SaveScheduleRequest()
.name(NAME)
.cronExpression(CRON_EXPRESSION)
.startWorkflowRequest(Commons.getStartWorkflowRequest())
.setZoneId("Europe/Madrid");
schedulerClient.saveSchedule(schedule);
var savedSchedule = schedulerClient.getSchedule(NAME);
assertEquals("Europe/Madrid", savedSchedule.getZoneId());
}

SaveScheduleRequest getSaveScheduleRequest() {
return new SaveScheduleRequest()
.name(NAME)
Expand Down

0 comments on commit 02e7724

Please sign in to comment.