2323import com .iexec .common .replicate .ReplicateStatusDetails ;
2424import com .iexec .common .result .ComputedFile ;
2525import com .iexec .commons .poco .chain .ChainReceipt ;
26+ import com .iexec .commons .poco .chain .DealParams ;
2627import com .iexec .commons .poco .chain .WorkerpoolAuthorization ;
2728import com .iexec .commons .poco .dapp .DappType ;
2829import com .iexec .commons .poco .task .TaskDescription ;
5253import org .mockito .Mock ;
5354import org .mockito .junit .jupiter .MockitoExtension ;
5455
55- import java .util .Collections ;
5656import java .util .List ;
5757import java .util .Optional ;
5858
@@ -118,6 +118,9 @@ void init() {
118118 }
119119
120120 TaskDescription .TaskDescriptionBuilder getTaskDescriptionBuilder (boolean isTeeTask ) {
121+ final DealParams dealParams = DealParams .builder ()
122+ .iexecInputFiles (List .of ("https://ab.cd/ef.jpeg" ))
123+ .build ();
121124 return TaskDescription .builder ()
122125 .chainTaskId (CHAIN_TASK_ID )
123126 .appType (DappType .DOCKER )
@@ -127,7 +130,7 @@ TaskDescription.TaskDescriptionBuilder getTaskDescriptionBuilder(boolean isTeeTa
127130 .datasetChecksum ("datasetChecksum" )
128131 .datasetUri ("datasetUri" )
129132 .isTeeTask (isTeeTask )
130- .inputFiles ( List . of ( "http://file1" ) );
133+ .dealParams ( dealParams );
131134 }
132135
133136 //region start
@@ -156,9 +159,12 @@ void shouldNotStartSinceCannotContributeStatusIsPresent() {
156159
157160 @ Test
158161 void shouldNotStartSinceStandardTaskWithEncryption () {
162+ final DealParams dealParams = DealParams .builder ()
163+ .iexecResultEncryption (true )
164+ .build ();
159165 final TaskDescription taskDescription = TaskDescription .builder ()
160166 .chainTaskId (CHAIN_TASK_ID )
161- .isResultEncryption ( true )
167+ .dealParams ( dealParams )
162168 .build ();
163169 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
164170 .thenReturn (Optional .empty ());
@@ -307,9 +313,12 @@ void shouldNotDownloadDataSinceCannotContributeStatusIsPresent() {
307313
308314 @ Test
309315 void shouldReturnSuccessAndNotDownloadDataSinceEmptyUrls () throws Exception {
316+ final DealParams dealParams = DealParams .builder ()
317+ .iexecInputFiles (null )
318+ .build ();
310319 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
311320 .datasetUri ("" )
312- .inputFiles ( null )
321+ .dealParams ( dealParams )
313322 .build ();
314323 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
315324 .thenReturn (Optional .empty ());
@@ -344,8 +353,11 @@ void shouldDownloadDatasetAndInputFiles() throws Exception {
344353
345354 @ Test
346355 void shouldDownloadDatasetAndNotInputFiles () throws Exception {
356+ final DealParams dealParams = DealParams .builder ()
357+ .iexecInputFiles (null )
358+ .build ();
347359 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
348- .inputFiles ( null )
360+ .dealParams ( dealParams )
349361 .build ();
350362 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
351363 .thenReturn (Optional .empty ());
@@ -503,33 +515,31 @@ void shouldHandleWorkflowExceptionInDownloadDataAndTriggerPostComputeHookWithSuc
503515 void shouldWithInputFilesDownloadData () throws Exception {
504516 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
505517 .datasetUri ("" )
506- .inputFiles (Collections .singletonList ("https://ab.cd/ef.jpeg" ))
507518 .build ();
508519 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
509520 .thenReturn (Optional .empty ());
510521 doNothing ().when (dataService ).downloadStandardInputFiles (CHAIN_TASK_ID ,
511- taskDescription .getInputFiles ());
522+ taskDescription .getDealParams (). getIexecInputFiles ());
512523
513524 ReplicateActionResponse actionResponse =
514525 taskManagerService .downloadData (taskDescription );
515526
516527 assertThat (actionResponse .isSuccess ()).isTrue ();
517528 verify (dataService ).downloadStandardInputFiles (CHAIN_TASK_ID ,
518- taskDescription .getInputFiles ());
529+ taskDescription .getDealParams (). getIexecInputFiles ());
519530 }
520531
521532 @ Test
522533 void shouldWithInputFilesDataDownloadFailedAndTriggerPostComputeHookWithSuccess ()
523534 throws Exception {
524535 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
525536 .datasetUri ("" )
526- .inputFiles (Collections .singletonList ("https://ab.cd/ef.jpeg" ))
527537 .build ();
528538 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
529539 .thenReturn (Optional .empty ());
530540 WorkflowException e = new WorkflowException (INPUT_FILES_DOWNLOAD_FAILED );
531541 doThrow (e ).when (dataService ).downloadStandardInputFiles (CHAIN_TASK_ID ,
532- taskDescription .getInputFiles ());
542+ taskDescription .getDealParams (). getIexecInputFiles ());
533543 when (resultService .writeErrorToIexecOut (anyString (), any (), any ()))
534544 .thenReturn (true );
535545 when (computeManagerService .runPostCompute (taskDescription , null ))
@@ -548,13 +558,12 @@ void shouldWithInputFilesDataDownloadFailedAndTriggerPostComputeHookWithFailure1
548558 throws Exception {
549559 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
550560 .datasetUri ("" )
551- .inputFiles (Collections .singletonList ("https://ab.cd/ef.jpeg" ))
552561 .build ();
553562 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
554563 .thenReturn (Optional .empty ());
555564 WorkflowException e = new WorkflowException (INPUT_FILES_DOWNLOAD_FAILED );
556565 doThrow (e ).when (dataService ).downloadStandardInputFiles (CHAIN_TASK_ID ,
557- taskDescription .getInputFiles ());
566+ taskDescription .getDealParams (). getIexecInputFiles ());
558567 when (resultService .writeErrorToIexecOut (anyString (), any (), any ()))
559568 .thenReturn (false );
560569
@@ -572,13 +581,12 @@ void shouldWithInputFilesDataDownloadFailedAndTriggerPostComputeHookWithFailure2
572581 throws Exception {
573582 final TaskDescription taskDescription = getTaskDescriptionBuilder (false )
574583 .datasetUri ("" )
575- .inputFiles (Collections .singletonList ("https://ab.cd/ef.jpeg" ))
576584 .build ();
577585 when (contributionService .getCannotContributeStatusCause (CHAIN_TASK_ID ))
578586 .thenReturn (Optional .empty ());
579587 WorkflowException e = new WorkflowException (INPUT_FILES_DOWNLOAD_FAILED );
580588 doThrow (e ).when (dataService ).downloadStandardInputFiles (CHAIN_TASK_ID ,
581- taskDescription .getInputFiles ());
589+ taskDescription .getDealParams (). getIexecInputFiles ());
582590 when (resultService .writeErrorToIexecOut (anyString (), any (), any ()))
583591 .thenReturn (true );
584592 when (computeManagerService .runPostCompute (taskDescription , null ))
0 commit comments