added smokeTests for argon2 parameters

This commit is contained in:
AsimA 2018-05-22 15:55:00 +02:00
parent 1e231013b0
commit fcaf315549

View file

@ -29,6 +29,9 @@ public class ConfigurationPropertiesSmokeTests implements
private static final String PROPERTY_LANGUAGE_SELECTABLE = "languages.selectableLocales"; private static final String PROPERTY_LANGUAGE_SELECTABLE = "languages.selectableLocales";
private static final String PROPERTY_LANGUAGE_FORCE = "languages.forceLocale"; private static final String PROPERTY_LANGUAGE_FORCE = "languages.forceLocale";
private static final String PROPERTY_LANGUAGE_FILTER = "RDFService.languageFilter"; private static final String PROPERTY_LANGUAGE_FILTER = "RDFService.languageFilter";
private static final String PROPERTY_ARGON2_TIME = "argon2.time";
private static final String PROPERTY_ARGON2_MEMORY = "argon2.memory";
private static final String PROPERTY_ARGON2_PARALLELISM = "argon2.parallelism";
@Override @Override
public void contextInitialized(ServletContextEvent sce) { public void contextInitialized(ServletContextEvent sce) {
@ -38,6 +41,7 @@ public class ConfigurationPropertiesSmokeTests implements
checkDefaultNamespace(ctx, props, ss); checkDefaultNamespace(ctx, props, ss);
checkLanguages(props, ss); checkLanguages(props, ss);
checkEncryptionParameters(props, ss);
} }
/** /**
@ -122,6 +126,26 @@ public class ConfigurationPropertiesSmokeTests implements
} }
} }
/**
* Fail if there are no config properties for the Argon2 encryption.
*/
private void checkEncryptionParameters(ConfigurationProperties props,
StartupStatus ss) {
failIfNotPresent(props, ss, PROPERTY_ARGON2_TIME);
failIfNotPresent(props, ss, PROPERTY_ARGON2_MEMORY);
failIfNotPresent(props, ss, PROPERTY_ARGON2_PARALLELISM);
}
private void failIfNotPresent(ConfigurationProperties props,
StartupStatus ss, String name) {
String value = props.getProperty(name);
if (value == null || value.isEmpty()) {
ss.fatal(this, "runtime.properties does not contain a value for '"
+ name + "'");
return;
}
}
@Override @Override
public void contextDestroyed(ServletContextEvent sce) { public void contextDestroyed(ServletContextEvent sce) {
// nothing to do at shutdown // nothing to do at shutdown