@Test public void testParseLinkNegative() { parser = new ODataEntityParser(mock("JPATypeMock(2)")); try { parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(2), "application/json"); fail("Exception Expected"); } catch (ODataJPARuntimeException e) { assertEquals(true, true); } catch (EdmException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; }
ODataEntityParser { public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; } }
ODataEntityParser { public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; } ODataEntityParser(final ODataJPAContext context); }
ODataEntityParser { public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; } ODataEntityParser(final ODataJPAContext context); final ODataEntry parseEntry(final EdmEntitySet entitySet,
      final InputStream content, final String requestContentType, final boolean merge); final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
      final Map<String, String> options); final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex); final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType); UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options); UriInfo parseBindingLink(final String link, final Map<String, String> options); }
ODataEntityParser { public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; } ODataEntityParser(final ODataJPAContext context); final ODataEntry parseEntry(final EdmEntitySet entitySet,
      final InputStream content, final String requestContentType, final boolean merge); final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
      final Map<String, String> options); final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex); final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType); UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options); UriInfo parseBindingLink(final String link, final Map<String, String> options);  }