geosolutions-it / geoserver-manager

Java client library for GeoServer
MIT License
253 stars 192 forks source link

Test at compile time fails. #166

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi all,

Steps to reproduce:

  1. - clone repository on a host
  2. - get in geoserver-manager folder
  3. - run 'mvn clean install'
2016-03-03 15:15:54,812 [main] WARN  it.geosolutions.geoserver.rest.GeoserverRESTTest @ 159 - === RUNNING TEST testIntegrationVersionDecoder
2016-03-03 15:15:54,812 [main] WARN  it.geosolutions.geoserver.rest.GeoserverRESTTest @ 160 - 
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in it.geosolutions.geoserver.decoder.VersionDecoderTest
Running it.geosolutions.geoserver.decoder.ResourceDecoderTest
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.037 sec - in it.geosolutions.geoserver.decoder.ResourceDecoderTest

Results :

Failed tests: 
  GSLayerEncoder21Test.testMetadata:109 null expected:<authority[2]> but was:<authority[1]>

Tests run: 134, Failures: 1, Errors: 0, Skipped: 1

Thanks for support.

LennartRoeder commented 8 years ago

The pull request does not fix it for me. I have a few more assertions failing, here are all of them:

line: 112 Expected :authority2 Actual :authority1

line: 114 Expected :identifier2 Actual :identifier1

line: 116 Expected :additionalId Actual :identifier2

line: 122 Expected :authority1 Actual :authority2

line: 124 Expected :identifier1 Actual :additionalId

ndlu2 commented 8 years ago

What operating system and Java version are you using? The ordering of the elements can differ based on the underlying JVM.

LennartRoeder commented 8 years ago

java version "1.8.0_72"

Java(TM) SE Runtime Environment (build 1.8.0_72-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode

Since all other tests and the library itself work it might me worth rewriting the test.

etj commented 8 years ago

Exactly. Build succeeds with jdk17, but fails on jdk18. Looking if we can have some consistent internal data handling (for instance SortedMaps instead of Maps).

ndlu2 commented 8 years ago

You can also fix this issue by changing the maps in GSLayerEncoder21.java in lines 56 and 57 to LinkedHashmaps and reordering the expected strings in the test class. LinkedHashmaps iterate in the order the elements are inserted, so the test should always pass. I can make the changes in my pull request you'd like. public Map<String,String> authorityURLList; public Map<String,List<String>> identifierList;