[OLINGO-557] small fix in technical service

Change-Id: I12b8e4ca94b7db28cae77a5fb173a4d90075fda6

Signed-off-by: Christian Amend <chrisam@apache.org>
This commit is contained in:
Klaus Straubinger 2015-03-12 15:53:03 +01:00 committed by Christian Amend
parent 200dac0a2c
commit 36219d3258
2 changed files with 27 additions and 20 deletions

View File

@ -89,7 +89,6 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals("2", property.getPrimitiveValue().toValue()); assertEquals("2", property.getPrimitiveValue().toValue());
} }
@Test @Test
public void entityCollectionWithAppendedKey() { public void entityCollectionWithAppendedKey() {
// .../odata.svc/FICRTCollESMedia()(1) // .../odata.svc/FICRTCollESMedia()(1)
@ -111,7 +110,6 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals(1, property.getPrimitiveValue().toValue()); assertEquals(1, property.getPrimitiveValue().toValue());
} }
@Test @Test
public void entityCollectionWithAppendedKeyAndProperty() { public void entityCollectionWithAppendedKeyAndProperty() {
// .../odata.svc/FICRTCollESMedia()(2)/PropertyInt16 // .../odata.svc/FICRTCollESMedia()(2)/PropertyInt16
@ -132,7 +130,6 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals(2, property.getPrimitiveValue().toValue()); assertEquals(2, property.getPrimitiveValue().toValue());
} }
@Test @Test
public void countEntityCollection() throws Exception { public void countEntityCollection() throws Exception {
final ODataRawRequest request = getClient().getRetrieveRequestFactory() final ODataRawRequest request = getClient().getRetrieveRequestFactory()
@ -187,6 +184,16 @@ public class FunctionImportITCase extends AbstractBaseTestITCase {
assertEquals("UFCRTString string value", response.getBody().toValue()); 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 @Override
protected ODataClient getClient() { protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient(); ODataClient odata = ODataClientFactory.getClient();

View File

@ -208,8 +208,7 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
final List<String> path = getPropertyPath(resourceParts, 0); final List<String> path = getPropertyPath(resourceParts, 0);
final Entity entity = readEntity(uriInfo); final Entity entity = readEntity(uriInfo);
final Property property = final Property property = entity == null ?
entity == null ?
getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0)) getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0))
.getFunction(), .getFunction(),
((UriResourceFunction) resourceParts.get(0)).getParameters()), path) : ((UriResourceFunction) resourceParts.get(0)).getParameters()), path) :
@ -368,8 +367,9 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
final Entity entity = readEntity(uriInfo); final Entity entity = readEntity(uriInfo);
final Property property = entity == null ? final Property property = entity == null ?
dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0)).getFunction(), getPropertyData(dataProvider.readFunctionPrimitiveComplex(((UriResourceFunction) resourceParts.get(0))
((UriResourceFunction) resourceParts.get(0)).getParameters()) : .getFunction(),
((UriResourceFunction) resourceParts.get(0)).getParameters()), path) :
getPropertyData(entity, path); getPropertyData(entity, path);
if (property == null || property.getValue() == null) { if (property == null || property.getValue() == null) {