aga9900 commented on code in PR #4130:
URL: https://github.com/apache/gobblin/pull/4130#discussion_r2273464978


##########
gobblin-service/src/test/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobSchedulerTest.java:
##########
@@ -120,6 +117,70 @@ public void testIsNextRunWithinRangeToSchedule() {
 
   }
 
+  /**
+   * Test that demonstrates the NullPointerException issue in 
GobblinServiceJob.executeImpl
+   * when getNextFireTime() returns null for a one-time scheduled flow.
+   */
+  @Test
+  public void testGobblinServiceJobExecuteImplWithNullNextFireTime()
+      throws Exception {
+    // Create a mock JobExecutionContext
+    org.quartz.JobExecutionContext mockContext = 
mock(org.quartz.JobExecutionContext.class);
+    org.quartz.JobDetail mockJobDetail = mock(org.quartz.JobDetail.class);
+    org.quartz.JobDataMap mockJobDataMap = mock(org.quartz.JobDataMap.class);
+    org.quartz.Trigger mockTrigger = mock(org.quartz.Trigger.class);
+
+    // Mock the job detail and data map
+    when(mockContext.getJobDetail()).thenReturn(mockJobDetail);
+    when(mockContext.getTrigger()).thenReturn(mockTrigger);
+    when(mockJobDetail.getJobDataMap()).thenReturn(mockJobDataMap);
+    when(mockJobDetail.getKey()).thenReturn(new org.quartz.JobKey("testFlow", 
"testGroup"));
+
+    // Mock the job data map contents
+    Properties jobProps = new Properties();
+    jobProps.setProperty(ConfigurationKeys.FLOW_NAME_KEY, "testFlow");
+    jobProps.setProperty(ConfigurationKeys.FLOW_GROUP_KEY, "testGroup");
+    
jobProps.setProperty(ConfigurationKeys.ORCHESTRATOR_TRIGGER_EVENT_TIME_MILLIS_KEY,
 "0");

Review Comment:
   Updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to