This is an automated email from the ASF dual-hosted git repository. archanarai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/olingo-odata2.git
The following commit(s) were added to refs/heads/master by this push: new f5ee664 [OLINGO-1321]ODATA V2.0 : An api to return list of child expandSelectTreeNode f5ee664 is described below commit f5ee664c909d2e9d269469bfd1b882c42ac721d3 Author: Archana Rai <archana....@sap.com> AuthorDate: Thu Dec 13 13:38:24 2018 +0530 [OLINGO-1321]ODATA V2.0 : An api to return list of child expandSelectTreeNode --- .../odata2/api/uri/ExpandSelectTreeNode.java | 8 +- .../odata2/core/ep/consumer/JsonEntryConsumer.java | 8 + .../odata2/core/ep/consumer/XmlEntryConsumer.java | 9 + .../odata2/core/uri/ExpandSelectTreeNodeImpl.java | 9 +- .../core/ep/consumer/JsonEntryConsumerTest.java | 28 ++ .../core/ep/consumer/XmlEntityConsumerTest.java | 28 ++ .../resources/employeesWithDifferentInlines.xml | 307 +++++++++++++++++++++ .../jsonEmployeesWithDifferentInlines.json | 160 +++++++++++ 8 files changed, 554 insertions(+), 3 deletions(-) diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java index b12eb43..a1915ec 100644 --- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java +++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java @@ -53,7 +53,13 @@ public abstract class ExpandSelectTreeNode { * otherwise the link must be expanded with information found in that node */ public abstract Map<String, ExpandSelectTreeNode> getLinks(); - + + /** + * A list of all expanded links within the parent entity. + * @return {@link ExpandSelectTreeNodeBuilder} for method chaining. + */ + public abstract List<ExpandSelectTreeNode> getExpandedList(); + /** * Creates a builder instance and sets the entitySet for this node. * @param entitySet on which this node is based diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java index d9d8e6e..d1c4179 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java @@ -389,6 +389,14 @@ public class JsonEntryConsumer { List<ODataEntry> entries = feed.getEntries(); if (!entries.isEmpty()) { updateExpandSelectTree(navigationPropertyName, entries.get(0)); + for(ODataEntry entry : entries){ + ExpandSelectTreeNodeImpl newExpandedSelectedTree = new ExpandSelectTreeNodeImpl(); + newExpandedSelectedTree.setExpanded(); + newExpandedSelectedTree.setExplicitlySelected(); + newExpandedSelectedTree.putLink(navigationPropertyName, + (ExpandSelectTreeNodeImpl) entry.getExpandSelectTree()); + expandSelectTree.getExpandedList().add(newExpandedSelectedTree); + } } else { expandSelectTree.setExpanded(); expandSelectTree.setExplicitlySelected(); diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java index 962fc34..8c5a240 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java @@ -345,6 +345,15 @@ public class XmlEntryConsumer { expandSelectTree.setExpanded(); ExpandSelectTreeNodeImpl subNode = getExpandSelectTreeNode(inlineEntries); expandSelectTree.putLink(navigationPropertyName, subNode); + for(ODataEntry entry : inlineEntries){ + ExpandSelectTreeNodeImpl newExpandedSelectedTree = new ExpandSelectTreeNodeImpl(); + newExpandedSelectedTree.setExpanded(); + newExpandedSelectedTree.setExplicitlySelected(); + newExpandedSelectedTree.putLink(navigationPropertyName, + (ExpandSelectTreeNodeImpl) entry.getExpandSelectTree()); + expandSelectTree.getExpandedList().add(newExpandedSelectedTree); + } + } /** diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java index 0237cdf..b7b646d 100644 --- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java +++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java @@ -60,7 +60,8 @@ public class ExpandSelectTreeNodeImpl extends ExpandSelectTreeNode { private boolean isExpanded = false; private final List<EdmProperty> properties = new ArrayList<EdmProperty>(); private final Map<String, ExpandSelectTreeNodeImpl> links = new HashMap<String, ExpandSelectTreeNodeImpl>(); - + private final List<ExpandSelectTreeNode> expandselectTreeNodes = new ArrayList<ExpandSelectTreeNode>(); + @Override public boolean isAll() { return isAll.getBoolean(); @@ -77,6 +78,11 @@ public class ExpandSelectTreeNodeImpl extends ExpandSelectTreeNode { return (Map<String, ExpandSelectTreeNode>) ((Map<String, ? extends ExpandSelectTreeNode>) Collections .unmodifiableMap(links)); } + + @Override + public List<ExpandSelectTreeNode> getExpandedList() { + return expandselectTreeNodes; + } public void putLink(final String name, final ExpandSelectTreeNodeImpl node) { links.put(name, node); @@ -275,5 +281,4 @@ public class ExpandSelectTreeNodeImpl extends ExpandSelectTreeNode { } } - } diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumerTest.java index 4f0d385..b0b5c7e 100644 --- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumerTest.java +++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumerTest.java @@ -434,6 +434,34 @@ public class JsonEntryConsumerTest extends AbstractConsumerTest { assertEquals(5, result.getProperties().size()); assertEquals(0, ((ODataFeed)result.getProperties().get("nr_Employees")).getEntries().size()); } + + + @Test + public void roomsFeedWithRoomInlineDifferent() throws Exception { + InputStream stream = getFileAsStream("jsonEmployeesWithDifferentInlines.json"); + assertNotNull(stream); + + EntityProviderReadProperties readProperties = EntityProviderReadProperties.init() + .mergeSemantic(false).isValidatingFacets(false).build(); + + EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); + JsonEntityConsumer xec = new JsonEntityConsumer(); + ODataEntry entry = xec.readEntry(entitySet, stream, readProperties); + assertNotNull(entry); + assertNotNull(entry.getExpandSelectTree().getLinks().get("nr_Employees")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(3) + .getLinks().get("nr_Employees").getLinks().get("ne_Team")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(0) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(0) + .getLinks().get("nr_Employees").getLinks().get("ne_Room") + .getLinks().get("nr_Building")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(1) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + assertNull(entry.getExpandSelectTree().getExpandedList().get(2) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + } + /** * @param inlineEntries * @param feed diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java index 4f51fcd..207815c 100644 --- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java +++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java @@ -2615,6 +2615,34 @@ public class XmlEntityConsumerTest extends AbstractXmlConsumerTest { assertEquals(5, result.getProperties().size()); assertEquals(0, ((ODataFeed)result.getProperties().get("nr_Employees")).getEntries().size()); } + + @Test + public void roomsFeedWithRoomInlineDifferent() throws Exception { + InputStream stream = getFileAsStream("employeesWithDifferentInlines.xml"); + assertNotNull(stream); + + EntityProviderReadProperties readProperties = EntityProviderReadProperties.init() + .mergeSemantic(false).isValidatingFacets(false).build(); + + EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); + XmlEntityConsumer xec = new XmlEntityConsumer(); + ODataEntry entry = xec.readEntry(entitySet, stream, readProperties); + assertNotNull(entry); + assertNotNull(entry.getExpandSelectTree().getLinks().get("nr_Employees")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(3) + .getLinks().get("nr_Employees").getLinks().get("ne_Team")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(1) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(1) + .getLinks().get("nr_Employees").getLinks().get("ne_Room") + .getLinks().get("nr_Building")); + assertNotNull(entry.getExpandSelectTree().getExpandedList().get(2) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + assertNull(entry.getExpandSelectTree().getExpandedList().get(0) + .getLinks().get("nr_Employees").getLinks().get("ne_Room")); + } + + /** * @param inlineEntries * @param feed diff --git a/odata2-lib/odata-core/src/test/resources/employeesWithDifferentInlines.xml b/odata2-lib/odata-core/src/test/resources/employeesWithDifferentInlines.xml new file mode 100644 index 0000000..cb6c508 --- /dev/null +++ b/odata2-lib/odata-core/src/test/resources/employeesWithDifferentInlines.xml @@ -0,0 +1,307 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<entry xmlns="http://www.w3.org/2005/Atom" + xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" + xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenario.svc/" + m:etag="W/"1""> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1') + </id> + <title type="text">Room 1</title> + <updated>2018-11-30T10:18:34.044+05:30</updated> + <category term="RefScenario.Room" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Rooms('1')" rel="edit" title="Room" /> + <link href="Rooms('1')/nr_Employees" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees" + title="nr_Employees" type="application/atom+xml;type=feed"> + <m:inline> + <feed + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/"> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Employees + </id> + <title type="text">Employees</title> + <updated>2018-11-30T10:21:56.387+05:30</updated> + <author> + <name /> + </author> + <link href="Rooms('1')/nr_Employees" rel="self" title="Employees" /> + <entry> + <id>...</id> + <title type="text">Walter Winter</title> + <updated>1999-01-01T00:00:00Z</updated> + <category term="RefScenario.Employee" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Employees('1')" rel="edit" title="Employee" /> + <link href="Employees('1')/$value" rel="edit-media" type="image/jpeg" /> + <link href="Employees('1')/ne_Manager" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager" + title="ne_Manager" type="application/atom+xml;type=entry" /> + <link href="Employees('2')/ne_Team" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team" + title="ne_Team" type="application/atom+xml;type=entry" /> + <link href="Employees('1')/ne_Room" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room" + title="ne_Room" type="application/atom+xml;type=entry" /> + <content type="image/jpeg" src="Employees('1')/$value" /> + <m:properties> + <d:EmployeeId>1</d:EmployeeId> + <d:EmployeeName>Walter Winter</d:EmployeeName> + <d:ManagerId>1</d:ManagerId> + <d:RoomId>1</d:RoomId> + <d:TeamId>1</d:TeamId> + <d:Location m:type="RefScenario.c_Location"> + <d:City m:type="RefScenario.c_City"> + <d:PostalCode>69124</d:PostalCode> + <d:CityName>Heidelberg</d:CityName> + </d:City> + <d:Country>Germany</d:Country> + </d:Location> + <d:Age>52</d:Age> + <d:EntryDate>1999-01-01T00:00:00</d:EntryDate> + <d:ImageUrl>Employees('1')/$value</d:ImageUrl> + </m:properties> + </entry> + <entry> + <id>...</id> + <title type="text">Walter Winter</title> + <updated>1999-01-01T00:00:00Z</updated> + <category term="RefScenario.Employee" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Employees('2')" rel="edit" title="Employee" /> + <link href="Employees('2')/$value" rel="edit-media" type="image/jpeg" /> + <link href="Employees('2')/ne_Manager" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager" + title="ne_Manager" type="application/atom+xml;type=entry" /> + <link href="Employees('2')/ne_Team" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team" + title="ne_Team" type="application/atom+xml;type=entry" /> + <link href="Employees('2')/ne_Room" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room" + title="ne_Room" type="application/atom+xml;type=entry"> + <m:inline> + <entry + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/" + m:etag="W/"1""> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1') + </id> + <title type="text">Room 1</title> + <updated>2018-11-30T11:01:31.778+05:30</updated> + <category term="RefScenario.Room" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Rooms('1')" rel="edit" title="Room" /> + <link href="Rooms('1')/nr_Employees" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees" + title="nr_Employees" type="application/atom+xml;type=feed" /> + <link href="Rooms('1')/nr_Building" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building" + title="nr_Building" type="application/atom+xml;type=entry"> + <m:inline> + <entry + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/"> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Buildings('1') + </id> + <title type="text">Buildings</title> + <updated>2018-11-30T10:53:24.066+05:30</updated> + <author> + <name>Building 1</name> + </author> + <category term="RefScenario.Building" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Buildings('1')" rel="edit" title="Building" /> + <link href="Buildings('1')/nb_Rooms" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nb_Rooms" + title="nb_Rooms" type="application/atom+xml;type=feed" /> + <content type="application/xml"> + <m:properties> + <d:Id>1</d:Id> + <d:Name>Building 1</d:Name> + <d:Image m:null="true" /> + </m:properties> + </content> + </entry> + </m:inline> + </link> + <content type="application/xml"> + <m:properties> + <d:Id>1</d:Id> + <d:Name>Room 1</d:Name> + <d:Seats>1</d:Seats> + <d:Version>1</d:Version> + </m:properties> + </content> + </entry> + </m:inline> + </link> + <content type="image/jpeg" src="Employees('1')/$value" /> + <m:properties> + <d:EmployeeId>2</d:EmployeeId> + <d:EmployeeName>Walter Winter</d:EmployeeName> + <d:ManagerId>2</d:ManagerId> + <d:RoomId>2</d:RoomId> + <d:TeamId>2</d:TeamId> + <d:Location m:type="RefScenario.c_Location"> + <d:City m:type="RefScenario.c_City"> + <d:PostalCode>69124</d:PostalCode> + <d:CityName>Heidelberg</d:CityName> + </d:City> + <d:Country>Germany</d:Country> + </d:Location> + <d:Age>52</d:Age> + <d:EntryDate>1999-01-01T00:00:00</d:EntryDate> + <d:ImageUrl>Employees('2')/$value</d:ImageUrl> + </m:properties> + </entry> + <entry> + <id>...</id> + <title type="text">Walter Winter</title> + <updated>1999-01-01T00:00:00Z</updated> + <category term="RefScenario.Employee" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Employees('3')" rel="edit" title="Employee" /> + <link href="Employees('3')/$value" rel="edit-media" type="image/jpeg" /> + <link href="Employees('3')/ne_Manager" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager" + title="ne_Manager" type="application/atom+xml;type=entry" /> + <link href="Employees('3')/ne_Team" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team" + title="ne_Team" type="application/atom+xml;type=entry" /> + <link href="Employees('3')/ne_Room" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room" + title="ne_Room" type="application/atom+xml;type=entry"> + <m:inline> + <entry + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/" + m:etag="W/"1""> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1') + </id> + <title type="text">Room 2</title> + <updated>2018-11-30T11:01:31.778+05:30</updated> + <category term="RefScenario.Room" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Rooms('2')" rel="edit" title="Room" /> + <link href="Rooms('2')/nr_Employees" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees" + title="nr_Employees" type="application/atom+xml;type=feed" /> + <link href="Rooms('2')/nr_Building" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building" + title="nr_Building" type="application/atom+xml;type=entry" /> + <content type="application/xml"> + <m:properties> + <d:Id>2</d:Id> + <d:Name>Room 2</d:Name> + <d:Seats>1</d:Seats> + <d:Version>1</d:Version> + </m:properties> + </content> + </entry> + </m:inline> + </link> + <content type="image/jpeg" src="Employees('1')/$value" /> + <m:properties> + <d:EmployeeId>3</d:EmployeeId> + <d:EmployeeName>Walter Winter</d:EmployeeName> + <d:ManagerId>3</d:ManagerId> + <d:RoomId>3</d:RoomId> + <d:TeamId>3</d:TeamId> + <d:Location m:type="RefScenario.c_Location"> + <d:City m:type="RefScenario.c_City"> + <d:PostalCode>69124</d:PostalCode> + <d:CityName>Heidelberg</d:CityName> + </d:City> + <d:Country>Germany</d:Country> + </d:Location> + <d:Age>52</d:Age> + <d:EntryDate>1999-01-01T00:00:00</d:EntryDate> + <d:ImageUrl>Employees('3')/$value</d:ImageUrl> + </m:properties> + </entry> + <entry> + <id>...</id> + <title type="text">Walter Winter</title> + <updated>1999-01-01T00:00:00Z</updated> + <category term="RefScenario.Employee" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Employees('4')" rel="edit" title="Employee" /> + <link href="Employees('4')/$value" rel="edit-media" type="image/jpeg" /> + <link href="Employees('4')/ne_Manager" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager" + title="ne_Manager" type="application/atom+xml;type=entry" /> + <link href="Employees('4')/ne_Team" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team" + title="ne_Team" type="application/atom+xml;type=entry"> + <m:inline> + <entry + xml:base="http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/"> + <id> + http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Teams('1') + </id> + <title type="text">Team 1</title> + <updated>2018-11-30T10:41:31.209+05:30</updated> + <category term="RefScenario.Team" + scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link href="Teams('1')" rel="edit" title="Team" /> + <link href="Teams('1')/nt_Employees" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nt_Employees" + title="nt_Employees" type="application/atom+xml;type=feed" /> + <content type="application/xml"> + <m:properties> + <d:Id>1</d:Id> + <d:Name>Team 1</d:Name> + <d:isScrumTeam>false</d:isScrumTeam> + </m:properties> + </content> + </entry> + </m:inline> + </link> + <link href="Employees('4')/ne_Room" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room" + title="ne_Room" type="application/atom+xml;type=entry" /> + <content type="image/jpeg" src="Employees('4')/$value" /> + <m:properties> + <d:EmployeeId>4</d:EmployeeId> + <d:EmployeeName>Walter Winter</d:EmployeeName> + <d:ManagerId>4</d:ManagerId> + <d:RoomId>4</d:RoomId> + <d:TeamId>4</d:TeamId> + <d:Location m:type="RefScenario.c_Location"> + <d:City m:type="RefScenario.c_City"> + <d:PostalCode>69124</d:PostalCode> + <d:CityName>Heidelberg</d:CityName> + </d:City> + <d:Country>Germany</d:Country> + </d:Location> + <d:Age>52</d:Age> + <d:EntryDate>1999-01-01T00:00:00</d:EntryDate> + <d:ImageUrl>Employees('4')/$value</d:ImageUrl> + </m:properties> + </entry> + </feed> + </m:inline> + </link> + <link href="Rooms('1')/nr_Building" + rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building" + title="nr_Building" type="application/atom+xml;type=entry" /> + <content type="application/xml"> + <m:properties> + <d:Id>1</d:Id> + <d:Name>Room 1</d:Name> + <d:Seats>1</d:Seats> + <d:Version>1</d:Version> + </m:properties> + </content> +</entry> \ No newline at end of file diff --git a/odata2-lib/odata-core/src/test/resources/jsonEmployeesWithDifferentInlines.json b/odata2-lib/odata-core/src/test/resources/jsonEmployeesWithDifferentInlines.json new file mode 100644 index 0000000..3aed203 --- /dev/null +++ b/odata2-lib/odata-core/src/test/resources/jsonEmployeesWithDifferentInlines.json @@ -0,0 +1,160 @@ + + { + "Id": "1", + "Name": "Room 1", + "Seats": 1, + "Version": 1, + "nr_Employees": { + "results": [ + + { + "EmployeeId": "4", + "EmployeeName": "Walter Winter", + "ManagerId": "4", + "RoomId": "4", + "TeamId": "4", + "Location": { + "__metadata": { + "type": "RefScenario.c_Location" + }, + "City": { + "__metadata": { + "type": "RefScenario.c_City" + }, + "PostalCode": "69124", + "CityName": "Heidelberg" + }, + "Country": "Germany" + }, + "Age": 52, + "EntryDate": "/Date(915148800000)/", + "ImageUrl": "Employees('4')/$value", + + "ne_Room": { + "__metadata": { + "id": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1')", + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1')", + "type": "RefScenario.Room", + "etag": "W/\"1\"" + }, + "Id": "1", + "Name": "Room 1", + "Seats": 1, + "Version": 1, + "nr_Building": { + "__metadata": { + "id": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Buildings('3')", + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Buildings('3')", + "type": "RefScenario.Building" + }, + "Id": "3", + "Name": "Building 3", + "Image": null, + "nb_Rooms": { + "__deferred": { + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Buildings('3')/nb_Rooms" + } + } + } + } + }, + { + "EmployeeId": "1", + "EmployeeName": "Walter Winter", + "ManagerId": "1", + "RoomId": "1", + "TeamId": "1", + "Location": { + "__metadata": { + "type": "RefScenario.c_Location" + }, + "City": { + "__metadata": { + "type": "RefScenario.c_City" + }, + "PostalCode": "69124", + "CityName": "Heidelberg" + }, + "Country": "Germany" + }, + "Age": 52, + "EntryDate": "/Date(915148800000)/", + "ImageUrl": "Employees('1')/$value", + + "ne_Room": { + "__metadata": { + "id": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1')", + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Rooms('1')", + "type": "RefScenario.Room", + "etag": "W/\"1\"" + }, + "Id": "1", + "Name": "Room 1", + "Seats": 1, + "Version": 1 + } + }, + { + "EmployeeId": "3", + "EmployeeName": "Walter Winter", + "ManagerId": "3", + "RoomId": "1", + "TeamId": "1", + "Location": { + "__metadata": { + "type": "RefScenario.c_Location" + }, + "City": { + "__metadata": { + "type": "RefScenario.c_City" + }, + "PostalCode": "69124", + "CityName": "Heidelberg" + }, + "Country": "Germany" + }, + "Age": 51, + "EntryDate": "/Date(915148800005)/", + "ImageUrl": "Employees('3')/$value" + } , + { + "EmployeeId": "2", + "EmployeeName": "Walter Winter", + "ManagerId": "2", + "RoomId": "1", + "TeamId": "1", + "Location": { + "__metadata": { + "type": "RefScenario.c_Location" + }, + "City": { + "__metadata": { + "type": "RefScenario.c_City" + }, + "PostalCode": "69124", + "CityName": "Heidelberg" + }, + "Country": "Germany" + }, + "Age": 51, + "EntryDate": "/Date(915148800005)/", + "ImageUrl": "Employees('2')/$value", + "ne_Team": { + "__metadata": { + "id": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Teams('1')", + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Teams('1')", + "type": "RefScenario.Team" + }, + "Id": "1", + "Name": "Team 1", + "isScrumTeam": false, + "nt_Employees": { + "__deferred": { + "uri": "http://localhost:8080/olingo-odata2-ref-web/ReferenceScenarioNonJaxrs.svc/Teams('1')/nt_Employees" + } + } + } + } + ] + } + } \ No newline at end of file