aboutsummaryrefslogtreecommitdiff
path: root/connector
diff options
context:
space:
mode:
authorThomas <>2022-02-07 18:55:46 +0100
committerThomas <>2022-02-08 09:38:21 +0100
commit10a890cefbec754f927d3adf63d56956c426b45d (patch)
treed21d1691b216ff7000e3fd03558faa0ee26c0663 /connector
parent6e7c333ec6e9a6fe33737ee3a67a23433854a55b (diff)
downloadNational_eIDAS_Gateway-10a890cefbec754f927d3adf63d56956c426b45d.tar.gz
National_eIDAS_Gateway-10a890cefbec754f927d3adf63d56956c426b45d.tar.bz2
National_eIDAS_Gateway-10a890cefbec754f927d3adf63d56956c426b45d.zip
test(core): fix broken integration tests after ERnP client integration
Diffstat (limited to 'connector')
-rw-r--r--connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java34
-rw-r--r--connector/src/test/resources/config/junit_config_1_springboot.properties9
-rw-r--r--connector/src/test/resources/config/junit_config_2_springboot.properties9
3 files changed, 46 insertions, 6 deletions
diff --git a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
index 09d11a78..890d4b19 100644
--- a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
+++ b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
@@ -97,9 +97,12 @@ import eu.eidas.auth.commons.tx.BinaryLightToken;
import eu.eidas.specificcommunication.SpecificCommunicationDefinitionBeanNames;
import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
import eu.eidas.specificcommunication.protocol.SpecificCommunicationService;
+import lombok.SneakyThrows;
import lombok.val;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
import szrservices.SZR;
import szrservices.SignContentEntry;
import szrservices.SignContentResponseType;
@@ -136,15 +139,20 @@ public class FullStartUpAndProcessTest {
private SZR szrMock;
private ServicePort zmrClient;
+ private static MockWebServer mockWebServer;
+
private String cc;
private String givenName;
private String familyName;
private String dateOfBirth;
private String personalId;
+ private String pseudonym;
private String vsz;
private String eidasBind;
+
+
/**
* jUnit class initializer.
* @throws InterruptedException In case of an error
@@ -153,7 +161,8 @@ public class FullStartUpAndProcessTest {
*
*/
@BeforeClass
- public static void classInitializer() throws InterruptedException, InitializationException, ComponentInitializationException {
+ @SneakyThrows
+ public static void classInitializer() {
final String current = new java.io.File(".").toURI().toString();
System.clearProperty("eidas.ms.configuration");
@@ -167,6 +176,10 @@ public class FullStartUpAndProcessTest {
EaafOpenSaml3xInitializer.eaafInitialize();
+ // start ERnP mockup WebServer
+ mockWebServer = new MockWebServer();
+ mockWebServer.start(1718);
+
}
/**
@@ -175,7 +188,8 @@ public class FullStartUpAndProcessTest {
* @throws Exception In case of an error
*/
@AfterClass
- public static void closeIgniteNode() throws Exception {
+ @SneakyThrows
+ public static void closeIgniteNode() {
System.out.println("Closiong Ignite Node ... ");
Ignition.stopAll(true);
@@ -183,6 +197,9 @@ public class FullStartUpAndProcessTest {
final Field field = IgniteInstanceInitializerSpecificCommunication.class.getDeclaredField("instance");
field.setAccessible(true);
field.set(null, null);
+
+ // shut-down ERnP mock-up WebServer
+ mockWebServer.shutdown();
}
@@ -210,7 +227,8 @@ public class FullStartUpAndProcessTest {
cc = RandomStringUtils.randomAlphabetic(2).toUpperCase();
- personalId = cc + "/AT/" + RandomStringUtils.randomNumeric(64);
+ pseudonym = RandomStringUtils.randomNumeric(64);
+ personalId = cc + "/AT/" + pseudonym;
familyName = RandomStringUtils.randomAlphabetic(10);
givenName = RandomStringUtils.randomAlphabetic(10);
dateOfBirth = "2015-10-12";
@@ -357,9 +375,13 @@ public class FullStartUpAndProcessTest {
RequestContextHolder.resetRequestAttributes();
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(eidasNodeRespReq, finalizeResp));
+ // inject ZMR, ERnP and SZR responses for matching
injectZmrResponse();
- injectSzrResponse();
-
+ injectSzrResponse();
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}") // empty response because we simulate result from ZMR
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
//excute eIDAS node response
eidasSignal.restoreEidasAuthProcess(eidasNodeRespReq, finalizeResp);
@@ -454,7 +476,7 @@ public class FullStartUpAndProcessTest {
EidasIdentitaetErgebnisType eidasPersonalIdentifier = new EidasIdentitaetErgebnisType();
personInfo.getEidasIdentitaet().add(eidasPersonalIdentifier);
- eidasPersonalIdentifier.setEidasWert(personalId);
+ eidasPersonalIdentifier.setEidasWert(pseudonym);
eidasPersonalIdentifier.setEidasArt(Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER);
eidasPersonalIdentifier.setStaatscode2(cc);
diff --git a/connector/src/test/resources/config/junit_config_1_springboot.properties b/connector/src/test/resources/config/junit_config_1_springboot.properties
index 3544c3a9..d3f0d136 100644
--- a/connector/src/test/resources/config/junit_config_1_springboot.properties
+++ b/connector/src/test/resources/config/junit_config_1_springboot.properties
@@ -55,6 +55,15 @@ eidas.ms.auth.eIDAS.zmrclient.ssl.trustStore.password=
eidas.ms.auth.eIDAS.zmrclient.req.organisation.behoerdennr=jUnit123456
eidas.ms.auth.eIDAS.zmrclient.req.update.reason.code=EIDAS-KITT
+# ERnP communication
+eidas.ms.auth.eIDAS.ernpclient.endpoint=http://localhost:1718/demoernp
+eidas.ms.auth.eIDAS.ernpclient.req.organisation.behoerdennr=jUnit123456
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.type=jks
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.path=keys/junit.jks
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.password=password
+eidas.ms.auth.eIDAS.client.common.ssl.key.alias=meta
+eidas.ms.auth.eIDAS.client.common.ssl.key.password=password
+
## PVP2 S-Profile end-point configuration
diff --git a/connector/src/test/resources/config/junit_config_2_springboot.properties b/connector/src/test/resources/config/junit_config_2_springboot.properties
index a67e387f..71a573e0 100644
--- a/connector/src/test/resources/config/junit_config_2_springboot.properties
+++ b/connector/src/test/resources/config/junit_config_2_springboot.properties
@@ -55,6 +55,15 @@ eidas.ms.auth.eIDAS.zmrclient.ssl.trustStore.password=
eidas.ms.auth.eIDAS.zmrclient.req.organisation.behoerdennr=jUnit123456
eidas.ms.auth.eIDAS.zmrclient.req.update.reason.code=EIDAS-KITT
+# ERnP communication
+eidas.ms.auth.eIDAS.ernpclient.endpoint=http://localhost:1718/demoernp
+eidas.ms.auth.eIDAS.ernpclient.req.organisation.behoerdennr=jUnit123456
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.type=jks
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.path=keys/junit.jks
+eidas.ms.auth.eIDAS.client.common.ssl.keyStore.password=password
+eidas.ms.auth.eIDAS.client.common.ssl.key.alias=meta
+eidas.ms.auth.eIDAS.client.common.ssl.key.password=password
+
## PVP2 S-Profile end-point configuration
eidas.ms.pvp2.keystore.type=jks