diff options
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/clients/ZmrAddressSearchClientProductionTest.java | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrAddressSearchClientProductionTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrAddressSearchClientProductionTest.java new file mode 100644 index 00000000..a6ff234b --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrAddressSearchClientProductionTest.java @@ -0,0 +1,169 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.IfProfileValue; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient.AddressInfo; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient.DetailLevel; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.LoggingHandler; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; +import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; +import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; + +@IfProfileValue(name = "spring.profiles.active", value = "devEnvironment") +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { + "/SpringTest-context_tasks_test.xml", + "/SpringTest-context_basic_realConfig.xml" }) +@TestPropertySource(locations = { + // "classpath:/application.properties", + "file:/home/tlenz/Projekte/config/ms_connector/default_config.properties", +}) +public class ZmrAddressSearchClientProductionTest { + + + @Autowired ZmrAddressSoapClient client; + @Autowired IConfiguration basicConfig; + + @BeforeClass + public static void classInitializer() { + final Logger logger1 = (Logger) LoggerFactory.getLogger(LoggingHandler.class); + logger1.setLevel(Level.TRACE); + + final Logger logger2 = (Logger) LoggerFactory.getLogger(ZmrAddressSoapClient.class); + logger2.setLevel(Level.TRACE); + + final Logger rootLogger = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); + rootLogger.setLevel(Level.INFO); + + } + + @Test + public void gemeinde() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setGemeinde("Frohnl*"); + req.setPostAdresse(address); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.CITY, resp.getLevel()); + + + } + + @Test + public void ortschaftAndGemeinde() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setGemeinde("Frohnleiten"); + address.setOrtschaft("Wannersdorf"); + req.setPostAdresse(address); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.STREET, resp.getLevel()); + + } + + @Test + public void ortschaftAndGemeindeAndStreet() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setGemeinde("Frohnleiten"); + address.setOrtschaft("Wannersdorf"); + req.setPostAdresse(address); + + ZustelladresseTyp addressDetail = new ZustelladresseTyp(); + addressDetail.setStrassenname("Wannersdorf"); + address.setZustelladresse(addressDetail); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.NUMBER, resp.getLevel()); + + } + + + @Test + public void ortschaftAndGemeinde2() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setGemeinde("Fro*"); + address.setOrtschaft("Wannersdorf"); + req.setPostAdresse(address); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.CITY, resp.getLevel()); + + } + + @Test + public void ortschaftAndGemeinde3() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setGemeinde("Eggelsberg"); + address.setOrtschaft("Wannersdorf"); + req.setPostAdresse(address); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.STREET, resp.getLevel()); + + } + + + @Test + public void ortschaft() throws EidasSAuthenticationException { + // build dummy request + Adressdaten req = new Adressdaten(); + PostAdresseTyp address = new PostAdresseTyp(); + address.setOrtschaft("Wannersdorf"); + req.setPostAdresse(address); + + // execute test + AddressInfo resp = client.searchAddress(req); + + // validate state + assertFalse("no results", resp.getPersonResult().isEmpty()); + assertEquals("wrong detail level", DetailLevel.CITY, resp.getLevel()); + + } + +} |