aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java340
1 files changed, 257 insertions, 83 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java
index 8ac6fff6..a338ebed 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java
@@ -8,6 +8,7 @@ import java.util.List;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
@@ -35,93 +36,125 @@ import ch.qos.logback.classic.Logger;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"/SpringTest-context_tasks_test.xml",
- "/SpringTest-context_basic_realConfig.xml"})
+ "/SpringTest-context_basic_realConfig.xml" })
@TestPropertySource(locations = {
- //"classpath:/application.properties",
+ // "classpath:/application.properties",
"file:/home/tlenz/Projekte/config/ms_connector/default_config.properties",
- })
+})
public class ZmrClientProductionTest {
- @Autowired ZmrSoapClient client;
- @Autowired IConfiguration basicConfig;
-
+ @Autowired
+ ZmrSoapClient client;
+ @Autowired
+ IConfiguration basicConfig;
+
@BeforeClass
public static void classInitializer() {
- Logger logger1 = (Logger) LoggerFactory.getLogger(LoggingHandler.class);
+ final Logger logger1 = (Logger) LoggerFactory.getLogger(LoggingHandler.class);
logger1.setLevel(Level.TRACE);
-
- Logger logger2 = (Logger) LoggerFactory.getLogger(ZmrSoapClient.class);
+
+ final Logger logger2 = (Logger) LoggerFactory.getLogger(ZmrSoapClient.class);
logger2.setLevel(Level.TRACE);
-
- Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+
+ final Logger rootLogger = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
rootLogger.setLevel(Level.INFO);
-
+
}
-
+
@Test
public void searchWithMdsOnly() throws EidasSAuthenticationException {
-
- ZmrRegisterResult result = client.searchWithMds(null,
- "Thomas", "Lenz", "1982-09-06",
+
+ final ZmrRegisterResult result = client.searchWithMds(null,
+ "Thomas", "Lenz", "1982-09-06",
"AT");
-
+
assertNotNull("ZMR response", result);
- assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR processId", result.getProcessId());
assertNotNull("ZMR personResult", result.getPersonResult());
- assertEquals("personResult size", 1, result.getPersonResult().size());
-
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
}
-
+
@Test
public void searchWithMdsOnlyTestIdentity() throws EidasSAuthenticationException {
-
- ZmrRegisterResult result = client.searchWithMds(null,
- "XXXHildegard", "XXXÖhlinger", "1971-02-18",
+
+ final ZmrRegisterResult result = client.searchWithMds(null,
+ "XXXHildegard", "XXXÖhlinger", "1971-02-18",
"AT");
-
+
assertNotNull("ZMR response", result);
- assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR processId", result.getProcessId());
assertNotNull("ZMR personResult", result.getPersonResult());
- assertEquals("personResult size", 1, result.getPersonResult().size());
-
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
}
-
+
+ @Test
+ public void searchWithMdsOnlyEidasIdentity() throws EidasSAuthenticationException {
+
+ final ZmrRegisterResult result = client.searchWithMds(null,
+ "javier", "Garcia", "1964-12-31",
+ "EE");
+
+ assertNotNull("ZMR response", result);
+ assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR personResult", result.getPersonResult());
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
+ }
+
@Test
public void searchWithCountrySpecificsNoExits() throws EidasSAuthenticationException {
- ZmrRegisterResult result = client.searchCountrySpecific(null,
- generateCustomRequest("AT", "Lenz", "Thomas", "1982-09-06",
- null,
- RandomStringUtils.randomAlphabetic(5),
- RandomStringUtils.randomAlphabetic(5)),
+ final ZmrRegisterResult result = client.searchCountrySpecific(null,
+ generateCustomRequest("AT", "Lenz", "Thomas", "1982-09-06",
+ null,
+ RandomStringUtils.randomAlphabetic(5),
+ RandomStringUtils.randomAlphabetic(5)),
"AT");
-
+
assertNotNull("ZMR response", result);
- assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR processId", result.getProcessId());
assertNotNull("ZMR personResult", result.getPersonResult());
- assertEquals("personResult size", 0, result.getPersonResult().size());
-
+ assertEquals("personResult size", 0, result.getPersonResult().size());
+
+ }
+
+ @Test
+ public void searchWithCountrySpecificsWithPersonalId() throws EidasSAuthenticationException {
+ final ZmrRegisterResult result = client.searchCountrySpecific(null,
+ generateCustomRequest("EE", "Lenz", "Thomas", "1982-09-06",
+ "7cEYSvKZvon+V4CDVzNT4E7cjkU4Vq",
+ null,
+ null),
+ "EE");
+
+ assertNotNull("ZMR response", result);
+ assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR personResult", result.getPersonResult());
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
}
@Test
public void searchWithPersonalIdOnly() throws EidasSAuthenticationException {
-
- ZmrRegisterResult result = client.searchWithPersonIdentifier(null,
- RandomStringUtils.randomAlphanumeric(25),
- "AT");
-
+
+ final ZmrRegisterResult result = client.searchWithPersonIdentifier(null,
+ RandomStringUtils.randomAlphanumeric(25),
+ "AT");
+
assertNotNull("ZMR response", result);
- assertNotNull("ZMR processId", result.getProcessId());
+ assertNotNull("ZMR processId", result.getProcessId());
assertNotNull("ZMR personResult", result.getPersonResult());
- assertEquals("personResult size", 0, result.getPersonResult().size());
-
+ assertEquals("personResult size", 0, result.getPersonResult().size());
+
}
-
+
@Test
public void updateZmrEntry() throws EidasSAuthenticationException {
- String personalIdentifier = "7cEYSvKZvon+V4CDVzNT4E7cjkU4Vq";
- String cc = "EE";
+ final String personalIdentifier = "7cEYSvKZvon+V4CDVzNT4E7cjkU4Vq";
+ final String cc = "EE";
- SimpleEidasData eidasData = SimpleEidasData.builder()
+ final SimpleEidasData eidasData = SimpleEidasData.builder()
.citizenCountryCode(cc)
.familyName("Lenz")
.givenName("Thomas")
@@ -129,44 +162,185 @@ public class ZmrClientProductionTest {
.personalIdentifier(cc + "/AT/" + personalIdentifier)
.pseudonym(personalIdentifier)
.build();
-
+
// get initial result
- ZmrRegisterResult result = client.searchWithMds(null,
+ final ZmrRegisterResult result = client.searchWithMds(null,
eidasData.getGivenName(),
- eidasData.getFamilyName(),
+ eidasData.getFamilyName(),
eidasData.getDateOfBirth(),
eidasData.getCitizenCountryCode());
assertNotNull("ZMR response", result);
- assertEquals("personResult size", 1, result.getPersonResult().size());
-
-
- //update ZMR entry
- ZmrRegisterResult updateResult =
- client.update(result.getProcessId(),
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
+ // update ZMR entry
+ final ZmrRegisterResult updateResult =
+ client.update(result.getProcessId(),
result.getPersonResult().get(0),
eidasData);
-
+
+ assertNotNull("ZMR response", updateResult);
+ assertEquals("personResult size", 1, updateResult.getPersonResult().size());
+
+ final ZmrRegisterResult afterUpdateResult = client.searchWithPersonIdentifier(null,
+ personalIdentifier, cc);
+
+ assertNotNull("ZMR response", afterUpdateResult);
+ assertEquals("personResult size", 1, afterUpdateResult.getPersonResult().size());
+
+ }
+
+ @Ignore
+ @Test
+ public void updateZmrEntryTestIdentity() throws EidasSAuthenticationException {
+ final String personalIdentifier = "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq";
+ final String cc = "EE";
+
+ final SimpleEidasData eidasData = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("XXXÖhlinger")
+ .givenName("XXXHildegard")
+ .dateOfBirth("1971-02-18")
+ .personalIdentifier(cc + "/AT/" + personalIdentifier)
+ .pseudonym(personalIdentifier)
+ .build();
+
+ // get initial result
+ final ZmrRegisterResult result = client.searchWithMds(null,
+ eidasData.getGivenName(),
+ eidasData.getFamilyName(),
+ eidasData.getDateOfBirth(),
+ eidasData.getCitizenCountryCode());
+ assertNotNull("ZMR response", result);
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
+ // update ZMR entry
+ final ZmrRegisterResult updateResult =
+ client.update(result.getProcessId(),
+ result.getPersonResult().get(0),
+ eidasData);
+
assertNotNull("ZMR response", updateResult);
- assertEquals("personResult size", 1, updateResult.getPersonResult().size());
+ assertEquals("personResult size", 1, updateResult.getPersonResult().size());
+
+ final ZmrRegisterResult afterUpdateResultMds = client.searchCountrySpecific(null,
+ generateCustomRequest("EE", "XXXHildegard", "XXXÖhlinger", "1971-02-18",
+ "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq",
+ null,
+ null),
+ cc);
+
+ assertNotNull("ZMR response", afterUpdateResultMds);
+ assertNotNull("ZMR processId", afterUpdateResultMds.getProcessId());
+ assertNotNull("ZMR personResult", afterUpdateResultMds.getPersonResult());
+ assertEquals("personResult size", 1, afterUpdateResultMds.getPersonResult().size());
- ZmrRegisterResult afterUpdateResult = client.searchWithPersonIdentifier(null,
- personalIdentifier, cc);
-
+ // check if ZMR entry can be found by PersonalId
+ final ZmrRegisterResult afterUpdateResult = client.searchWithPersonIdentifier(null,
+ personalIdentifier, cc);
+
assertNotNull("ZMR response", afterUpdateResult);
- assertEquals("personResult size", 1, afterUpdateResult.getPersonResult().size());
-
-
+ assertEquals("personResult size", 1, afterUpdateResult.getPersonResult().size());
+
}
+ @Test
+ public void updateZmrEntryTestIdentity2() throws EidasSAuthenticationException {
+ final String personalIdentifierFirst = "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq_first";
+ final String personalIdentifierSecond = "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq_second";
+ final String cc = "EE";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("XXXTüzekçi")
+ .givenName("XXXŐzgür")
+ .dateOfBirth("1983-06-04")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
- private PersonSuchenRequest generateCustomRequest(String cc, String familyName, String givenName,
- String dateOfBirth, String personalId, String placeOfBirth, String birthName) {
- PersonSuchenRequest req = new PersonSuchenRequest();
+ final SimpleEidasData eidasDataSecond = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("XXXTüzekçi")
+ .givenName("XXXŐzgür")
+ .dateOfBirth("1983-06-04")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierSecond)
+ .pseudonym(personalIdentifierSecond)
+ .build();
- //set basic MDS information
+
+ // first login with update
+ // get initial result
+ final ZmrRegisterResult result = client.searchWithMds(null,
+ eidasDataFirst.getGivenName(),
+ eidasDataFirst.getFamilyName(),
+ eidasDataFirst.getDateOfBirth(),
+ eidasDataFirst.getCitizenCountryCode());
+ assertNotNull("ZMR response", result);
+ assertEquals("personResult size", 1, result.getPersonResult().size());
+
+ // update ZMR entry
+ final ZmrRegisterResult updateResult =
+ client.update(result.getProcessId(),
+ result.getPersonResult().get(0),
+ eidasDataFirst);
+
+ assertNotNull("ZMR response", updateResult);
+ assertEquals("personResult size", 1, updateResult.getPersonResult().size());
+
+
+ // second login with update
+ // get initial result
+ final ZmrRegisterResult resultSecond = client.searchWithMds(null,
+ eidasDataSecond.getGivenName(),
+ eidasDataSecond.getFamilyName(),
+ eidasDataSecond.getDateOfBirth(),
+ eidasDataSecond.getCitizenCountryCode());
+ assertNotNull("ZMR response", resultSecond);
+ assertEquals("personResult size", 1, resultSecond.getPersonResult().size());
+
+ // update ZMR entry
+ final ZmrRegisterResult updateResultSecond =
+ client.update(resultSecond.getProcessId(),
+ resultSecond.getPersonResult().get(0),
+ eidasDataSecond);
+
+ assertNotNull("ZMR response", updateResultSecond);
+ assertEquals("personResult size", 1, updateResultSecond.getPersonResult().size());
+
+
+
+
+
+ final ZmrRegisterResult afterUpdateResultMds = client.searchCountrySpecific(null,
+ generateCustomRequest("EE", "XXXHildegard", "XXXÖhlinger", "1971-02-18",
+ "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq",
+ null,
+ null),
+ cc);
+
+ assertNotNull("ZMR response", afterUpdateResultMds);
+ assertNotNull("ZMR processId", afterUpdateResultMds.getProcessId());
+ assertNotNull("ZMR personResult", afterUpdateResultMds.getPersonResult());
+ assertEquals("personResult size", 1, afterUpdateResultMds.getPersonResult().size());
+
+
+ // check if ZMR entry can be found by PersonalId
+ final ZmrRegisterResult afterUpdateResult = client.searchWithPersonIdentifier(null,
+ personalIdentifierFirst, cc);
+
+ assertNotNull("ZMR response", afterUpdateResult);
+ assertEquals("personResult size", 1, afterUpdateResult.getPersonResult().size());
+
+ }
+
+
+ private PersonSuchenRequest generateCustomRequest(String cc, String familyName, String givenName,
+ String dateOfBirth, String personalId, String placeOfBirth, String birthName) {
+ final PersonSuchenRequest req = new PersonSuchenRequest();
+
+ // set basic MDS information
final NatuerlichePersonTyp searchNatPerson = new NatuerlichePersonTyp();
req.setNatuerlichePerson(searchNatPerson);
final PersonenNameTyp searchNatPersonName = new PersonenNameTyp();
@@ -174,31 +348,31 @@ public class ZmrClientProductionTest {
searchNatPersonName.setFamilienname(familyName);
searchNatPersonName.setVorname(givenName);
searchNatPerson.setGeburtsdatum(dateOfBirth);
-
- //add addtional eIDAS attributes if available
- addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth);
+
+ // add addtional eIDAS attributes if available
+ addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth);
addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_BIRTHNAME, birthName);
addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER, personalId);
-
+
return req;
-
+
}
- private void addIfAvailable(List<EidasSuchdatenType> eidasSuchdaten,
+ private void addIfAvailable(List<EidasSuchdatenType> eidasSuchdaten,
String cc, String attrName, String attrValue) {
if (StringUtils.isNotEmpty(attrValue)) {
eidasSuchdaten.add(buildEidasSuchData(cc, attrName, attrValue));
-
- }
+
+ }
}
-
+
private EidasSuchdatenType buildEidasSuchData(String cc, String attrName, String attrValue) {
- EidasSuchdatenType eidasInfos = new EidasSuchdatenType();
+ final EidasSuchdatenType eidasInfos = new EidasSuchdatenType();
eidasInfos.setStaatscode2(cc);
eidasInfos.setEidasArt(attrName);
eidasInfos.setEidasWert(attrValue);
return eidasInfos;
-
+
}
-
+
}