aboutsummaryrefslogtreecommitdiff
path: root/connector/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'connector/src/test/java')
-rw-r--r--connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java34
1 files changed, 28 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);