You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Michael Beaver <mb...@us.ibm.com> on 2011/08/29 17:05:08 UTC

Test failures when replacing org.json libraries


Hi, shindiggers.

As part of our internal customization and building of shindig, we replace
the org.json.json* dependency with a different JSON implementation.  Our
version tends to be much less forgiving on the various inputs and
subsequently is causing some of the unit tests to fail during the maven
build.

Two areas where we see failures due to this are:
ConfigInjectionProcessor.java/ConfigInjectionProcessorTest.java - When the
various tests invoke the checkInjectConfig() method, the resulting
injectedConfig string contains an invalid token that the
org.json.JSONObject constructor ignores but our library chokes on.  The
offending token is ");code".  For now, I have simply modified our version
of the checkInjectConfig() method to remove this token from the
injectedConfig string prior to creating a new JSONObject with the value,
but would like input from the developer community on the presence of this
token and whether or not there is a better way of accomplishing this in the
injectedConfig string.

JsonDbOpensocialService.java/JsonDbOpensocialServiceTest.java - Many of the
methods within JsonDbOpensocialService rely on the filterFields() method to
create a new JSONObject based on a subset of an existing object.  We are
seeing a 4 unit tests fail when using our JSON implementation due to fields
not existing in the input object that were asked for as part of the
filtered output object.  For instance, a call to
JsonDbOpensocialServiceTest.testGetPersonAllFields() fails due to the
"accounts" key not existing in the input object (our library thinks it's
helpful to throw an Exception here since what the calling method asked for
isn't achievable due to missing fields).  The input object is derived from
the canonicaldb.json file and the desired fields in the output object are
derived from Person.Field.ALL_FIELDS, so there's definitely a misalignment
here that I suspect isn't being caught in the unit tests due to the
forgiving nature of the org.json API.
The other methods that fail in the test of the shindig-social-api are:
testGetPersonAllAppData() -> The key [appData] was not in the map
testGetPersonOneAppDataField() -> The key [appData.size] was not in the map
testGetPersonMultipleAppDataFields() -> The key [appData.size] was not in
the map

Any and all input is very much welcomed.

Thanks!

Michael Beaver
IBM Lotus
919-254-7007 (T/L 444)