martinweiler commented on code in PR #3890:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3890#discussion_r2098814498


##########
jbpm/jbpm-flow/src/test/java/org/jbpm/process/instance/LightProcessRuntimeTest.java:
##########
@@ -81,4 +85,28 @@ void testInstantiation() {
 
     }
 
+    @Test
+    void testCreateTimerInstance() {
+        LightProcessRuntimeServiceProvider services =
+                new LightProcessRuntimeServiceProvider();
+
+        MyProcess myProcess = new MyProcess();
+        LightProcessRuntimeContext rtc = new 
LightProcessRuntimeContext(Collections.singletonList(myProcess.process));
+
+        Application application = mock(Application.class);
+        InternalKnowledgeRuntime runtime = 
mock(InternalKnowledgeRuntime.class);
+        
when(runtime.getEnvironment()).thenReturn(mock(org.kie.api.runtime.Environment.class));
+        Config config = mock(Config.class);
+        when(application.config()).thenReturn(config);
+        when(config.get(any())).thenReturn(mock(AbstractProcessConfig.class));
+        
when(application.get(Processes.class)).thenReturn(mock(Processes.class));
+        LightProcessRuntime rt = new LightProcessRuntime(rtc, services, 
application);
+        Timer timer = new Timer();
+        timer.setTimeType(Timer.TIME_CYCLE);
+        timer.setDelay("R5/PT10S");
+        ExpirationTime timerInstance = rt.createTimerInstance(timer, runtime);
+        assertEquals(5, timerInstance.repeatLimit());
+        assertEquals(10000L, timerInstance.repeatInterval());
+    }
+

Review Comment:
   @Abhitocode In your test, you are checking the following regarding the 
repeatLimit:
   ```
               "R5/PT10S -->  5
               "PT10S    --> -1
               "R/PT1S   --> -1
   ```
   While this makes sense from a logical standpoint, it will still not resolve 
the initially reported issue, which shows up during the actual job scheduling:
   
https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/addons/common/jobs/api/src/main/java/org/kie/kogito/jobs/api/JobCallbackResourceDef.java#L110-L112
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to