Manuel Blechschmidt created OLINGO-1154:
-------------------------------------------

             Summary: TestCases in odata2-jpa-processor/jpa-core can fail if 
timeing is bad
                 Key: OLINGO-1154
                 URL: https://issues.apache.org/jira/browse/OLINGO-1154
             Project: Olingo
          Issue Type: Bug
          Components: odata2-jpa
    Affects Versions: V2 2.0.9
            Reporter: Manuel Blechschmidt


 # Do the following steps multiple times:

{code}
git clone https://github.com/apache/olingo-odata2.git
cd olingo-odata2/odata2-jpa-processor/jpa-core
mvn install
{code}

Expected:
 * The test cases are always working

Actual:
 * The test case 
JPAEntityTest.testCreateODataEntryWithComplexTypeWithMoreProperties can fail 
when timing is bad

The problem is, that the ODataEntryMockUtil creates multiple Date and Calendar 
instances and hopes that they are created in the same millisecond. This is not 
always the case:

{code:title=ODataEntryMockUtil.java}
..
VALUE_DATE = Calendar.getInstance(TimeZone.getDefault()).getTime();
      VALUE_DATE1 = new 
java.sql.Date(Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis());
      VALUE_TIME = new 
java.sql.Time(Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis());
      VALUE_TIMESTAMP = new 
Timestamp(Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis());
      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MDATE, 
Calendar.getInstance(TimeZone.getDefault()));
      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MDATE1, 
Calendar.getInstance(TimeZone.getDefault()));
      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MTIME, 
Calendar.getInstance(TimeZone.getDefault()));
      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MTIMESTAMP, 
Calendar.getInstance(TimeZone.getDefault()));
...
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to