olingo-odata4 git commit: [OLINGO-1279]OData V4.0: Client returns CsdlPath for CsdlAnnotationPath attribute
Repository: olingo-odata4 Updated Branches: refs/heads/master a9aaa9355 -> 1da33a385 [OLINGO-1279]OData V4.0: Client returns CsdlPath for CsdlAnnotationPath attribute Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/1da33a38 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/1da33a38 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/1da33a38 Branch: refs/heads/master Commit: 1da33a385315fef97fe6b1d3791a996fb195de3a Parents: a9aaa93 Author: Archana Rai Authored: Thu Jul 26 17:24:06 2018 +0530 Committer: Archana Rai Committed: Thu Jul 26 17:24:06 2018 +0530 -- .../annotation/ClientCsdlDynamicExpression.java | 3 +- .../apache/olingo/client/core/MetadataTest.java | 26 ++ .../client/core/edmxWithCsdlAnnotationPath.xml | 37 3 files changed, 65 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1da33a38/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java -- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java index 8e41a64..1afbca5 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.Serializable; import org.apache.olingo.client.core.edm.xml.AbstractClientCsdlEdmDeserializer; +import org.apache.olingo.commons.api.edm.provider.annotation.CsdlAnnotationPath; import org.apache.olingo.commons.api.edm.provider.annotation.CsdlDynamicExpression; import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression; import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIf; @@ -120,7 +121,7 @@ public abstract class ClientCsdlDynamicExpression extends CsdlDynamicExpression } else if (PROPERTY_PATH.equals(jp.getCurrentName())) { expression = new CsdlPropertyPath().setValue(jp.nextTextValue()); } else if (ANNOTATION_PATH.equals(jp.getCurrentName())) { -expression = new CsdlPath().setValue(jp.nextTextValue()); +expression = new CsdlAnnotationPath().setValue(jp.nextTextValue()); } else if (APPLY.equals(jp.getCurrentName())) { jp.nextToken(); expression = jp.readValueAs(ClientCsdlApply.class); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1da33a38/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java -- diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java index 23ef55f..0e2dd0f 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java @@ -499,4 +499,30 @@ public class MetadataTest extends AbstractTest { assertEquals("Value", record.getPropertyValues().get(0).getProperty()); assertEquals("image", record.getPropertyValues().get(0).getValue().asDynamic().asPath().getValue()); } + + @Test + public void readPropertyAnnotationsTest() { +List streams = new ArrayList(); +streams.add(getClass().getResourceAsStream("VOC_Core.xml")); +final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("edmxWithCsdlAnnotationPath.xml"), +streams); +assertNotNull(edm); + +final EdmEntityType person = edm.getEntityType( +new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Person")); +assertNotNull(person); +EdmProperty userName = (EdmProperty) person.getProperty("UserName"); +List userNameAnnotations = userName.getAnnotations(); +for (EdmAnnotation annotation : userNameAnnotations) { + EdmTerm term = annotation.getTerm(); + assertNotNull(term); + assertEquals("Permissions", term.getName()); + assertEquals("Org.OData.Core.V1.Permissions", + term.getFullQualifiedName().getFullQualifiedNameAsString()); + EdmExpression expression = annotation.getExpression(); + assertNotNull(expression); + assertTrue(expression.isDynamic()); + assertEquals("AnnotationPath", expression.asDynamic().getExpressionName()); +} + } }
olingo-odata4 git commit: [OLINGO-1279]OData V4.0: Client returns CsdlPath for CsdlAnnotationPath attribute
Repository: olingo-odata4 Updated Branches: refs/heads/master 2696359f3 -> 8f4e554df [OLINGO-1279]OData V4.0: Client returns CsdlPath for CsdlAnnotationPath attribute Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8f4e554d Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8f4e554d Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8f4e554d Branch: refs/heads/master Commit: 8f4e554dfacb5b152f7b0c24939f8336db810c61 Parents: 2696359 Author: Archana Rai Authored: Thu Jul 26 17:06:16 2018 +0530 Committer: Archana Rai Committed: Thu Jul 26 17:06:16 2018 +0530 -- .../fit/tecsvc/client/AsyncSupportITCase.java | 46 +-- .../invoke/AbstractODataInvokeRequest.java | 2 +- .../request/invoke/ODataInvokeRequestImpl.java | 60 .../annotation/ClientCsdlDynamicExpression.java | 3 +- .../apache/olingo/client/core/MetadataTest.java | 28 + .../client/core/edmxWithCsdlAnnotationPath.xml | 37 .../org/apache/olingo/server/api/OData.java | 19 +++ .../netty/server/core/ODataNettyImpl.java | 12 .../apache/olingo/server/core/ODataImpl.java| 36 .../json/ODataJsonDeserializer.java | 23 ++-- .../server/tecsvc/data/RequestValidator.java| 6 +- 11 files changed, 258 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8f4e554d/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java -- diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java index 2263e9b..15c8c3e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java @@ -18,10 +18,17 @@ */ package org.apache.olingo.fit.tecsvc.client; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.net.URI; +import java.util.Calendar; +import java.util.Collections; +import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -30,32 +37,34 @@ import java.util.concurrent.TimeoutException; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper; +import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.request.ODataRequest; import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest; import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; +import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper; import org.apache.olingo.client.api.communication.response.ODataBatchResponse; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; +import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.data.ResWrap; import org.apache.olingo.client.api.domain.ClientEntity; import org.apache.olingo.client.api.domain.ClientEntitySet; import org.apache.olingo.client.api.domain.ClientProperty; +import org.apache.olingo.client.api.domain.ClientValue; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.PreferenceName; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; -import static org.junit.Assert.assertEquals; -import