aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-ehvd_integration/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-09-16 09:48:24 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-09-16 09:48:24 +0200
commit90eac625e68bdb9aaf1397b04f242fb94381bd4c (patch)
tree8bb2d12f8a428b342e5d5bfc7a12c63f3206bbe8 /id/server/modules/moa-id-module-ehvd_integration/src
parent664c9bcffc537dc206140f03ca0a7c9b81b396cd (diff)
downloadmoa-id-spss-90eac625e68bdb9aaf1397b04f242fb94381bd4c.tar.gz
moa-id-spss-90eac625e68bdb9aaf1397b04f242fb94381bd4c.tar.bz2
moa-id-spss-90eac625e68bdb9aaf1397b04f242fb94381bd4c.zip
add new attribute builder for EHVD specific attributes
Diffstat (limited to 'id/server/modules/moa-id-module-ehvd_integration/src')
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java1
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/AbstractEhvdAttributeBuilder.java51
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressStateAttributeBuilder.java28
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressZipcodeAttributeBuilder.java28
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdFirstnameAttributeBuilder.java22
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdIdAttributeBuilder.java22
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdOtherIdAttributeBuilder.java54
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdSurnameAttributeBuilder.java22
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdTitelAttributeBuilder.java22
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/resources/META-INF/services/at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder4
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/AbstractEhvdAttributeBuilderTest.java97
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressStateAttributeBuilderTest.java106
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressZipAttributeBuilderTest.java107
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdFirstnameAttributeBuilderTest.java47
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdIdAttributeBuilderTest.java64
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdOtherIdAttributeBuilderTest.java86
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdSurnameAttributeBuilderTest.java48
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdTitelAttributeBuilderTest.java46
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java9
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config1.properties2
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config_qs_service.properties3
21 files changed, 868 insertions, 1 deletions
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
index d1f7c47b2..6cb9c08e3 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
@@ -35,6 +35,7 @@ public class ConfigurationProperties {
public static final String PROP_MODULE_SERVICE_TARGET = MODULE_PREFIX + "service.bpk.target";
public static final String PROP_MODULE_SERVICE_ENDPOINT = MODULE_PREFIX + "service.url";
public static final String PROP_MODULE_EHVD_ROLE_REGEX = MODULE_PREFIX + "service.role.regex";
+ public static final String PROP_MODULE_EHVD_OTHERID_PREFIX = MODULE_PREFIX + "service.otherid.prefix";
public static final String PROP_MODULE_PVP_ROLE = MODULE_PREFIX + "role.pvp";
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/AbstractEhvdAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/AbstractEhvdAttributeBuilder.java
new file mode 100644
index 000000000..af413ffc3
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/AbstractEhvdAttributeBuilder.java
@@ -0,0 +1,51 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
+import at.gv.egiz.eaaf.core.api.idp.IAuthData;
+import at.gv.egiz.eaaf.core.api.idp.IPVPAttributeBuilder;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+import at.gv.egovernment.moa.logging.Logger;
+
+public abstract class AbstractEhvdAttributeBuilder implements IPVPAttributeBuilder {
+
+ @Override
+ public <ATT> ATT build(ISPConfiguration spConfig, IAuthData authData, IAttributeGenerator<ATT> g)
+ throws AttributeBuilderException {
+ try {
+ GdaDescriptor fullGdaInfo =
+ authData.getGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, GdaDescriptor.class);
+
+ if (fullGdaInfo != null) {
+ String attrValue = generateAttributeValue(fullGdaInfo);
+ Logger.debug(StringUtils.isEmpty(attrValue) ? "Skip" : "Build"
+ + "attribute: " + getName());
+ return g.buildStringAttribute(getName(), getName(),
+ StringUtils.isNotEmpty(attrValue) ? attrValue : null);
+
+ } else {
+ Logger.trace("Skipping attr: " + getName() + " because no GDA info available");
+ return null;
+
+ }
+
+ } catch (ClassCastException e) {
+ Logger.trace("Skipping attr: " + getName() + " because no GDA info available");
+ return null;
+
+ }
+ }
+
+ @Override
+ public <ATT> ATT buildEmpty(IAttributeGenerator<ATT> g) {
+ return g.buildEmptyAttribute(getName(), getName());
+
+ }
+
+ protected abstract String generateAttributeValue(GdaDescriptor fullGdaInfo);
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressStateAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressStateAttributeBuilder.java
new file mode 100644
index 000000000..7056c3099
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressStateAttributeBuilder.java
@@ -0,0 +1,28 @@
+//package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+//
+//import java.util.stream.Collectors;
+//
+//import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+//
+//@PVPMETADATA
+//public class EhvdAddressStateAttributeBuilder extends AbstractEhvdAttributeBuilder {
+//
+// private static final String ATTR_VALUE_DELIMITER = "|";
+//
+// @Override
+// public String getName() {
+// return ConfigurationProperties.ATTRIBUTE_URN_EHVD_STATE;
+//
+// }
+//
+// @Override
+// protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+// return fullGdaInfo.getAddress().stream()
+// .map(el -> el.getState() != null ? el.getState() : "")
+// .collect(Collectors.joining(ATTR_VALUE_DELIMITER));
+//
+// }
+//
+//}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressZipcodeAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressZipcodeAttributeBuilder.java
new file mode 100644
index 000000000..98a0567f2
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdAddressZipcodeAttributeBuilder.java
@@ -0,0 +1,28 @@
+//package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+//
+//import java.util.stream.Collectors;
+//
+//import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+//
+//@PVPMETADATA
+//public class EhvdAddressZipcodeAttributeBuilder extends AbstractEhvdAttributeBuilder {
+//
+// private static final String ATTR_VALUE_DELIMITER = "|";
+//
+// @Override
+// public String getName() {
+// return ConfigurationProperties.ATTRIBUTE_URN_EHVD_ZIPCODE;
+//
+// }
+//
+// @Override
+// protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+// return fullGdaInfo.getAddress().stream()
+// .map(el -> el.getZip() != null ? el.getZip() : "")
+// .collect(Collectors.joining(ATTR_VALUE_DELIMITER));
+//
+// }
+//
+//}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdFirstnameAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdFirstnameAttributeBuilder.java
new file mode 100644
index 000000000..1bb923cf4
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdFirstnameAttributeBuilder.java
@@ -0,0 +1,22 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+
+import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@PVPMETADATA
+public class EhvdFirstnameAttributeBuilder extends AbstractEhvdAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return ConfigurationProperties.ATTRIBUTE_URN_EHVD_FIRSTNAME;
+
+ }
+
+ @Override
+ protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+ return fullGdaInfo.getFirstname();
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdIdAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdIdAttributeBuilder.java
new file mode 100644
index 000000000..918b02c2e
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdIdAttributeBuilder.java
@@ -0,0 +1,22 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+
+import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@PVPMETADATA
+public class EhvdIdAttributeBuilder extends AbstractEhvdAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return ConfigurationProperties.ATTRIBUTE_URN_EHVD_ID;
+
+ }
+
+ @Override
+ protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+ return fullGdaInfo.getId() != null ? fullGdaInfo.getId().getId() : null;
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdOtherIdAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdOtherIdAttributeBuilder.java
new file mode 100644
index 000000000..2d0e20c9c
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdOtherIdAttributeBuilder.java
@@ -0,0 +1,54 @@
+//package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+//
+//import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+//import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+//import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
+//import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException;
+//import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
+//import at.gv.egovernment.moa.logging.Logger;
+//
+//@PVPMETADATA
+//public class EhvdOtherIdAttributeBuilder extends AbstractEhvdAttributeBuilder {
+//
+// private static final String DEFAULT_ID_PREFIX = "1.2.40.0.34.4.18:";
+//
+// private String idPrefix;
+//
+// public EhvdOtherIdAttributeBuilder() {
+// try {
+// AuthConfiguration config = AuthConfigurationProviderFactory.getInstance();
+// if (config != null) {
+// idPrefix = config.getBasicConfiguration(
+// ConfigurationProperties.PROP_MODULE_EHVD_OTHERID_PREFIX, DEFAULT_ID_PREFIX);
+//
+// } else {
+// idPrefix = DEFAULT_ID_PREFIX;
+//
+// }
+// } catch (ConfigurationException e) {
+// idPrefix = DEFAULT_ID_PREFIX;
+//
+// }
+//
+// Logger.info(" Set-up " + getName() + " with otherId prefix: " + idPrefix);
+//
+// }
+//
+// @Override
+// public String getName() {
+// return ConfigurationProperties.ATTRIBUTE_URN_EHVD_OTHERID;
+//
+// }
+//
+// @Override
+// protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+// return fullGdaInfo.getOtherID().stream()
+// .filter(el -> el.startsWith(idPrefix))
+// .findFirst()
+// .map(el -> el.substring(idPrefix.length()))
+// .orElse(null);
+//
+// }
+//
+//}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdSurnameAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdSurnameAttributeBuilder.java
new file mode 100644
index 000000000..db8de397b
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdSurnameAttributeBuilder.java
@@ -0,0 +1,22 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+
+import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@PVPMETADATA
+public class EhvdSurnameAttributeBuilder extends AbstractEhvdAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return ConfigurationProperties.ATTRIBUTE_URN_EHVD_SURNAME;
+
+ }
+
+ @Override
+ protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+ return fullGdaInfo.getSurname();
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdTitelAttributeBuilder.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdTitelAttributeBuilder.java
new file mode 100644
index 000000000..c978d4dd2
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/attributes/EhvdTitelAttributeBuilder.java
@@ -0,0 +1,22 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.attributes;
+
+import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PVPMETADATA;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@PVPMETADATA
+public class EhvdTitelAttributeBuilder extends AbstractEhvdAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return ConfigurationProperties.ATTRIBUTE_URN_EHVD_TITLE;
+
+ }
+
+ @Override
+ protected String generateAttributeValue(GdaDescriptor fullGdaInfo) {
+ return fullGdaInfo.getTitle();
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/resources/META-INF/services/at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder b/id/server/modules/moa-id-module-ehvd_integration/src/main/resources/META-INF/services/at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder
index 4dd043048..44f8d26cf 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/resources/META-INF/services/at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/resources/META-INF/services/at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder
@@ -1 +1,5 @@
at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.PvpRoleAttributeBuilder
+at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdTitelAttributeBuilder
+at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdFirstnameAttributeBuilder
+at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdSurnameAttributeBuilder
+at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdIdAttributeBuilder
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/AbstractEhvdAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/AbstractEhvdAttributeBuilderTest.java
new file mode 100644
index 000000000..b1ac7d99a
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/AbstractEhvdAttributeBuilderTest.java
@@ -0,0 +1,97 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.Collections;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;
+import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
+import at.gv.egiz.eaaf.core.api.idp.IAuthData;
+import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
+import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
+import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData;
+import at.gv.egiz.eaaf.core.impl.idp.builder.SimpleStringAttributeGenerator;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.modules.pvp2.impl.builder.PVPAttributeBuilder;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaAddress;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+public abstract class AbstractEhvdAttributeBuilderTest {
+
+ @Autowired
+ protected IConfiguration basicConfig;
+
+ protected DummySPConfiguration oaParam;
+ protected AuthenticationData authData;
+ protected IAttributeGenerator<String> g = new SimpleStringAttributeGenerator();
+
+ protected abstract String expectedAttrName();
+ protected abstract IAttributeBuilder getAttributeBuilderUnderTest();
+
+ protected GdaAddress generateAddress(String zip, String state) {
+ GdaAddress addr = new GdaAddress();
+ addr.setZip(zip);
+ addr.setState(state);
+ return addr;
+
+ }
+
+ @Before
+ public void initialize() {
+ oaParam = new DummySPConfiguration(Collections.emptyMap(), basicConfig);
+ authData = new AuthenticationData();
+
+ }
+
+ @Test
+ public void checkAttributeRegistration() {
+ assertNotNull("Attribute: " + expectedAttrName() + " not registrated",
+ PVPAttributeBuilder.getAttributeBuilder(expectedAttrName()));
+
+ }
+
+ @Test
+ public void checkName() {
+ assertEquals("wrong attr. name", expectedAttrName(), getAttributeBuilderUnderTest().getName());
+
+ }
+
+ @Test
+ public void checkEmptyAttribute() {
+ assertNull("wrong empty attr.", getAttributeBuilderUnderTest().buildEmpty(g));
+
+ }
+
+ @Test
+ public void noGdaInfos() throws AttributeBuilderException {
+ IAuthData authData = new AuthenticationData();
+ assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void wrongGdaInfos() throws AttributeBuilderException, EAAFStorageException {
+ AuthenticationData authData = new AuthenticationData();
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, RandomStringUtils.randomAlphabetic(10));
+ assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void emptyGdaInfos() throws AttributeBuilderException, EAAFStorageException {
+ AuthenticationData authData = new AuthenticationData();
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, new GdaDescriptor());
+ assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressStateAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressStateAttributeBuilderTest.java
new file mode 100644
index 000000000..d342d331b
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdAddressStateAttributeBuilderTest.java
@@ -0,0 +1,106 @@
+//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.EhvdAddressStateAttributeBuilder;
+//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 EhvdAddressStateAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+//
+// @Override
+// protected String expectedAttrName() {
+// return "urn:brzgvat:attributes.ehvd.state";
+//
+// }
+//
+// @Override
+// protected IAttributeBuilder getAttributeBuilderUnderTest() {
+// return new EhvdAddressStateAttributeBuilder();
+//
+// }
+//
+// @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 state = RandomStringUtils.randomAlphabetic(5);
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(5), state));
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", state,
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+// @Test
+// public void multiAddress() throws EAAFStorageException, AttributeBuilderException {
+// String state1 = RandomStringUtils.randomAlphabetic(4);
+// String state2 = RandomStringUtils.randomAlphabetic(4);
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state1));
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state2));
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", state1 + "|" + state2,
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+// @Test
+// public void multiAddressNullBefore() throws EAAFStorageException, AttributeBuilderException {
+// String state1 = null;
+// String state2 = RandomStringUtils.randomAlphabetic(4);
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state1));
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state2));
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", "|" + state2,
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+// @Test
+// public void multiAddressNullAfter() throws EAAFStorageException, AttributeBuilderException {
+// String state1 = RandomStringUtils.randomAlphabetic(4);
+// String state2 = null;
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state1));
+// gdaInfo.getAddress().add(generateAddress(RandomStringUtils.randomNumeric(4), state2));
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", state1 + "|",
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+//
+//}
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));
+//
+// }
+//
+//
+//}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdFirstnameAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdFirstnameAttributeBuilderTest.java
new file mode 100644
index 000000000..66f1b5028
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdFirstnameAttributeBuilderTest.java
@@ -0,0 +1,47 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes;
+
+import static org.junit.Assert.assertEquals;
+
+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.EhvdFirstnameAttributeBuilder;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdTitelAttributeBuilder;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class EhvdFirstnameAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+
+ @Override
+ protected String expectedAttrName() {
+ return "urn:brzgvat:attributes.ehvd.firstname";
+
+ }
+
+ @Override
+ protected IAttributeBuilder getAttributeBuilderUnderTest() {
+ return new EhvdFirstnameAttributeBuilder();
+
+ }
+
+ @Test
+ public void checkValid() throws EAAFStorageException, AttributeBuilderException {
+ final GdaDescriptor gdaInfo = new GdaDescriptor();
+ gdaInfo.setFirstname(RandomStringUtils.randomAlphabetic(5));
+
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+ assertEquals("wrong empty attr.", gdaInfo.getFirstname(),
+ getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdIdAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdIdAttributeBuilderTest.java
new file mode 100644
index 000000000..db73f9191
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdIdAttributeBuilderTest.java
@@ -0,0 +1,64 @@
+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.EhvdFirstnameAttributeBuilder;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.EhvdIdAttributeBuilder;
+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.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 EhvdIdAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+
+ @Override
+ protected String expectedAttrName() {
+ return "urn:brzgvat:attributes.ehvd.id";
+
+ }
+
+ @Override
+ protected IAttributeBuilder getAttributeBuilderUnderTest() {
+ return new EhvdIdAttributeBuilder();
+
+ }
+
+ @Test
+ public void checkMissingId() throws EAAFStorageException, AttributeBuilderException {
+ final GdaDescriptor gdaInfo = new GdaDescriptor();
+ InstanceIdentifier id = new InstanceIdentifier();
+ gdaInfo.setId(id );
+
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+ assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void checkValid() throws EAAFStorageException, AttributeBuilderException {
+ final GdaDescriptor gdaInfo = new GdaDescriptor();
+ InstanceIdentifier id = new InstanceIdentifier();
+ id.setId(RandomStringUtils.randomAlphabetic(5));
+ gdaInfo.setId(id );
+
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+ assertEquals("wrong empty attr.", id.getId(),
+ getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdOtherIdAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdOtherIdAttributeBuilderTest.java
new file mode 100644
index 000000000..bce8924d9
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdOtherIdAttributeBuilderTest.java
@@ -0,0 +1,86 @@
+//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.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.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 EhvdOtherIdAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+//
+// @Override
+// protected String expectedAttrName() {
+// return "urn:brzgvat:attributes.ehvd.otherid";
+//
+// }
+//
+// @Override
+// protected IAttributeBuilder getAttributeBuilderUnderTest() {
+// return new EhvdOtherIdAttributeBuilder();
+//
+// }
+//
+// @Test
+// public void checkMissingId() 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 checkWrongId() throws EAAFStorageException, AttributeBuilderException {
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getOtherID().add(RandomStringUtils.randomAlphabetic(10));
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertNull("wrong empty attr.", getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+// @Test
+// public void checkValidRandom() throws EAAFStorageException, AttributeBuilderException {
+// String value = RandomStringUtils.randomAlphabetic(5);
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getOtherID().add(RandomStringUtils.randomAlphabetic(10));
+// gdaInfo.getOtherID().add("1.2.40.0.34.4.18:" + value);
+//
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", value,
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+// @Test
+// public void checkValidBrzReal() throws EAAFStorageException, AttributeBuilderException {
+// final GdaDescriptor gdaInfo = new GdaDescriptor();
+// gdaInfo.getOtherID().add(RandomStringUtils.randomAlphabetic(10));
+// gdaInfo.getOtherID().add("1.2.40.0.34.4.18:1234-12");
+// gdaInfo.getOtherID().add("1.2.40.0.34.4.17:aabbccdd");
+//
+//
+// authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+// assertEquals("wrong empty attr.", "1234-12",
+// getAttributeBuilderUnderTest().build(oaParam, authData, g));
+//
+// }
+//
+//}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdSurnameAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdSurnameAttributeBuilderTest.java
new file mode 100644
index 000000000..af9e60cb7
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdSurnameAttributeBuilderTest.java
@@ -0,0 +1,48 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes;
+
+import static org.junit.Assert.assertEquals;
+
+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.EhvdFirstnameAttributeBuilder;
+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.GdaDescriptor;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class EhvdSurnameAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+
+ @Override
+ protected String expectedAttrName() {
+ return "urn:brzgvat:attributes.ehvd.surname";
+
+ }
+
+ @Override
+ protected IAttributeBuilder getAttributeBuilderUnderTest() {
+ return new EhvdSurnameAttributeBuilder();
+
+ }
+
+ @Test
+ public void checkValid() throws EAAFStorageException, AttributeBuilderException {
+ final GdaDescriptor gdaInfo = new GdaDescriptor();
+ gdaInfo.setSurname(RandomStringUtils.randomAlphabetic(5));
+
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+ assertEquals("wrong empty attr.", gdaInfo.getSurname(),
+ getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdTitelAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdTitelAttributeBuilderTest.java
new file mode 100644
index 000000000..2863c3508
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/EhvdTitelAttributeBuilderTest.java
@@ -0,0 +1,46 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes;
+
+import static org.junit.Assert.assertEquals;
+
+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.EhvdTitelAttributeBuilder;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class EhvdTitelAttributeBuilderTest extends AbstractEhvdAttributeBuilderTest {
+
+ @Override
+ protected String expectedAttrName() {
+ return "urn:brzgvat:attributes.ehvd.title";
+
+ }
+
+ @Override
+ protected IAttributeBuilder getAttributeBuilderUnderTest() {
+ return new EhvdTitelAttributeBuilder();
+
+ }
+
+ @Test
+ public void checkTitelValid() throws EAAFStorageException, AttributeBuilderException {
+ final GdaDescriptor gdaInfo = new GdaDescriptor();
+ gdaInfo.setTitle(RandomStringUtils.randomAlphabetic(5));
+
+ authData.setGenericData(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX, gdaInfo);
+ assertEquals("wrong empty attr.", gdaInfo.getTitle(),
+ getAttributeBuilderUnderTest().build(oaParam, authData, g));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java
index cabd8df19..624abff5f 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java
@@ -26,6 +26,7 @@ import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData;
import at.gv.egiz.eaaf.core.impl.idp.builder.SimpleStringAttributeGenerator;
import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.modules.pvp2.impl.builder.PVPAttributeBuilder;
import at.gv.egovernment.moa.id.auth.modules.ehvd.attributes.PvpRoleAttributeBuilder;
import at.gv.egovernment.moa.id.data.AuthenticationRole;
import at.gv.egovernment.moa.id.data.AuthenticationRoleFactory;
@@ -51,6 +52,13 @@ public class PvpRoleAttributeBuilderTest {
}
@Test
+ public void checkAttributeRegistration() {
+ assertNotNull("Attribute: urn:oid:1.2.40.0.10.2.1.1.261.30 not registrated",
+ PVPAttributeBuilder.getAttributeBuilder("urn:oid:1.2.40.0.10.2.1.1.261.30"));
+
+ }
+
+ @Test
public void checkName() {
assertEquals("wrong attr. name", "urn:oid:1.2.40.0.10.2.1.1.261.30", toTest.getName());
@@ -69,6 +77,7 @@ public class PvpRoleAttributeBuilderTest {
}
+ @Test
public void noRoles() throws AttributeBuilderException {
IAuthData authData = generateAuthData(null);
assertNull("wrong attr. value", toTest.build(oaParam, authData, g));
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config1.properties b/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config1.properties
index 263192c07..580af5559 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config1.properties
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config1.properties
@@ -8,4 +8,4 @@ modules.ehvd.service.url=http://localhost:1234/ehvd
#modules.ehvd.service.url=https://ehvdwsqs.gesundheit.gv.at
modules.ehvd.role.pvp=EPI-GDA()
-modules.ehvd.service.role.regex=^1\.2\.40\.0\.34\.5\.2\:(100|101|158)$ \ No newline at end of file
+modules.ehvd.service.role.regex=^1\.2\.40\.0\.34\.5\.2\:(100|101|158)$
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config_qs_service.properties b/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config_qs_service.properties
index 2f6c45365..dc8fe54d5 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config_qs_service.properties
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/resources/config/config_qs_service.properties
@@ -7,3 +7,6 @@ modules.ehvd.sp.4=435344534egewgegf
modules.ehvd.service.url=https://ehvdwsqs.gesundheit.gv.at
#modules.ehvd.service.bpk.target=
modules.ehvd.proxy.socks.port=12345
+modules.ehvd.role.pvp=EPI-GDA()
+modules.ehvd.service.role.regex=^1\.2\.40\.0\.34\.5\.2\:(100|101|158)$
+#modules.ehvd.service.otherid.prefix=1.2.40.0.34.4.18: \ No newline at end of file