@Test public void linksWithD() throws Exception { final String links = "{\"d\":[{\"uri\":\"http: JsonReader reader = new JsonReader(new InputStreamReader(createContentAsStream(links))); assertEquals(Arrays.asList("http: }
public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } } FeedMetadataImpl feedMetadata = new FeedMetadataImpl(); if (FormatJson.COUNT.equals(nextName)) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); nextName = reader.nextName(); } if (FormatJson.RESULTS.equals(nextName)) { links = readLinksArray(reader); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS) .addContent(nextName)); } if (reader.hasNext() && reader.peek() == JsonToken.NAME) { if (FormatJson.COUNT.equals(reader.nextName())) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT) .addContent(nextName)); } } for (; openedObjects > 0; openedObjects--) { reader.endObject(); } reader.peek(); } catch (final IOException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } catch (final IllegalStateException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } return links; }
JsonLinkConsumer { public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } } FeedMetadataImpl feedMetadata = new FeedMetadataImpl(); if (FormatJson.COUNT.equals(nextName)) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); nextName = reader.nextName(); } if (FormatJson.RESULTS.equals(nextName)) { links = readLinksArray(reader); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS) .addContent(nextName)); } if (reader.hasNext() && reader.peek() == JsonToken.NAME) { if (FormatJson.COUNT.equals(reader.nextName())) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT) .addContent(nextName)); } } for (; openedObjects > 0; openedObjects--) { reader.endObject(); } reader.peek(); } catch (final IOException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } catch (final IllegalStateException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } return links; } }
JsonLinkConsumer { public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } } FeedMetadataImpl feedMetadata = new FeedMetadataImpl(); if (FormatJson.COUNT.equals(nextName)) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); nextName = reader.nextName(); } if (FormatJson.RESULTS.equals(nextName)) { links = readLinksArray(reader); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS) .addContent(nextName)); } if (reader.hasNext() && reader.peek() == JsonToken.NAME) { if (FormatJson.COUNT.equals(reader.nextName())) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT) .addContent(nextName)); } } for (; openedObjects > 0; openedObjects--) { reader.endObject(); } reader.peek(); } catch (final IOException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } catch (final IllegalStateException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } return links; }  }
JsonLinkConsumer { public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } } FeedMetadataImpl feedMetadata = new FeedMetadataImpl(); if (FormatJson.COUNT.equals(nextName)) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); nextName = reader.nextName(); } if (FormatJson.RESULTS.equals(nextName)) { links = readLinksArray(reader); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS) .addContent(nextName)); } if (reader.hasNext() && reader.peek() == JsonToken.NAME) { if (FormatJson.COUNT.equals(reader.nextName())) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT) .addContent(nextName)); } } for (; openedObjects > 0; openedObjects--) { reader.endObject(); } reader.peek(); } catch (final IOException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } catch (final IllegalStateException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } return links; }  String readLink(final JsonReader reader, final EdmEntitySet entitySet); List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet); }
JsonLinkConsumer { public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); openedObjects++; nextName = reader.nextName(); } } FeedMetadataImpl feedMetadata = new FeedMetadataImpl(); if (FormatJson.COUNT.equals(nextName)) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); nextName = reader.nextName(); } if (FormatJson.RESULTS.equals(nextName)) { links = readLinksArray(reader); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS) .addContent(nextName)); } if (reader.hasNext() && reader.peek() == JsonToken.NAME) { if (FormatJson.COUNT.equals(reader.nextName())) { JsonFeedConsumer.readInlineCount(reader, feedMetadata); } else { throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT) .addContent(nextName)); } } for (; openedObjects > 0; openedObjects--) { reader.endObject(); } reader.peek(); } catch (final IOException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } catch (final IllegalStateException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } return links; }  String readLink(final JsonReader reader, final EdmEntitySet entitySet); List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet);  }