File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
main/java/com/iexec/core/worker
test/java/com/iexec/core/worker Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -165,13 +165,13 @@ public ResponseEntity<PublicConfiguration> getPublicConfiguration() {
165165 }
166166
167167
168- @ GetMapping (path = "/workers/currenttasks " )
169- public ResponseEntity <List <String >> getTasksInProgress (@ RequestHeader ("Authorization" ) String bearerToken ) {
168+ @ GetMapping (path = "/workers/computing " )
169+ public ResponseEntity <List <String >> getComputingTasks (@ RequestHeader ("Authorization" ) String bearerToken ) {
170170 String workerWalletAddress = jwtTokenProvider .getWalletAddressFromBearerToken (bearerToken );
171171 if (workerWalletAddress .isEmpty ()) {
172172 return ResponseEntity .status (HttpStatus .UNAUTHORIZED .value ()).build ();
173173 }
174- return ok (workerService .getChainTaskIds (workerWalletAddress ));
174+ return ok (workerService .getComputingTaskIds (workerWalletAddress ));
175175 }
176176
177177}
Original file line number Diff line number Diff line change @@ -137,6 +137,15 @@ public List<String> getChainTaskIds(String walletAddress) {
137137 return Collections .emptyList ();
138138 }
139139
140+ public List <String > getComputingTaskIds (String walletAddress ) {
141+ Optional <Worker > optional = workerRepository .findByWalletAddress (walletAddress );
142+ if (optional .isPresent ()) {
143+ Worker worker = optional .get ();
144+ return worker .getComputingChainTaskIds ();
145+ }
146+ return Collections .emptyList ();
147+ }
148+
140149 public Optional <Worker > removeChainTaskIdFromWorker (String chainTaskId , String walletAddress ) {
141150 Optional <Worker > optional = workerRepository .findByWalletAddress (walletAddress );
142151 if (optional .isPresent ()) {
Original file line number Diff line number Diff line change @@ -250,9 +250,9 @@ public void shouldGetTasksInProgress() {
250250 List <String > list = List .of ("t1" , "t2" );
251251 when (jwtTokenProvider .getWalletAddressFromBearerToken (TOKEN ))
252252 .thenReturn (WALLET );
253- when (workerService .getChainTaskIds (WALLET )).thenReturn (list );
253+ when (workerService .getComputingTaskIds (WALLET )).thenReturn (list );
254254 ResponseEntity <List <String >> response =
255- workerController .getTasksInProgress (TOKEN );
255+ workerController .getComputingTasks (TOKEN );
256256 assertThat (response .getStatusCode ()).isEqualTo (HttpStatus .OK );
257257 assertThat (response .getBody ()).isEqualTo (list );
258258 }
@@ -261,7 +261,7 @@ public void shouldGetTasksInProgress() {
261261 public void shouldNotGetTasksInProgressSinceUnauthorized () {
262262 when (jwtTokenProvider .getWalletAddressFromBearerToken (TOKEN )).thenReturn ("" );
263263 ResponseEntity <List <String >> response =
264- workerController .getTasksInProgress (TOKEN );
264+ workerController .getComputingTasks (TOKEN );
265265 assertThat (response .getStatusCode ()).isEqualTo (HttpStatus .UNAUTHORIZED );
266266 }
267267
You can’t perform that action at this time.
0 commit comments