Amila,
I think I see what you are suggesting.  
If we use a before date with a noon hour, then the day will not be changed for 
any timezone offset in the range: +1130 to -1130.  This is a great practical  
simplification!

However, the time zone offset can be -12:00 to +14:00.  For example, New 
Zealand summer time is +13:00.  Some standards go larger for future extensions: 
+-18:00.
( https://docs.oracle.com/javase/8/docs/api/java/time/ZoneOffset.html )

The purpose of the test is to make sure the timezone conversion during 
serialization and deserialization "roughly" gives the same date and time and 
preserves the seconds and milliseconds exactly.

david.

-----Original Message-----
From: Amila Wijayarathna [mailto:amwijayarat...@gmail.com] 
Sent: Tuesday, March 01, 2016 12:44 PM
To: dev@rya.incubator.apache.org
Subject: Re: Test 'testMilliSecondsNoZone' Fails when Building from Source

Hi David,

You are right, I'm from Sri Lanka (Time zone - +0530). But when I run "date -u" 
I am getting following.

"2016 මාර්තු  1 වැනි අඟහරුවාදා 17:09:26 +0000"

By setting up

String afterDate="2000-01-0(1|2|3)T\\d\\d:\\d\\d:01\\.000Z";

I could successfully run the test and it got passed. But I believe this is not 
a perfect fix since by accident if we get '2002-02-02T02:02:02.222'
when expected output is '2002-02-01T02:02:02.222', the test will still pass. So 
if this occurs due to a issue in functionality automation tests will miss it.

I tried

String beforeDate="2002-02-02T02:12:02.222";

and here also test passed successfully. Even though I'm not sure what is 
expected to test in this test case, this sounds a better solution to me. If 
funnctionality works fine, output for this will match the defined regex in
+1130 to -1130 time zones. What do you think? What would be the better fix?

I created a jira for this [1]. Once we finalized on the fix, I'll send a pull 
request to git 'develop' branch. Also is it possible to assign the created jira 
for me?

[1]. 
https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_RYA-2D44&d=BQIFaQ&c=Nwf-pp4xtYRe0sCRVM8_LWH54joYF7EKmrYIdfxIq10&r=ruy1rriFBFoeOJvvQWwN1h8AcdSNT3EVLrdVl7pr-iA&m=gGs-q5mWFLzFQT__sUMtnP5LZkgG2FYXGQnChlrEC1Q&s=yXAhcDuGZRRBSQyZH1O5-tw-Dr6_8B-awdFIP8po2uo&e=
 

Thank You!

Amila Wijayarathna

On Tue, Mar 1, 2016 at 2:30 AM, Lotts, David <david.lo...@parsons.com>
wrote:

> Amila,
> I think I see the cause of the failed test.  I'm going to predict that
> your timezone is greater than +02:00.   ( I am a psychic :-) ).
>
> The test above yours: testNoZone()
> is similar, except that it specifies milliseconds and uses this regex:
> String afterDate="2000-01-0(1|2|3)T\\d\\d:\\d\\d:01\\.000Z";
>
> It accounts for the fact that the local timezone might change the day.  
> So the fix is probably to add the same fuzzy day: "(1|2|3)" to the 
> test that is failing:  testMilliSecondsNoZone().
>
> Feel free to create a Jira issue and fix it and be a hero!
> Or just add a @Ignore above the @test and keep working and STILL be a 
> hero for find this test bug!
>
> david.
>
> -----Original Message-----
> From: Lotts, David
> Sent: Monday, February 29, 2016 3:09 PM
> To: dev@rya.incubator.apache.org
> Subject: RE: Test 'testMilliSecondsNoZone' Fails when Building from 
> Source
>
> I don't think that is a known bug.  It looks very similar to issue RYA-6.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org
> _jira_browse_RYA-2D6&d=BQIFaQ&c=Nwf-pp4xtYRe0sCRVM8_LWH54joYF7EKmrYIdf
> xIq10&r=ruy1rriFBFoeOJvvQWwN1h8AcdSNT3EVLrdVl7pr-iA&m=gGs-q5mWFLzFQT__
> sUMtnP5LZkgG2FYXGQnChlrEC1Q&s=63s28I-cmbpkqTb_06ldxBqPHhFng2WED6F8Tu8z
> t54&e= I would not think it is a fatal problem with your environment, 
> more likely an unanticipated corner case.  I think this test was 
> formulated to find those.
>
> May I ask what your computer's time zone?
> Use a command like this:
>
>     Unix$ date -u
>
>     Windows cmd> tzutil /g
>
> and your operating system and  java version?
>
> david.
>
>
>
> -----Original Message-----
> From: Amila Wijayarathna [mailto:amwijayarat...@gmail.com]
> Sent: Monday, February 29, 2016 2:07 PM
> To: dev@rya.incubator.apache.org
> Subject: Re: Test 'testMilliSecondsNoZone' Fails when Building from 
> Source
>
>  Hi all,
> I am getting the same issue in 'develop' branch as well .
>
> Thank you!
>
>
> *Amila Wijayarathna,*
> undergraduate,
> Faculty of Information Technology,
> University of Moratuwa,
> Sri Lanka.
>
> On Mon, Feb 29, 2016 at 11:46 PM, Amila Wijayarathna < 
> amwijayarat...@gmail.com> wrote:
>
> > Hi all,
> >
> > I am trying to build Apache Rya source available at [1]. I could 
> > successfully built the source by running without tests using "mvn 
> > clean install -Dmaven.test.skip=true". But when I am running the 
> > source with tests using "mvn clean install", I am getting test 
> > failure
> at [2].
> >
> > It seems like in the test 'testMilliSecondsNoZone', it pass 
> > '2002-02-02T02:02:02.222' to serializeAndDeserialize method, but it 
> > returns '2002-02-01T02:02:02.222' after deserialising and it causes 
> > the test to fail.
> >
> > Is this a know issue or am I getting this due to some 
> > incompatibility in my environment?
> >
> > Any idea on this is thoroughly appreciated.
> >
> > [1].
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apac
> > he
> > _incubator-2Drya&d=BQIBaQ&c=Nwf-pp4xtYRe0sCRVM8_LWH54joYF7EKmrYIdfxI
> > q1 
> > 0&r=ruy1rriFBFoeOJvvQWwN1h8AcdSNT3EVLrdVl7pr-iA&m=YMkoBqgmlbmrxhOslx
> > Ch 
> > aXpbBMpeTAkCqRWkaibToLM&s=hhM4nAeG7KurtBlNQNclAbVzZev4f-d2dx-Xlm6LHs
> > I&
> > e=
> > [2].
> > testMilliSecondsNoZone(mvm.rya.api.resolver.impl.DateTimeRyaTypeReso
> > lv
> > erTest)  Time elapsed: 0.051 sec  <<< FAILURE!
> > java.lang.AssertionError: Before='2002-02-02T02:02:02.222'; Expected 
> > should match actual regex after='2002-02-02T\d\d:\d\d:02\.222Z'
> > deserialized:2002-02-01T20:02:02.222Z
> > at org.junit.Assert.fail(Assert.java:88)
> > at org.junit.Assert.assertTrue(Assert.java:41)
> > at
> > mvm.rya.api.resolver.impl.DateTimeRyaTypeResolverTest.testMilliSecon
> > ds
> > NoZone(DateTimeRyaTypeResolverTest.java:116)
> >
> > Thank You!
> >
> > *Amila Wijayarathna,*
> > undergraduate,
> > Faculty of Information Technology,
> > University of Moratuwa,
> > Sri Lanka.
> >
>

Reply via email to