本文整理汇总了Java中org.apache.olingo.odata2.api.ep.feed.ODataFeed.getFeedMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java ODataFeed.getFeedMetadata方法的具体用法?Java ODataFeed.getFeedMetadata怎么用?Java ODataFeed.getFeedMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.ep.feed.ODataFeed
的用法示例。
在下文中一共展示了ODataFeed.getFeedMetadata方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: roomsFeedWithEtagEntries
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void roomsFeedWithEtagEntries() throws Exception {
InputStream stream = getFileAsStream("feed_rooms_small.xml");
assertNotNull(stream);
ODataFeed feed =
EntityProvider.readFeed("application/atom+xml", MockFacade.getMockEdm().getDefaultEntityContainer()
.getEntitySet(
"Rooms"), stream, DEFAULT_PROPERTIES);
assertNotNull(feed);
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertNotNull(feedMetadata.getNextLink());
List<ODataEntry> entries = feed.getEntries();
assertEquals(3, entries.size());
ODataEntry singleRoom = entries.get(0);
EntryMetadata roomMetadata = singleRoom.getMetadata();
assertNotNull(roomMetadata);
assertEquals("W/\"1\"", roomMetadata.getEtag());
}
示例2: readEmployeesFeedWithInlineCountValid
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void readEmployeesFeedWithInlineCountValid() throws Exception {
// prepare
String content = readFile("feed_employees_full.xml");
assertNotNull(content);
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream reqContent = createContentAsStream(content);
// 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);
assertEquals(6, inlineCount);
}
示例3: readDeltaLink
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void readDeltaLink() throws Exception {
// prepare
String content = readFile("feed_with_delta_link.xml");
assertNotNull(content);
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream reqContent = createContentAsStream(content);
// 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);
String deltaLink = feedMetadata.getDeltaLink();
// Null means no deltaLink found
assertNotNull(deltaLink);
assertEquals("http://thisisadeltalink", deltaLink);
}
示例4: emptyFeed
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeed() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
String content = "{\"d\":{\"results\":[]}}";
InputStream contentBody = createContentAsStream(content);
// execute
JsonEntityConsumer xec = new JsonEntityConsumer();
ODataFeed feed = xec.readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
assertNotNull(feed);
List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(0, entries.size());
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertNull(feedMetadata.getInlineCount());
assertNull(feedMetadata.getNextLink());
}
示例5: innerFeedNoMediaResourceWithoutCallbackContainsNextLinkAndCount
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@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());
}
示例6: innerFeedNoMediaResourceWithCallbackContainsNextLinkAndCount
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedNoMediaResourceWithCallbackContainsNextLinkAndCount() 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());
}
示例7: readLargeEmployeesFeed
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@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);
}
示例8: emptyFeedWithoutDAndResults
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeedWithoutDAndResults() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
InputStream contentBody = createContentAsStream("[]");
final ODataFeed feed = new JsonEntityConsumer().readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
assertNotNull(feed);
final List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(0, entries.size());
final FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertNull(feedMetadata.getInlineCount());
assertNull(feedMetadata.getNextLink());
}
示例9: emptyFeedWithoutResults
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeedWithoutResults() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
InputStream contentBody = createContentAsStream("{\"d\":[]}");
final ODataFeed feed = new JsonEntityConsumer().readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
assertNotNull(feed);
final List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(0, entries.size());
final FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertNull(feedMetadata.getInlineCount());
assertNull(feedMetadata.getNextLink());
}
示例10: teamsFeedWithCount
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void teamsFeedWithCount() throws Exception {
ODataFeed feed = prepareAndExecuteFeed("JsonTeamsWithCount.json", "Teams", DEFAULT_PROPERTIES);
List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(2, entries.size());
// Check FeedMetadata
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertEquals(Integer.valueOf(3), feedMetadata.getInlineCount());
assertNull(feedMetadata.getNextLink());
}
示例11: teamsFeedWithCountWithoutD
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void teamsFeedWithCountWithoutD() throws Exception {
ODataFeed feed = prepareAndExecuteFeed("JsonTeamsWithCountWithoutD.json", "Teams", DEFAULT_PROPERTIES);
List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(2, entries.size());
// Check FeedMetadata
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertEquals(Integer.valueOf(3), feedMetadata.getInlineCount());
assertNull(feedMetadata.getNextLink());
}
示例12: feedWithInlineCountAndNextAndDelta
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void feedWithInlineCountAndNextAndDelta() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
String content =
"{\"d\":{\"__count\":\"3\",\"results\":[{" +
"\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
"\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
"\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
"\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}]," +
"\"__next\":\"Rooms?$skiptoken=98&$inlinecount=allpages\",\"__delta\":\"deltalink\"}}";
assertNotNull(content);
InputStream contentBody = createContentAsStream(content);
// execute
JsonEntityConsumer xec = new JsonEntityConsumer();
ODataFeed feed = xec.readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
assertNotNull(feed);
List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(1, entries.size());
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertEquals(Integer.valueOf(3), feedMetadata.getInlineCount());
assertEquals("Rooms?$skiptoken=98&$inlinecount=allpages", feedMetadata.getNextLink());
assertEquals("deltalink", feedMetadata.getDeltaLink());
}
示例13: feedWithTeamAndNextAndDelta
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void feedWithTeamAndNextAndDelta() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
String content =
"{\"d\":{\"results\":[{" +
"\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
"\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
"\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
"\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}]," +
"\"__next\":\"Rooms?$skiptoken=98\"," +
"\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
assertNotNull(content);
InputStream contentBody = createContentAsStream(content);
// execute
JsonEntityConsumer xec = new JsonEntityConsumer();
ODataFeed feed = xec.readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
assertNotNull(feed);
List<ODataEntry> entries = feed.getEntries();
assertNotNull(entries);
assertEquals(1, entries.size());
FeedMetadata feedMetadata = feed.getFeedMetadata();
assertNotNull(feedMetadata);
assertEquals("Rooms?$skiptoken=98", feedMetadata.getNextLink());
assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711", feedMetadata.getDeltaLink());
}
示例14: testReadFeed
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testReadFeed() throws Exception {
// prepare
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
String content = readFile("feed_employees.xml");
InputStream contentAsStream = createContentAsStream(content);
// execute
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataFeed feedResult =
xec.readFeed(entitySet, contentAsStream, EntityProviderReadProperties.init().mergeSemantic(false).build());
// verify feed result
// metadata
FeedMetadata metadata = feedResult.getFeedMetadata();
assertNull(metadata.getInlineCount());
assertNull(metadata.getNextLink());
assertNull(metadata.getDeltaLink());
// entries
List<ODataEntry> entries = feedResult.getEntries();
assertEquals(6, entries.size());
// verify first employee
ODataEntry firstEmployee = entries.get(0);
Map<String, Object> properties = firstEmployee.getProperties();
assertEquals(9, properties.size());
assertEquals("1", properties.get("EmployeeId"));
assertEquals("Walter Winter", properties.get("EmployeeName"));
assertEquals("1", properties.get("ManagerId"));
assertEquals("1", properties.get("RoomId"));
assertEquals("1", properties.get("TeamId"));
Map<String, Object> location = (Map<String, Object>) properties.get("Location");
assertEquals(2, location.size());
assertEquals("Germany", location.get("Country"));
Map<String, Object> city = (Map<String, Object>) location.get("City");
assertEquals(2, city.size());
assertEquals("69124", city.get("PostalCode"));
assertEquals("Heidelberg", city.get("CityName"));
assertEquals(Integer.valueOf(52), properties.get("Age"));
Calendar entryDate = (Calendar) properties.get("EntryDate");
assertEquals(915148800000L, entryDate.getTimeInMillis());
assertEquals(TimeZone.getTimeZone("GMT"), entryDate.getTimeZone());
assertEquals("Employees('1')/$value", properties.get("ImageUrl"));
}
示例15: testReadFeedWithInlineCountAndNextLink
import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testReadFeedWithInlineCountAndNextLink() throws Exception {
// prepare
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
String content = readFile("feed_employees_full.xml");
InputStream contentAsStream = createContentAsStream(content);
// execute
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataFeed feedResult =
xec.readFeed(entitySet, contentAsStream, EntityProviderReadProperties.init().mergeSemantic(false).build());
// verify feed result
// metadata
FeedMetadata metadata = feedResult.getFeedMetadata();
assertEquals(Integer.valueOf(6), metadata.getInlineCount());
assertEquals("http://thisisanextlink", metadata.getNextLink());
assertNull(metadata.getDeltaLink());
// entries
List<ODataEntry> entries = feedResult.getEntries();
assertEquals(6, entries.size());
// verify first employee
ODataEntry firstEmployee = entries.get(0);
Map<String, Object> properties = firstEmployee.getProperties();
assertEquals(9, properties.size());
assertEquals("1", properties.get("EmployeeId"));
assertEquals("Walter Winter", properties.get("EmployeeName"));
assertEquals("1", properties.get("ManagerId"));
assertEquals("1", properties.get("RoomId"));
assertEquals("1", properties.get("TeamId"));
Map<String, Object> location = (Map<String, Object>) properties.get("Location");
assertEquals(2, location.size());
assertEquals("Germany", location.get("Country"));
Map<String, Object> city = (Map<String, Object>) location.get("City");
assertEquals(2, city.size());
assertEquals("69124", city.get("PostalCode"));
assertEquals("Heidelberg", city.get("CityName"));
assertEquals(Integer.valueOf(52), properties.get("Age"));
Calendar entryDate = (Calendar) properties.get("EntryDate");
assertEquals(915148800000L, entryDate.getTimeInMillis());
assertEquals(TimeZone.getTimeZone("GMT"), entryDate.getTimeZone());
assertEquals("Employees('1')/$value", properties.get("ImageUrl"));
}