powered by Jive Software

Openfire xmppserver unitary tests failing because of Locale


#1

Hello,

When running the unitary tests of Openfire xmppserver with Maven some of them are failing because my computer language is French and the tests are expecting some values to be displayed in English.

Those tests are :

[ERROR]   StringUtilsTest.testElapsedTimeInDays:99
Expected: is "1 day"
     but: was "1 jour"
[ERROR]   StringUtilsTest.testElapsedTimeInHours:92
Expected: is "1 hour"
     but: was "1 heure"
[ERROR]   StringUtilsTest.testElapsedTimeInMinutes:86
Expected: is "1 minute, 1 second, 1 ms"
     but: was "1 minute, 1 seconde, 1 ms"
[ERROR]   StringUtilsTest.testElapsedTimeInSeconds:78
Expected: is "1 second"
     but: was "1 seconde"
[ERROR]   SystemPropertyTest.willCreateAListOfDurationProperties:498
Expected: is "1 hour,0 ms"
     but: was "1 heure,0 ms"

As a solution I added inside the xmppserver pom.xml the following line to specify the Locale of the JVM when running the tests (in Openfire/xmppserver/pom.xml) :

	<argLine>-Duser.language=us -Duser.country=US</argLine>

The whole configuration of surefire is like this now :

<plugin>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>3.0.0-M2</version>
	<configuration>
		<systemPropertyVariables>
			<log4j.configurationFile>${project.build.directory}/test-classes/log4j2-test-mvn.xml</log4j.configurationFile>
		</systemPropertyVariables>
		<argLine>-Duser.language=us -Duser.country=US</argLine>
	</configuration>
</plugin>

I think it would be nice to add this in master branch of openfire xmppserver so the tests will be okay whichever the locale of the computer.


#2

Thanks, are you able to submit a Pull Request with this change?


#3

Yes I should be able to do this tomorrow.


#4

Mention OF-1713 in your PR title.
https://issues.igniterealtime.org/browse/OF-1713