Package org.apache.olingo.odata2.api.uri

Examples of org.apache.olingo.odata2.api.uri.PathSegment


        final TestOlingo2ResponseHandler<ServiceDocument> responseHandler =
            new TestOlingo2ResponseHandler<ServiceDocument>();

        olingoApp.read(null, "", null, responseHandler);

        final ServiceDocument serviceDocument = responseHandler.await();
        final List<Collection> collections = serviceDocument.getAtomInfo().getWorkspaces().get(0).getCollections();
        assertEquals("Service Atom Collections", 3, collections.size());
        LOG.info("Service Atom Collections:  {}", collections);

        final List<EdmEntitySetInfo> entitySetsInfo = serviceDocument.getEntitySetsInfo();
        assertEquals("Service Entity Sets", 3, entitySetsInfo.size());
        LOG.info("Service Document Entries:  {}", entitySetsInfo);
    }
View Full Code Here


    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    // Mocking the navigation property segments and adding to expand list
    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
    EasyMock.replay(navigationPropertySegment);
    navigationPropertyList.add(navigationPropertySegment);
    expandList.add(navigationPropertyList);
    // Mocking EntityUriInfo
    GetEntityUriInfo entityUriInfo = EasyMock.createMock(GetEntityUriInfo.class);
View Full Code Here

    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    // Mocking the navigation property segments and adding to expand list
    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
    EasyMock.replay(navigationPropertySegment);
    navigationPropertyList.add(navigationPropertySegment);
    expandList.add(navigationPropertyList);
    // Mocking EntityUriInfo
    GetEntitySetUriInfo entitySetUriInfo = EasyMock.createMock(GetEntitySetUriInfo.class);
View Full Code Here

      EasyMock.expect(navigationProperty.getName()).andStubReturn(navPropertyName);
    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    NavigationPropertySegment navPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.replay(navPropertySegment);
    return navPropertySegment;
  }
View Full Code Here

    return paging;
  }

  private PathInfo getLocalPathInfo() {
    PathInfo pathInfo = EasyMock.createMock(PathInfo.class);
    EasyMock.expect(pathInfo.getServiceRoot()).andStubReturn(getLocalURI());
    EasyMock.expect(pathInfo.getRequestUri()).andStubReturn(getRequestURI());
    EasyMock.replay(pathInfo);
    return pathInfo;
  }
View Full Code Here

      uriString = EntityProvider.readLink(contentType, entitySet, content);
      ODataContext odataContext = context.getODataContext();
      final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
      final String path =
          uriString.startsWith(serviceRoot.toString()) ? uriString.substring(serviceRoot.length()) : uriString;
      final PathSegment pathSegment = getPathSegment(path);
      edm = getEdm();
      uri = UriParser.parse(edm, Arrays.asList(pathSegment), Collections.<String, String> emptyMap());
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
    }
View Full Code Here

  public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
      throws ODataJPARuntimeException {
    List<PathSegment> pathSegments = new ArrayList<PathSegment>();
    for (String link : linkSegments) {
      PathSegment pathSegment = getPathSegment(link);
      pathSegments.add(pathSegment);
    }
    UriInfo uriInfo = null;
    try {
      edm = getEdm();
View Full Code Here

    return uriInfo;
  }

  public UriInfo parseBindingLink(final String link, final Map<String, String> options)
      throws ODataJPARuntimeException {
    final PathSegment pathSegment = getPathSegment(link);
    UriInfo uriInfo = null;
    try {
      edm = getEdm();
      uriInfo = UriParser.parse(edm, Arrays.asList(pathSegment), options);
    } catch (ODataException e) {
View Full Code Here

    }
    return edm;
  }

  private PathSegment getPathSegment(final String path) {
    final PathSegment pathSegment = new PathSegment() {

      @Override
      public String getPath() {
        return path;
      }
View Full Code Here

    ODataRequest request = mock(ODataRequest.class);
    when(request.getMethod()).thenReturn(method);
    PathInfo pathInfo = mock(PathInfo.class);
    List<PathSegment> segments = new ArrayList<PathSegment>();
    for (final String pathSegment : pathSegments) {
      PathSegment segment = mock(PathSegment.class);
      when(segment.getPath()).thenReturn(pathSegment);
      segments.add(segment);
    }
    when(pathInfo.getODataSegments()).thenReturn(segments);
    when(request.getPathInfo()).thenReturn(pathInfo);
    when(request.getQueryParameters()).thenReturn(
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.uri.PathSegment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.