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/InitialSearchTaskFirstTest.java89
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml21
2 files changed, 71 insertions, 39 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index f1bc98d6..f2dc6d55 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -23,34 +23,6 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks;
-import static org.junit.Assert.assertThrows;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Random;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.lang3.RandomStringUtils;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.web.context.request.RequestContextHolder;
-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.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
@@ -70,6 +42,34 @@ import eu.eidas.auth.commons.attribute.ImmutableAttributeMap;
import eu.eidas.auth.commons.attribute.PersonType;
import eu.eidas.auth.commons.protocol.impl.AuthenticationResponse;
import lombok.val;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
+
+import static org.junit.Assert.assertThrows;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
@@ -99,6 +99,17 @@ public class InitialSearchTaskFirstTest {
private final String randomBirthName = RandomStringUtils.randomAlphabetic(10);
private final String randomDate = "2011-01-" + (10 + new Random().nextInt(18));
+// /**
+// * jUnit class initializer.
+// *
+// * @throws IOException In case of an error
+// */
+// @BeforeClass
+// public static void classInitializer() throws IOException {
+// final String current = new java.io.File(".").toURI().toString();
+// System.setProperty("eidas.ms.configuration", current
+// + "src/test/resources/config/junit_config_1.properties");
+// }
/**
* jUnit test set-up.
@@ -127,7 +138,7 @@ public class InitialSearchTaskFirstTest {
public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
String newFirstName = RandomStringUtils.randomAlphabetic(10);
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
- new RegisterResult(randomBpk, randomPseudonym, newFirstName, randomFamilyName, randomDate)));
+ new RegisterResult(randomBpk, randomIdentifier, newFirstName, randomFamilyName, randomDate)));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
task.execute(pendingReq, executionContext);
@@ -147,7 +158,7 @@ public class InitialSearchTaskFirstTest {
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
String newRandomGivenName = RandomStringUtils.randomAlphabetic(10);
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
- new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate)));
+ new RegisterResult(randomBpk, randomIdentifier, newRandomGivenName, randomFamilyName, randomDate)));
task.execute(pendingReq, executionContext);
String bPk = (String)
@@ -164,9 +175,9 @@ public class InitialSearchTaskFirstTest {
@DirtiesContext
public void testNode101_ManualFixNecessary_a() {
ArrayList<RegisterResult> zmrResult = new ArrayList<>();
- zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
+ zmrResult.add(new RegisterResult(randomBpk, randomIdentifier, randomGivenName, randomFamilyName, randomDate));
String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
- zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
+ zmrResult.add(new RegisterResult(randomBpk, randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
@@ -189,7 +200,7 @@ public class InitialSearchTaskFirstTest {
ernpResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
ernpResult.add(
- new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
+ new RegisterResult(randomBpk, randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
TaskExecutionException exception = assertThrows(TaskExecutionException.class,
@@ -207,7 +218,7 @@ public class InitialSearchTaskFirstTest {
public void testNode102_UserIdentified_a() throws Exception {
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
- new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
+ new RegisterResult(randomBpk, randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
task.execute(pendingReq, executionContext);
String bPk = (String)
@@ -223,7 +234,7 @@ public class InitialSearchTaskFirstTest {
@DirtiesContext
public void testNode102_UserIdentified_b() throws Exception {
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
- new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
+ new RegisterResult(randomBpk, randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
task.execute(pendingReq, executionContext);
@@ -246,9 +257,9 @@ public class InitialSearchTaskFirstTest {
pendingReq1.getSessionData(AuthProcessDataWrapper.class)
.setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
- String newRandomPseudonym = IT_ST + randomIdentifier + RandomStringUtils.randomNumeric(2);
+ String newRandomIdentifier = randomIdentifier + RandomStringUtils.randomNumeric(2);
Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(Collections.singletonList(
- new RegisterResult(randomBpk, newRandomPseudonym, randomGivenName, randomFamilyName,
+ new RegisterResult(randomBpk, newRandomIdentifier, randomGivenName, randomFamilyName,
randomDate, null, null, taxNumber, null)));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
task = new InitialSearchTask(
@@ -278,7 +289,7 @@ public class InitialSearchTaskFirstTest {
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
randomBirthName))
- .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+ .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomIdentifier, randomGivenName,
randomFamilyName, randomDate, randomPlaceOfBirth, randomBirthName, null, null)));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
task = new InitialSearchTask(
@@ -310,7 +321,7 @@ public class InitialSearchTaskFirstTest {
Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
zmrResultSpecific.add(
- new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate,
+ new RegisterResult(randomBpk, randomIdentifier, randomGivenName, randomFamilyName, randomDate,
randomPlaceOfBirth, randomBirthName, null, null));
zmrResultSpecific.add(new RegisterResult(newRandomBpk, newRandomPseudonym, randomGivenName, randomFamilyName, randomDate,
randomPlaceOfBirth, randomBirthName, null, null));
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
index 0989cbef..e479dc78 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
@@ -81,4 +81,25 @@
<bean id="IT-Specific-Search"
class="at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ItSpecificDetailSearchProcessor">
</bean>
+
+ <bean id="CreateNewErnpEntryTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask"
+ scope="prototype" />
+
+ <bean id="GenerateGuiTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateGuiTask"
+ scope="prototype" />
+
+ <bean id="GenerateMobilePhoneSignatureRequestTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateMobilePhoneSignatureRequestTask"
+ scope="prototype" />
+
+ <bean id="ReceiveGuiResponseTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveGuiResponseTask"
+ scope="prototype" />
+
+ <bean id="ReceiveMobilePhoneSignatureResponseTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveMobilePhoneSignatureResponseTask"
+ scope="prototype" />
+
</beans> \ No newline at end of file