本文整理汇总了Java中org.apache.olingo.odata2.api.ep.entry.ODataEntry.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java ODataEntry.getProperties方法的具体用法?Java ODataEntry.getProperties怎么用?Java ODataEntry.getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.ep.entry.ODataEntry
的用法示例。
在下文中一共展示了ODataEntry.getProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: innerEntryNoMediaResourceWithCallback
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void innerEntryNoMediaResourceWithCallback() throws Exception {
EntryCallback callback = new EntryCallback();
EntityProviderReadProperties readProperties =
EntityProviderReadProperties.init().mergeSemantic(false).callback(callback).build();
ODataEntry outerEntry = prepareAndExecuteEntry(EMPLOYEE_WITH_INLINE_TEAM, "Employees", readProperties);
assertThat(outerEntry.getProperties().get("ne_Team"), nullValue());
ODataEntry innerTeam = callback.getEntry();
Map<String, Object> innerTeamProperties = innerTeam.getProperties();
assertEquals("1", innerTeamProperties.get("Id"));
assertEquals("Team 1", innerTeamProperties.get("Name"));
assertEquals(Boolean.FALSE, innerTeamProperties.get("isScrumTeam"));
assertNull(innerTeamProperties.get("nt_Employees"));
List<String> associationUris = innerTeam.getMetadata().getAssociationUris("nt_Employees");
assertEquals(1, associationUris.size());
assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees", associationUris.get(0));
}
示例3: readCustomizableFeedMappings
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void readCustomizableFeedMappings() throws Exception {
XmlEntityConsumer xec = new XmlEntityConsumer();
EdmEntitySet entitySet = MockFacade.getMockEdm().getEntityContainer("Container2").getEntitySet("Photos");
InputStream reqContent = createContentAsStream(PHOTO_XML);
ODataEntry result =
xec.readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(false).build());
// verify
EntryMetadata entryMetadata = result.getMetadata();
assertEquals("http://localhost:19000/test/Container2.Photos(Id=1,Type='image%2Fpng')", entryMetadata.getId());
Map<String, Object> data = result.getProperties();
assertEquals("Образ", data.get("Содержание"));
assertEquals("Photo1", data.get("Name"));
assertEquals("image/png", data.get("Type"));
assertNull(data.get("ignore"));
}
示例4: 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());
}
示例5: testReadSkipTag
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void testReadSkipTag() throws Exception {
// prepare
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream contentBody = createContentAsStream(EMPLOYEE_1_XML
.replace("<title type=\"text\">Walter Winter</title>",
"<title type=\"text\"><title>Walter Winter</title></title>"));
// execute
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry result =
xec.readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(false).build());
// verify
String id = result.getMetadata().getId();
assertEquals("http://localhost:19000/Employees('1')", id);
Map<String, Object> properties = result.getProperties();
assertEquals(9, properties.size());
}
示例6: readWithInlineContentEmployeeNullRoomEntry
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
/**
* Reads an employee with inlined but <code>NULL</code> room navigation property
* (which has {@link com.sap.core.odata.api.edm.EdmMultiplicity#ONE EdmMultiplicity#ONE}).
*/
@Test
public void readWithInlineContentEmployeeNullRoomEntry() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream reqContent = createContentAsStream(EMPLOYEE_1_NULL_ROOM_XML);
// 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");
assertNull(room);
}
示例7: 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());
}
}
示例8: readWithInlineContentRoomNullEmployeesEntry
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
/**
* Reads a room with inlined but <code>NULL</code> employees navigation property
* (which has {@link com.sap.core.odata.api.edm.EdmMultiplicity#MANY EdmMultiplicity#MANY}).
*/
@Test
public void readWithInlineContentRoomNullEmployeesEntry() throws Exception {
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
InputStream reqContent = createContentAsStream(ROOM_1_NULL_EMPLOYEE_XML);
// 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("Id"));
ODataEntry room = (ODataEntry) properties.get("ne_Employees");
assertNull(room);
}
示例9: readIncompleteEntry
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void readIncompleteEntry() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
InputStream reqContent = createContentAsStream(ROOM_1_XML);
final ODataEntry result =
new XmlEntityConsumer().readEntry(entitySet, reqContent, EntityProviderReadProperties.init().build());
final EntryMetadata entryMetadata = result.getMetadata();
assertEquals("http://localhost:19000/test/Rooms('1')", entryMetadata.getId());
assertEquals("W/\"1\"", entryMetadata.getEtag());
assertNull(entryMetadata.getUri());
final MediaMetadata mediaMetadata = result.getMediaMetadata();
assertEquals(HttpContentType.APPLICATION_XML, mediaMetadata.getContentType());
assertNull(mediaMetadata.getSourceLink());
assertNull(mediaMetadata.getEditLink());
assertNull(mediaMetadata.getEtag());
final Map<String, Object> properties = result.getProperties();
assertEquals(1, properties.size());
assertEquals("1", properties.get("Id"));
assertFalse(properties.containsKey("Seats"));
}
示例10: readEntryNullProperty
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void readEntryNullProperty() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
final String content = EMPLOYEE_1_XML.replace("<d:EntryDate>1999-01-01T00:00:00</d:EntryDate>",
"<d:EntryDate m:null='true' />");
InputStream contentBody = createContentAsStream(content);
final ODataEntry result =
new XmlEntityConsumer().readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(
true).build());
final Map<String, Object> properties = result.getProperties();
assertEquals(9, properties.size());
assertTrue(properties.containsKey("EntryDate"));
assertNull(properties.get("EntryDate"));
}
示例11: UserSynchronizer
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
/**
* Creates an new UserSynchronizer from the given ODataEntry.
*
* @param odata_entry created by a POST request on the OData interface.
* @throws ODataException if the given entry is malformed.
*/
public UserSynchronizer(ODataEntry odata_entry) throws ODataException
{
Map<String, Object> props = odata_entry.getProperties();
String label = (String) props.get(LABEL);
String schedule = (String) props.get(SCHEDULE);
String request = (String) props.get(REQUEST);
String service_url = (String) props.get(SERVICE_URL);
if (schedule == null || schedule.isEmpty() || service_url == null || service_url.isEmpty())
{
throw new IncompleteDocException();
}
if (request != null && !request.equals("start") && !request.equals("stop"))
{
throw new InvalidValueException(REQUEST, request);
}
try
{
this.syncConf = SYNC_SERVICE.createSynchronizer(label, "ODataUserSynchronizer", schedule);
updateFromEntry(odata_entry);
}
catch (ParseException e)
{
throw new ExpectedException(e.getMessage());
}
}
示例12: Synchronizer
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
/**
* Creates an new Synchronizer from the given ODataEntry.
*
* @param odata_entry created by a POST request on the OData interface.
* @throws ODataException if the given entry is malformed.
*/
public Synchronizer (ODataEntry odata_entry) throws ODataException
{
Map<String, Object> props = odata_entry.getProperties ();
String label = (String) props.get(SynchronizerEntitySet.LABEL);
String schedule = (String) props.get(SynchronizerEntitySet.SCHEDULE);
String request = (String) props.get(SynchronizerEntitySet.REQUEST);
String service_url = (String) props.get(SynchronizerEntitySet.SERVICE_URL);
if (schedule == null || schedule.isEmpty () || service_url == null ||
service_url.isEmpty ())
{
throw new IncompleteDocException();
}
if (request != null && !request.equals ("start") &&
!request.equals ("stop"))
{
throw new InvalidValueException(SynchronizerEntitySet.REQUEST, request);
}
try
{
this.syncConf =
SYNCHRONIZER_SERVICE.createSynchronizer (label,
"ODataProductSynchronizer", schedule);
updateFromEntry (odata_entry);
}
catch (ParseException e)
{
throw new ExpectedException(e.getMessage());
}
}
示例13: testRead
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void testRead() throws Exception {
final Map<String, Object> headers = new HashMap<String, Object>();
// read ServiceDocument
final ServiceDocument document = requestBodyAndHeaders("direct://READSERVICEDOC", null, headers);
assertNotNull(document);
assertFalse("ServiceDocument entity sets", document.getEntitySetsInfo().isEmpty());
LOG.info("Service document has {} entity sets", document.getEntitySetsInfo().size());
// parameter type is java.util.Map
final HashMap<String, String> queryParams = new HashMap<String, String>();
queryParams.put(SystemQueryOption.$top.name(), "5");
headers.put("CamelOlingo2.queryParams", queryParams);
// read ODataFeed
final ODataFeed manufacturers = requestBodyAndHeaders("direct://READFEED", null, headers);
assertNotNull(manufacturers);
final List<ODataEntry> manufacturersEntries = manufacturers.getEntries();
assertFalse("Manufacturers empty entries", manufacturersEntries.isEmpty());
LOG.info("Manufacturers feed has {} entries", manufacturersEntries.size());
// read ODataEntry
headers.clear();
headers.put(Olingo2Constants.PROPERTY_PREFIX + "keyPredicate", "'1'");
final ODataEntry manufacturer = requestBodyAndHeaders("direct://READENTRY", null, headers);
assertNotNull(manufacturer);
final Map<String, Object> properties = manufacturer.getProperties();
assertEquals("Manufacturer Id", "1", properties.get(ID_PROPERTY));
LOG.info("Manufacturer: {}", properties.toString());
}
示例14: testCreateUpdateDelete
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void testCreateUpdateDelete() throws Exception {
final Map<String, Object> data = getEntityData();
Map<String, Object> address;
final ODataEntry manufacturer = requestBody("direct://CREATE", data);
assertNotNull("Created Manufacturer", manufacturer);
final Map<String, Object> properties = manufacturer.getProperties();
assertEquals("Created Manufacturer Id", "123", properties.get(ID_PROPERTY));
LOG.info("Created Manufacturer: {}", properties);
// update
data.put("Name", "MyCarManufacturer Renamed");
address = (Map<String, Object>)data.get("Address");
address.put("Street", "Main Street");
HttpStatusCodes status = requestBody("direct://UPDATE", data);
assertNotNull("Update status", status);
assertEquals("Update status", HttpStatusCodes.NO_CONTENT.getStatusCode(), status.getStatusCode());
LOG.info("Update status: {}", status);
// delete
status = requestBody("direct://DELETE", null);
assertNotNull("Delete status", status);
assertEquals("Delete status", HttpStatusCodes.NO_CONTENT.getStatusCode(), status.getStatusCode());
LOG.info("Delete status: {}", status);
}
示例15: readMinimalEntry
import org.apache.olingo.odata2.api.ep.entry.ODataEntry; //导入方法依赖的package包/类
@Test
public void readMinimalEntry() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
final ODataEntry result =
new JsonEntityConsumer().readEntry(entitySet, createContentAsStream("{\"Id\":\"99\"}"), DEFAULT_PROPERTIES);
final Map<String, Object> properties = result.getProperties();
assertNotNull(properties);
assertEquals(1, properties.size());
assertEquals("99", properties.get("Id"));
assertTrue(result.getMetadata().getAssociationUris("nt_Employees").isEmpty());
checkMediaDataInitial(result.getMediaMetadata());
}