-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/MODTLR-5' into MODTLR-5
- Loading branch information
Showing
6 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/org/folio/controller/OpenRequestsProcessingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.folio.controller; | ||
|
||
import org.folio.service.OpenRequestsProcessingService; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Log4j2 | ||
public class OpenRequestsProcessingController { | ||
|
||
private final OpenRequestsProcessingService openRequestsProcessingService; | ||
|
||
@PostMapping(value = "/title-level-requests-processing") | ||
public void processOpenRequests() { | ||
openRequestsProcessingService.processOpenRequests(); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/org/folio/service/OpenRequestsProcessingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.folio.service; | ||
|
||
public interface OpenRequestsProcessingService { | ||
void processOpenRequests(); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/folio/service/impl/OpenRequestsProcessingServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.folio.service.impl; | ||
|
||
import org.folio.service.OpenRequestsProcessingService; | ||
import org.springframework.stereotype.Service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Log4j2 | ||
public class OpenRequestsProcessingServiceImpl implements OpenRequestsProcessingService { | ||
|
||
@Override | ||
public void processOpenRequests() { | ||
log.info("processOpenRequests:: start"); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/test/java/org/folio/api/OpenRequestsProcessingApiTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.folio.api; | ||
|
||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.http.MediaType; | ||
|
||
class OpenRequestsProcessingApiTest extends BaseIT { | ||
private static final String PROCESS_OPEN_REQUESTS_URL = "/title-level-requests-processing"; | ||
|
||
@Test | ||
void getByIdNotFound() throws Exception { | ||
mockMvc.perform( | ||
post(PROCESS_OPEN_REQUESTS_URL) | ||
.headers(defaultHeaders()) | ||
.contentType(MediaType.APPLICATION_JSON)) | ||
.andExpect(status().is2xxSuccessful()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/org/folio/controller/OpenRequestsProcessingControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.folio.controller; | ||
|
||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
|
||
import org.folio.service.OpenRequestsProcessingService; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class OpenRequestsProcessingControllerTest { | ||
|
||
@Mock | ||
private OpenRequestsProcessingService service; | ||
|
||
@InjectMocks | ||
private OpenRequestsProcessingController controller; | ||
|
||
@Test | ||
void openRequestsProcessingServiceCalledFromController() { | ||
controller.processOpenRequests(); | ||
verify(service, times(1)).processOpenRequests(); | ||
} | ||
|
||
} |