-
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.
OTR(Backend & Frontend) OPHOTRKEH-248: NPE/Enum korjaus kun ONR-tiedo…
…t muuttuneet (#587) * OTR(Backend) OPHOTRKEH-248: NPE fix when interpreter is not found from cache * OTR(Backend) OPHOTRKEH-248: NPE fix when not found from cache. Also fix unknown enum in contact source * OTR(Backend) OPHOTRKEH-248: test for ONR response deserialization * OTR(Backend) OPHOTRKEH-248: test for ONR response deserialization * OTR(Frontend) OPHOTRKEH-248: show alert if interpreters are not synchronized between OTR and ONR [deploy] * OTR(Frontend) OPHOTRKEH-248: mock-up endpoint for missing interpreters [deploy] * OTR(Frontend) OPHOTRKEH-248: error handler for missing interpreters [deploy]
- Loading branch information
Showing
15 changed files
with
338 additions
and
49 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
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
2 changes: 2 additions & 0 deletions
2
backend/otr/src/main/java/fi/oph/otr/onr/dto/ContactDetailsGroupSource.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
2 changes: 2 additions & 0 deletions
2
backend/otr/src/main/java/fi/oph/otr/onr/dto/ContactDetailsGroupType.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
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
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
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
43 changes: 43 additions & 0 deletions
43
backend/otr/src/test/java/fi/oph/otr/onr/OnrRequestTest.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,43 @@ | ||
package fi.oph.otr.onr; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import fi.oph.otr.onr.model.PersonalData; | ||
import fi.vm.sade.javautils.nio.cas.CasClient; | ||
import java.io.IOException; | ||
import java.util.Optional; | ||
import org.asynchttpclient.Response; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.security.test.context.support.WithMockUser; | ||
|
||
@WithMockUser | ||
@DataJpaTest | ||
class OnrRequestTest { | ||
|
||
@Value("classpath:json/henkilo-hetu-response.json") | ||
private org.springframework.core.io.Resource hetuRequestResponse; | ||
|
||
@Test | ||
void testFindPersonByIdentityNumberDeserializes() throws Exception { | ||
final Response response = mock(Response.class); | ||
final CasClient casClient = mock(CasClient.class); | ||
final OnrOperationApiImpl onrOperationApi = new OnrOperationApiImpl(casClient, "http://localhost"); | ||
|
||
when(casClient.executeBlocking(any())).thenReturn(response); | ||
when(response.getStatusCode()).thenReturn(200); | ||
when(response.getResponseBody()).thenReturn(getHetuMockJsonResponse()); | ||
|
||
final Optional<PersonalData> personalDataOptional = onrOperationApi.findPersonalDataByIdentityNumber("54321-54312"); | ||
|
||
assertTrue(personalDataOptional.isPresent()); | ||
} | ||
|
||
private String getHetuMockJsonResponse() throws IOException { | ||
return new String(hetuRequestResponse.getInputStream().readAllBytes()); | ||
} | ||
} |
Oops, something went wrong.