aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-ehvd_integration/src/test/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2021-12-20 15:54:56 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2021-12-20 15:54:56 +0100
commit506ab3232b2c237a1d83c9e970dccdb9445d5d81 (patch)
tree3c94a1a8b4849bdcdbe56d12d0dd7b2e964b234f /id/server/modules/moa-id-module-ehvd_integration/src/test/java
parentfc0385dbeee71f1ce18783ef1c7a4d06288fdb0d (diff)
parent600369d4ffa753716a9572824de7a96a04cb05a7 (diff)
downloadmoa-id-spss-506ab3232b2c237a1d83c9e970dccdb9445d5d81.tar.gz
moa-id-spss-506ab3232b2c237a1d83c9e970dccdb9445d5d81.tar.bz2
moa-id-spss-506ab3232b2c237a1d83c9e970dccdb9445d5d81.zip
Merge branch 'master' of gitlab.iaik.tugraz.at:egiz/moa-idspssHEADmaster
Diffstat (limited to 'id/server/modules/moa-id-module-ehvd_integration/src/test/java')
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/BeanCreationTest.java39
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthModuleTest.java101
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthSpringResourceProviderTest.java56
-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.java159
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/DummyAuthConfigMap.java136
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/TestUtils.java150
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationQsSystemTest.java171
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationTaskTest.java1086
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AttributeBuilderRegistrationTest.java41
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AuthenticationRoleFactoryTest.java65
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/MoaStatusMessagerTest.java55
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/test/java/com/github/skjolber/mockito/soap/Soap12EndpointRule.java195
20 files changed, 2855 insertions, 0 deletions
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/BeanCreationTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/BeanCreationTest.java
new file mode 100644
index 000000000..91bf67b2d
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/BeanCreationTest.java
@@ -0,0 +1,39 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import at.gv.egovernment.moa.id.auth.modules.ehvd.EhvdServiceAuthModule;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.DummyAuthConfigMap;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth_lazy.beans.xml" })
+public class BeanCreationTest {
+
+ @Autowired
+ DummyAuthConfigMap config;
+ @Autowired
+ ApplicationContext context;
+
+ @Before
+ public void initialize() {
+ // re-set config
+ config.putConfigValue("modules.ehvd.enabled", String.valueOf(false));
+
+ }
+
+ @Test
+ public void authModuleDeactivated() {
+ assertNotNull("AuthModule", context.getBean(EhvdServiceAuthModule.class));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthModuleTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthModuleTest.java
new file mode 100644
index 000000000..4a7c98803
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthModuleTest.java
@@ -0,0 +1,101 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import at.gv.egiz.eaaf.core.api.data.EAAFConfigConstants;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.EhvdServiceAuthModule;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.DummyAuthConfigMap;
+import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class EhvdServiceAuthModuleTest {
+
+ @Autowired DummyAuthConfigMap config;
+ @Autowired EhvdServiceAuthModule module;
+
+ private ExecutionContext context;
+ private TestRequestImpl pendingReq;
+ private Map<String, String> spConfigMap;
+
+ @Before
+ public void initialize() {
+ context = new ExecutionContextImpl();
+
+ spConfigMap = new HashMap<>();
+ spConfigMap.put(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER, RandomStringUtils.randomAlphanumeric(10));
+
+ ISPConfiguration spConfig = new DummySPConfiguration(spConfigMap, config);
+ pendingReq = new TestRequestImpl();
+ pendingReq.setSpConfig(spConfig);
+
+ // re-set config
+ config.putConfigValue("modules.ehvd.enabled", String.valueOf(true));
+
+ context.put(MOAIDAuthConstants.PROCESSCONTEXT_PERFORM_BKUSELECTION, String.valueOf(false));
+ context.put(MOAIDAuthConstants.PARAM_BKU, RandomStringUtils.randomAlphabetic(5));
+
+ }
+
+ @Test
+ public void checkProcessDefinition() {
+ String[] def = module.getProcessDefinitions();
+
+ assertNotNull("no process definition", def);
+ Arrays.asList(def).stream().forEach(
+ el -> EhvdServiceAuthModuleTest.class.getResourceAsStream(el));
+
+ }
+
+ @Test
+ public void bkuSelectionActiv() {
+ context.put(MOAIDAuthConstants.PROCESSCONTEXT_PERFORM_BKUSELECTION, String.valueOf(true));
+
+ assertNull("wrong authModule selected", module.selectProcess(context, pendingReq));
+
+ }
+
+ @Test
+ public void deactivated() {
+ config.putConfigValue("modules.ehvd.enabled", String.valueOf(false));
+
+ assertNull("wrong authModule selected", module.selectProcess(context, pendingReq));
+
+ }
+
+ @Test
+ public void unknownServiceProvider() {
+ assertNull("wrong authModule selected", module.selectProcess(context, pendingReq));
+
+ }
+
+ @Test
+ public void allowedServiceProviderAndRequested() {
+ spConfigMap.put(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER, "yyasdfasfsa2323");
+
+ assertEquals("wrong authmethod identifier", "DefaultAuthenticationWithEHVDInteraction",
+ module.selectProcess(context, pendingReq));
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthSpringResourceProviderTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthSpringResourceProviderTest.java
new file mode 100644
index 000000000..b584e8753
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/EhvdServiceAuthSpringResourceProviderTest.java
@@ -0,0 +1,56 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.springframework.core.io.Resource;
+
+import at.gv.egovernment.moa.id.auth.modules.ehvd.EhvdServiceAuthSpringResourceProvider;
+
+
+
+@RunWith(BlockJUnit4ClassRunner.class)
+public class EhvdServiceAuthSpringResourceProviderTest {
+
+ @Test
+ public void testSpringConfig() {
+ final EhvdServiceAuthSpringResourceProvider test =
+ new EhvdServiceAuthSpringResourceProvider();
+ for (final Resource el : test.getResourcesToLoad()) {
+ try {
+ IOUtils.toByteArray(el.getInputStream());
+
+ } catch (final IOException e) {
+ Assert.fail("Ressouce: " + el.getFilename() + " not found");
+ }
+
+ }
+
+ Assert.assertNotNull("no Name", test.getName());
+ Assert.assertNull("Find package definitions", test.getPackagesToScan());
+
+ }
+
+ @Test
+ public void testSpILoaderConfig() {
+ final InputStream el = this.getClass().getResourceAsStream(
+ "/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider");
+ try {
+ final String spiFile = IOUtils.toString(el, "UTF-8");
+
+ Assert.assertEquals("Wrong classpath in SPI file",
+ EhvdServiceAuthSpringResourceProvider.class.getName(), spiFile);
+
+
+ } catch (final IOException e) {
+ Assert.fail("Ressouce: '/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider' not found");
+
+ }
+ }
+
+}
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
new file mode 100644
index 000000000..624abff5f
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/attributes/PvpRoleAttributeBuilderTest.java
@@ -0,0 +1,159 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.attributes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+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.api.idp.ISPConfiguration;
+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;
+import at.gv.egovernment.moa.id.data.MOAAuthenticationData;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class PvpRoleAttributeBuilderTest {
+
+ @Autowired
+ private IConfiguration basicConfig;
+
+ private PvpRoleAttributeBuilder toTest = new PvpRoleAttributeBuilder();
+ private IAttributeGenerator<String> g = new SimpleStringAttributeGenerator();
+ private ISPConfiguration oaParam;
+
+
+ @Before
+ public void initialize() {
+ oaParam = new DummySPConfiguration(Collections.emptyMap(), basicConfig);
+
+ }
+
+ @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());
+
+ }
+
+ @Test
+ public void checkEmptyAttribute() {
+ assertNull("wrong empty attr.", toTest.buildEmpty(g));
+
+ }
+
+ @Test
+ public void wrongAuthData() throws AttributeBuilderException {
+ IAuthData authData = new AuthenticationData();
+ assertNull("wrong attr. value", toTest.build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void noRoles() throws AttributeBuilderException {
+ IAuthData authData = generateAuthData(null);
+ assertNull("wrong attr. value", toTest.build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void emptyRoles() throws AttributeBuilderException {
+ IAuthData authData = generateAuthData(Collections.emptyList());
+ assertNull("wrong attr. value", toTest.build(oaParam, authData, g));
+
+ }
+
+ @Test
+ public void randomRoles() throws AttributeBuilderException {
+ String role1 = RandomStringUtils.randomAlphabetic(5);
+ String role2 = RandomStringUtils.randomAlphabetic(5);
+ String role3 = RandomStringUtils.randomAlphabetic(5);
+ String role4 = RandomStringUtils.randomAlphabetic(5);
+
+ IAuthData authData = generateAuthData(Arrays.asList(
+ new AuthenticationRole(role1, role1),
+ new AuthenticationRole(role2, role2),
+ new AuthenticationRole(role3, role3 + "()"),
+ new AuthenticationRole(role4, role4 + "(\"aaa\"=\"bbb\")")
+ ));
+
+ // perform test
+ String attrValue = toTest.build(oaParam, authData, g);
+
+ // validate state
+ assertNotNull("wrong attr. value", attrValue);
+ assertFalse("List delimiter after last element" ,attrValue.endsWith(";"));
+
+
+ String[] el = attrValue.split(";");
+ assertEquals("wrong role count", 4, el.length);
+ assertEquals("wrong 1. role", role1, el[0]);
+ assertEquals("wrong 2. role", role2, el[1]);
+ assertEquals("wrong 3. role", role3 + "()", el[2]);
+ assertEquals("wrong 4. role", role4 + "(\"aaa\"=\"bbb\")", el[3]);
+
+
+ }
+
+ @Test
+ public void brzProductionRole() throws AttributeBuilderException {
+
+ IAuthData authData = generateAuthData(Arrays.asList(
+ AuthenticationRoleFactory.buildFormPVPole("EPI-GDA()")));
+
+ // perform test
+ String attrValue = toTest.build(oaParam, authData, g);
+
+ // validate state
+ assertNotNull("wrong attr. value", attrValue);
+ assertFalse("List delimiter after last element" ,attrValue.endsWith(";"));
+
+
+ String[] el = attrValue.split(";");
+ assertEquals("wrong role count", 1, el.length);
+ assertEquals("wrong 1. role", "EPI-GDA()", el[0]);
+
+ assertEquals("wrong role attr. value", "EPI-GDA()", attrValue);
+
+ }
+
+ private IAuthData generateAuthData(List<AuthenticationRole> roles) {
+ MOAAuthenticationData authData = new MOAAuthenticationData(null);
+ if (roles != null) {
+ roles.forEach(el -> authData.addAuthenticationRole(el));
+
+ }
+
+ return authData;
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/DummyAuthConfigMap.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/DummyAuthConfigMap.java
new file mode 100644
index 000000000..865cf7157
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/DummyAuthConfigMap.java
@@ -0,0 +1,136 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
+
+/**
+ * Dummy Application-configuration implementation for jUnit tests.
+ *
+ * @author tlenz
+ *
+ */
+public class DummyAuthConfigMap implements IConfigurationWithSP {
+
+ private Map<String, String> config = new HashMap<>();
+
+ public DummyAuthConfigMap() {
+
+ }
+
+ /**
+ * Dummy Application-configuration.
+ *
+ * @param configIs Property based configuration
+ * @throws IOException In case of an configuration read error
+ */
+ public DummyAuthConfigMap(final InputStream configIs) throws IOException {
+
+ final Properties props = new Properties();
+ props.load(configIs);
+
+ config = KeyValueUtils.convertPropertiesToMap(props);
+
+ }
+
+ /**
+ * Dummy Application-configuration.
+ *
+ * @param path Path to property based configuration
+ * @throws IOException In case of an configuration read error
+ */
+ public DummyAuthConfigMap(final String path) throws IOException {
+
+ final Properties props = new Properties();
+ props.load(this.getClass().getResourceAsStream(path));
+
+ config = KeyValueUtils.convertPropertiesToMap(props);
+
+ }
+
+
+ @Override
+ public String getBasicConfiguration(final String key) {
+ return config.get(key);
+
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key, final String defaultValue) {
+ final String value = getBasicConfiguration(key);
+ if (StringUtils.isEmpty(value)) {
+ return defaultValue;
+ } else {
+ return value;
+ }
+
+ }
+
+ @Override
+ public Boolean getBasicConfigurationBoolean(final String key) {
+ final String value = getBasicConfiguration(key);
+ if (StringUtils.isEmpty(value)) {
+ return false;
+ } else {
+ return Boolean.valueOf(value);
+ }
+ }
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) {
+ return Boolean.parseBoolean(getBasicConfiguration(key, String.valueOf(defaultValue)));
+
+ }
+
+ @Override
+ public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) {
+ return KeyValueUtils.getSubSetWithPrefix(config, prefix);
+
+ }
+
+ @Override
+ public ISPConfiguration getServiceProviderConfiguration(final String uniqueID)
+ throws EAAFConfigurationException {
+ return null;
+ }
+
+ @Override
+ public <T> T getServiceProviderConfiguration(final String spIdentifier, final Class<T> decorator)
+ throws EAAFConfigurationException {
+ return null;
+ }
+
+ @Override
+ public URI getConfigurationRootDirectory() {
+ return new java.io.File(".").toURI();
+
+ }
+
+ @Override
+ public String validateIDPURL(final URL authReqUrl) throws EAAFException {
+ return null;
+ }
+
+ public void putConfigValue(final String key, final String value) {
+ config.put(key, value);
+ }
+
+ public void removeConfigValue(final String key) {
+ config.remove(key);
+
+ }
+
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/TestUtils.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/TestUtils.java
new file mode 100644
index 000000000..9ab52a27e
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/dummy/TestUtils.java
@@ -0,0 +1,150 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy;
+
+import java.io.IOException;
+import java.security.PublicKey;
+
+import javax.xml.transform.TransformerException;
+
+import org.w3c.dom.Element;
+
+import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
+
+public class TestUtils {
+
+ public static IIdentityLink generateDummyIdl(String baseId, String baseIdType) {
+ return new IIdentityLink() {
+
+ @Override
+ public void setSamlAssertion(Element samlAssertion) throws TransformerException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setPublicKey(PublicKey[] publicKey) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setPrPerson(Element prPerson) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setIssueInstant(String issueInstant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setIdentificationValue(String identificationValue) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setIdentificationType(String identificationType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setGivenName(String givenName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFamilyName(String familyName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setDsigReferenceTransforms(Element[] dsigReferenceTransforms) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setDateOfBirth(String dateOfBirth) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getSerializedSamlAssertion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Element getSamlAssertion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PublicKey[] getPublicKey() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Element getPrPerson() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getIssueInstant() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getIdentificationValue() {
+ return baseId;
+
+ }
+
+ @Override
+ public String getIdentificationType() {
+ return baseIdType;
+
+ }
+
+ @Override
+ public String getGivenName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFamilyName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Element[] getDsigReferenceTransforms() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDateOfBirth() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationQsSystemTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationQsSystemTest.java
new file mode 100644
index 000000000..8bccefc8d
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationQsSystemTest.java
@@ -0,0 +1,171 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import java.net.SocketTimeoutException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.annotation.IfProfileValue;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+
+import com.github.skjolber.mockito.soap.Soap12EndpointRule;
+
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequestStorage;
+import at.gv.egiz.eaaf.core.api.data.EAAFConfigConstants;
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.exceptions.EAAFParserException;
+import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
+import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.EHVD;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GDARoles;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GDAStatus;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaDescriptor;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GdaIndexResponse;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.task.InjectEhvdInformationTask;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.DummyAuthConfigMap;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.TestUtils;
+import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_qs_service_auth.beans.xml" })
+@IfProfileValue(name = "spring.profiles.active", value = "devEnvironment")
+public class InjectEhvdIdentityInformationQsSystemTest {
+
+ @Autowired
+ InjectEhvdInformationTask task;
+ @Autowired
+ DummyAuthConfigMap config;
+ @Autowired
+ IRequestStorage storage;
+
+ protected MockHttpServletRequest httpReq;
+ protected MockHttpServletResponse httpResp;
+ private ExecutionContext context;
+ private TestRequestImpl pendingReq;
+ private Map<String, String> spConfigMap;
+
+ @BeforeClass
+ public static void classInitializer() {
+ System.setProperty(
+ "https.cipherSuites",
+ //high secure RSA bases ciphers
+ "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" +
+ ",TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" +
+ ",TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" +
+ ",TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" +
+
+ //high secure ECC bases ciphers
+ ",TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" +
+ ",TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" +
+ ",TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" +
+ ",TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" +
+ ",TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" +
+ ",TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" +
+ ",TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" +
+ ",TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" +
+
+ //secure backup chipers
+ ",TLS_DHE_RSA_WITH_AES_256_CBC_SHA" +
+ ",TLS_DHE_RSA_WITH_AES_128_CBC_SHA" +
+ ",TLS_RSA_WITH_AES_128_CBC_SHA" +
+ ",TLS_RSA_WITH_AES_256_CBC_SHA"
+ );
+
+ }
+
+ @Before
+ public void initialize() throws EAAFParserException {
+ httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
+ httpResp = new MockHttpServletResponse();
+ RequestContextHolder.resetRequestAttributes();
+ RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
+
+ context = new ExecutionContextImpl();
+
+ spConfigMap = new HashMap<>();
+ spConfigMap.put(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER, RandomStringUtils.randomAlphanumeric(10));
+
+ final ISPConfiguration spConfig = new DummySPConfiguration(spConfigMap, config);
+ pendingReq = new TestRequestImpl();
+ pendingReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(10));
+ pendingReq.setSpConfig(spConfig);
+
+ // re-set config
+ config.putConfigValue("modules.dummyauth.enabled", String.valueOf(true));
+
+ }
+
+ @Test
+ public void validateState() throws TaskExecutionException, PendingReqIdValidationException {
+ // inject identityLink
+ final AuthenticationSessionWrapper moaSession = pendingReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+ moaSession.setIdentityLink(TestUtils.generateDummyIdl(
+ "SUTFhJ/FXHmLGfTFchYnnWG/e3A=",
+ EAAFConstants.URN_PREFIX_CDID + "GH"));
+
+ task.execute(pendingReq, context);
+
+ // validate state
+ final IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId());
+ assertNotNull("pendingReq not stored", storedReq);
+
+ final AuthenticationSessionWrapper moaSessionStored = storedReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+
+ assertFalse("foreign", moaSessionStored.isForeigner());
+ assertFalse("mandate", moaSessionStored.isMandateUsed());
+ assertEquals("missing attributes", 1, moaSessionStored.getGenericSessionDataStorage().size());
+ assertNotNull("no Role attr", moaSessionStored.getGenericDataFromSession(PVPConstants.ROLES_NAME));
+
+ }
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationTaskTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationTaskTest.java
new file mode 100644
index 000000000..818a2c34b
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/tasks/InjectEhvdIdentityInformationTaskTest.java
@@ -0,0 +1,1086 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.tasks;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.Assert;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+
+import com.github.skjolber.mockito.soap.Soap12EndpointRule;
+
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequestStorage;
+import at.gv.egiz.eaaf.core.api.data.EAAFConfigConstants;
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.exceptions.EAAFParserException;
+import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
+import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.EHVD;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GDARoles;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.GDAStatus;
+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.GdaIndexResponse;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.client.wsdl.InstanceIdentifier;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.task.InjectEhvdInformationTask;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.DummyAuthConfigMap;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.test.dummy.TestUtils;
+import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/test_ehvd_service_auth.beans.xml" })
+public class InjectEhvdIdentityInformationTaskTest {
+
+ @Autowired
+ InjectEhvdInformationTask task;
+ @Autowired
+ DummyAuthConfigMap config;
+ @Autowired
+ IRequestStorage storage;
+
+ @Rule
+ public final Soap12EndpointRule soap = Soap12EndpointRule.newInstance();
+
+ protected MockHttpServletRequest httpReq;
+ protected MockHttpServletResponse httpResp;
+ private ExecutionContext context;
+ private TestRequestImpl pendingReq;
+ private Map<String, String> spConfigMap;
+
+ private EHVD ehvdService;
+
+ @Before
+ public void initialize() throws EAAFParserException {
+ httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
+ httpResp = new MockHttpServletResponse();
+ RequestContextHolder.resetRequestAttributes();
+ RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
+
+ context = new ExecutionContextImpl();
+
+ spConfigMap = new HashMap<>();
+ spConfigMap.put(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER, RandomStringUtils.randomAlphanumeric(10));
+
+ final ISPConfiguration spConfig = new DummySPConfiguration(spConfigMap, config);
+ pendingReq = new TestRequestImpl();
+ pendingReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(10));
+ pendingReq.setSpConfig(spConfig);
+
+ // re-set config
+ config.putConfigValue("modules.dummyauth.enabled", String.valueOf(true));
+
+ // inject identityLink
+ final AuthenticationSessionWrapper moaSession = pendingReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+ moaSession.setIdentityLink(TestUtils.generateDummyIdl(
+ RandomStringUtils.randomAlphanumeric(10),
+ EAAFConstants.URN_PREFIX_BASEID));
+
+ // mock EHVD service
+ ehvdService = soap.mock(EHVD.class, "http://localhost:1234/ehvd");
+
+ }
+
+ @Test
+ public void noIdentityLinkInSession() {
+ final AuthenticationSessionWrapper moaSession = pendingReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+ moaSession.setIdentityLink(null);
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "process.04", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+ @Test
+ public void noActiveGda() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String role1 = RandomStringUtils.randomAlphabetic(10);
+ when(ehvdService.getGDA(any())).thenReturn(generateGdaResponse(false, Arrays.asList(role1)));
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "ehvd.00", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+ @Test
+ public void gdaGenericServiceError() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ when(ehvdService.getGDA(any())).thenThrow(new RuntimeException("No anwser from Service"));
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "ehvd.02", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+ @Test
+ public void gdaServiceError() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String msg = RandomStringUtils.randomAlphabetic(10);
+ SOAPFault fault = generateSoaFault(msg);
+ SOAPFaultException error = new SOAPFaultException(fault );
+ when(ehvdService.getGDA(any())).thenThrow(error);
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "ehvd.02", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+ @Test
+ public void noGdaInfosInResponse() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ GdaIndexResponse gdaResponse = new GdaIndexResponse();
+ when(ehvdService.getGDA(any())).thenReturn(gdaResponse);
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "ehvd.03", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+
+ @Test
+ public void noValidGdaRole() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String role1 = RandomStringUtils.randomAlphabetic(10);
+ String role2 = RandomStringUtils.randomAlphabetic(10);
+ when(ehvdService.getGDA(any())).thenReturn(generateGdaResponse(true, Arrays.asList(role1, role2)));
+
+ try {
+ task.execute(pendingReq, context);
+ fail("wrong state not detected");
+
+ } catch (final TaskExecutionException e) {
+ Assert.isInstanceOf(AuthenticationException.class, e.getOriginalException(), "wrong execpetion");
+ assertEquals("wrong errorCode", "ehvd.04", ((EAAFException) e.getOriginalException()).getErrorId());
+
+ }
+ }
+
+
+ @Test
+ public void validateStateWithRandomData() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String role1 = RandomStringUtils.randomAlphabetic(10);
+ String role2 = "1.2.40.0.34.5.2:101";
+ String role3 = RandomStringUtils.randomAlphabetic(10);
+ when(ehvdService.getGDA(any())).thenReturn(generateGdaResponse(true, Arrays.asList(role1, role2, role3)));
+
+ task.execute(pendingReq, context);
+
+ // validate state
+ final IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId());
+ assertNotNull("pendingReq not stored", storedReq);
+
+ final AuthenticationSessionWrapper moaSession = storedReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+
+ assertFalse("foreign", moaSession.isForeigner());
+ assertFalse("mandate", moaSession.isMandateUsed());
+ assertEquals("missing attributes", 2, moaSession.getGenericSessionDataStorage().size());
+ assertNotNull("no Role attr", moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME));
+ assertEquals("wrong role attr",
+ "EPI-GDA()",
+ moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME, String.class));
+
+ }
+
+ @Test
+ public void validateState() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String role1 = "1.2.40.0.33.5.2.101";
+ String role2 = "1.2.40.0.34.5.2:100";
+ String role3 = RandomStringUtils.randomAlphabetic(10);
+ when(ehvdService.getGDA(any())).thenReturn(generateGdaResponse(true, Arrays.asList(role1, role2, role3)));
+
+ task.execute(pendingReq, context);
+
+ // validate state
+ final IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId());
+ assertNotNull("pendingReq not stored", storedReq);
+
+ final AuthenticationSessionWrapper moaSession = storedReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+
+ assertFalse("foreign", moaSession.isForeigner());
+ assertFalse("mandate", moaSession.isMandateUsed());
+ assertEquals("missing attributes", 2, moaSession.getGenericSessionDataStorage().size());
+ assertNotNull("no Role attr", moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME));
+ assertEquals("wrong role attr",
+ "EPI-GDA()",
+ moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME, String.class));
+
+ }
+
+ @Test
+ public void validateStateSecondOid() throws TaskExecutionException, PendingReqIdValidationException {
+ // set-up EHVD response
+ String role1 = "1.2.40.0.33.5.2.101";
+ String role2 = "1.2.40.0.34.5.2:158";
+ String role3 = RandomStringUtils.randomAlphabetic(10);
+ GdaIndexResponse gdaResponse = generateGdaResponse(true, Arrays.asList(role1, role2, role3));
+ when(ehvdService.getGDA(any())).thenReturn(gdaResponse);
+
+ task.execute(pendingReq, context);
+
+ // validate state
+ final IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId());
+ assertNotNull("pendingReq not stored", storedReq);
+
+ final AuthenticationSessionWrapper moaSession = storedReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+
+ assertFalse("foreign", moaSession.isForeigner());
+ assertFalse("mandate", moaSession.isMandateUsed());
+ assertEquals("missing attributes", 2, moaSession.getGenericSessionDataStorage().size());
+ assertNotNull("no Role attr", moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME));
+ assertEquals("wrong role attr",
+ "EPI-GDA()",
+ moaSession.getGenericDataFromSession(PVPConstants.ROLES_NAME, String.class));
+
+ assertNotNull("no full GDA response",
+ moaSession.getGenericDataFromSession(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX));
+ assertTrue("wrong GDA response type",
+ moaSession.getGenericDataFromSession(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX) instanceof GdaDescriptor);
+
+
+ }
+
+ private GdaIndexResponse generateGdaResponse(boolean isActive, List<String> roles) {
+ GdaIndexResponse resp = new GdaIndexResponse();
+ GdaDescriptor gda = new GdaDescriptor();
+ resp.setGda(gda);
+
+ GDAStatus status = new GDAStatus();
+ gda.setStatus(status);
+ status.setEhvdstatus(isActive ? "Aktiv" : "Inaktiv");
+
+ gda.setFirstname(RandomStringUtils.randomAlphabetic(5));
+ gda.setSurname(RandomStringUtils.randomAlphabetic(5));
+ gda.setTitle(RandomStringUtils.randomAlphabetic(5));
+
+ InstanceIdentifier id = new InstanceIdentifier();
+ id.setId(RandomStringUtils.randomAlphabetic(5));
+ gda.setId(id);
+
+ gda.getOtherID().add(RandomStringUtils.randomAlphabetic(5));
+ gda.getOtherID().add(RandomStringUtils.randomAlphabetic(5));
+
+ gda.getAddress().add(generateAddress());
+ gda.getAddress().add(generateAddress());
+
+ GDARoles gdaRoles = new GDARoles();
+ gda.setRoles(gdaRoles);
+ gdaRoles.getRole().addAll(roles);
+
+ return resp;
+ }
+
+ private GdaAddress generateAddress() {
+ GdaAddress address = new GdaAddress();
+ address.setZip(RandomStringUtils.randomNumeric(4));
+ address.setState(RandomStringUtils.randomAlphabetic(10));
+ return address;
+
+ }
+
+ private SOAPFault generateSoaFault(String msg) {
+ return new SOAPFault() {
+
+ @Override
+ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setIdAttribute(String name, boolean isId) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Attr setAttributeNode(Attr newAttr) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(String name, String value) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAttribute(String name) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean hasAttribute(String name) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getTagName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public TypeInfo getSchemaTypeInfo() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NodeList getElementsByTagName(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Attr getAttributeNode(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object setUserData(String key, Object data, UserDataHandler handler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setTextContent(String textContent) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setPrefix(String prefix) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setNodeValue(String nodeValue) throws DOMException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node removeChild(Node oldChild) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void normalize() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String lookupPrefix(String namespaceURI) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String lookupNamespaceURI(String prefix) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isSupported(String feature, String version) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSameNode(Node other) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isEqualNode(Node arg) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isDefaultNamespace(String namespaceURI) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasChildNodes() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean hasAttributes() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Object getUserData(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getTextContent() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node getPreviousSibling() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPrefix() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node getParentNode() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Document getOwnerDocument() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNodeValue() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public short getNodeType() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getNodeName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node getNextSibling() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNamespaceURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLocalName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node getLastChild() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node getFirstChild() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getFeature(String feature, String version) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NodeList getChildNodes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getBaseURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NamedNodeMap getAttributes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public short compareDocumentPosition(Node other) throws DOMException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Node cloneNode(boolean deep) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Node appendChild(Node newChild) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setValue(String value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setParentElement(SOAPElement parent) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void recycleNode() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement getParentElement() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void detachNode() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setEncodingStyle(String encodingStyle) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public SOAPElement setElementQName(QName newName) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean removeNamespaceDeclaration(String prefix) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void removeContents() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean removeAttribute(QName qname) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean removeAttribute(Name name) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Iterator getVisibleNamespacePrefixes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNamespaceURI(String prefix) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getNamespacePrefixes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getEncodingStyle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public QName getElementQName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Name getElementName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getChildElements(QName qname) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getChildElements(Name name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getChildElements() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAttributeValue(QName qname) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAttributeValue(Name name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getAllAttributesAsQNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getAllAttributes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public QName createQName(String localName, String prefix) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addTextNode(String text) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(String localName, String prefix) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(SOAPElement element) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(String localName) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(QName qname) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addChildElement(Name name) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SOAPElement addAttribute(Name name, String value) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setFaultString(String faultString, Locale locale) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultString(String faultString) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultRole(String uri) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultNode(String uri) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultCode(String faultCode) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultCode(QName faultCodeQName) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultCode(Name faultCodeQName) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFaultActor(String faultActor) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAllFaultSubcodes() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean hasDetail() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Iterator getFaultSubcodes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Locale getFaultStringLocale() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFaultString() {
+ return msg;
+
+ }
+
+ @Override
+ public String getFaultRole() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getFaultReasonTexts() throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFaultReasonText(Locale locale) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator getFaultReasonLocales() throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFaultNode() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public QName getFaultCodeAsQName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Name getFaultCodeAsName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFaultCode() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFaultActor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Detail getDetail() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void appendFaultSubcode(QName subcode) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addFaultReasonText(String text, Locale locale) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Detail addDetail() throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AttributeBuilderRegistrationTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AttributeBuilderRegistrationTest.java
new file mode 100644
index 000000000..5ff8ffba7
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AttributeBuilderRegistrationTest.java
@@ -0,0 +1,41 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.utils;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.opensaml.saml2.core.Attribute;
+import org.opensaml.xml.ConfigurationException;
+
+import at.gv.egiz.eaaf.core.api.data.PVPAttributeDefinitions;
+import at.gv.egiz.eaaf.modules.pvp2.impl.builder.PVPAttributeBuilder;
+import at.gv.egiz.eaaf.modules.pvp2.impl.opensaml.initialize.EAAFDefaultSAML2Bootstrap;
+
+@RunWith(BlockJUnit4ClassRunner.class)
+public class AttributeBuilderRegistrationTest {
+
+ @BeforeClass
+ public static void classInitializer() throws ConfigurationException {
+ EAAFDefaultSAML2Bootstrap.bootstrap();
+
+ }
+
+ @Test
+ public void checkRegistratedAttributeBuilder() {
+
+ List<Attribute> supportedAttributes = PVPAttributeBuilder.buildSupportedEmptyAttributes();
+
+ assertFalse("Registered Attribute-Builder is empty", supportedAttributes.isEmpty());
+ assertTrue("No role attribute registrated", supportedAttributes.stream()
+ .filter(el -> PVPAttributeDefinitions.ROLES_NAME.equals(el.getName()))
+ .findFirst()
+ .isPresent());
+
+ }
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AuthenticationRoleFactoryTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AuthenticationRoleFactoryTest.java
new file mode 100644
index 000000000..6d39b926e
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/AuthenticationRoleFactoryTest.java
@@ -0,0 +1,65 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+import at.gv.egovernment.moa.id.data.AuthenticationRole;
+import at.gv.egovernment.moa.id.data.AuthenticationRoleFactory;
+
+@RunWith(BlockJUnit4ClassRunner.class)
+public class AuthenticationRoleFactoryTest {
+
+ @Test
+ public void simpleRole() {
+ String role = RandomStringUtils.randomAlphabetic(5);
+
+ AuthenticationRole toCheck = AuthenticationRoleFactory.buildFormPVPole(role);
+
+ assertEquals("wrong role name", role, toCheck.getRoleName());
+ assertEquals("wrong raw role", role, toCheck.getRawRoleString());
+ assertNull("wrong role attr", toCheck.getParams());
+
+ }
+
+ @Test
+ public void complexeRoleEmptyParams() {
+ String role = RandomStringUtils.randomAlphabetic(5);
+ String fullRole = role + "()";
+
+ AuthenticationRole toCheck = AuthenticationRoleFactory.buildFormPVPole(fullRole);
+
+ assertEquals("wrong role name", role, toCheck.getRoleName());
+ assertEquals("wrong raw role", fullRole, toCheck.getRawRoleString());
+ assertNull("wrong role attr", toCheck.getParams());
+
+ }
+
+ @Test
+ public void complexeRoleWithParams() {
+ String p1 = RandomStringUtils.randomAlphabetic(5);
+ String v1 = RandomStringUtils.randomAlphabetic(5);
+ String p2 = RandomStringUtils.randomAlphabetic(5);
+ String v2 = RandomStringUtils.randomAlphabetic(5);
+
+ String role = RandomStringUtils.randomAlphabetic(5);
+ String fullRole = role + "(\""
+ + p1 + "\"=\"" + v1 + "\","
+ + p2 + "\"=\"" + v2 + "\""
+ +")";
+
+ AuthenticationRole toCheck = AuthenticationRoleFactory.buildFormPVPole(fullRole);
+
+ assertEquals("wrong role name", role, toCheck.getRoleName());
+ assertEquals("wrong raw role", fullRole, toCheck.getRawRoleString());
+ assertNotNull("wrong role attr", toCheck.getParams());
+ assertEquals("wrong param size", 2, toCheck.getParams().size());
+
+ }
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/MoaStatusMessagerTest.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/MoaStatusMessagerTest.java
new file mode 100644
index 000000000..387aca540
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/at/gv/egovernment/moa/id/auth/modules/ehvd/test/utils/MoaStatusMessagerTest.java
@@ -0,0 +1,55 @@
+package at.gv.egovernment.moa.id.auth.modules.ehvd.test.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import at.gv.egiz.eaaf.core.api.IStatusMessenger;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({"/test_ehvd_service_messager_auth.beans.xml"})
+public class MoaStatusMessagerTest {
+
+ @Autowired IStatusMessenger messager;
+
+
+ @Test
+ public void checkErrorCodeMapper() {
+ assertEquals("default errorcode", "9199",
+ messager.getResponseErrorCode(new NullPointerException()));
+
+
+ assertEquals("new errorCode file", "aabbccdd",
+ messager.mapInternalErrorToExternalError("test.01"));
+ assertEquals("new errorCode file", "zzzyyyxxx",
+ messager.mapInternalErrorToExternalError("test.02"));
+
+ assertEquals("existing errorCode file", "4401",
+ messager.mapInternalErrorToExternalError("auth.34"));
+ assertEquals("existing errorCode file", "1101",
+ messager.mapInternalErrorToExternalError("parser.07"));
+
+ }
+
+ @Test
+ public void checkErrorMessages() {
+ assertEquals("new error msg",
+ "Für den abgefragtem GDA liegt keine Berechtigung vor", messager.getMessage("ehvd.00", null));
+ assertEquals("new error msg",
+ "Allgemeiner Fehler bei der Abfrage des EHVD Service", messager.getMessage("ehvd.99", null));
+
+
+ assertEquals("existing error msg",
+ "Zertifikat konnte nicht ausgelesen werden.", messager.getMessage("auth.14", null));
+ assertEquals("existing error msg",
+ "\"Issuer\" im AUTH-Block nicht vorhanden.", messager.getMessage("validator.32", null));
+
+ }
+
+
+}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/test/java/com/github/skjolber/mockito/soap/Soap12EndpointRule.java b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/com/github/skjolber/mockito/soap/Soap12EndpointRule.java
new file mode 100644
index 000000000..547401cc3
--- /dev/null
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/test/java/com/github/skjolber/mockito/soap/Soap12EndpointRule.java
@@ -0,0 +1,195 @@
+package com.github.skjolber.mockito.soap;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.spi.Provider;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.service.ServiceImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+
+
+/**
+ * Fork of {@link SoapEndpointRule} that set <i>endpoint.setBindingUri(SOAPBinding.SOAP12HTTP_BINDING)</i>
+ * into {@link EndpointImpl}.
+ *
+ * @author tlenz
+ *
+ */
+public class Soap12EndpointRule extends SoapServerRule {
+ private static final int PORT_RANGE_START = 1024 + 1;
+ private static final int PORT_RANGE_END = PortManager.PORT_RANGE_MAX;
+
+ public static Soap12EndpointRule newInstance() {
+ return new Soap12EndpointRule();
+ }
+
+ private final Map<String, EndpointImpl> endpoints = new HashMap<>();
+
+ private PortManager<Destination> portManager;
+
+ public Soap12EndpointRule() {
+ this(PORT_RANGE_START, PORT_RANGE_END);
+ }
+
+ public Soap12EndpointRule(String... portNames) {
+ this(PORT_RANGE_START, PORT_RANGE_END, portNames);
+ }
+
+ public Soap12EndpointRule(int portRangeStart, int portRangeEnd, String... portNames) {
+ portManager = new PortManager<Destination>(portRangeStart, portRangeEnd) {
+ @Override
+ public Destination reserve(int port) throws Exception {
+ return createDestination(port);
+ }
+
+ @Override
+ public void release(Destination destination) {
+ destination.shutdown();
+ }
+ };
+
+ portManager.add(portNames);
+ }
+
+ /**
+ * Returns the port number that was reserved for the given name.
+ *
+ * @param portName port name
+ * @return a valid port number if the port has been reserved, -1 otherwise
+ */
+ public int getPort(String portName) {
+ return portManager.getPort(portName);
+ }
+
+ /**
+ * Returns all port names and respective port numbers.
+ *
+ * @return a map of port name and port value (a valid port number if the port
+ * has been reserved, or -1 otherwise)
+ */
+ public Map<String, Integer> getPorts() {
+ return portManager.getPorts();
+ }
+
+ /**
+ * Attempt to reserve a port by starting a server.
+ *
+ * @param port port to reserve
+ * @return destination if successful
+ * @throws IOException
+ * @throws EndpointException
+ */
+ private Destination createDestination(int port) throws IOException, EndpointException {
+ final JaxWsServiceFactoryBean jaxWsServiceFactoryBean = new JaxWsServiceFactoryBean();
+
+ final JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean(jaxWsServiceFactoryBean);
+ final Bus bus = serverFactoryBean.getBus();
+
+ final String address = "http://localhost:" + port;
+ serverFactoryBean.setAddress(address);
+
+ final DestinationFactory destinationFactory = bus.getExtension(DestinationFactoryManager.class)
+ .getDestinationFactoryForUri(address);
+
+ final EndpointInfo ei = new EndpointInfo(null, Integer.toString(port));
+ ei.setAddress(address);
+
+ final Destination destination = destinationFactory.getDestination(ei, bus);
+
+ final ServiceImpl serviceImpl = new ServiceImpl();
+
+ final org.apache.cxf.endpoint.Endpoint endpoint = new org.apache.cxf.endpoint.EndpointImpl(bus,
+ serviceImpl, ei);
+ destination.setMessageObserver(new ChainInitiationObserver(endpoint, bus));
+ return destination;
+ }
+
+ @Override
+ public <T> void proxy(T target, Class<T> port, String address, String wsdlLocation,
+ List<String> schemaLocations, Map<String, Object> properties) {
+ assertValidParams(target, port, address);
+
+ if (endpoints.containsKey(address)) {
+ throw new IllegalArgumentException("Endpoint " + address + " already exists");
+ }
+
+ final T serviceInterface = SoapServiceProxy.newInstance(target);
+
+ final EndpointImpl endpoint = (EndpointImpl) Provider.provider().createEndpoint(null, serviceInterface);
+ endpoint.setBindingUri(SOAPBinding.SOAP12HTTP_BINDING);
+
+ if (wsdlLocation != null) {
+ endpoint.setWsdlLocation(wsdlLocation);
+ }
+
+ if (schemaLocations != null) {
+ endpoint.setSchemaLocations(schemaLocations);
+ }
+
+ endpoint.setProperties(processProperties(properties, wsdlLocation, schemaLocations));
+
+ final Destination destination = portManager.getData(parsePort(address));
+ if (destination != null) {
+ final ServerImpl server = endpoint.getServer();
+ server.setDestination(destination);
+ }
+
+ endpoint.publish(address);
+
+ endpoints.put(address, endpoint);
+ }
+
+ @Override
+ protected void before() {
+ // reserve all ports
+ portManager.start();
+ }
+
+ @Override
+ protected void after() {
+ destroy();
+ }
+
+ /**
+ * Stop and remove endpoints, keeping port reservations.
+ */
+ public void clear() {
+ endpoints.values().forEach(EndpointImpl::stop);
+ endpoints.clear();
+ }
+
+ @Override
+ public void destroy() {
+ endpoints.values().forEach(endpoint -> {
+ endpoint.stop();
+ endpoint.getBus().shutdown(true);
+ });
+ endpoints.clear();
+ portManager.stop();
+ }
+
+ @Override
+ public void stop() {
+ endpoints.values().forEach(endpoint -> endpoint.getServer().stop());
+ }
+
+ @Override
+ public void start() {
+ // republish
+ endpoints.values().forEach(endpoint -> endpoint.getServer().start());
+ }
+}