From 90eac625e68bdb9aaf1397b04f242fb94381bd4c Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 16 Sep 2021 09:48:24 +0200 Subject: add new attribute builder for EHVD specific attributes --- .../EhvdAddressZipAttributeBuilderTest.java | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java (limited to 'id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java') diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java new file mode 100644 index 000000000..69d17f8c3 --- /dev/null +++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java @@ -0,0 +1,107 @@ +//package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes; +// +//import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertNull; +// +//import org.apache.commons.lang3.RandomStringUtils; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +// +//import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder; +//import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException; +//import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdAddressZipcodeAttributeBuilder; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdFirstnameAttributeBuilder; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdOtherIdAttributeBuilder; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdSurnameAttributeBuilder; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdTitelAttributeBuilder; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaAddress; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor; +//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.InstanceIdentifier; +// +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration({ +// "/test_ehvd_service_auth.beans.xml" }) +//public class EhvdAddressZipAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest { +// +// @Override +// protected String expectedAttrName() { +// return "urn:brzgvat:attributes.ehvd.zip"; +// +// } +// +// @Override +// protected IAttributeBuilder getAttributeBuilderUnderTest() { +// return new EhvdAddressZipcodeAttributeBuilder(); +// +// } +// +// @Test +// public void checkMissing() throws EAAFStorageException, AttributeBuilderException { +// final GdaDescriptor gdaInfo = new GdaDescriptor(); +// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo); +// assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g)); +// +// } +// +// @Test +// public void singleAddress() throws EAAFStorageException, AttributeBuilderException { +// String zip = RandomStringUtils.randomNumeric(4); +// final GdaDescriptor gdaInfo = new GdaDescriptor(); +// gdaInfo.getAddress().add(generateAddress( +// zip, +// RandomStringUtils.randomAlphabetic(5))); +// +// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo); +// assertEquals("wrong empty attr.", zip, +// getAttributeBuilderUnderTest().build(oaParam, authData, g)); +// +// } +// +// @Test +// public void multiAddress() throws EAAFStorageException, AttributeBuilderException { +// String zip1 = RandomStringUtils.randomNumeric(4); +// String zip2 = RandomStringUtils.randomNumeric(4); +// final GdaDescriptor gdaInfo = new GdaDescriptor(); +// gdaInfo.getAddress().add(generateAddress(zip1, RandomStringUtils.randomAlphabetic(5))); +// gdaInfo.getAddress().add(generateAddress(zip2, RandomStringUtils.randomAlphabetic(5))); +// +// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo); +// assertEquals("wrong empty attr.", zip1 + "|" + zip2, +// getAttributeBuilderUnderTest().build(oaParam, authData, g)); +// +// } +// +// @Test +// public void multiAddressNullBefore() throws EAAFStorageException, AttributeBuilderException { +// String zip1 = null; +// String zip2 = RandomStringUtils.randomNumeric(4); +// final GdaDescriptor gdaInfo = new GdaDescriptor(); +// gdaInfo.getAddress().add(generateAddress(zip1, RandomStringUtils.randomAlphabetic(5))); +// gdaInfo.getAddress().add(generateAddress(zip2, RandomStringUtils.randomAlphabetic(5))); +// +// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo); +// assertEquals("wrong empty attr.", "|" + zip2, +// getAttributeBuilderUnderTest().build(oaParam, authData, g)); +// +// } +// +// @Test +// public void multiAddressNullAfter() throws EAAFStorageException, AttributeBuilderException { +// String zip1 = RandomStringUtils.randomNumeric(4); +// String zip2 = null; +// final GdaDescriptor gdaInfo = new GdaDescriptor(); +// gdaInfo.getAddress().add(generateAddress(zip1, RandomStringUtils.randomAlphabetic(5))); +// gdaInfo.getAddress().add(generateAddress(zip2, RandomStringUtils.randomAlphabetic(5))); +// +// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo); +// assertEquals("wrong empty attr.", zip1 + "|", +// getAttributeBuilderUnderTest().build(oaParam, authData, g)); +// +// } +// +// +//} -- cgit v1.2.3