diff options
Diffstat (limited to 'eaaf_core')
3 files changed, 68 insertions, 5 deletions
diff --git a/eaaf_core/pom.xml b/eaaf_core/pom.xml index 5e988c05..28ce135c 100644 --- a/eaaf_core/pom.xml +++ b/eaaf_core/pom.xml @@ -87,6 +87,7 @@ <artifactId>xalan</artifactId> </dependency> + <!-- For testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -97,6 +98,12 @@ <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>at.gv.egiz.eaaf</groupId> + <artifactId>eaaf_core_utils</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> </dependencies> <build> diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java index 1c7806ef..5dcbcb7e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java @@ -28,6 +28,10 @@ import java.util.Map.Entry; import javax.annotation.PostConstruct; +import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; +import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,10 +42,6 @@ import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertySource; -import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; -import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; -import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; - public abstract class AbstractSpringBootConfigurationImpl implements IConfigurationWithSP { private static final Logger log = LoggerFactory.getLogger(AbstractSpringBootConfigurationImpl.class); @@ -190,7 +190,7 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat // note: Most descendants of PropertySource are EnumerablePropertySource. There // are some // few others like JndiPropertySource or StubPropertySource - log.debug("Given PropertySource is instanceof " + apropSource.getClass().getName() + log.trace("Given PropertySource is instanceof " + apropSource.getClass().getName() + " and cannot be iterated"); return result; diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java new file mode 100644 index 00000000..cbe8d815 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java @@ -0,0 +1,56 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth; + +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.egiz.eaaf.core.impl.idp.EaafCoreSpringResourceProvider; +import at.gv.egiz.eaaf.core.test.TestConstants; + + + +@RunWith(BlockJUnit4ClassRunner.class) +public class EaafCoreSpringResourceProviderTest { + + @Test + public void testSpringConfig() { + final EaafCoreSpringResourceProvider test = + new EaafCoreSpringResourceProvider(); + 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(TestConstants.TEST_SPI_LOADER_PATH); + try { + final String spiFile = IOUtils.toString(el, "UTF-8"); + + Assert.assertEquals("Wrong classpath in SPI file", + EaafCoreSpringResourceProvider.class.getName(), spiFile); + + + } catch (final IOException e) { + Assert.fail("Ressouce: " + TestConstants.TEST_SPI_LOADER_PATH + " not found"); + + } + } + +} |