[
https://issues.apache.org/jira/browse/FALCON-1326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14644259#comment-14644259
]
Ajay Yadava commented on FALCON-1326:
-------------------------------------
In that case we should generate the expected output also so that the expected
and actual output both are using same locale. For sake of illustration,
{code}
Calendar calendar = Calendar.getInstance();
calendar.set(2009, 8, 2); // calendar months start from 0
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd");
String expected = sdf.format(calendar.getTime());
{code}
This way expected string will also automatically pick the current locale.
SimpleDateFormat is not thread safe you will need to do some extra work there
as well. Since these are just tests a synchronized utility method might be a
succinct solution.
> Test failed due to unix locale
> ------------------------------
>
> Key: FALCON-1326
> URL: https://issues.apache.org/jira/browse/FALCON-1326
> Project: Falcon
> Issue Type: Bug
> Components: build-tools, tests
> Affects Versions: 0.7
> Environment: CentOS 6.6, Maven 3.2.3, JDK 1.7.0_71
> Reporter: Anthony Ly
> Priority: Minor
> Labels: build, maven
>
> Running instructions for building Falcon :
> git clone https://git-wip-us.apache.org/repos/asf/falcon.git falcon
> cd falcon
> export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m -noverify" && mvn clean
> install
> On my centos causes a test failure because of the date format.
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running org.apache.oozie.extensions.TestOozieELExtensions
> Tests run: 12, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.117 sec
> <<< FAILURE! - in org.apache.oozie.extensions.TestOozieELExtensions
> testActionExpressions(org.apache.oozie.extensions.TestOozieELExtensions)
> Time elapsed: 0.04 sec <<< FAILURE!
> java.lang.AssertionError: expected:<2009-Sep-02> but was:<2009-sept.-02>
> at org.testng.Assert.fail(Assert.java:89)
> at org.testng.Assert.failNotEquals(Assert.java:489)
> at org.testng.Assert.assertEquals(Assert.java:118)
> at org.testng.Assert.assertEquals(Assert.java:171)
> at org.testng.Assert.assertEquals(Assert.java:181)
> at
> org.apache.oozie.extensions.TestOozieELExtensions.testActionExpressions(TestOozieELExtensions.java:106)
> Results :
> Failed tests:
> TestOozieELExtensions.testActionExpressions:106 expected:<2009-Sep-02> but
> was:<2009-sept.-02>
> Tests run: 12, Failures: 1, Errors: 0, Skipped: 0
> I solved the problem setting LANG to 'en_US.utf8' instead of my 'fr_FR.utf8'
> but I think this test can get the good format from system locale.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)