Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6292

jcr.js.nodetypes tests fail when run in a different timezone

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Extensions
    • Labels:

      Description

      The NodeTypes module JSON comparison tests expect the formatted date to be in the '+01:00' time zone, most likely were developed in the Europe/Berlin timezone

      Of course, this fails when run in other timezones, for instance on Jenkins which has the timezone set to Etc/GMT or anywhere else in the world.

      Sandro Boehme - I think you're the best person to look into this, would be great to fix as it would remove two failed jobs on Jenkins.

      A sample test failure is:

      Tests run: 13, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.113 sec <<< FAILURE! - in org.apache.sling.jcr.js.nodetypes.PropertyDefGenerationTest
      testCompleteDatePropertyDefinition(org.apache.sling.jcr.js.nodetypes.PropertyDefGenerationTest)  Time elapsed: 0.037 sec  <<< FAILURE!
      org.junit.ComparisonFailure: Actual JSON: {"ntWithPropertyDefs": {"declaredPropertyDefinitions": [{
        "name": "datePropertyDef",
        "autoCreated": true,
        "mandatory": true,
        "protected": true,
        "onParentVersion": "VERSION",
        "defaultValues": [{
          "date": "2012-02-01T00:00:00.000Z",
          "type": "Date"
          }],
        "requiredType": "Date",
        "valueConstraints": ["2012-04-01T00:00:00Z"],
        "multiple": true
        }]}}
      
      Expected JSON: {  "ntWithPropertyDefs": {    "declaredPropertyDefinitions": [      {        "defaultValues": [          {            "date": "2012-02-01T00:00:00.000+01:00",            "type": "Date"          }        ],        "requiredType": "Date",        "valueConstraints": [          "2012-04-01T00:00:00Z"        ],        "multiple": true,        "autoCreated": true,        "mandatory": true,        "protected": true,        "onParentVersion": "VERSION",        "name": "datePropertyDef"      }    ]  }}: objects differed at key [ntWithPropertyDefs];: objects differed at key [declaredPropertyDefinitions];: arrays first differed at element [0];: objects differed at key [defaultValues];: arrays first differed at element [0];: objects differed at key [date]; expected:<...2-02-01T00:00:00.000[+01:00]> but was:<...2-02-01T00:00:00.000[Z]>
      	at org.junit.Assert.assertEquals(Assert.java:115)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:173)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:99)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:170)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:99)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:170)
      	at org.apache.sling.jcr.js.nodetypes.test.JSONAssert.assertEquals(JSONAssert.java:167)
      	at org.apache.sling.jcr.js.nodetypes.mock.MockNodeTypeGenerator.assertEqualsWithServletResult(MockNodeTypeGenerator.java:143)
      	at org.apache.sling.jcr.js.nodetypes.PropertyDefGenerationTest.testCompletePropertyDefinition(PropertyDefGenerationTest.java:123)
      	at org.apache.sling.jcr.js.nodetypes.PropertyDefGenerationTest.testCompleteDatePropertyDefinition(PropertyDefGenerationTest.java:70)

        Attachments

          Activity

            People

            • Assignee:
              sandro Sandro Boehme
              Reporter:
              rombert Robert Munteanu
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: