aboutsummaryrefslogtreecommitdiff
path: root/connector_lib/src/test/java/at/asitplus
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-21 18:10:37 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-22 08:31:36 +0100
commitf2430c98c248907d27207dba30da96483f6db45e (patch)
tree681bca8c2697e1bba57f51be2605e31539f03424 /connector_lib/src/test/java/at/asitplus
parentd8a6a3a0fa27f6ea487c9fc4006f705383780917 (diff)
downloadNational_eIDAS_Gateway-f2430c98c248907d27207dba30da96483f6db45e.tar.gz
National_eIDAS_Gateway-f2430c98c248907d27207dba30da96483f6db45e.tar.bz2
National_eIDAS_Gateway-f2430c98c248907d27207dba30da96483f6db45e.zip
add jUnit tests improve test coverage
Diffstat (limited to 'connector_lib/src/test/java/at/asitplus')
-rw-r--r--connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummyConfigMap.java112
-rw-r--r--connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummySpConfiguration.java28
2 files changed, 140 insertions, 0 deletions
diff --git a/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummyConfigMap.java b/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummyConfigMap.java
new file mode 100644
index 00000000..ab390731
--- /dev/null
+++ b/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummyConfigMap.java
@@ -0,0 +1,112 @@
+package at.asitplus.eidas.specific.connector.test.config;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.test.dummy.DummyAuthConfigMap;
+import lombok.Setter;
+
+/**
+ * MS-Connector specific dummy basic-config implementation.
+ *
+ * @author tlenz
+ *
+ */
+public class MsConnectorDummyConfigMap extends DummyAuthConfigMap {
+
+ private static final String CONFIG_PREFIX = "eidas.ms.";
+
+ @Setter
+ private String configRootDirSufix;
+
+ /**
+ * Creates an emptry configuration.
+ *
+ */
+ public MsConnectorDummyConfigMap() {
+
+ }
+
+ /**
+ * Dummy Application-configuration.
+ *
+ * @param configIs Property based configuration
+ * @throws IOException In case of an configuration read error
+ */
+ public MsConnectorDummyConfigMap(final InputStream configIs) throws IOException {
+ super(configIs);
+
+ }
+
+ /**
+ * Dummy Application-configuration.
+ *
+ * @param path Path to property based configuration
+ * @throws IOException In case of an configuration read error
+ */
+ public MsConnectorDummyConfigMap(final String path) throws IOException {
+ super(path);
+
+ }
+
+
+ @Override
+ public String getBasicConfiguration(final String key) {
+ return super.getBasicConfiguration(addPrefixToKey(key));
+
+ }
+
+ @Override
+ public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) {
+ return super.getBasicConfigurationWithPrefix(addPrefixToKey(prefix));
+
+ }
+
+ @Override
+ public void putConfigValue(final String key, final String value) {
+ super.putConfigValue(addPrefixToKey(key), value);
+ }
+
+ @Override
+ public void removeConfigValue(final String key) {
+ super.removeConfigValue(addPrefixToKey(key));
+
+ }
+
+ @Override
+ public URI getConfigurationRootDirectory() {
+ URI basePath = super.getConfigurationRootDirectory();
+ if (StringUtils.isNotEmpty(configRootDirSufix)) {
+ try {
+ return new URI(basePath.toString() + configRootDirSufix);
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("Wrong Dummyconfig", e);
+
+ }
+
+ } else {
+ return basePath;
+
+ }
+
+
+ }
+
+ private String addPrefixToKey(final String key) {
+ if (key.startsWith(CONFIG_PREFIX)) {
+ return key;
+
+ } else {
+ return CONFIG_PREFIX + key;
+
+ }
+ }
+
+
+}
diff --git a/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummySpConfiguration.java b/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummySpConfiguration.java
new file mode 100644
index 00000000..e6e35ab1
--- /dev/null
+++ b/connector_lib/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorDummySpConfiguration.java
@@ -0,0 +1,28 @@
+package at.asitplus.eidas.specific.connector.test.config;
+
+import java.util.List;
+import java.util.Map;
+
+import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
+import lombok.Setter;
+
+public class MsConnectorDummySpConfiguration extends DummySpConfiguration {
+
+ private static final long serialVersionUID = -3249018889871026127L;
+
+ @Setter
+ private List<String> loa;
+
+ public MsConnectorDummySpConfiguration(Map<String, String> spConfig, IConfiguration authConfig) {
+ super(spConfig, authConfig);
+
+ }
+
+ @Override
+ public List<String> getRequiredLoA() {
+ return loa;
+
+ }
+
+}