aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/test/java
diff options
context:
space:
mode:
authorThomas <>2022-10-17 12:52:00 +0200
committerThomas <>2022-10-17 12:52:00 +0200
commit2f69fe3154251d4c4e36eca874039b3227d88fcd (patch)
treec9507e44386f8d513b06e3405afc9efd4e517a6b /modules/authmodule-eIDAS-v2/src/test/java
parent6dbb60973826e173bf44988b822c56d84b677c1a (diff)
downloadNational_eIDAS_Gateway-2f69fe3154251d4c4e36eca874039b3227d88fcd.tar.gz
National_eIDAS_Gateway-2f69fe3154251d4c4e36eca874039b3227d88fcd.tar.bz2
National_eIDAS_Gateway-2f69fe3154251d4c4e36eca874039b3227d88fcd.zip
freat(ernp): update ERnP client to distiguish between active ERnP entries and closed ERnP entries that kitt to ZMR entries
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.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
3 files changed, 43 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