You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by "Fabian Christ (JIRA)" <ji...@apache.org> on 2012/12/12 21:04:19 UTC

[jira] [Updated] (STANBOL-659) Adapt Unit test to work independend of Hashing algorithm used by HashSets/-Maps

     [ https://issues.apache.org/jira/browse/STANBOL-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fabian Christ updated STANBOL-659:
----------------------------------

    Component/s: Integration Test
    
> Adapt Unit test to work independend of Hashing algorithm used by HashSets/-Maps
> -------------------------------------------------------------------------------
>
>                 Key: STANBOL-659
>                 URL: https://issues.apache.org/jira/browse/STANBOL-659
>             Project: Stanbol
>          Issue Type: Test
>          Components: Integration Test
>            Reporter: Rupert Westenthaler
>            Assignee: Rupert Westenthaler
>
> With Java SE 7u6 and all current SE 8 build the hash algorithm used by the HashSet/HashMap based Set implementation will change (see [1] for details). 
> It is important to note that the iteration order of hash based set implementations relays on the used hash algorithm. Therefore with this change the iteration order of will change - something that has not happened since JDK1.2 if I remember correctly.
> Related to Stanbol this has the following affects:
> * ordering of Triples in serialize RDF graphs changes
> * ordering of Roles for the Factstore changes -> resulting in different sorted SQL queries (e.g. such as ordering of selected fields will change)
> while this does not have any effect for normal operation it does affect a lot of unit tests as those do often check against String patterns that will no longer match if the ordering in the serialization changes.
> Validate compatibility of the Tests:
> * ensure that the new hashing algorith is used for all HashSet/-Maps under Java7u6 by setting "jdk.map.althashing.threshold=0" (see also [1])
> * check build with JDK 1.6 (old hashing)
> * check build with JDK 1.7u6+ (new hashing)
> Adapting Tests/Components:
> * For the JSON-LD serializer I suggest to use TreeMaps. This has the advantage that properties will be sorted alphabetically - what will the serialized RDF made much easier to read for users. This is also important because all JSON-LD specific properties start with '@' and will therefore be in the beginning of an JSON object.
> * Adapt unit tests for JSON-LD to validate the alphabetically ordered JSON properties.  
> * For Roles of the FactStore I also suggest to use a TreeMap to ensure that the created SQL queries are independend of the used JDK version.
> * All other unit tests affected by this need to be adapted to be independent of this (e.g. changed serialization order of triples.
> [1] http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-May/003118.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira