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

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


  private List<PathSegment> getPathSegments(final String uri) throws UriSyntaxException {
    List<PathSegment> pathSegments = new ArrayList<PathSegment>();
    for (final String segment : uri.split("/", -1)) {
      final String unescapedSegment = unescape(segment);
      PathSegment oDataSegment = new ODataPathSegmentImpl(unescapedSegment, null);
      pathSegments.add(oDataSegment);
    }
    return pathSegments;
  }
View Full Code Here


  }

  private static List<PathSegment> convertPathSegmentList(final List<javax.ws.rs.core.PathSegment> pathSegments) {
    ArrayList<PathSegment> converted = new ArrayList<PathSegment>();
    for (final javax.ws.rs.core.PathSegment pathSegment : pathSegments) {
      final PathSegment segment =
          new ODataPathSegmentImpl(Decoder.decode(pathSegment.getPath()), pathSegment.getMatrixParameters());
      converted.add(segment);
    }
    return converted;
  }
View Full Code Here

  }

  public static List<PathSegment> getPathSegmentsAsODataPathSegmentMock(final List<String> segments) {
    final List<PathSegment> pathSegmentsMock = new ArrayList<PathSegment>();
    for (final String segment : segments) {
      PathSegment pathSegment = Mockito.mock(PathSegment.class);
      Mockito.when(pathSegment.getPath()).thenReturn(segment);
      pathSegmentsMock.add(pathSegment);
    }
    return pathSegmentsMock;
  }
View Full Code Here

  private Map<String, Object> parseLinkUri(final EdmEntitySet targetEntitySet, final String uriString)
      throws ODataException {
    final String serviceRoot = getContext().getPathInfo().getServiceRoot().toString();
    final String path = uriString.startsWith(serviceRoot.toString()) ?
        uriString.substring(serviceRoot.length()) : uriString;
    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())
View Full Code Here

  }

  private static List<PathSegment> convertPathSegmentList(final List<javax.ws.rs.core.PathSegment> pathSegments) {
    ArrayList<PathSegment> converted = new ArrayList<PathSegment>();
    for (final javax.ws.rs.core.PathSegment pathSegment : pathSegments) {
      final PathSegment segment =
          new ODataPathSegmentImpl(Decoder.decode(pathSegment.getPath()), pathSegment.getMatrixParameters());
      converted.add(segment);
    }
    return converted;
  }
View Full Code Here

      final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();

      final String path =
          uriString.startsWith(serviceRoot.toString()) ? uriString.substring(serviceRoot.length()) : uriString;

      final PathSegment pathSegment = new PathSegment() {
        @Override
        public String getPath() {
          return path;
        }
View Full Code Here

      final Edm edm = odataContext.getService().getEntityDataModel();

      for (String uriString : uriList) {
        final String path = uriString.startsWith(serviceRoot) ? uriString.substring(length) : uriString;

        final PathSegment pathSegment = new PathSegment() {
          @Override
          public String getPath() {
            return path;
          }
View Full Code Here

    selectItems.add(getSelectItem());
    return selectItems;
  }

  private SelectItem getSelectItem() {
    SelectItem selectItem = EasyMock.createMock(SelectItem.class);
    EasyMock.expect(selectItem.getProperty()).andStubReturn(getEdmPropertyForSelect());
    List<NavigationPropertySegment> navigationSegmentList = new ArrayList<NavigationPropertySegment>();
    EasyMock.expect(selectItem.getNavigationPropertySegments()).andStubReturn(navigationSegmentList);
    EasyMock.expect(selectItem.isStar()).andReturn(false).anyTimes();
    EasyMock.replay(selectItem);
    return selectItem;
  }
View Full Code Here

  /*
   * This Unit is supposed to test the building of Entity Provider Properties for query with $expand
   */
  @Test
  public void testGetEntityProviderPropertiesQuery() {
    GetEntitySetUriInfo getEntitySetUriInfo = mockEntitySetUriInfoForExpand();
    ODataJPAContext oDataJPAContext = getODataJPAContext();
    // Building the edm entity
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    Map<String, Object> edmEntity = new HashMap<String, Object>();
    edmEntity.put("ID", 1);
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.