1010import de .envite .greenbpm .carbonreductorconnector .adapter .in .zeebe .variable .CarbonReductorInputVariable ;
1111import de .envite .greenbpm .carbonreductorconnector .adapter .in .zeebe .variable .CarbonReductorOutputVariable ;
1212import de .envite .greenbpm .carbonreductorconnector .adapter .in .zeebe .variable .CarbonReductorVariableMapper ;
13- import io .camunda .zeebe . client .ZeebeClient ;
14- import io .camunda .zeebe . client .api .ZeebeFuture ;
15- import io .camunda .zeebe . client .api .response .ActivatedJob ;
13+ import io .camunda .client .CamundaClient ;
14+ import io .camunda .client .api .CamundaFuture ;
15+ import io .camunda .client .api .response .ActivatedJob ;
1616import org .junit .jupiter .api .BeforeAll ;
1717import org .junit .jupiter .api .Test ;
1818
@@ -59,16 +59,16 @@ static void init() {
5959 void shouldNotTimeShiftWhenEnergyIsClean () throws Exception {
6060 DelayCalculatorService delayCalculatorService = mock (DelayCalculatorService .class );
6161 when (delayCalculatorService .calculateDelay (any ())).thenReturn (carbonReductorOutput_Clean );
62- ZeebeClient client = mock (ZeebeClient .class , RETURNS_DEEP_STUBS );
62+ CamundaClient client = mock (CamundaClient .class , RETURNS_DEEP_STUBS );
6363
6464 var worker = new CarbonReductorWorker (client , delayCalculatorService , variableMapper );
6565
6666 ActivatedJob job = mock (ActivatedJob .class );
6767 when (job .getVariablesAsType (CarbonReductorInputVariable .class )).thenReturn (createInputVariables ());
6868
6969 when (job .getRetries ()).thenReturn (3 );
70- when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (ZeebeFuture .class ));
71- when (client .newCompleteCommand (job ).send ()).thenReturn (mock (ZeebeFuture .class ));
70+ when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (CamundaFuture .class ));
71+ when (client .newCompleteCommand (job ).send ()).thenReturn (mock (CamundaFuture .class ));
7272 worker .execute (job );
7373
7474 verify (client , times (2 )).newSetVariablesCommand (anyLong ());
@@ -79,15 +79,15 @@ void shouldNotTimeShiftWhenEnergyIsClean() throws Exception {
7979 void shouldTimeShiftWhenEnergyIsDirty () throws Exception {
8080 DelayCalculatorService delayCalculatorService = mock (DelayCalculatorService .class );
8181 when (delayCalculatorService .calculateDelay (any ())).thenReturn (carbonReductorOutput_Dirty );
82- ZeebeClient client = mock (ZeebeClient .class , RETURNS_DEEP_STUBS );
82+ CamundaClient client = mock (CamundaClient .class , RETURNS_DEEP_STUBS );
8383
8484 var worker = new CarbonReductorWorker (client , delayCalculatorService , variableMapper );
8585
8686 ActivatedJob job = mock (ActivatedJob .class );
8787 when (job .getVariablesAsType (CarbonReductorInputVariable .class )).thenReturn (createInputVariables ());
8888 when (job .getRetries ()).thenReturn (3 );
89- when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (ZeebeFuture .class ));
90- when (client .newFailCommand (job ).retries (999 ).retryBackoff (any (Duration .class )).send ()).thenReturn (mock (ZeebeFuture .class ));
89+ when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (CamundaFuture .class ));
90+ when (client .newFailCommand (job ).retries (999 ).retryBackoff (any (Duration .class )).send ()).thenReturn (mock (CamundaFuture .class ));
9191 worker .execute (job );
9292
9393 verify (client , times (2 )).newSetVariablesCommand (job .getElementInstanceKey ());
@@ -97,15 +97,15 @@ void shouldTimeShiftWhenEnergyIsDirty() throws Exception {
9797 @ Test
9898 void shouldCompleteAfterTimeShift () throws Exception {
9999 DelayCalculatorService delayCalculatorService = mock (DelayCalculatorService .class );
100- ZeebeClient client = mock (ZeebeClient .class , RETURNS_DEEP_STUBS );
100+ CamundaClient client = mock (CamundaClient .class , RETURNS_DEEP_STUBS );
101101
102102 var worker = new CarbonReductorWorker (client , delayCalculatorService , variableMapper );
103103
104104 ActivatedJob job = mock (ActivatedJob .class );
105105
106106 when (job .getRetries ()).thenReturn (999 );
107- when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (anyLong ()).send ()).thenReturn (mock (ZeebeFuture .class ));
108- when (client .newCompleteCommand (job ).send ()).thenReturn (mock (ZeebeFuture .class ));
107+ when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (anyLong ()).send ()).thenReturn (mock (CamundaFuture .class ));
108+ when (client .newCompleteCommand (job ).send ()).thenReturn (mock (CamundaFuture .class ));
109109 worker .execute (job );
110110
111111 verify (delayCalculatorService , never ()).calculateDelay (any (CarbonReductorConfiguration .class ));
@@ -117,7 +117,7 @@ void shouldCompleteAfterTimeShift() throws Exception {
117117 void shouldThrowBPMNErrorOnCarbonReductorException () throws Exception {
118118 DelayCalculatorService delayCalculatorService = mock (DelayCalculatorService .class );
119119 when (delayCalculatorService .calculateDelay (any ())).thenThrow (new CarbonReductorException ("Test" , new RuntimeException ("Testing" )));
120- ZeebeClient client = mock (ZeebeClient .class , RETURNS_DEEP_STUBS );
120+ CamundaClient client = mock (CamundaClient .class , RETURNS_DEEP_STUBS );
121121 CarbonReductorOutputVariable defaultCarbonReductorOutput = createDefaultOutput ();
122122
123123 var worker = new CarbonReductorWorker (client , delayCalculatorService , variableMapper );
@@ -138,7 +138,7 @@ void shouldThrowBPMNErrorOnCarbonReductorException() throws Exception {
138138 void shouldWriteDataAndNotShiftOnMeasurementOnly () throws Exception {
139139 DelayCalculatorService delayCalculatorService = mock (DelayCalculatorService .class );
140140 when (delayCalculatorService .calculateDelay (any ())).thenReturn (carbonReductorOutput_Dirty );
141- ZeebeClient client = mock (ZeebeClient .class , RETURNS_DEEP_STUBS );
141+ CamundaClient client = mock (CamundaClient .class , RETURNS_DEEP_STUBS );
142142
143143 var worker = new CarbonReductorWorker (client , delayCalculatorService , variableMapper );
144144
@@ -147,8 +147,8 @@ void shouldWriteDataAndNotShiftOnMeasurementOnly() throws Exception {
147147 inputVariables .setMeasurementOnly (true );
148148 when (job .getVariablesAsType (CarbonReductorInputVariable .class )).thenReturn (inputVariables );
149149 when (job .getRetries ()).thenReturn (3 );
150- when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (ZeebeFuture .class ));
151- when (client .newCompleteCommand (job ).send ()).thenReturn (mock (ZeebeFuture .class ));
150+ when (client .newSetVariablesCommand (job .getElementInstanceKey ()).variables (any (CarbonReductorOutputVariable .class )).send ()).thenReturn (mock (CamundaFuture .class ));
151+ when (client .newCompleteCommand (job ).send ()).thenReturn (mock (CamundaFuture .class ));
152152 worker .execute (job );
153153
154154 verify (client , times (2 )).newSetVariablesCommand (job .getElementInstanceKey ());
0 commit comments