[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());
|
assertEquals("2", property.getPrimitiveValue().toValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void entityCollectionWithAppendedKey() {
|
public void entityCollectionWithAppendedKey() {
|
||||||
// .../odata.svc/FICRTCollESMedia()(1)
|
// .../odata.svc/FICRTCollESMedia()(1)
|
||||||
final ODataInvokeRequest<ODataEntity> request = getClient().getInvokeRequestFactory()
|
final ODataInvokeRequest<ODataEntity> request = getClient().getInvokeRequestFactory()
|
||||||
.getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
.getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||||
.appendOperationCallSegment("FICRTCollESMedia")
|
.appendOperationCallSegment("FICRTCollESMedia")
|
||||||
.appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1))
|
.appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1))
|
||||||
.build(), ODataEntity.class);
|
.build(), ODataEntity.class);
|
||||||
assertNotNull(request);
|
assertNotNull(request);
|
||||||
|
|
||||||
final ODataInvokeResponse<ODataEntity> response = request.execute();
|
final ODataInvokeResponse<ODataEntity> response = request.execute();
|
||||||
|
@ -111,16 +110,15 @@ 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
|
||||||
final ODataInvokeRequest<ODataProperty> request = getClient().getInvokeRequestFactory()
|
final ODataInvokeRequest<ODataProperty> request = getClient().getInvokeRequestFactory()
|
||||||
.getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
.getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||||
.appendOperationCallSegment("FICRTCollESMedia")
|
.appendOperationCallSegment("FICRTCollESMedia")
|
||||||
.appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2))
|
.appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2))
|
||||||
.appendPropertySegment("PropertyInt16")
|
.appendPropertySegment("PropertyInt16")
|
||||||
.build(), ODataProperty.class);
|
.build(), ODataProperty.class);
|
||||||
assertNotNull(request);
|
assertNotNull(request);
|
||||||
|
|
||||||
final ODataInvokeResponse<ODataProperty> response = request.execute();
|
final ODataInvokeResponse<ODataProperty> response = request.execute();
|
||||||
|
@ -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();
|
||||||
|
|
|
@ -208,12 +208,11 @@ 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) :
|
getPropertyData(entity, path);
|
||||||
getPropertyData(entity, path);
|
|
||||||
|
|
||||||
if (property == null) {
|
if (property == null) {
|
||||||
throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
|
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 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) {
|
||||||
|
|
Loading…
Reference in New Issue