From 5bda3bcc87f7c58dfa782e76eecb183631369ede Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 31 Oct 2019 08:16:30 +0100 Subject: add jUnit tests for static ProviderName include an update to eaaf-core 1.0.12-snapshot --- .../connector/controller/MonitoringController.java | 4 +-- .../connector/provider/PVPMetadataProvider.java | 4 +-- .../connector/provider/StatusMessageProvider.java | 42 ++++++++++++---------- 3 files changed, 28 insertions(+), 22 deletions(-) (limited to 'connector/src/main/java') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/MonitoringController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/MonitoringController.java index 37602a67..0e95c1fc 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/MonitoringController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/MonitoringController.java @@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; import at.gv.egiz.eaaf.core.exceptions.EAAFException; import at.gv.egiz.eaaf.core.impl.utils.DOMUtils; @@ -68,7 +68,7 @@ public class MonitoringController { private static final String TEST_EIDASNODEMETADATA = "eIDASNode_metadata: "; @Autowired private ITransactionStorage storage; - @Autowired private IConfiguration config; + @Autowired private IConfigurationWithSP config; @Autowired private PVPMetadataBuilder metadatabuilder; @Autowired private IPVPMetadataConfigurationFactory configFactory; diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PVPMetadataProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PVPMetadataProvider.java index 9be87a95..831338c2 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PVPMetadataProvider.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PVPMetadataProvider.java @@ -40,7 +40,7 @@ import org.springframework.stereotype.Service; import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.asitplus.eidas.specific.connector.verification.MetadataSignatureVerificationFilter; -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +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.impl.utils.FileUtils; @@ -54,7 +54,7 @@ import at.gv.egiz.eaaf.modules.pvp2.impl.validation.metadata.SchemaValidationFil public class PVPMetadataProvider extends AbstractChainingMetadataProvider{ private static final Logger log = LoggerFactory.getLogger(PVPMetadataProvider.class); - @Autowired(required=true) IConfiguration basicConfig; + @Autowired(required=true) IConfigurationWithSP basicConfig; @Override protected String getMetadataURL(String entityId) throws EAAFConfigurationException { diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java index 21e97ee9..875192a1 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java @@ -57,29 +57,35 @@ public class StatusMessageProvider implements IStatusMessenger { private static final Locale DEFAULT_EXTERNALERROR_LOCALES = new Locale("en", "GB"); private ResourceBundle externalError = null; - @Override - public String getMessage(String messageId, Object[] parameters) { - // initialize messages - if (messages == null) { - this.messages = PropertyResourceBundle.getBundle( - DEFAULT_MESSAGE_RESOURCES, - DEFAULT_MESSAGE_LOCALES); - - } + @Override + public String getMessageWithoutDefault(String messageId, Object[] parameters) { + // initialize messages + if (messages == null) { + this.messages = PropertyResourceBundle.getBundle( + DEFAULT_MESSAGE_RESOURCES, + DEFAULT_MESSAGE_LOCALES); + + } - // create the message - if (messages == null) { - return MessageFormat.format(ERROR_MESSAGES_UNAVAILABLE, new Object[] { messageId }); + // create the message + if (messages == null) { + return MessageFormat.format(ERROR_MESSAGES_UNAVAILABLE, new Object[] { messageId }); - } else { - try { - String rawMessage = messages.getString(messageId); - return MessageFormat.format(rawMessage, parameters); + } else { + String rawMessage = messages.getString(messageId); + return MessageFormat.format(rawMessage, parameters); + + } + } + + @Override + public String getMessage(String messageId, Object[] parameters) { + try { + return getMessageWithoutDefault(messageId, parameters); - } catch (MissingResourceException e2) { + } catch (MissingResourceException e2) { return MessageFormat.format(ERROR_NO_MESSAGE, new Object[] { messageId }); - } } } -- cgit v1.2.3