aboutsummaryrefslogtreecommitdiff
path: root/connector
diff options
context:
space:
mode:
authorThomas <>2022-03-10 13:23:58 +0100
committerThomas <>2022-03-10 13:23:58 +0100
commit32988b1df31a0ed1a31275371b18201a10db88d7 (patch)
treef9616e96473b6cf3b7b4a4d5f0a33f99282b5a6f /connector
parent9a9c5e8696b4bcff1c4511b5edbc44ca0e48799a (diff)
downloadNational_eIDAS_Gateway-32988b1df31a0ed1a31275371b18201a10db88d7.tar.gz
National_eIDAS_Gateway-32988b1df31a0ed1a31275371b18201a10db88d7.tar.bz2
National_eIDAS_Gateway-32988b1df31a0ed1a31275371b18201a10db88d7.zip
chore(core): add Spring based message source to MS-Connector
Diffstat (limited to 'connector')
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java21
-rw-r--r--connector/src/main/resources/specific_eIDAS_connector.beans.xml3
-rw-r--r--connector/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorMessageSourceTest.java71
3 files changed, 95 insertions, 0 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java
new file mode 100644
index 00000000..59df6375
--- /dev/null
+++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java
@@ -0,0 +1,21 @@
+package at.asitplus.eidas.specific.connector.config;
+
+import java.util.Arrays;
+import java.util.List;
+
+import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation;
+
+/**
+ * Inject eIDAS Connector specific messages into Spring based message-source.
+ *
+ * @author tlenz
+ *
+ */
+public class MsConnectorMessageSource implements IMessageSourceLocation {
+
+ @Override
+ public List<String> getMessageSourceLocation() {
+ return Arrays.asList("classpath:/properties/messages");
+ }
+
+}
diff --git a/connector/src/main/resources/specific_eIDAS_connector.beans.xml b/connector/src/main/resources/specific_eIDAS_connector.beans.xml
index e3db72f8..9861a7c6 100644
--- a/connector/src/main/resources/specific_eIDAS_connector.beans.xml
+++ b/connector/src/main/resources/specific_eIDAS_connector.beans.xml
@@ -14,6 +14,9 @@
<import resource="specific_eIDAS_core.beans.xml"/>
+ <bean id="msConnectorMessageSource"
+ class="at.asitplus.eidas.specific.connector.config.MsConnectorMessageSource" />
+
<bean id="processEngineSignalController"
class="at.asitplus.eidas.specific.connector.controller.ProcessEngineSignalController" />
diff --git a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorMessageSourceTest.java b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorMessageSourceTest.java
new file mode 100644
index 00000000..4c9d825d
--- /dev/null
+++ b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/config/MsConnectorMessageSourceTest.java
@@ -0,0 +1,71 @@
+package at.asitplus.eidas.specific.connector.test.config;
+
+import java.security.cert.CertificateException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opensaml.core.config.InitializationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "/applicationContext.xml",
+ "/spring/SpringTest_connector.beans.xml",
+ "/eaaf_core.beans.xml",
+ "/eaaf_pvp.beans.xml",
+ "/eaaf_pvp_idp.beans.xml",
+ "/spring/SpringTest-context_simple_storage.xml" })
+@WebAppConfiguration
+@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
+@ActiveProfiles(profiles = {"deprecatedConfig"})
+public class MsConnectorMessageSourceTest {
+
+ /**
+ * jUnit class initializer.
+ * @throws ComponentInitializationException In case of an error
+ * @throws InitializationException In case of an error
+ * @throws CertificateException
+ *
+ */
+ @BeforeClass
+ public static void classInitializer() throws InitializationException,
+ ComponentInitializationException, CertificateException {
+ final String current = new java.io.File(".").toURI().toString();
+ System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_1.properties");
+
+ }
+
+ @Autowired
+ private ResourceLoader loader;
+ @Autowired(required = false)
+ private List<IMessageSourceLocation> messageSources;
+
+ @Test
+ public void checkMessageSources() {
+ Assert.assertNotNull("No messageSource", messageSources);
+
+ for (final IMessageSourceLocation messageSource : messageSources) {
+ Assert.assertNotNull("No sourcePath", messageSource.getMessageSourceLocation());
+
+ for (final String el : messageSource.getMessageSourceLocation()) {
+ final Resource messages = loader.getResource(el + ".properties");
+ Assert.assertTrue("Source not exist", messages.exists());
+
+ }
+ }
+ }
+}