[OLINGO-557] small fix in technical service
Change-Id: I12b8e4ca94b7db28cae77a5fb173a4d90075fda6 Signed-off-by: Christian Amend <chrisam@apache.org>
This commit is contained in:
parent
200dac0a2c
commit
36219d3258
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue