• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ODataEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.odata2.api.ep.entry.ODataEntry的典型用法代码示例。如果您正苦于以下问题:Java ODataEntry类的具体用法?Java ODataEntry怎么用?Java ODataEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODataEntry类属于org.apache.olingo.odata2.api.ep.entry包,在下文中一共展示了ODataEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
/**
 * Reads an entry (an Entity, a property, a complexType, ...).
 * 
 * @param resource_path the resource path to the parent of the requested
 *    EntitySet, as defined in {@link #getResourcePath(URI)}.
 * @param query_parameters Query parameters, as defined in {@link URI}.
 * 
 * @return an ODataEntry for the given {@code resource_path}.
 * 
 * @throws HttpException if the server emits an HTTP error code.
 * @throws IOException if the connection with the remote service fails.
 * @throws EdmException if the EDM does not contain the given entitySetName.
 * @throws EntityProviderException if reading of data (de-serialization)
 *    fails.
 * @throws UriSyntaxException violation of the OData URI construction rules.
 * @throws UriNotMatchingException URI parsing exception.
 * @throws ODataException encapsulate the OData exceptions described above.
 * @throws InterruptedException if running thread has been interrupted.
 */
public ODataEntry readEntry(String resource_path,
   Map<String, String> query_parameters) throws IOException, ODataException, InterruptedException
{
   if (resource_path == null || resource_path.isEmpty ())
      throw new IllegalArgumentException (
         "resource_path must not be null or empty.");
   
   ContentType contentType = ContentType.APPLICATION_ATOM_XML;
   
   String absolutUri = serviceRoot.toString () + '/' + resource_path;
   
   // Builds the query parameters string part of the URL.
   absolutUri = appendQueryParam (absolutUri, query_parameters);
   
   InputStream content = execute (absolutUri, contentType, "GET");
   
   return EntityProvider.readEntry(contentType.type (),
      getEntitySet (resource_path), content,
      EntityProviderReadProperties.init ().build ());
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:40,代码来源:ODataClient.java


示例2: testReadEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void testReadEntry() throws Exception {
    final TestOlingo2ResponseHandler<ODataEntry> responseHandler = new TestOlingo2ResponseHandler<ODataEntry>();

    olingoApp.read(edm, TEST_MANUFACTURER, null, responseHandler);
    ODataEntry entry = responseHandler.await();
    LOG.info("Single Entry:  {}", prettyPrint(entry));

    responseHandler.reset();

    olingoApp.read(edm, TEST_CAR, null, responseHandler);
    entry = responseHandler.await();
    LOG.info("Single Entry:  {}", prettyPrint(entry));

    responseHandler.reset();
    final Map<String, String> queryParams = new HashMap<String, String>();
    queryParams.put(SystemQueryOption.$expand.toString(), CARS);

    olingoApp.read(edm, TEST_MANUFACTURER, queryParams, responseHandler);

    ODataEntry entryExpanded = responseHandler.await();
    LOG.info("Single Entry with expanded Cars relation:  {}", prettyPrint(entryExpanded));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:Olingo2AppAPITest.java


示例3: readEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
public ODataEntry readEntry(String serviceUri, String contentType,
		String entitySetName, String keyValue, SystemQueryOptions options)
		throws IllegalStateException, IOException, EdmException,
		EntityProviderException {
	EdmEntityContainer entityContainer = readEdm()
			.getDefaultEntityContainer();
	logger.info("Entity container is => " + entityContainer.getName());
	String absolutUri = createUri(serviceUri, entitySetName, keyValue,
			options);

	InputStream content = executeGet(absolutUri, contentType);

	return EntityProvider.readEntry(contentType,
			entityContainer.getEntitySet(entitySetName), content,
			EntityProviderReadProperties.init().build());
}
 
开发者ID:SAP,项目名称:C4CODATAAPIDEVGUIDE,代码行数:17,代码来源:ServiceTicketODataConsumer.java


示例4: parseEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
private ODataEntry parseEntry(final EdmEntitySet entitySet, final InputStream content,
    final String requestContentType, final EntityProviderReadProperties properties) throws ODataBadRequestException {
  ODataContext context = getContext();
  final int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readEntry");

  ODataEntry entryValues;
  try {
    entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, properties);
  } catch (final EntityProviderException e) {
    throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
  }

  context.stopRuntimeMeasurement(timingHandle);

  return entryValues;
}
 
开发者ID:mibo,项目名称:janos,代码行数:17,代码来源:DataSourceProcessor.java


示例5: readSimpleBuildingEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readSimpleBuildingEntry() throws Exception {
  ODataEntry result = prepareAndExecuteEntry(SIMPLE_ENTRY_BUILDING, "Buildings", DEFAULT_PROPERTIES);
  // verify
  Map<String, Object> properties = result.getProperties();
  assertNotNull(properties);
  assertEquals("1", properties.get("Id"));
  assertEquals("Building 1", properties.get("Name"));
  assertNull(properties.get("Image"));
  assertNull(properties.get("nb_Rooms"));

  List<String> associationUris = result.getMetadata().getAssociationUris("nb_Rooms");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Buildings('1')/nb_Rooms", associationUris.get(0));

  checkMediaDataInitial(result.getMediaMetadata());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:JsonEntryConsumerTest.java


示例6: updateEntity

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Override
public ODataResponse updateEntity(final PutMergePatchUriInfo uriInfo, final InputStream content,
    final String requestContentType, final boolean merge, final String contentType) throws ODataException {
  Object data = retrieveData(
      uriInfo.getStartEntitySet(),
      uriInfo.getKeyPredicates(),
      uriInfo.getFunctionImport(),
      mapFunctionParameters(uriInfo.getFunctionImportParameters()),
      uriInfo.getNavigationSegments());

  if (!appliesFilter(data, uriInfo.getFilter())) {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }

  final EdmEntitySet entitySet = uriInfo.getTargetEntitySet();
  final EdmEntityType entityType = entitySet.getEntityType();
  final EntityProviderReadProperties properties = EntityProviderReadProperties.init()
      .mergeSemantic(merge)
      .addTypeMappings(getStructuralTypeTypeMap(data, entityType))
      .build();
  final ODataEntry entryValues = parseEntry(entitySet, content, requestContentType, properties);

  setStructuralTypeValuesFromMap(data, entityType, entryValues.getProperties(), merge);

  return ODataResponse.newBuilder().eTag(constructETag(entitySet, data)).build();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:ListsProcessor.java


示例7: normalizeInlineEntries

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
  List<ODataEntry> entries = null;
  try {
    for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
      Object inline = oDataEntryProperties.get(navigationPropertyName);
      if (inline instanceof ODataFeed) {
        entries = ((ODataFeed) inline).getEntries();
      } else if (inline instanceof ODataEntry) {
        entries = new ArrayList<ODataEntry>();
        entries.add((ODataEntry) inline);
      }
      if (entries != null) {
        oDataEntryProperties.put(navigationPropertyName, entries);
        entries = null;
      }
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException
        .throwException(ODataJPARuntimeException.GENERAL
            .addContent(e.getMessage()), e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:JPAEntity.java


示例8: extractLinkURI

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<String> extractLinkURI(ODataEntry oDataEntry, String navigationPropertyName) {

  List<String> links = new ArrayList<String>();

  String link = null;
  Object object = oDataEntry.getProperties().get(navigationPropertyName);
  if (object == null) {
    return links;
  }
  if (object instanceof ODataEntry) {
    link = ((ODataEntry) object).getMetadata().getUri();
    if (!link.isEmpty()) {
      links.add(link);
    }
  } else {
    for (ODataEntry entry : (List<ODataEntry>) object) {
      link = entry.getMetadata().getUri();
      if (link != null && link.isEmpty() == false) {
        links.add(link);
      }
    }
  }

  return links;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:JPALink.java


示例9: mockODataEntryWithNullValue

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
public static ODataEntry mockODataEntryWithNullValue(final String entityName) {
  ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
  Map<String, Object> propertiesMap = mockODataEntryProperties(entityName);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MINT, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MCHAR, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_CLOB, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_ENUM, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MBLOB, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MCARRAY, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MC, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MCHARARRAY, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MDATETIME, null);
  propertiesMap.put(JPATypeMock.PROPERTY_NAME_MSTRING, null);
  EasyMock.expect(oDataEntry.getProperties()).andReturn(propertiesMap).anyTimes();

  enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
  EasyMock.replay(oDataEntry);
  return oDataEntry;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ODataEntryMockUtil.java


示例10: readSimpleTeamEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readSimpleTeamEntry() throws Exception {
  ODataEntry result = prepareAndExecuteEntry(SIMPLE_ENTRY_TEAM, "Teams", DEFAULT_PROPERTIES);

  Map<String, Object> properties = result.getProperties();
  assertNotNull(properties);
  assertEquals("1", properties.get("Id"));
  assertEquals("Team 1", properties.get("Name"));
  assertEquals(Boolean.FALSE, properties.get("isScrumTeam"));
  assertNull(properties.get("nt_Employees"));

  List<String> associationUris = result.getMetadata().getAssociationUris("nt_Employees");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees", associationUris.get(0));

  checkMediaDataInitial(result.getMediaMetadata());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:JsonEntryConsumerTest.java


示例11: innerFeedNoMediaResourceWithCallbackContainsNextLinkAndCount

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的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());

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:JsonEntryDeepInsertFeedTest.java


示例12: readEntryWithNullProperty

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readEntryWithNullProperty() throws Exception {
  final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
  final String content = "{\"Id\":\"99\",\"Seats\":null}";

  for (final boolean merge : new boolean[] { false, true }) {
    final ODataEntry result = new JsonEntityConsumer().readEntry(entitySet, createContentAsStream(content),
        EntityProviderReadProperties.init().mergeSemantic(merge).build());

    final Map<String, Object> properties = result.getProperties();
    assertNotNull(properties);
    assertEquals(2, properties.size());
    assertEquals("99", properties.get("Id"));
    assertTrue(properties.containsKey("Seats"));
    assertNull(properties.get("Seats"));

    assertTrue(result.getMetadata().getAssociationUris("nr_Employees").isEmpty());
    checkMediaDataInitial(result.getMediaMetadata());
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JsonEntryConsumerTest.java


示例13: RoomEntryWithInlineEmployeeInlineTeam

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
/**
 * Room has inline entity to Employees and has inline entry To Team
 * Scenario of 1:n:1 navigation 
 * E.g: Rooms('1')?$expand=nr_Employees/ne_Team
 * @throws Exception
 */
@Test
public void RoomEntryWithInlineEmployeeInlineTeam() throws Exception {
  InputStream stream = getFileAsStream("JsonRoom_InlineEmployeesToTeam.json");
  assertNotNull(stream);
  FeedCallback callback = new FeedCallback();

  EntityProviderReadProperties readProperties = EntityProviderReadProperties.init()
      .mergeSemantic(false).callback(callback).build();

  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
  JsonEntityConsumer xec = new JsonEntityConsumer();
  ODataEntry result =
      xec.readEntry(entitySet, stream, readProperties);
  assertNotNull(result);
  assertEquals(4, result.getProperties().size());

  Map<String, Object> inlineEntries = callback.getNavigationProperties();
  getExpandedData(inlineEntries, result);
  assertEquals(5, result.getProperties().size());
  for (ODataEntry employeeEntry : ((ODataFeed)result.getProperties().get("nr_Employees")).getEntries()) {
    assertEquals(10, employeeEntry.getProperties().size());
    assertEquals(3, ((ODataEntry)employeeEntry.getProperties().get("ne_Team")).getProperties().size());
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:31,代码来源:JsonEntryConsumerTest.java


示例14: readSimpleRoomEntry

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readSimpleRoomEntry() throws Exception {
  ODataEntry roomEntry = prepareAndExecuteEntry(SIMPLE_ENTRY_ROOM, "Rooms", DEFAULT_PROPERTIES);

  // verify
  Map<String, Object> properties = roomEntry.getProperties();
  assertEquals(4, properties.size());

  assertEquals("1", properties.get("Id"));
  assertEquals("Room 1", properties.get("Name"));
  assertEquals((short) 1, properties.get("Seats"));
  assertEquals((short) 1, properties.get("Version"));

  List<String> associationUris = roomEntry.getMetadata().getAssociationUris("nr_Employees");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms('1')/nr_Employees", associationUris.get(0));

  associationUris = roomEntry.getMetadata().getAssociationUris("nr_Building");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms('1')/nr_Building", associationUris.get(0));

  EntryMetadata metadata = roomEntry.getMetadata();
  assertEquals("W/\"1\"", metadata.getEtag());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:JsonEntryConsumerTest.java


示例15: getExpandedData

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
/**
 * @param inlineEntries
 * @param feed
 * @param entry
 */
private void getExpandedData(Map<String, Object> inlineEntries, ODataEntry entry) {
  assertNotNull(entry);
  Map<String, ExpandSelectTreeNode> expandNodes = entry.getExpandSelectTree().getLinks();
  for (Entry<String, ExpandSelectTreeNode> expand : expandNodes.entrySet()) {
    assertNotNull(expand.getKey());
    if (inlineEntries.containsKey(expand.getKey() + entry.getMetadata().getId())) {
      if (inlineEntries.get(expand.getKey() + entry.getMetadata().getId()) instanceof ODataFeed) {
        ODataFeed innerFeed = (ODataFeed) inlineEntries.get(expand.getKey() + entry.getMetadata().getId());
        assertNotNull(innerFeed);
        getExpandedData(inlineEntries, innerFeed);
        entry.getProperties().put(expand.getKey(), innerFeed);
      } else if (inlineEntries.get(expand.getKey() + entry.getMetadata().getId()) instanceof ODataEntry) {
        ODataEntry innerEntry = (ODataEntry) inlineEntries.get(expand.getKey() + entry.getMetadata().getId());
        assertNotNull(innerEntry);
        getExpandedData(inlineEntries, innerEntry);
        entry.getProperties().put(expand.getKey(), innerEntry);
      }
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:XmlFeedConsumerTest.java


示例16: emptyFeed

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的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());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JsonFeedConsumerTest.java


示例17: readContentOnlyEmployeeWithAdditionalLink

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readContentOnlyEmployeeWithAdditionalLink() throws Exception {
  // prepare
  String content = readFile("EmployeeContentOnlyWithAdditionalLink.xml");
  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
  InputStream contentBody = createContentAsStream(content);

  // execute
  XmlEntityConsumer xec = new XmlEntityConsumer();
  ODataEntry result =
      xec.readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(true).build());

  // verify
  assertEquals(9, result.getProperties().size());
  List<String> associationUris = result.getMetadata().getAssociationUris("ne_Manager");
  assertEquals(1, associationUris.size());
  assertEquals("Managers('1')", associationUris.get(0));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:XmlEntityConsumerTest.java


示例18: roomsFeedWithRoomsToEmployeesInlineTeams

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
/**
 * Rooms navigate to Employees and has inline entry Teams
 * E.g: Rooms('1')/nr_Employees?$expand=ne_Team
 * @throws Exception
 */
@Test
public void roomsFeedWithRoomsToEmployeesInlineTeams() throws Exception {
  InputStream stream = getFileAsStream("JsonRoomsToEmployeesWithInlineTeams.json");
  assertNotNull(stream);
  FeedCallback callback = new FeedCallback();

  EntityProviderReadProperties readProperties = EntityProviderReadProperties.init()
      .mergeSemantic(false).callback(callback).build();

  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
  JsonEntityConsumer xec = new JsonEntityConsumer();
  ODataDeltaFeed feed = xec.readDeltaFeed(entitySet, stream, readProperties);
  assertNotNull(feed);
  assertEquals(2, feed.getEntries().size());

  Map<String, Object> inlineEntries = callback.getNavigationProperties();
  getExpandedData(inlineEntries, feed);
  for (ODataEntry entry : feed.getEntries()) {
    assertEquals(10, entry.getProperties().size());
    assertEquals(3, ((ODataEntry)entry.getProperties().get("ne_Team")).getProperties().size());
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:28,代码来源:JsonFeedConsumerTest.java


示例19: readWithInlineContentIgnored

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
@Test
public void readWithInlineContentIgnored() throws Exception {
  // prepare
  String content = readFile("expanded_team.xml");
  assertNotNull(content);

  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
  InputStream reqContent = createContentAsStream(content);

  // execute
  XmlEntityConsumer xec = new XmlEntityConsumer();
  ODataEntry entry =
      xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(false).build());

  // validate
  assertNotNull(entry);
  Map<String, Object> properties = entry.getProperties();
  assertEquals("1", properties.get("Id"));
  assertEquals("Team 1", properties.get("Name"));
  assertEquals(Boolean.FALSE, properties.get("isScrumTeam"));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:XmlEntityConsumerTest.java


示例20: readWithInlineContentEmployeeRoomEntrySpecialXml

import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入依赖的package包/类
/**
 * Reads an inline Room at an Employee with specially formatted XML (see issue ODATAFORSAP-92).
 */
@Test
public void readWithInlineContentEmployeeRoomEntrySpecialXml() throws Exception {

  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
  InputStream reqContent = createContentAsStream(EMPLOYEE_1_ROOM_XML, true);

  // execute
  XmlEntityConsumer xec = new XmlEntityConsumer();
  ODataEntry entry =
      xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(true).build());

  // validate
  assertNotNull(entry);
  Map<String, Object> properties = entry.getProperties();
  assertEquals("1", properties.get("EmployeeId"));
  assertEquals("Walter Winter", properties.get("EmployeeName"));
  ODataEntry room = (ODataEntry) properties.get("ne_Room");
  Map<String, Object> roomProperties = room.getProperties();
  assertEquals(4, roomProperties.size());
  assertEquals("1", roomProperties.get("Id"));
  assertEquals("Room 1", roomProperties.get("Name"));
  assertEquals(Short.valueOf("1"), roomProperties.get("Seats"));
  assertEquals(Short.valueOf("1"), roomProperties.get("Version"));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:28,代码来源:XmlEntityConsumerTest.java



注:本文中的org.apache.olingo.odata2.api.ep.entry.ODataEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColorPanelView类代码示例发布时间:2022-05-23
下一篇:
Java TableViewSkin类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap