Return-Path: X-Original-To: apmail-olingo-commits-archive@minotaur.apache.org Delivered-To: apmail-olingo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E7CE10DDD for ; Fri, 14 Feb 2014 09:06:39 +0000 (UTC) Received: (qmail 41745 invoked by uid 500); 14 Feb 2014 09:06:10 -0000 Delivered-To: apmail-olingo-commits-archive@olingo.apache.org Received: (qmail 41492 invoked by uid 500); 14 Feb 2014 09:06:05 -0000 Mailing-List: contact commits-help@olingo.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.incubator.apache.org Delivered-To: mailing list commits@olingo.incubator.apache.org Received: (qmail 41240 invoked by uid 99); 14 Feb 2014 09:05:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Feb 2014 09:05:59 +0000 X-ASF-Spam-Status: No, hits=-2000.6 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 14 Feb 2014 09:05:57 +0000 Received: (qmail 40661 invoked by uid 99); 14 Feb 2014 09:05:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Feb 2014 09:05:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A49489264B5; Fri, 14 Feb 2014 09:05:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sklevenz@apache.org To: commits@olingo.incubator.apache.org Date: Fri, 14 Feb 2014 09:06:06 -0000 Message-Id: In-Reply-To: <3c57a565a0c44045812f3a45853024c7@git.apache.org> References: <3c57a565a0c44045812f3a45853024c7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [46/50] [abbrv] git commit: [OLINGO-123] fix X-Virus-Checked: Checked by ClamAV on apache.org [OLINGO-123] fix Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/8ff7807b Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/8ff7807b Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/8ff7807b Branch: refs/heads/ODataServlet Commit: 8ff7807bf97a61394ea47719417fe26136fe1d4e Parents: 16106f6 Author: Stephan Klevenz Authored: Fri Jan 24 16:55:18 2014 +0100 Committer: Stephan Klevenz Committed: Mon Feb 10 16:20:42 2014 +0100 ---------------------------------------------------------------------- .../core/ep/consumer/XmlEntryConsumer.java | 31 +++-- .../core/ep/consumer/XmlEntityConsumerTest.java | 6 + .../src/test/resources/expandedBuilding.xml | 113 ++++++++++--------- 3 files changed, 77 insertions(+), 73 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8ff7807b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java ---------------------------------------------------------------------- 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 d464b1f..6b9cd5f 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 @@ -229,25 +229,22 @@ public class XmlEntryConsumer { final String etag = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, FormatXml.M_ETAG); // read to next tag to check if contains any further tags + reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_LINK); reader.nextTag(); - if (reader.isEndElement()) { - reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_LINK); - - if (rel == null || uri == null) { - throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent( - FormatXml.ATOM_HREF + "' and/or '" + FormatXml.ATOM_REL).addContent(FormatXml.ATOM_LINK)); - } else if (rel.startsWith(Edm.NAMESPACE_REL_2007_08)) { - final String navigationPropertyName = rel.substring(Edm.NAMESPACE_REL_2007_08.length()); - entryMetadata.putAssociationUri(navigationPropertyName, uri); - } else if (rel.equals(Edm.LINK_REL_EDIT_MEDIA)) { - mediaMetadata.setEditLink(uri); - mediaMetadata.setEtag(etag); - } - } else { - if (rel != null && rel.startsWith(Edm.NAMESPACE_REL_2007_08)) { - readInlineContent(reader, eia, readProperties, type, rel); - } + if (rel == null || uri == null) { + throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent( + FormatXml.ATOM_HREF + "' and/or '" + FormatXml.ATOM_REL).addContent(FormatXml.ATOM_LINK)); + } else if (rel.startsWith(Edm.NAMESPACE_REL_2007_08)) { + final String navigationPropertyName = rel.substring(Edm.NAMESPACE_REL_2007_08.length()); + entryMetadata.putAssociationUri(navigationPropertyName, uri); + } else if (rel.equals(Edm.LINK_REL_EDIT_MEDIA)) { + mediaMetadata.setEditLink(uri); + mediaMetadata.setEtag(etag); + } + + if (!reader.isEndElement() && rel != null && rel.startsWith(Edm.NAMESPACE_REL_2007_08)) { + readInlineContent(reader, eia, readProperties, type, rel); } } http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8ff7807b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java ---------------------------------------------------------------------- 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 361de02..b357c71 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 @@ -577,6 +577,9 @@ public class XmlEntityConsumerTest extends AbstractXmlConsumerTest { assertEquals("Building 1", inlineBuildingProps.get("Name")); assertNull(inlineBuildingProps.get("Image")); assertNull(inlineBuildingProps.get("nb_Rooms")); + + assertEquals("Rooms('1')/nr_Employees", entry.getMetadata().getAssociationUris("nr_Employees").get(0)); + assertEquals("Rooms('1')/nr_Building", entry.getMetadata().getAssociationUris("nr_Building").get(0)); } /** Teams('1')?$expand=nt_Employees */ @@ -2322,6 +2325,9 @@ public class XmlEntityConsumerTest extends AbstractXmlConsumerTest { Map properties = result.getProperties(); assertEquals(1, properties.size()); assertEquals("1", properties.get("Id")); + + assertEquals("Rooms('1')/nr_Building", result.getMetadata().getAssociationUris("nr_Building").get(0)); + assertEquals("Rooms('1')/nr_Employees", result.getMetadata().getAssociationUris("nr_Employees").get(0)); } @Test http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/8ff7807b/odata2-lib/odata-core/src/test/resources/expandedBuilding.xml ---------------------------------------------------------------------- diff --git a/odata2-lib/odata-core/src/test/resources/expandedBuilding.xml b/odata2-lib/odata-core/src/test/resources/expandedBuilding.xml index b4b34a4..e637969 100644 --- a/odata2-lib/odata-core/src/test/resources/expandedBuilding.xml +++ b/odata2-lib/odata-core/src/test/resources/expandedBuilding.xml @@ -1,60 +1,61 @@ - - http://some.host.com/service.root/ReferenceScenario.svc/Rooms('1') - Room 1 - 2013-04-19T10:58:03.646Z - - - - - - - http://some.host.com/service.root/ReferenceScenario.svc/Buildings('1') - Buildings - 2013-04-19T10:58:03.646Z - - Building 1 - - - - - - - 1 - Building 1 - - - - - - - - - 1 - Room 1 - 1 - 1 - - + + http://some.host.com/service.root/ReferenceScenario.svc/Rooms('1') + Room 1 + 2013-04-19T10:58:03.646Z + + + + + + + http://some.host.com/service.root/ReferenceScenario.svc/Buildings('1') + Buildings + 2013-04-19T10:58:03.646Z + + Building 1 + + + + + + + 1 + Building 1 + + + + + + + + + 1 + Room 1 + 1 + 1 + +