sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konrad Windszus (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SLING-8061) sling-mocks: Make compatible when Johnzon is managed to version 1.1
Date Wed, 31 Oct 2018 08:52:00 GMT

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

Konrad Windszus updated SLING-8061:
-----------------------------------
    Summary: sling-mocks: Make compatible when Johnzon is managed to version 1.1  (was: Make
compatible when Johnzon is managed to version 1.1)

> sling-mocks: Make compatible when Johnzon is managed to version 1.1
> -------------------------------------------------------------------
>
>                 Key: SLING-8061
>                 URL: https://issues.apache.org/jira/browse/SLING-8061
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: Testing Sling Mock 2.3.4
>            Reporter: Konrad Windszus
>            Priority: Major
>             Fix For: Testing Sling Mock 2.3.6
>
>
> Whenever sling-mock is used where {{johnzon-core}} is managed from 1.0.0 to 1.1.0 the
following exception is thrown when executing tests which leverage {{SlingContext.load().json(...)}}
> {code}
> [ERROR] testHitsPerPageWithHitsOnAzdePath(com.allianz.onemarketing.azde.vthp.core.services.impl.DuplicateContentCheckServiceImplTest)
 Time elapsed: 0.018 s  <<< ERROR!
> java.lang.NoClassDefFoundError: Could not initialize class org.apache.johnzon.core.JsonProviderImpl
> 	at sun.reflect.GeneratedConstructorAccessor33.newInstance(Unknown Source)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 	at java.lang.Class.newInstance(Class.java:442)
> 	at javax.json.spi.JsonProvider.doLoadProvider(JsonProvider.java:103)
> 	at javax.json.spi.JsonProvider.provider(JsonProvider.java:64)
> 	at javax.json.Json.createReaderFactory(Json.java:76)
> 	at org.apache.sling.jcr.contentparser.impl.JsonContentParser.<init>(JsonContentParser.java:74)
> 	at org.apache.sling.jcr.contentparser.ContentParserFactory.create(ContentParserFactory.java:54)
> 	at org.apache.sling.testing.mock.sling.loader.ContentLoader.<init>(ContentLoader.java:119)
> 	at org.apache.sling.testing.mock.sling.context.SlingContextImpl.load(SlingContextImpl.java:336)
> 	at org.apache.sling.testing.mock.sling.context.SlingContextImpl.load(SlingContextImpl.java:326)
> 	at ...
> {code}
> The reason is that Johnzon 1.1 implements JSON-P 1.1 and therefore references interfaces
from the newer spec (e.g. in https://github.com/apache/johnzon/blob/b2d205738c65fb53e768fca445fa611515417c19/johnzon-core/src/main/java/org/apache/johnzon/core/JsonProviderImpl.java#L38),
which are not contained in JSON-P 1.0. Unfortunately the version of JSON-P cannot be overwritten
by {{DependencyManagement}} as the GAV differs between JSON-P 1.0 ({{org.apache.geronimo.specs:geronimo-json_1.0_spec}})
and JSON-P 1.1 ({{org.apache.geronimo.specs:geronimo-json_1.1_spec}}).
> An easy fix for this is to load the dependencies for both JSON-P 1.1 instead from within
sling-mocks, that way it is compatible with both Johnzon-Core 1.0 and 1.1. (JSON-P 1.1 should
be backwards-compatible, so works with both Johnzon-Core 1.0 and 1.1).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message