diff options
author | Martin Bonato <mbonato@datentechnik-innovation.com> | 2015-01-21 16:55:53 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2015-06-19 11:08:37 +0200 |
commit | d24179f90949ff6768f89eea0073f65990d0765a (patch) | |
tree | 842ee9a20e052fd1e347d93a080a657a8bac0028 /id/server/idserverlib/src/main/java/at | |
parent | 54cb4518bd64dba0c1f373f262afb7a988f35e1a (diff) | |
download | moa-id-spss-d24179f90949ff6768f89eea0073f65990d0765a.tar.gz moa-id-spss-d24179f90949ff6768f89eea0073f65990d0765a.tar.bz2 moa-id-spss-d24179f90949ff6768f89eea0073f65990d0765a.zip |
Add unit initial unit tests.
Diffstat (limited to 'id/server/idserverlib/src/main/java/at')
2 files changed, 21 insertions, 7 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index a143eb636..087b331b5 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -274,6 +274,12 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements } /** + * Protected constructor. Used by unit tests. + */ + protected AuthConfigurationProvider() { + } + + /** * Load the configuration data from XML file with the given name and build * the internal data structures representing the MOA ID configuration. * @@ -493,12 +499,15 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements throw new ConfigurationException("config.02", null, t); } } - + + protected MOAIDConfiguration loadDataBaseConfig() { + return ConfigurationDBRead.getMOAIDConfiguration(); + } + public synchronized void reloadDataBaseConfig() throws ConfigurationException { Logger.info("Read MOA-ID 2.0 configuration from database."); - //moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); - moaidconfig = NewConfigurationDBRead.getMOAIDConfiguration(); + moaidconfig = loadDataBaseConfig(); Logger.info("MOA-ID 2.0 is loaded."); if (moaidconfig == null) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java index 77a9f032c..0ee143a1a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java @@ -54,10 +54,12 @@ import com.datentechnik.moa.id.conf.persistence.Configuration; */ public class NewAuthConfigurationProvider extends ConfigurationProvider implements AuthConfiguration { - @Autowired private Configuration configuration; private final Properties properties = new Properties(); + + public NewAuthConfigurationProvider() { + } public NewAuthConfigurationProvider(String fileName) throws ConfigurationException { File propertiesFile = new File(fileName); @@ -71,6 +73,11 @@ public class NewAuthConfigurationProvider extends ConfigurationProvider implemen throw new ConfigurationException("config.03", null, e); } } + + @Autowired + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } private Properties getProperties() { return properties; @@ -105,11 +112,9 @@ public class NewAuthConfigurationProvider extends ConfigurationProvider implemen } catch (ConfigurationException e) { return null; } - ProtocolAllowed allowedProtcols = new ProtocolAllowed(); Protocols protocols = authComponentGeneral.getProtocols(); if (protocols != null) { - allowedProtcols = new ProtocolAllowed(); - + ProtocolAllowed allowedProtcols = new ProtocolAllowed(); if (protocols.getSAML1() != null) { allowedProtcols.setSAML1Active(protocols.getSAML1().isIsActive()); } |