aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <>2022-10-21 20:54:25 +0200
committerThomas <>2022-10-21 20:54:25 +0200
commitc25f53f2ae3522f2cea1707b8869187013bba8e9 (patch)
treeb0001e7ba611b495ff124bf03720afd3c42f9aa7
parente25cba73e85becbc332a2060ebd7f60bcc8091e2 (diff)
downloadNational_eIDAS_Gateway-c25f53f2ae3522f2cea1707b8869187013bba8e9.tar.gz
National_eIDAS_Gateway-c25f53f2ae3522f2cea1707b8869187013bba8e9.tar.bz2
National_eIDAS_Gateway-c25f53f2ae3522f2cea1707b8869187013bba8e9.zip
test(matching): add some more validations for advanced statistic log
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/log/statistic/DetailedMatchtingStatistic.java4
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java5
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java20
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java9
4 files changed, 33 insertions, 5 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/log/statistic/DetailedMatchtingStatistic.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/log/statistic/DetailedMatchtingStatistic.java
index 975d17b4..e2b5f3e5 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/log/statistic/DetailedMatchtingStatistic.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/log/statistic/DetailedMatchtingStatistic.java
@@ -66,7 +66,7 @@ public class DetailedMatchtingStatistic implements Serializable {
public static MatchingStepResult buildFrom(RegisterStatusResults result) {
return new MatchingStepResult(
result.getResultsZmr().size(),
- result.getResultsZmr().size());
+ result.getResultsErnp().size());
}
@@ -74,7 +74,7 @@ public class DetailedMatchtingStatistic implements Serializable {
@Setter
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
- private static class MatchingStepResult {
+ public static class MatchingStepResult {
@JsonProperty("zmr")
private int zmrResults = 0;
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
index 176e95cb..25a8a5b5 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
@@ -60,6 +60,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttribute
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.GenericEidProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.log.statistic.DetailedMatchtingStatistic;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterOperationStatus;
@@ -521,6 +522,10 @@ public class AlternativeSearchTaskWithRegisterTest {
checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
+ DetailedMatchtingStatistic entry = MatchingTaskUtils.getDetailedMatchingStatistic(pendingReq);
+ assertNotNull("statisticLogEntry", entry);
+ assertEquals("use eIDAS count", 1, entry.getEidasLoginUsed());
+
}
@Test
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 1ce48a2e..6292a0e1 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
@@ -80,6 +80,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowExcept
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ZmrCommunicationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.GenericEidProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.log.statistic.DetailedMatchtingStatistic;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterStatusResults;
@@ -523,7 +524,12 @@ public class InitialSearchTaskTest {
task.execute(pendingReq, executionContext);
// validate state
- checkMatchingSuccessState(pendingReq, randomBpk, randomFamilyName, randomGivenName, randomBirthDate, DE);
+ checkMatchingSuccessState(pendingReq, randomBpk, randomFamilyName, randomGivenName, randomBirthDate, DE);
+ DetailedMatchtingStatistic entry = MatchingTaskUtils.getDetailedMatchingStatistic(pendingReq);
+ assertNotNull("statisticLogEntry", entry);
+ assertEquals("ZMR", 1, entry.getPersonalIdResult().getZmrResults());
+ assertEquals("ERnP", 0, entry.getPersonalIdResult().getErnpResults());
+
}
/**
@@ -685,7 +691,7 @@ public class InitialSearchTaskTest {
assertTrue("Wrong exception", (exception.getOriginalException() instanceof WorkflowException));
assertTrue("Wrong flag 'manualFixNeeded'",
((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
-
+
}
/**
@@ -838,6 +844,7 @@ public class InitialSearchTaskTest {
*/
@Test
@DirtiesContext
+ @SneakyThrows
public void resultByMdsSearch_ZmrAndErnp() throws TaskExecutionException, EidasSAuthenticationException {
BigInteger zmrProcessId = generateRandomProcessId();
Mockito.when(zmrClient.searchWithPersonIdentifier(null, randomPseudonym, DE))
@@ -861,7 +868,14 @@ public class InitialSearchTaskTest {
// validate state
checkIntermediateResult(2);
-
+
+ DetailedMatchtingStatistic entry = MatchingTaskUtils.getDetailedMatchingStatistic(pendingReq);
+ assertNotNull("statisticLogEntry", entry);
+ assertEquals("ZMR", 0, entry.getPersonalIdResult().getZmrResults());
+ assertEquals("ERnP", 0, entry.getPersonalIdResult().getErnpResults());
+ assertEquals("ZMR", 1, entry.getMdsResult().getZmrResults());
+ assertEquals("ERnP", 1, entry.getMdsResult().getErnpResults());
+
}
/**
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
index d7c0acc4..3bd86e63 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
@@ -35,6 +35,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.controller.AdresssucheCo
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;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.log.statistic.DetailedMatchtingStatistic;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterOperationStatus;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterStatusResults;
@@ -123,6 +124,10 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
assertEquals("failed reason", "module.eidasauth.matching.21", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+ DetailedMatchtingStatistic entry = MatchingTaskUtils.getDetailedMatchingStatistic(pendingReq);
+ assertNotNull("statisticLogEntry", entry);
+ assertEquals("registerSearchCount", 0, entry.getAddressSearchUsed());
+
}
@Test
@@ -142,6 +147,10 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
assertEquals("failed reason", "module.eidasauth.matching.22", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+ DetailedMatchtingStatistic entry = MatchingTaskUtils.getDetailedMatchingStatistic(pendingReq);
+ assertNotNull("statisticLogEntry", entry);
+ assertEquals("registerSearchCount", 1, entry.getAddressSearchUsed());
+
}
@Test