aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java400
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java108
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java42
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java38
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java41
6 files changed, 306 insertions, 325 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
index b70b4854..63266cf6 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
@@ -97,7 +97,7 @@ public class AlternativeSearchTaskWithRegisterTest {
@Rule
public SoapServiceRule soap = SoapServiceRule.newInstance();
-
+
@Mock private IErnpClient ernpClient;
@Autowired private IZmrClient zmrClient;
@@ -105,15 +105,15 @@ public class AlternativeSearchTaskWithRegisterTest {
private RegisterSearchService registerSearchService;
private ServicePort zmrMock = null;
-
+
private final ICcSpecificEidProcessingService eidPostProcessor = createEidPostProcessor();
private AlternativeSearchTask task;
final ExecutionContext executionContext = new ExecutionContextImpl();
private TestRequestImpl pendingReq;
private static JAXBContext jaxbContext;
-
-
+
+
/**
* Initialize jUnit class.
*/
@@ -126,19 +126,17 @@ public class AlternativeSearchTaskWithRegisterTest {
at.gv.bmi.namespace.zmr_su.base._20040201.ObjectFactory.class);
}
-
+
/**
* jUnit test set-up.
*/
@Before
public void setUp() throws URISyntaxException, EaafStorageException {
- MockitoAnnotations.initMocks(this);
-
if (zmrMock == null) {
zmrMock = soap.mock(ServicePort.class, "http://localhost:1234/demozmr");
-
+
}
-
+
registerSearchService = new RegisterSearchService(handlers, zmrClient, ernpClient);
task = new AlternativeSearchTask(registerSearchService, eidPostProcessor);
@@ -151,12 +149,12 @@ public class AlternativeSearchTaskWithRegisterTest {
}
-
+
@Test
@SneakyThrows
public void missingStateInfoFirstEidasData() {
// inject matching intermediate state
- RegisterStatusResults matchingState = new RegisterStatusResults(null,
+ RegisterStatusResults matchingState = new RegisterStatusResults(null,
Arrays.asList(RegisterResult.builder()
.bpk("")
.givenName("XXXKlaus - Maria")
@@ -166,14 +164,14 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
-
+
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -183,12 +181,12 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "No initial eIDAS authn data",
+ assertEquals("wrong errorparam 1", "No initial eIDAS authn data",
((EaafException) exception.getOriginalException()).getParams()[1]);
-
-
+
+
}
-
+
@Test
@SneakyThrows
public void missingStateInfoIntermediateMatchingState() {
@@ -203,11 +201,11 @@ public class AlternativeSearchTaskWithRegisterTest {
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
-
+
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -217,11 +215,11 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "No intermediate matching-state",
+ assertEquals("wrong errorparam 1", "No intermediate matching-state",
((EaafException) exception.getOriginalException()).getParams()[1]);
-
+
}
-
+
@Test
@SneakyThrows
public void countryCodeNotMatch() {
@@ -236,7 +234,7 @@ public class AlternativeSearchTaskWithRegisterTest {
.build());
// inject matching intermediate state
- RegisterStatusResults matchingState = new RegisterStatusResults(null,
+ RegisterStatusResults matchingState = new RegisterStatusResults(null,
Arrays.asList(RegisterResult.builder()
.bpk("")
.givenName("XXXKlaus - Maria")
@@ -246,14 +244,14 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"EE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
-
+
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -263,11 +261,11 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "Country Code of alternative eIDAS authn not matching",
+ assertEquals("wrong errorparam 1", "Country Code of alternative eIDAS authn not matching",
((EaafException) exception.getOriginalException()).getParams()[1]);
-
+
}
-
+
@Test
@SneakyThrows
public void mdsNoMatch() {
@@ -282,7 +280,7 @@ public class AlternativeSearchTaskWithRegisterTest {
.build());
// inject matching intermediate state
- RegisterStatusResults matchingState = new RegisterStatusResults(null,
+ RegisterStatusResults matchingState = new RegisterStatusResults(null,
Arrays.asList(RegisterResult.builder()
.bpk("")
.givenName("XXXKlaus - Maria")
@@ -292,14 +290,14 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1995-12-31"));
-
-
+
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -309,11 +307,11 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "MDS of alternative eIDAS authn does not match initial authn",
+ assertEquals("wrong errorparam 1", "MDS of alternative eIDAS authn does not match initial authn",
((EaafException) exception.getOriginalException()).getParams()[1]);
-
+
}
-
+
@Test
@SneakyThrows
public void seachPersonalIdMoreThanOneResult() {
@@ -329,7 +327,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("")
.givenName("XXXKlaus - Maria")
@@ -339,19 +337,19 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState);
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/search_with_personalId_only_resp_moreThanOne.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -361,18 +359,18 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "searchWithPersonalIdentifier", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
-
+
// validate request
assertEquals("wrong number of req.", 1, zmrReq.getAllValues().size());
- checkBasicRequestParameters(zmrReq.getValue(), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getValue(), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
assertNotNull("Personensuche req.", zmrReq.getValue().getPersonSuchenRequest());
- checkEidasDocumentResult(zmrReq.getValue().getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
+ checkEidasDocumentResult(zmrReq.getValue().getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
}
-
+
@Test
@SneakyThrows
public void seachPersonalIdNoBpkMatchWithIntermediateResults() {
@@ -387,7 +385,7 @@ public class AlternativeSearchTaskWithRegisterTest {
.build());
// inject matching intermediate state
- RegisterStatusResults matchingState = new RegisterStatusResults(null,
+ RegisterStatusResults matchingState = new RegisterStatusResults(null,
Arrays.asList(RegisterResult.builder()
.bpk("notExists")
.givenName("XXXKlaus - Maria")
@@ -397,19 +395,19 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-8_search_with_personalId_only_resp.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -419,18 +417,18 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "step7bKittProcess", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertFalse("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "Register result from alternativ authentication does not fit into intermediate state",
+ assertEquals("wrong errorparam 1", "Register result from alternativ authentication does not fit into intermediate state",
((EaafException) exception.getOriginalException()).getParams()[1]);
-
+
// validate request
assertEquals("wrong number of req.", 1, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getValue().getPersonSuchenRequest());
- checkEidasDocumentResult(zmrReq.getValue().getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
+ checkEidasDocumentResult(zmrReq.getValue().getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
}
-
+
@Test
@SneakyThrows
public void seachPersonalIdSuccess() {
@@ -446,7 +444,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("UgeknNsc26lVuB7U/uYGVmWtnnA=")
.givenName("XXXKlaus - Maria")
@@ -456,57 +454,57 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-8_search_with_personalId_only_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-4_kitt_get_latest_version_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-6_kitt_update_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-4_kitt_get_latest_version_resp.xml"))
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-6_kitt_update_resp.xml"))
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml"))
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
task.execute(pendingReq, executionContext);
// validate state
//INFO: has to be the old givenName because ZMR allows no update of MDS information
- checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
+ checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
"XXXClaus - Maria", "1994-12-31", "DE");
- assertNull("wrong executionContextFlag 'alternative eIDAS result'",
+ assertNull("wrong executionContextFlag 'alternative eIDAS result'",
executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
-
-
+
+
// validate request
assertEquals("wrong number of req.", 4, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
-
+ checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
+
assertNotNull("Personensuche KITT req.", zmrReq.getAllValues().get(1).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
-
+
assertNotNull("PersonAender KITT req.", zmrReq.getAllValues().get(2).getPersonAendernRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_UPDATE,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_UPDATE,
new BigInteger("367100000000079"), "jUnit123456");
-
+
assertNotNull("Personensuche KITT req.", zmrReq.getAllValues().get(3).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
-
+
}
-
+
@Test
@SneakyThrows
public void seachCcSpecificSuccess() {
@@ -522,7 +520,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("UgeknNsc26lVuB7U/uYGVmWtnnA=")
.givenName("XXXKlaus - Maria")
@@ -532,73 +530,73 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml"))
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-8_search_with_personalId_only_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-4_kitt_get_latest_version_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-6_kitt_update_resp.xml"))
- .thenReturn(loadResponseFromFile("/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml"))
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-4_kitt_get_latest_version_resp.xml"))
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-6_kitt_update_resp.xml"))
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml"))
.thenReturn(loadResponseFromFile("/data/zmr/seq_3-10_kitt_update_resp.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
task.execute(pendingReq, executionContext);
// validate state
//INFO: has to be the old givenName because ZMR allows no update of MDS information
- checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
+ checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
"XXXClaus - Maria", "1994-12-31", "DE");
- assertNull("wrong executionContextFlag 'alternative eIDAS result'",
+ assertNull("wrong executionContextFlag 'alternative eIDAS result'",
executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
-
-
+
+
// validate request
assertEquals("wrong number of req.", 6, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
+ checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
assertNotNull("Personensuche CC-specific req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
"DE", "Hintergigritzpotschn");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/BirthName",
"DE", "XXXvon Heuburg");
-
-
+
+
assertNotNull("Personensuche KITT req.", zmrReq.getAllValues().get(2).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
-
+
assertNotNull("PersonAender KITT req.", zmrReq.getAllValues().get(3).getPersonAendernRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_UPDATE,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_UPDATE,
new BigInteger("367100000000079"), "jUnit123456");
-
+
assertNotNull("Personensuche KITT req.", zmrReq.getAllValues().get(4).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(4), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(4), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
-
+
assertNotNull("PersonAender KITT req.", zmrReq.getAllValues().get(5).getPersonAendernRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(5), ZmrClientTest.PROCESS_TASK_UPDATE,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(5), ZmrClientTest.PROCESS_TASK_UPDATE,
new BigInteger("367100000000079"), "jUnit123456");
}
-
+
@Test
@SneakyThrows
public void seachCcSpecificNotPossible() {
@@ -614,7 +612,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("UgeknNsc26lVuB7U/uYGVmWtnnA=")
.givenName("XXXKlaus - Maria")
@@ -624,41 +622,41 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"EE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
task.execute(pendingReq, executionContext);
// validate state
assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
assertNull("final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
- assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
+ assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
-
-
+
+
// validate request
assertEquals("wrong number of req.", 1, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "EE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+ checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "EE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
}
-
+
@Test
@SneakyThrows
public void seachCcSpecificMoreThanOneResult() {
@@ -674,7 +672,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("UgeknNsc26lVuB7U/uYGVmWtnnA=")
.givenName("XXXKlaus - Maria")
@@ -684,21 +682,21 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml"))
.thenReturn(loadResponseFromFile("/data/zmr/search_with_personalId_only_resp_moreThanOne.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
@@ -708,29 +706,29 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("wrong errorparam 1", "searchWithCountrySpecifics", ((EaafException) exception.getOriginalException()).getParams()[0]);
assertTrue("Wrong flag 'step11'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
-
-
+
+
// validate request
assertEquals("wrong number of req.", 2, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
+ checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
assertNotNull("Personensuche CC-specific req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
"DE", "Hintergigritzpotschn");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/BirthName",
"DE", "XXXvon Heuburg");
-
+
}
-
+
@Test
@SneakyThrows
public void seachCcSpecificEmptyResult() {
@@ -746,7 +744,7 @@ public class AlternativeSearchTaskWithRegisterTest {
// inject matching intermediate state
RegisterStatusResults matchingState = new RegisterStatusResults(
- new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
+ new RegisterOperationStatus(new BigInteger(RandomStringUtils.randomNumeric(5))),
Arrays.asList(RegisterResult.builder()
.bpk("UgeknNsc26lVuB7U/uYGVmWtnnA=")
.givenName("XXXKlaus - Maria")
@@ -756,52 +754,52 @@ public class AlternativeSearchTaskWithRegisterTest {
.build()),
Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, matchingState );
-
+
//inject alternative eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
// inject response
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml"))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
-
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
// execute task
task.execute(pendingReq, executionContext);
// validate state
assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
assertNull("final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
- assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
+ assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
-
-
+
+
// validate request
assertEquals("wrong number of req.", 2, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH,
matchingState.getOperationStatus().getZmrProcessId(), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
- "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
-
+ checkEidasDocumentResult(zmrReq.getAllValues().get(0).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "DE", "7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit");
+
assertNotNull("Personensuche CC-specific req.", zmrReq.getAllValues().get(0).getPersonSuchenRequest());
- checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
+ checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
"DE", "Hintergigritzpotschn");
- checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
- "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ checkEidasDocumentResult(zmrReq.getAllValues().get(1).getPersonSuchenRequest().getEidasSuchdaten(),
+ "http://eidas.europa.eu/attributes/naturalperson/BirthName",
"DE", "XXXvon Heuburg");
-
+
}
-
+
@NotNull
private ICcSpecificEidProcessingService createEidPostProcessor() {
return new ICcSpecificEidProcessingService() {
@@ -819,7 +817,7 @@ public class AlternativeSearchTaskWithRegisterTest {
}
};
}
-
+
@NotNull
private ZmrRegisterResult zmrRegisterResult(RegisterResult registerResult, BigInteger processId) {
return new ZmrRegisterResult(Collections.singletonList(registerResult), processId);
@@ -942,7 +940,7 @@ public class AlternativeSearchTaskWithRegisterTest {
return (ResponseType) resp.getValue();
}
-
+
private void checkBasicRequestParameters(RequestType requestType, String vorgangName, BigInteger processId,
String behoerdennummer) {
assertNotNull("no workflow infos", requestType.getWorkflowInfoClient());
@@ -959,19 +957,19 @@ public class AlternativeSearchTaskWithRegisterTest {
assertEquals("behoerdennummer", behoerdennummer, requestType.getClientInfo().getOrganisation()
.getBehoerdenNr());
}
-
- private void checkEidasDocumentResult(List<EidasSuchdatenType> list, String type, String cc, String value) {
+
+ private void checkEidasDocumentResult(List<EidasSuchdatenType> list, String type, String cc, String value) {
Optional<EidasSuchdatenType> eidasDoc = list.stream()
.filter(el -> type.equals(el.getEidasArt()))
.findFirst();
-
- assertTrue("eidas doc: " + type, eidasDoc.isPresent());
+
+ assertTrue("eidas doc: " + type, eidasDoc.isPresent());
assertEquals("eIDAS docType", type, eidasDoc.get().getEidasArt());
assertEquals("eIDAS docValue", value, eidasDoc.get().getEidasWert());
assertEquals("eIDAS docCC", cc, eidasDoc.get().getStaatscode2());
}
-
-
-
+
+
+
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
index b0de3460..e5ba2e07 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
@@ -127,8 +127,6 @@ public class InitialSearchTaskTest {
*/
@Before
public void setUp() throws URISyntaxException, EaafStorageException {
- MockitoAnnotations.initMocks(this);
-
registerSearchService = new RegisterSearchService(handlers, zmrClient, ernpClient);
task = new InitialSearchTask(registerSearchService, eidPostProcessor);
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
index 11dfc522..14ad3519 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
@@ -118,7 +118,7 @@ public class InitialSearchTaskWithRegistersTest {
@Rule
public SoapServiceRule soap = SoapServiceRule.newInstance();
-
+
@Mock private IErnpClient ernpClient;
@Autowired private IZmrClient zmrClient;
@@ -126,7 +126,7 @@ public class InitialSearchTaskWithRegistersTest {
private RegisterSearchService registerSearchService;
private ServicePort zmrMock = null;
-
+
private final ICcSpecificEidProcessingService eidPostProcessor = createEidPostProcessor();
private InitialSearchTask task;
@@ -146,19 +146,17 @@ public class InitialSearchTaskWithRegistersTest {
at.gv.bmi.namespace.zmr_su.base._20040201.ObjectFactory.class);
}
-
+
/**
* jUnit test set-up.
*/
@Before
public void setUp() throws URISyntaxException, EaafStorageException {
- MockitoAnnotations.initMocks(this);
-
if (zmrMock == null) {
zmrMock = soap.mock(ServicePort.class, "http://localhost:1234/demozmr");
-
+
}
-
+
registerSearchService = new RegisterSearchService(handlers, zmrClient, ernpClient);
task = new InitialSearchTask(registerSearchService, eidPostProcessor);
@@ -177,36 +175,36 @@ public class InitialSearchTaskWithRegistersTest {
@Test
@DirtiesContext
public void singlePersonalIdMatchUpdateNecessary_Zmr() throws Exception {
-
+
String oldGivenName = "XXXClaus - Maria";
-
+
//inject eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
-
+
// inject response
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-8_search_with_personalId_only_resp.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
-
// execute test
task.execute(pendingReq, executionContext);
// validate state
//INFO: has to be the old givenName because ZMR allows no update of MDS information
- checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
+ checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
oldGivenName, "1994-12-31", DE);
// validate request
assertEquals("wrong number of req.", 1, zmrReq.getAllValues().size());
assertNotNull("Personensuche req.", zmrReq.getValue().getPersonSuchenRequest());
checkBasicRequestParameters(zmrReq.getValue(), ZmrClientTest.PROCESS_TASK_SEARCH, null, "jUnit123456");
-
+
}
@@ -218,17 +216,17 @@ public class InitialSearchTaskWithRegistersTest {
@Test
@DirtiesContext
@SneakyThrows
- public void multiPersonalIdMatch_Zmr() throws EidasSAuthenticationException {
+ public void multiPersonalIdMatch_Zmr() throws EidasSAuthenticationException {
//inject eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE,
- buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
+
// inject response
when(zmrMock.service(any(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/search_with_personalId_only_resp_moreThanOne.xml"))
- .thenThrow(new RuntimeException("This request is not needed any more"));
+ .thenThrow(new RuntimeException("This request is not needed any more"));
// execute task
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
@@ -238,50 +236,50 @@ public class InitialSearchTaskWithRegistersTest {
assertTrue("Wrong exception", (exception.getOriginalException() instanceof WorkflowException));
assertTrue("Wrong flag 'manualFixNeeded'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
-
+
}
-
-
+
+
/**
* Find single person in ZMR by country specifics.
*/
@Test
@DirtiesContext
- public void singlePersonFindWithCountySpecifics_Zmr() throws Exception {
+ public void singlePersonFindWithCountySpecifics_Zmr() throws Exception {
//inject eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE,
- buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit_with_New_ID", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
BigInteger processId = new BigInteger("367100000000079");
-
+
// inject response
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //personalId search
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-8_search_with_personalId_only_resp.xml")) //CC specific search
- .thenReturn(loadResponseFromFile("/data/zmr/seq_1-4_kitt_get_latest_version_resp.xml")) //KITT latest version
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_1-4_kitt_get_latest_version_resp.xml")) //KITT latest version
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-6_kitt_update_resp.xml")) //KITT update
.thenThrow(new RuntimeException("This request is not needed any more"));
-
+
// execute test
task.execute(pendingReq, executionContext);
// validate state
- checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
+ checkMatchingSuccessState(pendingReq, "UgeknNsc26lVuB7U/uYGVmWtnnA=", "XXXvon Brandenburg",
"XXXClaus - Maria", "1994-12-31", DE);
// validate request
- assertEquals("wrong number of req.", 4, zmrReq.getAllValues().size());
+ assertEquals("wrong number of req.", 4, zmrReq.getAllValues().size());
checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH, null, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_UPDATE, processId, "jUnit123456");
-
+
}
-
+
/**
* Find one match with MDS search in ZMR.
*/
@@ -291,18 +289,18 @@ public class InitialSearchTaskWithRegistersTest {
public void resultByMdsSearch_Zmr() throws TaskExecutionException, EidasSAuthenticationException {
//inject eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE,
- buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit_with_New_ID", "1994-12-31"));
-
+
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
BigInteger processId = new BigInteger("367100000000079");
-
+
// inject response
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //personalId search
- //CC-specific will be ignored because CC is DE but BirthName and PlaceOfBirth is 'null'
- .thenReturn(loadResponseFromFile("/data/zmr/seq_1-2_search_with_mds_resp.xml")) //MDS specific search
+ //CC-specific will be ignored because CC is DE but BirthName and PlaceOfBirth is 'null'
+ .thenReturn(loadResponseFromFile("/data/zmr/seq_1-2_search_with_mds_resp.xml")) //MDS specific search
.thenThrow(new RuntimeException("This request is not needed any more"));
@@ -316,9 +314,9 @@ public class InitialSearchTaskWithRegistersTest {
assertEquals("wrong number of req.", 2, zmrReq.getAllValues().size());
checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH, null, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
-
+
}
-
+
/**
* Find one match with MDS search in ZMR.
*/
@@ -328,19 +326,19 @@ public class InitialSearchTaskWithRegistersTest {
public void resultByMdsSearch_Zmr_Second() throws TaskExecutionException, EidasSAuthenticationException {
//inject eIDAS data
pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
- Constants.DATA_FULL_EIDAS_RESPONSE,
- buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("XXXClaus - Maria", "XXXvon Brandenburg",
"DE/AT/7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit_with_New_ID", "1994-12-31",
null, "Hintergigritzpotschn", "XXXvon Heuburg"));
-
+
final ArgumentCaptor<RequestType> zmrReq = ArgumentCaptor.forClass(RequestType.class);
BigInteger processId = new BigInteger("367100000000079");
-
+
// inject response
when(zmrMock.service(zmrReq.capture(), any()))
.thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //personalId search
- .thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //CC-specific search
- .thenReturn(loadResponseFromFile("/data/zmr/search_with_personalId_only_resp_moreThanOne.xml")) //MDS specific search
+ .thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //CC-specific search
+ .thenReturn(loadResponseFromFile("/data/zmr/search_with_personalId_only_resp_moreThanOne.xml")) //MDS specific search
.thenThrow(new RuntimeException("This request is not needed any more"));
@@ -355,11 +353,11 @@ public class InitialSearchTaskWithRegistersTest {
checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH, null, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
-
+
}
-
-
-
+
+
+
@NotNull
private ICcSpecificEidProcessingService createEidPostProcessor() {
return new ICcSpecificEidProcessingService() {
@@ -377,7 +375,7 @@ public class InitialSearchTaskWithRegistersTest {
}
};
}
-
+
@NotNull
private ZmrRegisterResult zmrRegisterResult(RegisterResult registerResult, BigInteger processId) {
return new ZmrRegisterResult(Collections.singletonList(registerResult), processId);
@@ -500,7 +498,7 @@ public class InitialSearchTaskWithRegistersTest {
return (ResponseType) resp.getValue();
}
-
+
private void checkBasicRequestParameters(RequestType requestType, String vorgangName, BigInteger processId,
String behoerdennummer) {
assertNotNull("no workflow infos", requestType.getWorkflowInfoClient());
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
index 25a77cce..64bb0d48 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
@@ -61,12 +61,12 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
@Autowired
protected MsConnectorDummyConfigMap authConfig;
-
+
@MockBean
private RegisterSearchService registerSearchService;
private ReceiveAustrianResidenceGuiResponseTask task;
-
+
private final ExecutionContext executionContext = new ExecutionContextImpl();
private MockHttpServletRequest httpReq;
private MockHttpServletResponse httpResp;
@@ -79,10 +79,8 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
*/
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
task = new ReceiveAustrianResidenceGuiResponseTask(registerSearchService);
-
+
httpReq = new MockHttpServletRequest("POST", "https://localhost/ms_connector");
httpResp = new MockHttpServletResponse();
RequestContextHolder.resetRequestAttributes();
@@ -102,7 +100,7 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
RegisterStatusResults registerSearchResult = buildEmptyResult();
mockRegisterSearch(userInput, registerSearchResult, eidasData);
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, registerSearchResult);
-
+
task.execute(pendingReq, executionContext);
assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK));
@@ -120,7 +118,7 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
assertNull("Transition To S9", executionContext.get(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK));
Mockito.verify(registerSearchService).step7aKittProcess(eq(registerSearchResult), eq(eidasData));
-
+
}
@Test
@@ -153,35 +151,35 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
}
private void mockRegisterSearch(UserInput userInput, RegisterStatusResults registerSearchResult, SimpleEidasData eidasData ) {
- Mockito.when(registerSearchService.searchWithResidence(eq(registerSearchResult.getOperationStatus()), eq(eidasData),
+ Mockito.when(registerSearchService.searchWithResidence(eq(registerSearchResult.getOperationStatus()), eq(eidasData),
eq(userInput.getZipcode()), eq(userInput.getCity()), eq(userInput.getStreet()))).thenReturn(registerSearchResult);
}
@NotNull
- private RegisterStatusResults buildEmptyResult() {
- return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
+ private RegisterStatusResults buildEmptyResult() {
+ return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
Collections.emptyList(), Collections.emptyList());
-
+
}
private BigInteger generateRandomProcessId() {
return new BigInteger(RandomStringUtils.randomNumeric(10));
-
+
}
-
+
@NotNull
private RegisterStatusResults buildResultWithOneMatch(RegisterResult registerResult) {
- return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
+ return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
Collections.singletonList(registerResult), Collections.emptyList());
-
+
}
@NotNull
private RegisterStatusResults buildResultWithTwoMatches() {
List<RegisterResult> results = Lists.newArrayList(buildRandomRegisterResult(), buildRandomRegisterResult());
- return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
+ return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
results, Collections.emptyList());
-
+
}
@NotNull
@@ -192,8 +190,8 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
.familyName(RandomStringUtils.randomAlphabetic(8))
.dateOfBirth(RandomStringUtils.randomAlphabetic(8))
.bpk(RandomStringUtils.randomAlphabetic(8))
- .build();
-
+ .build();
+
}
private RegisterResult buildMatchingRegisterResult(SimpleEidasData eidData) {
@@ -203,8 +201,8 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
.familyName(eidData.getFamilyName())
.dateOfBirth(eidData.getDateOfBirth())
.bpk(RandomStringUtils.randomAlphabetic(8))
- .build();
-
+ .build();
+
}
private RegisterResult buildNotMatchingRegisterResult(SimpleEidasData eidData) {
@@ -215,7 +213,7 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
.dateOfBirth(eidData.getDateOfBirth())
.bpk(RandomStringUtils.randomAlphabetic(8))
.build();
-
+
}
private void setHttpParameters(UserInput input) {
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
index b072b8b2..8094ac1e 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
@@ -47,7 +47,6 @@ import at.asitplus.eidas.specific.connector.test.config.dummy.MsConnectorDummyCo
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.InvalidUserInputException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.idaustriaclient.IdAustriaClientAuthConstants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.idaustriaclient.provider.IdAustriaClientAuthCredentialProvider;
@@ -118,7 +117,6 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
*/
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
httpReq.setScheme("https");
httpReq.setServerPort(443);
@@ -325,12 +323,11 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
.build();
authProcessData.setGenericDataToSession(Constants.DATA_SIMPLE_EIDAS, eidData);
- TaskExecutionException e = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
- assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
- isInstanceOf(AuthnResponseValidationException.class, e.getOriginalException());
- isInstanceOf(InvalidUserInputException.class, e.getOriginalException().getCause());
+ task.execute(pendingReq, executionContext);
+
+ assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
}
//TODO: implement new test that this test makes no sense any more
@@ -345,13 +342,12 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
RegisterStatusResults registerSearchResult = new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
Collections.emptyList(), Collections.emptyList());
MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, registerSearchResult);
-
+
task.execute(pendingReq, executionContext);
AuthProcessDataWrapper session = pendingReq.getSessionData(AuthProcessDataWrapper.class);
assertEquals("LoA", "http://eidas.europa.eu/LoA/low", session.getQaaLevel());
assertEquals("IssueInstant", "2014-03-05T06:39:51Z", session.getIssueInstantString());
- assertNull("Matching BPK", session.getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK));
assertEquals("Transition To S16", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
}
@@ -370,9 +366,8 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
AuthProcessDataWrapper session = pendingReq.getSessionData(AuthProcessDataWrapper.class);
assertEquals("LoA", "http://eidas.europa.eu/LoA/low", session.getQaaLevel());
assertEquals("IssueInstant", "2014-03-05T06:39:51Z", session.getIssueInstantString());
- assertNull("Matching BPK", session.getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK));
assertNull("Transition To S16", executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
-
+
//TODO: update this check because this task selects one result from MDS search result before and creates a new element
//Mockito.verify(registerSearchService).step7aKittProcess(eq(registerSearchResult), eq(eidData));
}
@@ -390,15 +385,14 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
TaskExecutionException e = assertThrows(TaskExecutionException.class,
() -> task.execute(pendingReq, executionContext));
-
+
assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
isInstanceOf(AuthnResponseValidationException.class, e.getOriginalException());
isInstanceOf(ManualFixNecessaryException.class, e.getOriginalException().getCause());
assertEquals("sp.pvp2.12", ((AuthnResponseValidationException) e.getOriginalException()).getErrorId());
-
-
- AuthProcessDataWrapper session = pendingReq.getSessionData(AuthProcessDataWrapper.class);
- assertNull("Matching BPK", session.getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK));
+
+
+ AuthProcessDataWrapper session = pendingReq.getSessionData(AuthProcessDataWrapper.class);
assertNull("Transition To S16", executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
}
@@ -411,9 +405,9 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
.givenName("foo")
.familyName("foo")
.dateOfBirth("bar")
- .build()),
+ .build()),
Collections.emptyList());
-
+
}
@NotNull
@@ -433,16 +427,16 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
.familyName("familyName")
.dateOfBirth("dateOfBirth")
.build());
-
- return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
+
+ return new RegisterStatusResults(new RegisterOperationStatus(generateRandomProcessId()),
results, Collections.emptyList());
}
private BigInteger generateRandomProcessId() {
return new BigInteger(RandomStringUtils.randomNumeric(10));
-
+
}
-
+
private SimpleEidasData.SimpleEidasDataBuilder createEidasDataMatchingToSamlResponse() {
// data from "/data/Response_with_EID.xml"
return SimpleEidasData.builder()
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
index 84e78fdb..da8a7497 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
@@ -25,7 +25,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.InvalidUserInputException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveOtherLoginMethodGuiResponseTask;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
@@ -88,7 +87,7 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest {
public void withNoOtherLoginSelection() throws TaskExecutionException {
testTransition(SelectedLoginMethod.NO_OTHER_LOGIN, Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK);
}
-
+
@Test
public void withAddMeAsNewSelection() throws TaskExecutionException {
testTransition(SelectedLoginMethod.ADD_ME_AS_NEW, Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK);
@@ -106,48 +105,44 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest {
assertEquals("Wrong login-selection found", loginMethod, executionContext.get(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER));
assertEquals("Next task", true, executionContext.get(expectedTransition));
assertNull("find advancedMatchingError flag", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
-
+
}
- public void withInvalidSelection() {
+ public void withInvalidSelection() throws TaskExecutionException {
httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, RandomStringUtils.randomAlphabetic(2));
- TaskExecutionException e = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
- assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
- isInstanceOf(InvalidUserInputException.class, e.getOriginalException());
+ assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
}
@Test
- public void withNullSelection() {
+ public void withNullSelection() throws TaskExecutionException {
httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, "null");
- TaskExecutionException e = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
- assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
- isInstanceOf(InvalidUserInputException.class, e.getOriginalException());
+ assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
}
@Test
- public void withEmptySelection() {
+ public void withEmptySelection() throws TaskExecutionException {
httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, "");
- TaskExecutionException e = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
- assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
- isInstanceOf(InvalidUserInputException.class, e.getOriginalException());
+ assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
}
@Test
- public void withoutLoginMethodSelection() {
+ public void withoutLoginMethodSelection() throws TaskExecutionException {
- TaskExecutionException e = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
- assertEquals(pendingReq.getPendingRequestId(), e.getPendingRequestID());
- isInstanceOf(InvalidUserInputException.class, e.getOriginalException());
+ assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
}
}