Examples of ODataFeed


Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  @Test
  public void readLargeEmployeesFeed() throws Exception {
    InputStream file = getFileAsStream("LargeEmployeeFeed.xml");
    assertNotNull(file);

    ODataFeed feed =
        EntityProvider.readFeed("application/atom+xml", MockFacade.getMockEdm().getDefaultEntityContainer()
            .getEntitySet(
                "Employees"), file, DEFAULT_PROPERTIES);
    assertNotNull(feed);

    FeedMetadata feedMetadata = feed.getFeedMetadata();
    assertNotNull(feedMetadata);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

    // execute
    XmlEntityConsumer xec = new XmlEntityConsumer();
    EntityProviderReadProperties consumerProperties = EntityProviderReadProperties.init()
        .mergeSemantic(false).build();

    ODataFeed feed = xec.readFeed(entitySet, reqContent, consumerProperties);
    assertNotNull(feed);

    FeedMetadata feedMetadata = feed.getFeedMetadata();
    assertNotNull(feedMetadata);

    int inlineCount = feedMetadata.getInlineCount();
    // Null means no inlineCount found
    assertNotNull(inlineCount);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  private void testDeltaFeedWithDeltaLink(final String contentType) throws Exception {
    roomDataCount = 3;
    deletedRoomDataCount = 4;

    ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
    String deltaLink = feed.getFeedMetadata().getDeltaLink();

    assertNotNull(feed);
    assertEquals(roomDataCount, feed.getEntries().size());
    assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());

    ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);

    assertNotNull(deltaFeed);
    assertEquals(roomDataCount, deltaFeed.getEntries().size());
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  private void testDeltaFeedWithZeroEntries(final String contentType) throws Exception {
    roomDataCount = 0;
    deletedRoomDataCount = 0;

    ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
    String deltaLink = feed.getFeedMetadata().getDeltaLink();

    assertNotNull(feed);
    assertEquals(roomDataCount, feed.getEntries().size());
    assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());

    ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);

    assertNotNull(deltaFeed);
    assertEquals(roomDataCount, deltaFeed.getEntries().size());
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

    final String contentType = ContentType.APPLICATION_ATOM_XML_FEED.toContentTypeString();
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
    InputStream content = getFileAsStream("feed_employees.xml");
    EntityProviderReadProperties properties = EntityProviderReadProperties.init().build();

    ODataFeed feed = new ProviderFacadeImpl().readFeed(contentType, entitySet, content, properties);
    assertNotNull(feed);
    assertNotNull(feed.getEntries());
    assertNotNull(feed.getFeedMetadata());
    assertEquals(6, feed.getEntries().size());
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  @Test
  public void innerFeedNoMediaResourceWithoutCallback() throws Exception {
    ODataEntry outerEntry = prepareAndExecuteEntry(BUILDING_WITH_INLINE_ROOMS, "Buildings", DEFAULT_PROPERTIES);

    ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
    assertNotNull(innerRoomFeed);

    List<ODataEntry> rooms = innerRoomFeed.getEntries();
    assertNotNull(rooms);
    assertEquals(1, rooms.size());

    ODataEntry room = rooms.get(0);
    Map<String, Object> roomProperties = room.getProperties();
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  @Test
  public void innerFeedNoMediaResourceWithoutCallbackContainsNextLinkAndCount() throws Exception {
    ODataEntry outerEntry =
        prepareAndExecuteEntry(BUILDING_WITH_INLINE_ROOMS_NEXTLINK_AND_COUNT, "Buildings", DEFAULT_PROPERTIES);

    ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
    assertNotNull(innerRoomFeed);

    List<ODataEntry> rooms = innerRoomFeed.getEntries();
    assertNotNull(rooms);
    assertEquals(1, rooms.size());

    FeedMetadata roomsMetadata = innerRoomFeed.getFeedMetadata();
    assertEquals(Integer.valueOf(1), roomsMetadata.getInlineCount());
    assertEquals("nextLink", roomsMetadata.getNextLink());
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

    String content = "{\"d\":{\"Id\":\"1\",\"Name\":\"Building 1\","
        + "\"nb_Rooms\":[{\"Id\":\"1\",\"Name\":\"Room 1\"}]}}";
    InputStream contentBody = createContentAsStream(content);
    final ODataEntry outerEntry = new JsonEntityConsumer().readEntry(entitySet, contentBody, DEFAULT_PROPERTIES);
    assertNotNull(outerEntry);
    final ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
    assertNotNull(innerRoomFeed);

    final List<ODataEntry> rooms = innerRoomFeed.getEntries();
    assertNotNull(rooms);
    assertEquals(1, rooms.size());
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

  @Test
  public void innerFeedMediaResourceWithoutCallback() throws Exception {
    ODataEntry outerEntry = prepareAndExecuteEntry(TEAM_WITH_INLINE_EMPLOYEES, "Teams", DEFAULT_PROPERTIES);

    ODataFeed innerEmployeeFeed = (ODataFeed) outerEntry.getProperties().get("nt_Employees");
    assertNotNull(innerEmployeeFeed);

    List<ODataEntry> employees = innerEmployeeFeed.getEntries();
    assertNotNull(employees);
    assertEquals(3, employees.size());
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ep.feed.ODataFeed

    FeedCallback callback = new FeedCallback();
    EntityProviderReadProperties readProperties =
        EntityProviderReadProperties.init().mergeSemantic(false).callback(callback).build();
    ODataEntry outerEntry = prepareAndExecuteEntry(BUILDING_WITH_INLINE_ROOMS, "Buildings", readProperties);

    ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
    assertNull(innerRoomFeed);

    innerRoomFeed = callback.getFeed();

    List<ODataEntry> rooms = innerRoomFeed.getEntries();
    assertNotNull(rooms);
    assertEquals(1, rooms.size());

    ODataEntry room = rooms.get(0);
    Map<String, Object> roomProperties = room.getProperties();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.