prathyushreddylpr opened a new pull request, #1516:
URL: https://github.com/apache/cxf/pull/1516

   ### Description
   Fixed the flaky tests named `testDeserialization` inside 
`SerializationTest.java` and `AttributeTest.java` classes. 
   
   
https://github.com/apache/cxf/blob/3048785bf03baf76750f448777dfb003b5b1c98e/rt/javascript/javascript-tests/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java#L91
   
   
https://github.com/apache/cxf/blob/3048785bf03baf76750f448777dfb003b5b1c98e/rt/javascript/javascript-tests/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java#L73
   
   #### Root Cause
   The test `testDeserialization` has been reported as flaky when run with the 
[NonDex](https://github.com/TestingResearchIllinois/NonDex) tool. The tests 
failed because of the serialization of Testbean and AttributeTestBean classes, 
where the order of elements in the serialized XML changes between runs. The 
contents of the serialized strings do not remain constant and hence the tests 
are failing.  
   
   #### Fix
   To define a specific order for the XML elements when the classes TestBean1 
and AttributeTestBean are serialized, we need to add the propOrder attribute to 
the @XmlType annotation. This attribute explicitly specifies the order in which 
fields should be serialized.
   
   ### How this has been tested?
   
   **Java:** openjdk version "11.0.20.1"
   **Maven:** Apache Maven 3.6.3
   
   1) **Module build** - Successful
   Command used - 
   ```
   mvn install -pl core -am -DskipTests
   ```
   
   2) **Regular test**  - Successful
   Command used - 
   ```
   mvn -pl rt/javascript/javascript-tests test 
-Dtest=org.apache.cxf.javascript.types.SerializationTest#testDeserialization
   ```
   
   ```
   mvn -pl rt/javascript/javascript-tests test 
-Dtest=org.apache.cxf.javascript.types.AttributeTest#testDeserialization
   ```
   
   3) **NonDex test**  - Failed
   Command used - 
   ```
   mvn -pl rt/javascript/javascript-tests 
edu.illinois:nondex-maven-plugin:2.1.7-SNAPSHOT:nondex 
-Dtest=org.apache.cxf.javascript.types.SerializationTest#testDeserialization
   ```
   
   ```
   
   mvn -pl rt/javascript/javascript-tests 
edu.illinois:nondex-maven-plugin:2.1.7-SNAPSHOT:nondex 
-Dtest=org.apache.cxf.javascript.types.AttributeTest#testDeserialization 
-DnondexRuns=10
   ```
   
   NonDex test passed after the fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to