Fixed issue with loading messages in different language. As a standalone jar you can write properties back to messages.properties, this approach worked when you run with exploded classpath (target/classes etc). However failed when running inside Docker container.

This commit is contained in:
Nanne Baars
2017-02-05 21:54:07 +01:00
parent d25700434e
commit ae82df3fb4
12 changed files with 145 additions and 41 deletions

View File

@ -27,6 +27,7 @@ package org.owasp.webgoat.assignments;
import org.mockito.Mock;
import org.owasp.webgoat.i18n.Messages;
import org.owasp.webgoat.i18n.PluginMessages;
import org.owasp.webgoat.session.UserSessionData;
import org.owasp.webgoat.session.UserTracker;
import org.owasp.webgoat.session.WebSession;
@ -60,13 +61,14 @@ public class AssignmentEndpointTest {
return Locale.ENGLISH;
}
};
protected PluginMessages pluginMessages = new PluginMessages(messages);
public void init(AssignmentEndpoint a) {
messages.setBasenames("classpath:/i18n/messages", "classpath:/plugin/i18n/WebGoatLabels");
ReflectionTestUtils.setField(a, "userTracker", userTracker);
ReflectionTestUtils.setField(a, "userSessionData", userSessionData);
ReflectionTestUtils.setField(a, "webSession", webSession);
ReflectionTestUtils.setField(a, "messages", messages);
ReflectionTestUtils.setField(a, "messages", pluginMessages);
}
}