You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/03/17 14:32:09 UTC
[2/2] olingo-odata4 git commit: [OLINGO-557] small fix in technical
service
[OLINGO-557] small fix in technical service
Change-Id: I12b8e4ca94b7db28cae77a5fb173a4d90075fda6
Signed-off-by: Christian Amend <ch...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/36219d32
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/36219d32
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/36219d32
Branch: refs/heads/master
Commit: 36219d3258eaa350493a0ff06a5b4bcc49d8d6b5
Parents: 200dac0
Author: Klaus Straubinger <kl...@sap.com>
Authored: Thu Mar 12 15:53:03 2015 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Tue Mar 17 14:25:18 2015 +0100
----------------------------------------------------------------------
.../fit/tecsvc/client/FunctionImportITCase.java | 31 ++++++++++++--------
.../TechnicalPrimitiveComplexProcessor.java | 16 +++++-----
2 files changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/36219d32/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
index 2e51fd2..ec3331e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
@@ -89,15 +89,14 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals("2", property.getPrimitiveValue().toValue());
}
-
@Test
public void entityCollectionWithAppendedKey() {
// .../odata.svc/FICRTCollESMedia()(1)
final ODataInvokeRequest<ODataEntity> request = getClient().getInvokeRequestFactory()
- .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
- .appendOperationCallSegment("FICRTCollESMedia")
- .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1))
- .build(), ODataEntity.class);
+ .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendOperationCallSegment("FICRTCollESMedia")
+ .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1))
+ .build(), ODataEntity.class);
assertNotNull(request);
final ODataInvokeResponse<ODataEntity> response = request.execute();
@@ -111,16 +110,15 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals(1, property.getPrimitiveValue().toValue());
}
-
@Test
public void entityCollectionWithAppendedKeyAndProperty() {
// .../odata.svc/FICRTCollESMedia()(2)/PropertyInt16
final ODataInvokeRequest<ODataProperty> request = getClient().getInvokeRequestFactory()
- .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
- .appendOperationCallSegment("FICRTCollESMedia")
- .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2))
- .appendPropertySegment("PropertyInt16")
- .build(), ODataProperty.class);
+ .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendOperationCallSegment("FICRTCollESMedia")
+ .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2))
+ .appendPropertySegment("PropertyInt16")
+ .build(), ODataProperty.class);
assertNotNull(request);
final ODataInvokeResponse<ODataProperty> response = request.execute();
@@ -132,7 +130,6 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals(2, property.getPrimitiveValue().toValue());
}
-
@Test
public void countEntityCollection() throws Exception {
final ODataRawRequest request = getClient().getRetrieveRequestFactory()
@@ -187,6 +184,16 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals("UFCRTString string value", response.getBody().toValue());
}
+ @Test
+ public void primitiveValueWithPath() throws Exception {
+ final ODataValueRequest request = getClient().getRetrieveRequestFactory()
+ .getPropertyValueRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendOperationCallSegment("FICRTCTTwoPrim")
+ .appendPropertySegment("PropertyString").appendValueSegment().build());
+ final ODataRetrieveResponse<ODataPrimitiveValue> response = request.execute();
+ assertEquals("UFCRTCTTwoPrim string value", response.getBody().toValue());
+ }
+
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/36219d32/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
index f1dfa95..e36dc6b 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
@@ -208,12 +208,11 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
final List<String> path = getPropertyPath(resourceParts, 0);
final Entity entity = readEntity(uriInfo);
- final Property property =
- entity == null ?
- getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0))
- .getFunction(),
- ((UriResourceFunction) resourceParts.get(0)).getParameters()), path) :
- getPropertyData(entity, path);
+ final Property property = entity == null ?
+ getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0))
+ .getFunction(),
+ ((UriResourceFunction) resourceParts.get(0)).getParameters()), path) :
+ getPropertyData(entity, path);
if (property == null) {
throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
@@ -368,8 +367,9 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
final Entity entity = readEntity(uriInfo);
final Property property = entity == null ?
- dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0)).getFunction(),
- ((UriResourceFunction) resourceParts.get(0)).getParameters()) :
+ getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0))
+ .getFunction(),
+ ((UriResourceFunction) resourceParts.get(0)).getParameters()), path) :
getPropertyData(entity, path);
if (property == null || property.getValue() == null) {