aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/test/java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
index 8057eafe..7b2e2b61 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
@@ -1058,6 +1058,93 @@ public class ErnpRestClientTest {
@Test
@SneakyThrows
+ public void differendMdsButOnlyUppercase() {
+ final String cc = "DE";
+ final String personalIdentifierFirst = "Y8ADWaeh0h";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("CTKKrtUe")
+ .givenName("DUEYZUFg")
+ .dateOfBirth("1995-05-05")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .placeOfBirth("hrFevCfP")
+ .birthName("sNUEAhEr")
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/6_kitt_search_latest_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/6_kitt_update_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ RegisterResult ernpResult = RegisterResult.builder()
+ .familyName("CtKKrtUe")
+ .givenName("dUeYzUFg")
+ .dateOfBirth("1985-05-05")
+ .bpk("+OQnljn0Son1W2rkM73nP/VMsvc=")
+ .pseudonym(Arrays.asList("Y8ADWaeh0h"))
+ .birthName("sNUEAhEr")
+ .placeOfBirth("hrFevCfP")
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.update(ernpResult, eidasDataFirst);
+
+ // validate request
+ // check get-latest-version request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "KITT get-latest-version");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", ernpResult.getFamilyName());
+ checkJsonElement(person, "vorname", ernpResult.getGivenName());
+ checkJsonElement(person, "bpkZp", ernpResult.getBpk());
+ checkPersonDateOfBirth(person, ernpResult.getDateOfBirth());
+
+ // check update request
+ final RecordedRequest requestKitt = mockWebServer.takeRequest();
+ String reqBodyKitt = requestKitt.getBody().readUtf8();
+ assertFalse("no request body", reqBodyKitt.isEmpty());
+ JsonNode reqJsonKitt = mapper.readTree(reqBodyKitt);
+ checkJsonElement(reqJsonKitt, "begruendung", "KITT update dataset");
+ checkJsonElement(reqJsonKitt, "entityId", "1933000000000475");
+ checkJsonElement(reqJsonKitt, "version", "2022-03-03T10:07:28.885Z");
+ JsonNode personChange = getJsonObject(reqJsonKitt, "aendern");
+ JsonNode personKitt = getJsonObject(personChange, "personendaten");
+ checkJsonElement(personKitt, "familienname", "CtKKrtUe");
+ checkJsonElement(personKitt, "vorname", "dUeYzUFg");
+ checkPersonDateOfBirth(personKitt, eidasDataFirst.getDateOfBirth());
+
+ checkJsonElement(personKitt, "geburtsbundesland", "Burgenland");
+
+ assertFalse("find 'aendern' element", reqJsonKitt.has("anlegen"));
+ assertFalse("find 'aendern' element", personChange.has("eidas"));
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", eidasDataFirst.getDateOfBirth(), persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", ernpResult.getBpk(), persInfo.getBpk());
+ assertEquals("wrong pseudonym", ernpResult.getPseudonym().get(0), persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "hrFevCfP", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "sNUEAhEr", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
public void updateUpdateRequiredEidasDocs() {
final String cc = "DE";
final String personalIdentifierFirst = "nj1m79jm9z";