aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/test')
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java34
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateNewErnpEntryTaskTest.java6
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java9
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_zmr_kitt_resp.json44
4 files changed, 87 insertions, 6 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 93d8ab74..82d89e3e 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
@@ -163,6 +163,7 @@ public class ErnpRestClientTest {
ErnpRegisterResult resp = client.searchWithResidenceData(null, null, null, null, null, null);
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 0, resp.getZmrPersonResult().size());
}
@@ -290,6 +291,7 @@ public class ErnpRestClientTest {
mockWebServer.takeRequest();
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 2, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 0, resp.getZmrPersonResult().size());
}
@@ -316,9 +318,7 @@ public class ErnpRestClientTest {
assertEquals("wrong resp size", 2, resp.getPersonResult().size());
}
-
-
-
+
@Test
@SneakyThrows
public void searchWithPersonalIdNoResponse() {
@@ -432,7 +432,33 @@ public class ErnpRestClientTest {
mockWebServer.takeRequest();
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 0, resp.getZmrPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdZmrKitt() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream(
+ "/data/ernp/1_search_with_personalId_zmr_kitt_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 1, resp.getZmrPersonResult().size());
+
}
@Test
@@ -455,6 +481,7 @@ public class ErnpRestClientTest {
mockWebServer.takeRequest();
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 0, resp.getZmrPersonResult().size());
RegisterResult persInfo = resp.getPersonResult().get(0);
assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
@@ -619,6 +646,7 @@ public class ErnpRestClientTest {
mockWebServer.takeRequest();
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ assertEquals("wrong resp size", 0, resp.getZmrPersonResult().size());
RegisterResult persInfo = resp.getPersonResult().get(0);
assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateNewErnpEntryTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateNewErnpEntryTaskTest.java
index 985a5e14..6298e250 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateNewErnpEntryTaskTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateNewErnpEntryTaskTest.java
@@ -9,6 +9,7 @@ import static org.mockito.ArgumentMatchers.any;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
@@ -28,6 +29,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.ErnpRestClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.ErnpRestClient.ErnpRegisterResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpPersonRegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
@@ -150,7 +152,9 @@ public class CreateNewErnpEntryTaskTest {
@NotNull
private ErnpRegisterResult ernpRegisterResult(List<RegisterResult> registerResult) {
- return new ErnpRegisterResult(registerResult);
+ return new ErnpRegisterResult(registerResult.stream()
+ .map(el -> new ErnpPersonRegisterResult(el, false))
+ .collect(Collectors.toList()));
}
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
index c9b7b1ac..4cfba521 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
@@ -41,6 +41,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.stream.Collectors;
import javax.xml.namespace.QName;
@@ -68,6 +69,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.IErnpClient
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.IZmrClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient.ZmrRegisterResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpPersonRegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
@@ -809,12 +811,15 @@ public class InitialSearchTaskTest {
@NotNull
private ErnpRegisterResult ernpRegisterResult(RegisterResult registerResult) {
- return new ErnpRegisterResult(Collections.singletonList(registerResult));
+ return new ErnpRegisterResult(Collections.singletonList(
+ new ErnpPersonRegisterResult(registerResult, false)));
}
@NotNull
private ErnpRegisterResult ernpRegisterResult(List<RegisterResult> registerResult) {
- return new ErnpRegisterResult(registerResult);
+ return new ErnpRegisterResult(registerResult.stream()
+ .map(el -> new ErnpPersonRegisterResult(el, false))
+ .collect(Collectors.toList()));
}
@NotNull
diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_zmr_kitt_resp.json b/modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_zmr_kitt_resp.json
new file mode 100644
index 00000000..5612e3d0
--- /dev/null
+++ b/modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_zmr_kitt_resp.json
@@ -0,0 +1,44 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "47769100000077607",
+ "gueltigAb": "2022-10-06T08:01:18.117+02:00",
+ "gueltigBis": "2022-10-06T08:01:18.117+02:00",
+ "staatscode2": "XZ",
+ "wert": "eidasmatcherclosed19740404_01"
+ }
+ ],
+ "entityId": "47769100000077596",
+ "gueltigAb": "2022-10-06T08:01:18.117+02:00",
+ "gueltigBis": "2045-10-06T08:01:18.117+02:00",
+ "letzteOperation": {
+ "begruendung": "EIDAS Integrationstest",
+ "grund": "Person amtlich beenden",
+ "vorgang": "PersonUebernehmen",
+ "zeitpunkt": "2022-10-06T08:01:18.117+02:00"
+ },
+ "personendaten": {
+ "basiszahl": "000862899079",
+ "bpkZp": "mhnWeYYC8KfRY/MaYKdUDkzwD2w=",
+ "entityId": "47769100000077596",
+ "familienname": "EidasMatcher",
+ "geburtsdatum": {
+ "jahr": 1974,
+ "monat": 4,
+ "tag": 4
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-10-06T08:01:18.117+02:00",
+ "gueltigBis": "2022-10-06T08:01:18.117+02:00",
+ "vorname": "Closed"
+ },
+ "version": "2022-10-06T08:01:18.117+02:00"
+ }
+ ]
+} \ No newline at end of file