[OLINGO-695] Merged with master
This commit is contained in:
commit
74fddd1df7
12
fit/pom.xml
12
fit/pom.xml
|
@ -41,6 +41,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>odata-client-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>odata-client-proxy</artifactId>
|
||||
|
@ -116,12 +122,6 @@
|
|||
<artifactId>commons-vfs2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>odata-client-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>odata-server-tecsvc</artifactId>
|
||||
|
|
|
@ -68,6 +68,11 @@ import org.apache.cxf.jaxrs.client.WebClient;
|
|||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.client.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.client.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.commons.api.data.ComplexValue;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||
|
@ -79,12 +84,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
import org.apache.olingo.commons.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.fit.metadata.EntityType;
|
||||
import org.apache.olingo.fit.metadata.Metadata;
|
||||
import org.apache.olingo.fit.metadata.NavigationProperty;
|
||||
|
|
|
@ -27,8 +27,8 @@ import java.nio.charset.CodingErrorAction;
|
|||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.apache.olingo.client.core.serialization.AtomDeserializer;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.core.serialization.AtomDeserializer;
|
||||
|
||||
public class FITAtomDeserializer extends AtomDeserializer {
|
||||
|
||||
|
|
|
@ -42,19 +42,19 @@ import javax.ws.rs.core.Response;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.vfs2.FileObject;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.client.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.client.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||
import org.apache.olingo.commons.api.data.Link;
|
||||
import org.apache.olingo.commons.api.data.Property;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.fit.UnsupportedMediaTypeException;
|
||||
import org.apache.olingo.fit.metadata.Metadata;
|
||||
import org.apache.olingo.fit.metadata.NavigationProperty;
|
||||
|
|
|
@ -38,12 +38,12 @@ import org.apache.commons.vfs2.FileSystemException;
|
|||
import org.apache.commons.vfs2.FileSystemManager;
|
||||
import org.apache.commons.vfs2.FileType;
|
||||
import org.apache.commons.vfs2.VFS;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.client.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonSerializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ import org.apache.olingo.client.api.ODataClient;
|
|||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.client.api.domain.ClientValue;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.fit.server.TomcatTestServer;
|
||||
import org.apache.olingo.server.tecsvc.TechnicalServlet;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.junit.Assert.fail;
|
|||
import java.math.BigDecimal;
|
||||
import java.net.URI;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -32,6 +33,8 @@ import java.util.TimeZone;
|
|||
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
|
||||
import org.apache.olingo.client.api.domain.ClientCollectionValue;
|
||||
import org.apache.olingo.client.api.domain.ClientComplexValue;
|
||||
|
@ -42,6 +45,7 @@ import org.apache.olingo.client.api.domain.ClientValue;
|
|||
import org.apache.olingo.client.core.ODataClientFactory;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpStatusCode;
|
||||
import org.apache.olingo.fit.AbstractBaseTestITCase;
|
||||
import org.apache.olingo.fit.tecsvc.TecSvcConst;
|
||||
import org.junit.Test;
|
||||
|
@ -50,50 +54,62 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void noReturnTypeAction() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRT").build();
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
|
||||
assertEquals(204, response.getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void primitveAction() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build();
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRT").build();
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void primitiveAction() throws Exception {
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTString").build();
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("UARTString string value", response.getBody().getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void primitveActionInvalidParameters() throws Exception {
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("Invalid", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1));
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build();
|
||||
public void primitiveActionMinimalResponse() throws Exception {
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTString").build();
|
||||
ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
|
||||
.getActionInvokeRequest(actionURI, ClientProperty.class);
|
||||
request.setPrefer(getClient().newPreferences().returnMinimal());
|
||||
final ODataInvokeResponse<ClientProperty> response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("return=\"minimal\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void primitiveActionInvalidParameters() throws Exception {
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTString").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("Invalid",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1));
|
||||
try {
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
.execute();
|
||||
fail("Expected an ODataClientErrorException");
|
||||
} catch (ODataClientErrorException e) {
|
||||
assertEquals(400, e.getStatusLine().getStatusCode());
|
||||
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void primitveCollectionAction() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollStringTwoParam").build();
|
||||
public void primitiveCollectionAction() throws Exception {
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollStringTwoParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
|
||||
EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
|
||||
parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder()
|
||||
.setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue();
|
||||
assertEquals(3, valueArray.size());
|
||||
Iterator<ClientValue> iterator = valueArray.iterator();
|
||||
|
@ -104,14 +120,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void complexAction() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientComplexValue complexValue = response.getBody().getComplexValue();
|
||||
ClientProperty propInt16 = complexValue.get("PropertyInt16");
|
||||
assertNotNull(propInt16);
|
||||
|
@ -123,28 +139,28 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void complexCollectionActionNoContent() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
|
||||
assertEquals(0, complexValueCollection.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void complexCollectionActionSubContent() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1));
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
|
||||
assertEquals(1, complexValueCollection.size());
|
||||
Iterator<ClientValue> iterator = complexValueCollection.iterator();
|
||||
|
@ -156,14 +172,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void complexCollectionActionAllContent() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
ODataInvokeResponse<ClientProperty> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
|
||||
assertEquals(3, complexValueCollection.size());
|
||||
Iterator<ClientValue> iterator = complexValueCollection.iterator();
|
||||
|
@ -183,15 +199,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void entityActionETTwoKeyTwoPrim() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365));
|
||||
ODataInvokeResponse<ClientEntity> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientEntity entity = response.getBody();
|
||||
ClientProperty propInt16 = entity.getProperty("PropertyInt16");
|
||||
assertNotNull(propInt16);
|
||||
|
@ -203,15 +218,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void entityCollectionActionETKeyNav() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
|
||||
ODataInvokeResponse<ClientEntitySet> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientEntitySet entitySet = response.getBody();
|
||||
assertEquals(3, entitySet.getEntities().size());
|
||||
Integer key = 1;
|
||||
|
@ -223,51 +237,49 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void entityCollectionActionETKeyNavEmptyCollection() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
|
||||
ODataInvokeResponse<ClientEntitySet> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientEntitySet entitySet = response.getBody();
|
||||
assertEquals(0, entitySet.getEntities().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void entityCollectionActionETKeyNavNegativeParam() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10));
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollETKeyNavParam").build();
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10));
|
||||
ODataInvokeResponse<ClientEntitySet> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientEntitySet entitySet = response.getBody();
|
||||
assertEquals(0, entitySet.getEntities().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void entityCollectionActionETAllPrim() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollESAllPrimParam").build();
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTCollESAllPrimParam").build();
|
||||
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
time.clear();
|
||||
time.set(Calendar.HOUR_OF_DAY, 3);
|
||||
time.set(Calendar.MINUTE, 0);
|
||||
time.set(Calendar.SECOND, 0);
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterTimeOfDay", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
|
||||
EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap(
|
||||
"ParameterTimeOfDay",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
|
||||
.setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
|
||||
ODataInvokeResponse<ClientEntitySet> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
|
||||
.execute();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ClientEntitySet entitySet = response.getBody();
|
||||
assertEquals(3, entitySet.getEntities().size());
|
||||
Integer key = 1;
|
||||
|
@ -279,20 +291,19 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
|
|||
|
||||
@Test
|
||||
public void entityActionETAllPrim() throws Exception {
|
||||
URI actionURI =
|
||||
getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTESAllPrimParam").build();
|
||||
final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendActionCallSegment("AIRTESAllPrimParam").build();
|
||||
Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
dateTime.clear();
|
||||
dateTime.set(1012, 2, 0, 0, 0, 0);
|
||||
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
|
||||
parameters
|
||||
.put("ParameterDate", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
|
||||
EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
|
||||
Map<String, ClientValue> parameters = Collections.singletonMap(
|
||||
"ParameterDate",
|
||||
(ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
|
||||
.setType(EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
|
||||
ODataInvokeResponse<ClientEntity> response =
|
||||
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
|
||||
.execute();
|
||||
// Check 201
|
||||
assertEquals(201, response.getStatusCode());
|
||||
.execute();
|
||||
assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
|||
import org.apache.olingo.client.api.EdmEnabledODataClient;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
|
||||
|
@ -45,6 +46,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRe
|
|||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
|
||||
|
@ -57,6 +59,7 @@ import org.apache.olingo.client.api.domain.ClientEntitySet;
|
|||
import org.apache.olingo.client.api.domain.ClientInlineEntity;
|
||||
import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
|
||||
import org.apache.olingo.client.api.domain.ClientObjectFactory;
|
||||
import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.client.api.domain.ClientServiceDocument;
|
||||
import org.apache.olingo.client.api.domain.ClientValue;
|
||||
|
@ -162,6 +165,22 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(0, property.getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readEntityCollectionCount() {
|
||||
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
|
||||
.getValueRequest(getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESServerSidePaging").appendCountSegment().build());
|
||||
assertNotNull(request);
|
||||
|
||||
final ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals(ContentType.TEXT_PLAIN.toContentTypeString(), response.getContentType());
|
||||
|
||||
final ClientPrimitiveValue value = response.getBody();
|
||||
assertNotNull(value);
|
||||
assertEquals("503", value.toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readException() throws Exception {
|
||||
final ODataEntityRequest<ClientEntity> request = getClient().getRetrieveRequestFactory()
|
||||
|
@ -382,6 +401,24 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
assertNull(property2.getPrimitiveValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createEntityMinimalResponse() throws Exception {
|
||||
final ODataClient client = getClient();
|
||||
final ClientObjectFactory factory = client.getObjectFactory();
|
||||
ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETTwoPrim"));
|
||||
newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString",
|
||||
factory.newPrimitiveValueBuilder().buildString("new")));
|
||||
ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityCreateRequest(
|
||||
client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").build(),
|
||||
newEntity);
|
||||
request.setPrefer(getClient().newPreferences().returnMinimal());
|
||||
|
||||
final ODataEntityCreateResponse<ClientEntity> response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("return=\"minimal\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
assertEquals(SERVICE_URI + "/ESTwoPrim(1)", response.getHeader(HttpHeader.LOCATION).iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readEntityWithExpandedNavigationProperty() {
|
||||
final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
|
||||
|
@ -441,30 +478,20 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
entity.getProperties().add(
|
||||
of.newCollectionProperty("CollPropertyComp",
|
||||
of.newCollectionValue("CTPrimComp")
|
||||
.add(
|
||||
of.newComplexValue("CTPrimComp")
|
||||
.add(
|
||||
of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder()
|
||||
.buildInt16(
|
||||
(short) 42)))
|
||||
.add(
|
||||
of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim")
|
||||
.add(
|
||||
of.newPrimitiveProperty("PropertyString", of
|
||||
.newPrimitiveValueBuilder()
|
||||
.buildString("42"))))))
|
||||
.add(
|
||||
of.newComplexValue("CTPrimComp")
|
||||
.add(
|
||||
of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder()
|
||||
.buildInt16(
|
||||
(short) 43)))
|
||||
.add(
|
||||
of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim")
|
||||
.add(
|
||||
of.newPrimitiveProperty("PropertyString", of
|
||||
.newPrimitiveValueBuilder()
|
||||
.buildString("43"))))))));
|
||||
.add(of.newComplexValue("CTPrimComp")
|
||||
.add(of.newPrimitiveProperty("PropertyInt16",
|
||||
of.newPrimitiveValueBuilder().buildInt16((short) 42)))
|
||||
.add(of.newComplexProperty("PropertyComp",
|
||||
of.newComplexValue("CTAllPrim")
|
||||
.add(of.newPrimitiveProperty("PropertyString",
|
||||
of.newPrimitiveValueBuilder().buildString("42"))))))
|
||||
.add(of.newComplexValue("CTPrimComp")
|
||||
.add(of.newPrimitiveProperty("PropertyInt16",
|
||||
of.newPrimitiveValueBuilder().buildInt16((short) 43)))
|
||||
.add(of.newComplexProperty("PropertyComp",
|
||||
of.newComplexValue("CTAllPrim")
|
||||
.add(of.newPrimitiveProperty("PropertyString",
|
||||
of.newPrimitiveValueBuilder().buildString("43"))))))));
|
||||
|
||||
final URI uri = getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESKeyNav")
|
||||
|
@ -663,13 +690,15 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
entity.getProperties().add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder()
|
||||
.buildString(null)));
|
||||
|
||||
final ODataEntityUpdateResponse<ClientEntity> updateResponse = client.getCUDRequestFactory()
|
||||
.getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity)
|
||||
.execute();
|
||||
ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory()
|
||||
.getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity);
|
||||
request.setPrefer(getClient().newPreferences().returnRepresentation());
|
||||
final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
|
||||
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), updateResponse.getStatusCode());
|
||||
assertTrue(updateResponse.getBody().getProperty("PropertyString").hasNullValue());
|
||||
assertEquals(34, updateResponse.getBody().getProperty("PropertyDecimal").getPrimitiveValue().toValue());
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("return=\"representation\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
assertTrue(response.getBody().getProperty("PropertyString").hasNullValue());
|
||||
assertEquals(34, response.getBody().getProperty("PropertyDecimal").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test(expected = ODataClientErrorException.class)
|
||||
|
@ -725,23 +754,23 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany")
|
||||
.build());
|
||||
entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
|
||||
final ODataRetrieveResponse<ClientEntity> entitytResponse = entityRequest.execute();
|
||||
final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
|
||||
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode());
|
||||
assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
|
||||
assertEquals(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
|
||||
.asInlineEntity()
|
||||
.getEntity()
|
||||
.getProperty("PropertyInt16")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
.size());
|
||||
|
||||
assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -750,7 +779,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(2, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -759,7 +788,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -768,7 +797,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
final Iterator<ClientValue> collectionIterator = entitytResponse.getBody()
|
||||
final Iterator<ClientValue> collectionIterator = entityResponse.getBody()
|
||||
.getProperty("CollPropertyString")
|
||||
.getCollectionValue()
|
||||
.iterator();
|
||||
|
@ -776,7 +805,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue());
|
||||
assertFalse(collectionIterator.hasNext());
|
||||
|
||||
final ClientComplexValue complexValue = entitytResponse.getBody()
|
||||
final ClientComplexValue complexValue = entityResponse.getBody()
|
||||
.getProperty("PropertyCompAllPrim")
|
||||
.getComplexValue();
|
||||
|
||||
|
@ -807,14 +836,14 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.add(of.newPrimitiveValueBuilder().buildString("Single entry!"))));
|
||||
entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim",
|
||||
of.newComplexValue("CTAllPrim")
|
||||
.add(of.newPrimitiveProperty("PropertyString",
|
||||
of.newPrimitiveValueBuilder().buildString("Changed")))));
|
||||
.add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("Changed")))));
|
||||
|
||||
final ODataEntityUpdateResponse<ClientEntity> response = client.getCUDRequestFactory()
|
||||
.getEntityUpdateRequest(targetURI, UpdateType.REPLACE, entity)
|
||||
.execute();
|
||||
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory()
|
||||
.getEntityUpdateRequest(targetURI, UpdateType.REPLACE, entity);
|
||||
request.setPrefer(getClient().newPreferences().returnMinimal());
|
||||
final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("return=\"minimal\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next();
|
||||
|
||||
final ODataEntityRequest<ClientEntity> entityRequest = client.getRetrieveRequestFactory()
|
||||
|
@ -825,23 +854,23 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany")
|
||||
.build());
|
||||
entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
|
||||
final ODataRetrieveResponse<ClientEntity> entitytResponse = entityRequest.execute();
|
||||
final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
|
||||
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode());
|
||||
assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
|
||||
assertEquals(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
|
||||
.asInlineEntity()
|
||||
.getEntity()
|
||||
.getProperty("PropertyInt16")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
.size());
|
||||
|
||||
assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -850,7 +879,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(2, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -859,7 +888,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
|
||||
.asInlineEntitySet()
|
||||
.getEntitySet()
|
||||
.getEntities()
|
||||
|
@ -868,7 +897,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
final Iterator<ClientValue> collectionIterator = entitytResponse.getBody()
|
||||
final Iterator<ClientValue> collectionIterator = entityResponse.getBody()
|
||||
.getProperty("CollPropertyString")
|
||||
.getCollectionValue()
|
||||
.iterator();
|
||||
|
@ -876,7 +905,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue());
|
||||
assertFalse(collectionIterator.hasNext());
|
||||
|
||||
final ClientComplexValue propCompAllPrim = entitytResponse.getBody()
|
||||
final ClientComplexValue propCompAllPrim = entityResponse.getBody()
|
||||
.getProperty("PropertyCompAllPrim")
|
||||
.getComplexValue();
|
||||
|
||||
|
@ -884,15 +913,15 @@ public class BasicITCase extends AbstractBaseTestITCase {
|
|||
assertTrue(propCompAllPrim.get("PropertyInt16").hasNullValue());
|
||||
assertTrue(propCompAllPrim.get("PropertyDate").hasNullValue());
|
||||
|
||||
final ClientComplexValue propCompTwoPrim = entitytResponse.getBody()
|
||||
final ClientComplexValue propCompTwoPrim = entityResponse.getBody()
|
||||
.getProperty("PropertyCompTwoPrim")
|
||||
.getComplexValue();
|
||||
|
||||
assertEquals("Must not be null", propCompTwoPrim.get("PropertyString").getPrimitiveValue().toValue());
|
||||
assertEquals(42, propCompTwoPrim.get("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
assertNotNull(entitytResponse.getBody().getProperty("PropertyCompNav").getComplexValue());
|
||||
assertTrue(entitytResponse.getBody()
|
||||
assertNotNull(entityResponse.getBody().getProperty("PropertyCompNav").getComplexValue());
|
||||
assertTrue(entityResponse.getBody()
|
||||
.getProperty("PropertyCompNav")
|
||||
.getComplexValue()
|
||||
.get("PropertyInt16")
|
||||
|
|
|
@ -60,7 +60,6 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
public class BatchClientITCase extends AbstractTestITCase {
|
||||
private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM.toContentTypeString();
|
||||
private static final String SERVICE_URI = TecSvcConst.BASE_URI;
|
||||
private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
|
||||
private static final String ES_NOT_AVAILABLE_NAME = "ESNotAvailable";
|
||||
|
@ -70,6 +69,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
|
||||
client.getConfiguration().setContinueOnError(false);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder()
|
||||
.buildString("1")));
|
||||
final ODataBatchRequest batchRequest = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
batchRequest.setAccept(ACCEPT);
|
||||
final BatchManager payloadManager = batchRequest.payloadManager();
|
||||
final ODataChangeset changeset = payloadManager.addChangeset();
|
||||
final URI targetURI = client.newURIBuilder(SERVICE_URI)
|
||||
|
@ -130,12 +129,11 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
public void emptyBatchRequest() {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("Accepted", response.getStatusMessage());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
@ -145,7 +143,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
@Test
|
||||
public void getBatchRequestWithRelativeUris() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
|
||||
|
@ -155,7 +152,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
// Fetch result
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("Accepted", response.getStatusMessage());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
@ -177,7 +174,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
@Test
|
||||
public void getBatchRequest() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
|
||||
|
@ -187,7 +183,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
// Fetch result
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("Accepted", response.getStatusMessage());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
@ -209,7 +205,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
@Test
|
||||
public void testErrorWithoutContinueOnErrorPreferHeader() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
|
||||
|
@ -219,7 +214,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
|
||||
// Fetch result
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
||||
|
@ -253,7 +248,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
@Test
|
||||
public void testInvalidAbsoluteUri() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
final URI uri = new URI(SERVICE_URI + "/../ESAllPrim(32767)");
|
||||
|
@ -263,7 +257,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
|
||||
// Fetch result
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
|
||||
assertTrue(bodyIterator.hasNext());
|
||||
|
@ -272,13 +266,12 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
assertFalse(item.isChangeset());
|
||||
|
||||
final ODataResponse oDataResponse = item.next();
|
||||
assertEquals(400, oDataResponse.getStatusCode());
|
||||
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), oDataResponse.getStatusCode());
|
||||
}
|
||||
|
||||
@Test(expected = HttpClientException.class)
|
||||
public void testInvalidHost() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
final URI uri = new URI("http://otherhost/odata/ESAllPrim(32767)");
|
||||
|
@ -293,7 +286,6 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
@Test(expected = HttpClientException.class)
|
||||
public void testInvalidAbsoluteRequest() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
final URI uri = new URI("/ESAllPrim(32767)");
|
||||
|
@ -306,10 +298,9 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testErrorWithContinueOnErrorPreferHeader() throws URISyntaxException {
|
||||
public void errorWithContinueOnErrorPreferHeader() throws Exception {
|
||||
client.getConfiguration().setContinueOnError(true);
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
|
||||
|
@ -319,7 +310,8 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
|
||||
// Fetch result
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("odata.continue-on-error", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
|
||||
|
||||
|
@ -331,10 +323,10 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
ODataResponse oDataResonse = item.next();
|
||||
assertNotNull(oDataResonse);
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
|
||||
assertEquals(1, oDataResonse.getHeader("OData-Version").size());
|
||||
assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader("Content-Length").size());
|
||||
assertEquals("605", oDataResonse.getHeader("Content-Length").toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader(HttpHeader.ODATA_VERSION).size());
|
||||
assertEquals("4.0", oDataResonse.getHeader(HttpHeader.ODATA_VERSION).toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader(HttpHeader.CONTENT_LENGTH).size());
|
||||
assertEquals("605", oDataResonse.getHeader(HttpHeader.CONTENT_LENGTH).toArray()[0]);
|
||||
assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
|
||||
|
||||
// Check second get request
|
||||
|
@ -354,20 +346,18 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
oDataResonse = item.next();
|
||||
assertNotNull(oDataResonse);
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
|
||||
assertEquals(1, oDataResonse.getHeader("OData-Version").size());
|
||||
assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader("Content-Length").size());
|
||||
assertEquals("513", oDataResonse.getHeader("Content-Length").toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader(HttpHeader.ODATA_VERSION).size());
|
||||
assertEquals("4.0", oDataResonse.getHeader(HttpHeader.ODATA_VERSION).toArray()[0]);
|
||||
assertEquals(1, oDataResonse.getHeader(HttpHeader.CONTENT_LENGTH).size());
|
||||
assertEquals("513", oDataResonse.getHeader(HttpHeader.CONTENT_LENGTH).toArray()[0]);
|
||||
assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void changesetWithReferences() throws EdmPrimitiveTypeException, URISyntaxException {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
final ClientObjectFactory of = client.getObjectFactory();
|
||||
request.setAccept(ACCEPT);
|
||||
final BatchManager streamManager = request.payloadManager();
|
||||
|
||||
final ODataChangeset changeset = streamManager.addChangeset();
|
||||
|
@ -421,7 +411,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
ODataResponse res = chgitem.next();
|
||||
assertEquals(HttpStatusCode.CREATED.getStatusCode(), res.getStatusCode());
|
||||
assertTrue(res instanceof ODataEntityCreateResponse);
|
||||
final ODataEntityCreateResponse<ClientEntity> createResponse = ((ODataEntityCreateResponse<ClientEntity>) res);
|
||||
final ODataEntityCreateResponse<?> createResponse = ((ODataEntityCreateResponse<?>) res);
|
||||
|
||||
res = chgitem.next();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), res.getStatusCode());
|
||||
|
@ -442,11 +432,9 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void changesetBatchRequest() throws URISyntaxException {
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
|
||||
final ClientObjectFactory of = client.getObjectFactory();
|
||||
request.setAccept(ACCEPT);
|
||||
|
||||
final BatchManager payload = request.payloadManager();
|
||||
// -----------------------------
|
||||
|
@ -530,7 +518,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
// - Fetch result
|
||||
// -----------------------------
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
assertEquals(202, response.getStatusCode());
|
||||
assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
|
||||
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
|
||||
|
||||
// Check first get request
|
||||
|
@ -540,7 +528,9 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
assertTrue(item.hasNext());
|
||||
final ODataResponse response0 = item.next();
|
||||
assertTrue(response0 instanceof ODataRetrieveResponse);
|
||||
assertEquals(34, ((ODataRetrieveResponse<ClientEntity>) response0).getBody()
|
||||
@SuppressWarnings("unchecked")
|
||||
ODataRetrieveResponse<ClientEntity> retrieveResponse = (ODataRetrieveResponse<ClientEntity>) response0;
|
||||
assertEquals(34, retrieveResponse.getBody()
|
||||
.getProperty("PropertyDecimal")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
@ -555,7 +545,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
final ODataResponse response1 = item.next();
|
||||
assertEquals(HttpStatusCode.CREATED.getStatusCode(), response1.getStatusCode());
|
||||
assertTrue(response1 instanceof ODataEntityCreateResponse);
|
||||
assertEquals(3.1415, ((ODataEntityCreateResponse<ClientEntity>) response1).getBody().getProperty("PropertyDouble")
|
||||
assertEquals(3.1415, ((ODataEntityCreateResponse<?>) response1).getBody().getProperty("PropertyDouble")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
// Update
|
||||
|
@ -569,7 +559,7 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
final ODataResponse response3 = item.next();
|
||||
assertEquals(HttpStatusCode.CREATED.getStatusCode(), response3.getStatusCode());
|
||||
assertTrue(response3 instanceof ODataEntityUpdateResponse);
|
||||
assertEquals(3.1415, ((ODataEntityUpdateResponse<ClientEntity>) response3).getBody().getProperty("PropertyDouble")
|
||||
assertEquals(3.1415, ((ODataEntityUpdateResponse<?>) response3).getBody().getProperty("PropertyDouble")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
||||
|
@ -580,7 +570,9 @@ public class BatchClientITCase extends AbstractTestITCase {
|
|||
assertTrue(item.hasNext());
|
||||
final ODataResponse response4 = item.next();
|
||||
assertTrue(response4 instanceof ODataRetrieveResponse);
|
||||
assertEquals(3.1415, ((ODataRetrieveResponse<ClientEntity>) response4).getBody()
|
||||
@SuppressWarnings("unchecked")
|
||||
final ODataRetrieveResponse<ClientEntity> retrieveResponse2 = (ODataRetrieveResponse<ClientEntity>) response4;
|
||||
assertEquals(3.1415, retrieveResponse2.getBody()
|
||||
.getProperty("PropertyDouble")
|
||||
.getPrimitiveValue()
|
||||
.toValue());
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.fit.tecsvc.client;
|
|||
import static org.hamcrest.CoreMatchers.anyOf;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
@ -34,6 +35,7 @@ import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
|
|||
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.UpdateType;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||
|
@ -202,6 +204,16 @@ public final class ConditionalITCase extends AbstractBaseTestITCase {
|
|||
executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatePropertyValueWithWrongIfMatch() throws Exception {
|
||||
ODataValueUpdateRequest request = client.getCUDRequestFactory().getValueUpdateRequest(
|
||||
uriPropertyValue,
|
||||
UpdateType.REPLACE,
|
||||
client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S"));
|
||||
request.setIfMatch("W/\"1\"");
|
||||
executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletePropertyWithWrongIfMatch() throws Exception {
|
||||
ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriProperty);
|
||||
|
@ -209,6 +221,16 @@ public final class ConditionalITCase extends AbstractBaseTestITCase {
|
|||
executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletePropertyValue() throws Exception {
|
||||
ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriPropertyValue);
|
||||
request.setIfMatch("W/\"0\"");
|
||||
final ODataDeleteResponse response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
assertNotNull(response.getETag());
|
||||
assertNotEquals(request.getIfMatch(), response.getETag());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletePropertyValueWithWrongIfMatch() throws Exception {
|
||||
ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriPropertyValue);
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
|
|||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.domain.ClientEntitySet;
|
||||
import org.apache.olingo.client.api.domain.ClientObjectFactory;
|
||||
import org.apache.olingo.client.api.domain.ClientValuable;
|
||||
import org.apache.olingo.client.core.ODataClientFactory;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
|
@ -62,7 +61,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -71,15 +70,15 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, response.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
clientEntity = response.getBody().getEntities().get(1);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq true");
|
||||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -88,7 +87,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,7 +97,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -109,7 +108,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -121,7 +120,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -130,12 +129,12 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
|
||||
assertEquals(2, result.getBody().getEntities().size());
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -145,8 +144,8 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -166,8 +165,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
|
||||
assertEquals(1, response.getBody().getEntities().size());
|
||||
ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -176,7 +174,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -185,18 +183,18 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' and PropertyInt16 eq 1");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' or PropertyInt16 eq 1");
|
||||
assertEquals(2, result.getBody().getEntities().size());
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -296,26 +294,17 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
.appendKeySegment(32766)
|
||||
.build()));
|
||||
|
||||
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").build();
|
||||
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
|
||||
ODataEntityCreateResponse<ClientEntity> createResponse =
|
||||
client.getCUDRequestFactory().getEntityCreateRequest(uri, entity).execute();
|
||||
|
||||
final URI receiveURI =
|
||||
client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESAllPrim")
|
||||
.filter(filterString)
|
||||
.build();
|
||||
|
||||
ODataEntitySetRequest<ClientEntitySet> filterRequest =
|
||||
client.getRetrieveRequestFactory().getEntitySetRequest(receiveURI);
|
||||
filterRequest.addCustomHeader(HttpHeader.COOKIE, createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
|
||||
ODataRetrieveResponse<ClientEntitySet> filterResponse = filterRequest.execute();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> filterResponse = sendRequest(ES_ALL_PRIM, filterString,
|
||||
createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
|
||||
assertEquals(1, filterResponse.getBody().getEntities().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumericComparisionOperators() {
|
||||
public void numericComparisonOperators() {
|
||||
ODataRetrieveResponse<ClientEntitySet> result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 ge 1");
|
||||
assertEquals(4, result.getBody().getEntities().size());
|
||||
|
||||
|
@ -355,25 +344,22 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(3, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue()
|
||||
.get("PropertyInt16")).getValue()
|
||||
.toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
|
||||
.getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue()
|
||||
.get("PropertyInt16")).getValue()
|
||||
.toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
|
||||
.getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(2);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue()
|
||||
.get("PropertyInt16")).getValue()
|
||||
.toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
|
||||
.getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -382,12 +368,12 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -396,12 +382,12 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -410,12 +396,12 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -444,7 +430,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -455,30 +441,27 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(4, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(2);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(3);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubstringDouble() {
|
||||
try {
|
||||
sendRequest(ES_ALL_PRIM, "substring(PropertyString, length('First')"
|
||||
+ "add 1, 2.0 * 4) eq ('Resource')");
|
||||
} catch (ODataClientErrorException e) {
|
||||
assertEquals(400, e.getStatusLine().getStatusCode());
|
||||
}
|
||||
fail(ES_ALL_PRIM,
|
||||
"substring(PropertyString, length('First') add 1, 2.0 * 4) eq ('Resource')",
|
||||
HttpStatusCode.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -487,7 +470,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -496,7 +479,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -505,13 +488,13 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(3, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(2);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -520,7 +503,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -529,13 +512,13 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(3, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(2);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -544,7 +527,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -553,10 +536,10 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -565,7 +548,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -574,7 +557,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -583,7 +566,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -592,7 +575,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -601,7 +584,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -611,10 +594,12 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, response.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("W/\"32767\"", clientEntity.getETag());
|
||||
|
||||
clientEntity = response.getBody().getEntities().get(1);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("W/\"0\"", clientEntity.getETag());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -653,15 +638,15 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.1)");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -670,15 +655,15 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.6)");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -687,29 +672,29 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.4)");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.6)");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
|
||||
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(3.1)");
|
||||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString());
|
||||
assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -718,10 +703,10 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(2, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
|
||||
clientEntity = result.getBody().getEntities().get(1);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -731,7 +716,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -740,7 +725,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -750,7 +735,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -760,7 +745,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -770,7 +755,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -780,7 +765,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -790,7 +775,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, result.getBody().getEntities().size());
|
||||
|
||||
ClientEntity clientEntity = result.getBody().getEntities().get(0);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -808,7 +793,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -818,7 +803,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -835,7 +820,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -845,7 +830,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -855,7 +840,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -865,7 +850,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -875,7 +860,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -885,7 +870,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(1, response.getBody().getEntities().size());
|
||||
|
||||
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
|
||||
assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
|
||||
assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,20 +26,24 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.UpdateType;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
|
||||
import org.apache.olingo.client.api.domain.ClientCollectionValue;
|
||||
import org.apache.olingo.client.api.domain.ClientComplexValue;
|
||||
import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
|
||||
|
@ -318,15 +322,102 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
|
|||
public void readPropertyValue() throws Exception {
|
||||
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
|
||||
.getPropertyValueRequest(getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESTwoPrim")
|
||||
.appendKeySegment(32766)
|
||||
.appendPropertySegment("PropertyString")
|
||||
.appendValueSegment()
|
||||
.appendEntitySetSegment("ESTwoPrim").appendKeySegment(32766)
|
||||
.appendPropertySegment("PropertyString").appendValueSegment()
|
||||
.build());
|
||||
final ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
|
||||
assertEquals("Test String1", response.getBody().toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletePropertyValue() throws Exception {
|
||||
final URI uri = getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESKeyNav").appendKeySegment(1)
|
||||
.appendPropertySegment("PropertyCompAllPrim").appendPropertySegment("PropertyString")
|
||||
.appendValueSegment()
|
||||
.build();
|
||||
final ODataDeleteRequest request = getClient().getCUDRequestFactory().getDeleteRequest(uri);
|
||||
final ODataDeleteResponse response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
|
||||
// Check that the property is really gone.
|
||||
// This check has to be in the same session in order to access the same data provider.
|
||||
ODataValueRequest valueRequest = getClient().getRetrieveRequestFactory().getPropertyValueRequest(uri);
|
||||
valueRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), valueRequest.execute().getStatusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatePropertyValue() throws Exception {
|
||||
final ODataValueUpdateRequest request =
|
||||
getClient().getCUDRequestFactory().getValueUpdateRequest(
|
||||
getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESTwoPrim").appendKeySegment(32766)
|
||||
.appendPropertySegment("PropertyString")
|
||||
.build(),
|
||||
UpdateType.REPLACE,
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Test String1"));
|
||||
assertNotNull(request);
|
||||
|
||||
final ODataValueUpdateResponse response = request.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals(ContentType.TEXT_PLAIN.toContentTypeString(), response.getContentType());
|
||||
|
||||
final ClientPrimitiveValue value = response.getBody();
|
||||
assertNotNull(value);
|
||||
assertEquals("Test String1", IOUtils.toString((InputStream) value.toValue(), "UTF-8"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatePropertyValueMinimalResponse() throws Exception {
|
||||
ODataValueUpdateRequest request = getClient().getCUDRequestFactory().getValueUpdateRequest(
|
||||
getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").appendKeySegment(32766)
|
||||
.appendPropertySegment("PropertyString")
|
||||
.build(),
|
||||
UpdateType.REPLACE,
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Test String1"));
|
||||
request.setPrefer(getClient().newPreferences().returnMinimal());
|
||||
|
||||
final ODataValueUpdateResponse response = request.execute();
|
||||
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
|
||||
assertEquals("return=\"minimal\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readPrimitiveCollectionCount() {
|
||||
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
|
||||
.getValueRequest(getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1)
|
||||
.appendPropertySegment("CollPropertyBoolean").appendCountSegment().build());
|
||||
assertNotNull(request);
|
||||
|
||||
final ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals(ContentType.TEXT_PLAIN.toContentTypeString(), response.getContentType());
|
||||
|
||||
final ClientPrimitiveValue value = response.getBody();
|
||||
assertNotNull(value);
|
||||
assertEquals("3", value.toValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readComplexCollectionCount() {
|
||||
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
|
||||
.getValueRequest(getClient().newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment("ESCompCollAllPrim").appendKeySegment(5678)
|
||||
.appendPropertySegment("PropertyComp").appendPropertySegment("CollPropertyBoolean").appendCountSegment()
|
||||
.build());
|
||||
assertNotNull(request);
|
||||
|
||||
final ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
|
||||
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
|
||||
assertEquals(ContentType.TEXT_PLAIN.toContentTypeString(), response.getContentType());
|
||||
|
||||
final ClientPrimitiveValue value = response.getBody();
|
||||
assertNotNull(value);
|
||||
assertEquals("3", value.toValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ODataClient getClient() {
|
||||
ODataClient odata = ODataClientFactory.getClient();
|
||||
|
|
|
@ -25,10 +25,11 @@ import java.net.URI;
|
|||
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.domain.ClientEntitySet;
|
||||
import org.apache.olingo.client.api.uri.QueryOption;
|
||||
import org.apache.olingo.client.core.ODataClientFactory;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpStatusCode;
|
||||
|
@ -47,7 +48,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_ALL_PRIM)
|
||||
.addQueryOption(QueryOption.COUNT, "true")
|
||||
.count(true)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -63,7 +64,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.COUNT, "true")
|
||||
.count(true)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -79,7 +80,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.TOP, new Integer(5).toString())
|
||||
.top(5)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -99,7 +100,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.SKIP, new Integer(5).toString())
|
||||
.skip(5)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -119,8 +120,8 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.TOP, new Integer(20).toString())
|
||||
.addQueryOption(QueryOption.SKIP, new Integer(503).toString())
|
||||
.top(20)
|
||||
.skip(503)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -135,7 +136,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.SKIP, new Integer(10000).toString())
|
||||
.skip(10000)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -152,9 +153,9 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.filter("PropertyInt16 le 105") // 1, 2, ... , 105
|
||||
.orderBy("PropertyInt16 desc") // 105, 104, ..., 2, 1
|
||||
.addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString()) // 105
|
||||
.addQueryOption(QueryOption.SKIP, new Integer(3).toString()) // 102, 101, ..., 2, 1
|
||||
.addQueryOption(QueryOption.TOP, new Integer(43).toString()) // 102, 101, ...., 59
|
||||
.count(true) // 105
|
||||
.skip(3) // 102, 101, ..., 2, 1
|
||||
.top(43) // 102, 101, ...., 59
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -212,7 +213,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
|
||||
// Check initial next link format
|
||||
URI nextLink = response.getBody().getNext();
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=1", nextLink.toASCIIString());
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=1%2A10", nextLink.toASCIIString());
|
||||
|
||||
// Check subsequent next links
|
||||
response = client.getRetrieveRequestFactory()
|
||||
|
@ -220,7 +221,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
.execute();
|
||||
|
||||
nextLink = response.getBody().getNext();
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=2", nextLink.toASCIIString());
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=2%2A10", nextLink.toASCIIString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -228,7 +229,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
|
||||
.addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString())
|
||||
.count(true)
|
||||
.build();
|
||||
|
||||
ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
|
||||
|
@ -237,7 +238,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
|
||||
// Check initial next link format
|
||||
URI nextLink = response.getBody().getNext();
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=1",
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=1%2A10",
|
||||
nextLink.toASCIIString());
|
||||
|
||||
int token = 1;
|
||||
|
@ -251,7 +252,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
|
||||
nextLink = response.getBody().getNext();
|
||||
if (nextLink != null) {
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=" + token,
|
||||
assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=" + token + "%2A10",
|
||||
nextLink.toASCIIString());
|
||||
}
|
||||
}
|
||||
|
@ -259,12 +260,25 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
assertEquals(50 + 1, token);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nextLinkFormatWithClientPageSize() {
|
||||
final ODataClient client = getClient();
|
||||
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_SERVER_SIDE_PAGING).build();
|
||||
ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
|
||||
request.setPrefer(getClient().newPreferences().maxPageSize(7));
|
||||
|
||||
final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
|
||||
assertEquals("odata.maxpagesize=\"7\"", response.getHeader(HeaderName.preferenceApplied).iterator().next());
|
||||
assertEquals(SERVICE_URI + '/' + ES_SERVER_SIDE_PAGING + "?%24skiptoken=1%2A" + 7,
|
||||
response.getBody().getNext().toASCIIString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNegativeSkip() {
|
||||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_ALL_PRIM)
|
||||
.addQueryOption(QueryOption.SKIP, new Integer(-5).toString())
|
||||
.skip(-5)
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
@ -282,7 +296,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
|
|||
ODataClient client = getClient();
|
||||
URI uri = client.newURIBuilder(SERVICE_URI)
|
||||
.appendEntitySetSegment(ES_ALL_PRIM)
|
||||
.addQueryOption(QueryOption.TOP, new Integer(-5).toString())
|
||||
.top(-5)
|
||||
.build();
|
||||
try {
|
||||
client.getRetrieveRequestFactory()
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven.bundle.plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.RetrieveReque
|
|||
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataBinder;
|
||||
import org.apache.olingo.client.api.serialization.ODataReader;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
import org.apache.olingo.client.api.uri.FilterFactory;
|
||||
import org.apache.olingo.client.api.uri.SearchFactory;
|
||||
|
@ -35,7 +36,6 @@ import org.apache.olingo.client.api.uri.URIBuilder;
|
|||
import org.apache.olingo.client.api.domain.ClientObjectFactory;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
|
||||
public interface ODataClient {
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ import java.util.NoSuchElementException;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ import org.apache.olingo.client.api.data.ServiceDocument;
|
|||
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
|
||||
import org.apache.olingo.commons.api.data.Delta;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
public interface ClientODataDeserializer extends ODataDeserializer {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.api.serialization;
|
||||
package org.apache.olingo.client.api.serialization;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.api.serialization;
|
||||
package org.apache.olingo.client.api.serialization;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataException;
|
||||
|
|
@ -30,7 +30,6 @@ import org.apache.olingo.client.api.domain.ClientServiceDocument;
|
|||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* OData reader.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.api.serialization;
|
||||
package org.apache.olingo.client.api.serialization;
|
||||
|
||||
import java.io.Writer;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.api.serialization;
|
||||
package org.apache.olingo.client.api.serialization;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataException;
|
||||
|
|
@ -27,7 +27,6 @@ import org.apache.olingo.client.api.domain.ClientEntity;
|
|||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.client.api.domain.ClientLink;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* OData writer.
|
||||
|
|
|
@ -120,6 +120,12 @@ public interface URIBuilder {
|
|||
*/
|
||||
URIBuilder appendValueSegment();
|
||||
|
||||
/**
|
||||
* Appends count segment to the URI.
|
||||
* @return current URIBuilder instance
|
||||
*/
|
||||
URIBuilder appendCountSegment();
|
||||
|
||||
/**
|
||||
* Appends operation (action or function) segment to the URI.
|
||||
*
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven.bundle.plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.RetrieveReque
|
|||
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataBinder;
|
||||
import org.apache.olingo.client.api.serialization.ODataReader;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
import org.apache.olingo.client.api.uri.FilterFactory;
|
||||
import org.apache.olingo.client.api.uri.SearchFactory;
|
||||
|
@ -41,7 +42,9 @@ import org.apache.olingo.client.core.communication.request.batch.BatchRequestFac
|
|||
import org.apache.olingo.client.core.communication.request.cud.CUDRequestFactoryImpl;
|
||||
import org.apache.olingo.client.core.communication.request.invoke.InvokeRequestFactoryImpl;
|
||||
import org.apache.olingo.client.core.communication.request.retrieve.RetrieveRequestFactoryImpl;
|
||||
import org.apache.olingo.client.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl;
|
||||
import org.apache.olingo.client.core.serialization.JsonSerializer;
|
||||
import org.apache.olingo.client.core.serialization.ODataBinderImpl;
|
||||
import org.apache.olingo.client.core.serialization.ODataReaderImpl;
|
||||
import org.apache.olingo.client.core.serialization.ODataWriterImpl;
|
||||
|
@ -50,10 +53,7 @@ import org.apache.olingo.client.core.uri.URIBuilderImpl;
|
|||
import org.apache.olingo.client.api.domain.ClientObjectFactory;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.core.domain.ClientObjectFactoryImpl;
|
||||
import org.apache.olingo.commons.core.serialization.AtomSerializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonSerializer;
|
||||
|
||||
public class ODataClientImpl implements ODataClient {
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ import org.apache.http.StatusLine;
|
|||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.ODataServerErrorException;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.ODataError;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ import org.apache.olingo.client.core.uri.URIUtils;
|
|||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData create request.
|
||||
|
|
|
@ -35,10 +35,10 @@ import org.apache.olingo.client.core.uri.URIUtils;
|
|||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData update request.
|
||||
|
|
|
@ -34,10 +34,10 @@ import org.apache.olingo.client.core.uri.URIUtils;
|
|||
import org.apache.olingo.commons.api.data.Property;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData update entity property request.
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
|||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
|
@ -35,7 +36,6 @@ import org.apache.olingo.client.core.uri.URIUtils;
|
|||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* See {@link ODataReferenceAddingRequest}
|
||||
|
|
|
@ -35,6 +35,8 @@ import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequ
|
|||
import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent;
|
||||
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
|
||||
import org.apache.olingo.client.api.http.HttpClientException;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
|
@ -45,8 +47,6 @@ import org.apache.olingo.client.api.domain.ClientProperty;
|
|||
import org.apache.olingo.client.api.domain.ClientValue;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData invoke operation request.
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.apache.olingo.client.api.ODataClient;
|
|||
import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.http.HttpClientException;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.data.Delta;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientDelta;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ClientDelta>
|
||||
implements ODataDeltaRequest {
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
|
|||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData retrieve query request returning a single entity.
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
|
|||
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntitySet;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData EntitySet query request.
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.apache.olingo.client.api.ODataClient;
|
|||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.http.HttpClientException;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.data.Property;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData entity property query request.
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.apache.http.client.HttpClient;
|
|||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements a generic OData request.
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
|
|||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientServiceDocument;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData service document request.
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
|
|||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
|
|||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientEntity;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
/**
|
||||
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
|
||||
|
|
|
@ -25,10 +25,10 @@ import java.util.Iterator;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeserializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
|
|
|
@ -23,10 +23,10 @@ import java.io.InputStream;
|
|||
import java.net.URI;
|
||||
|
||||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.core.serialization.JsonDeserializer;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeserializer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.QName;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
@ -35,6 +35,8 @@ import javax.xml.stream.events.StartElement;
|
|||
import javax.xml.stream.events.XMLEvent;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.ODataError;
|
||||
import org.apache.olingo.commons.api.ODataPropertyType;
|
||||
|
@ -58,8 +60,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.geo.Geospatial;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
import com.fasterxml.aalto.stax.InputFactoryImpl;
|
||||
|
@ -431,7 +431,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria
|
|||
final Delta delta = new Delta();
|
||||
final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
|
||||
if (xmlBase != null) {
|
||||
delta.setBaseURI(xmlBase.getValue());
|
||||
delta.setBaseURI(URI.create(xmlBase.getValue()));
|
||||
}
|
||||
|
||||
boolean foundEndFeed = false;
|
||||
|
@ -579,7 +579,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria
|
|||
entity = new Entity();
|
||||
final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
|
||||
if (xmlBase != null) {
|
||||
entity.setBaseURI(xmlBase.getValue());
|
||||
entity.setBaseURI(URI.create(xmlBase.getValue()));
|
||||
}
|
||||
|
||||
final Attribute etag = start.getAttributeByName(etagQName);
|
||||
|
@ -737,7 +737,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria
|
|||
final EntityCollection entitySet = new EntityCollection();
|
||||
final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
|
||||
if (xmlBase != null) {
|
||||
entitySet.setBaseURI(xmlBase.getValue());
|
||||
entitySet.setBaseURI(URI.create(xmlBase.getValue()));
|
||||
}
|
||||
|
||||
boolean foundEndFeed = false;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.net.URI;
|
||||
|
@ -29,6 +29,8 @@ import javax.xml.stream.XMLStreamException;
|
|||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.data.AbstractODataObject;
|
||||
|
@ -46,8 +48,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.geo.Geospatial;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
|
||||
|
@ -550,7 +550,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize
|
|||
|
||||
if (container.getContextURL() != null) {
|
||||
final ContextURL contextURL = ContextURLParser.parse(container.getContextURL());
|
||||
String base = contextURL.getServiceRoot().toASCIIString();
|
||||
final URI base = contextURL.getServiceRoot();
|
||||
if (container.getPayload() instanceof EntityCollection) {
|
||||
((EntityCollection) container.getPayload()).setBaseURI(base);
|
||||
}
|
|
@ -26,6 +26,8 @@ import javax.xml.stream.XMLStreamException;
|
|||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
|
||||
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
|
||||
import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
|
||||
import org.apache.olingo.client.core.edm.xml.ClientCsdlEdmx;
|
||||
|
@ -38,11 +40,6 @@ import org.apache.olingo.commons.api.data.ResWrap;
|
|||
import org.apache.olingo.commons.api.ODataError;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.serialization.AtomDeserializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeltaDeserializer;
|
||||
import org.apache.olingo.commons.core.serialization.JsonDeserializer;
|
||||
|
||||
import com.fasterxml.aalto.stax.InputFactoryImpl;
|
||||
import com.fasterxml.aalto.stax.OutputFactoryImpl;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
|
@ -16,20 +16,20 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.ContextURL;
|
||||
import org.apache.olingo.commons.api.data.DeletedEntity;
|
||||
import org.apache.olingo.commons.api.data.Delta;
|
||||
import org.apache.olingo.commons.api.data.DeltaLink;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
|
@ -52,7 +52,7 @@ public class JsonDeltaDeserializer extends JsonDeserializer {
|
|||
final URI contextURL = tree.hasNonNull(Constants.JSON_CONTEXT) ?
|
||||
URI.create(tree.get(Constants.JSON_CONTEXT).textValue()) : null;
|
||||
if (contextURL != null) {
|
||||
delta.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA));
|
||||
delta.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
|
||||
}
|
||||
|
||||
if (tree.hasNonNull(Constants.JSON_COUNT)) {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -31,6 +31,8 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.ODataError;
|
||||
import org.apache.olingo.commons.api.ODataPropertyType;
|
||||
|
@ -49,8 +51,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.geo.Geospatial;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
@ -76,7 +76,7 @@ public class JsonEntityDeserializer extends JsonDeserializer {
|
|||
contextURL = null;
|
||||
}
|
||||
if (contextURL != null) {
|
||||
entity.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA));
|
||||
entity.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
|
||||
}
|
||||
|
||||
final String metadataETag;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
@ -66,7 +66,7 @@ public class JsonEntitySetDeserializer extends JsonDeserializer {
|
|||
contextURL = null;
|
||||
}
|
||||
if (contextURL != null) {
|
||||
entitySet.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA));
|
||||
entitySet.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
|
||||
}
|
||||
|
||||
final String metadataETag;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
@ -28,6 +28,8 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.Annotatable;
|
||||
import org.apache.olingo.commons.api.data.Annotation;
|
||||
|
@ -44,8 +46,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.geo.Geospatial;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializer;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
|
|
@ -31,6 +31,7 @@ import org.apache.olingo.client.api.ODataClient;
|
|||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.client.api.data.ServiceDocumentItem;
|
||||
import org.apache.olingo.client.api.serialization.ODataBinder;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.Annotatable;
|
||||
|
@ -87,14 +88,12 @@ import org.apache.olingo.commons.api.edm.EdmType;
|
|||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.edm.geo.Geospatial;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.core.domain.ClientAnnotationImpl;
|
||||
import org.apache.olingo.client.core.domain.ClientDeletedEntityImpl;
|
||||
import org.apache.olingo.client.core.domain.ClientDeltaLinkImpl;
|
||||
import org.apache.olingo.client.core.domain.ClientPropertyImpl;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
import org.apache.olingo.commons.core.serialization.ContextURLParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.olingo.client.api.ODataClient;
|
|||
import org.apache.olingo.client.api.data.ServiceDocument;
|
||||
import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
|
||||
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataReader;
|
||||
import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
|
@ -43,7 +44,6 @@ import org.apache.olingo.commons.api.edm.Edm;
|
|||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Collections;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
|
@ -36,7 +37,6 @@ import org.apache.olingo.client.api.domain.ClientEntity;
|
|||
import org.apache.olingo.client.api.domain.ClientLink;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
|
||||
public class ODataWriterImpl implements ODataWriter {
|
||||
|
||||
|
|
|
@ -179,6 +179,12 @@ public class URIBuilderImpl implements URIBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URIBuilder appendCountSegment() {
|
||||
segments.add(new Segment(SegmentType.COUNT, SegmentType.COUNT.getValue()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URIBuilder appendActionCallSegment(final String action) {
|
||||
segments.add(new Segment(
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -25,6 +25,7 @@ import static org.junit.Assert.assertNull;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.olingo.client.core.serialization.AtomDeserializer;
|
||||
import org.apache.olingo.commons.api.data.Entity;
|
||||
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.core.serialization;
|
||||
package org.apache.olingo.client.core.serialization;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.olingo.client.core.serialization.ContextURLParser;
|
||||
import org.apache.olingo.commons.api.data.ContextURL;
|
||||
import org.junit.Test;
|
||||
|
|
@ -24,8 +24,8 @@ import org.apache.olingo.commons.api.data.EntityCollection;
|
|||
import org.apache.olingo.commons.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.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
package org.apache.olingo.client.core.v4;
|
||||
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.core.AbstractTest;
|
||||
import org.apache.olingo.commons.api.ODataError;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.apache.olingo.client.api.domain.ClientCollectionValue;
|
|||
import org.apache.olingo.client.api.domain.ClientComplexValue;
|
||||
import org.apache.olingo.client.api.domain.ClientProperty;
|
||||
import org.apache.olingo.client.api.domain.ClientValue;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.client.api.serialization.ODataSerializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.apache.olingo.client.api.data.ServiceDocument;
|
|||
import org.apache.olingo.client.core.AbstractTest;
|
||||
import org.apache.olingo.commons.api.data.ResWrap;
|
||||
import org.apache.olingo.client.api.domain.ClientServiceDocument;
|
||||
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.URI;
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven.bundle.plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
|
|
|
@ -36,8 +36,8 @@ public abstract class AbstractODataObject extends Annotatable {
|
|||
return baseURI;
|
||||
}
|
||||
|
||||
public void setBaseURI(final String baseURI) {
|
||||
this.baseURI = baseURI == null ? null : URI.create(baseURI);
|
||||
public void setBaseURI(final URI baseURI) {
|
||||
this.baseURI = baseURI;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
*/
|
||||
package org.apache.olingo.commons.api.edm.provider;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface CsdlNamed extends Serializable {
|
||||
public interface CsdlNamed {
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
|
|
@ -162,12 +162,17 @@ public interface HttpHeader {
|
|||
*/
|
||||
public static final String ODATA_MAX_VERSION = "OData-MaxVersion";
|
||||
|
||||
// CHECKSTYLE:OFF
|
||||
/**
|
||||
* OData Prefer Header
|
||||
* See
|
||||
* {@link <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata01/os/complete/part1-protocol/odata-v4.0-errata01-os-part1-protocol-complete.html#_Toc399426728"> OData Version 4.0 Part 1: Protocol Plus Errata 01</a>}
|
||||
* OData Prefer Header.
|
||||
* See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398233">
|
||||
* OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
|
||||
*/
|
||||
public static final String PREFER = "Prefer";
|
||||
// CHECKSTYLE:ON
|
||||
|
||||
/**
|
||||
* OData Preference-Applied Header.
|
||||
* See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398247">
|
||||
* OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
|
||||
*/
|
||||
public static final String PREFERENCE_APPLIED = "Preference-Applied";
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven.bundle.plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven.bundle.plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.server.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
@ -31,6 +32,7 @@ import org.apache.olingo.server.api.deserializer.ODataDeserializer;
|
|||
import org.apache.olingo.server.api.edmx.EdmxReference;
|
||||
import org.apache.olingo.server.api.etag.ETagHelper;
|
||||
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
|
||||
import org.apache.olingo.server.api.prefer.Preferences;
|
||||
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
|
||||
import org.apache.olingo.server.api.serializer.ODataSerializer;
|
||||
import org.apache.olingo.server.api.serializer.SerializerException;
|
||||
|
@ -135,4 +137,10 @@ public abstract class OData {
|
|||
* It can be used in Processor implementations.
|
||||
*/
|
||||
public abstract ETagHelper createETagHelper();
|
||||
|
||||
/**
|
||||
* Creates a new Preferences object out of Prefer HTTP request headers.
|
||||
* It can be used in Processor implementations.
|
||||
*/
|
||||
public abstract Preferences createPreferences(Collection<String> preferHeaders);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class DeserializerException extends ODataLibraryException {
|
|||
/** parameter: propertyName */
|
||||
INVALID_NULL_PROPERTY,
|
||||
/** parameter: keyName */
|
||||
UNKOWN_CONTENT,
|
||||
UNKNOWN_CONTENT,
|
||||
/** parameter: propertyName */
|
||||
INVALID_VALUE_FOR_PROPERTY,
|
||||
/** parameter: propertyName */
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.server.api.deserializer;
|
|||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
|
||||
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
|
||||
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
|
||||
|
@ -32,7 +33,14 @@ public interface FixedFormatDeserializer {
|
|||
* @param content the binary data as input stream
|
||||
* @return the binary data
|
||||
*/
|
||||
byte[] binary(InputStream content) throws DeserializerException;
|
||||
public byte[] binary(InputStream content) throws DeserializerException;
|
||||
|
||||
/**
|
||||
* Reads primitive-type data from an InputStream.
|
||||
* @param content the textual value as input stream
|
||||
* @param property EDM property
|
||||
*/
|
||||
public Object primitiveValue(InputStream content, EdmProperty property) throws DeserializerException;
|
||||
|
||||
public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)
|
||||
throws BatchDeserializerException;
|
||||
|
|
|
@ -24,23 +24,23 @@ import java.util.List;
|
|||
import org.apache.olingo.server.api.ODataResponse;
|
||||
|
||||
/**
|
||||
* An ODataResponsePart represents a collections of ODataResponses.
|
||||
* An ODataResponsePart represents a collection of ODataResponses.
|
||||
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
|
||||
* OData batch response.
|
||||
*/
|
||||
public class ODataResponsePart {
|
||||
private List<ODataResponse> responses;
|
||||
private boolean isChangeSet;
|
||||
private final List<ODataResponse> responses;
|
||||
private final boolean isChangeSet;
|
||||
|
||||
/**
|
||||
* Creates a new ODataResponsePart.
|
||||
*
|
||||
* An ODataResponsePart represents a collections of ODataResponses.
|
||||
* An ODataResponsePart represents a collection of ODataResponses.
|
||||
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
|
||||
* OData batch response.
|
||||
*
|
||||
* @param responses A list of {@link ODataResponse}
|
||||
* @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
|
||||
* @param isChangeSet whether this ODataResponsePart represents a change set
|
||||
*/
|
||||
public ODataResponsePart(final List<ODataResponse> responses, final boolean isChangeSet) {
|
||||
this.responses = responses;
|
||||
|
@ -50,12 +50,12 @@ public class ODataResponsePart {
|
|||
/**
|
||||
* Creates a new ODataResponsePart.
|
||||
*
|
||||
* An ODataResponsePart represents a collections of ODataResponses.
|
||||
* An ODataResponsePart represents a collection of ODataResponses.
|
||||
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
|
||||
* OData batch response.
|
||||
*
|
||||
* @param response A single {@link ODataResponse}
|
||||
* @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
|
||||
* @param isChangeSet whether this ODataResponsePart represents a change set
|
||||
*/
|
||||
public ODataResponsePart(final ODataResponse response, final boolean isChangeSet) {
|
||||
responses = Arrays.asList(response);
|
||||
|
@ -63,21 +63,18 @@ public class ODataResponsePart {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current instance represents a change set.
|
||||
*
|
||||
* @return true or false
|
||||
* Returns a collection of ODataResponses.
|
||||
* Each collection contains at least one {@link ODataResponse}.
|
||||
* If this instance represents a change set, there may be many ODataResponses.
|
||||
* @return a list of {@link ODataResponse}
|
||||
*/
|
||||
public List<ODataResponse> getResponses() {
|
||||
return responses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection of ODataResponses.
|
||||
* Each collections contains at least one {@link ODataResponse}.
|
||||
*
|
||||
* If this instance represents a change set, there are may many ODataResponses
|
||||
*
|
||||
* @return a list of {@link ODataResponse}
|
||||
* Returns true if the current instance represents a change set.
|
||||
* @return true or false
|
||||
*/
|
||||
public boolean isChangeSet() {
|
||||
return isChangeSet;
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.server.api.prefer;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides access methods to the preferences set in Prefer HTTP request headers
|
||||
* as described in <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
|
||||
* Preferences defined in the OData standard can be accessed with named methods.
|
||||
*/
|
||||
public interface Preferences {
|
||||
|
||||
/**
|
||||
* Gets named preference. Names are case insensitive.
|
||||
* @param name name of the preference
|
||||
* @return {@link Preference} or <code>null</code> if no such preference has been set
|
||||
*/
|
||||
public Preference getPreference(String name);
|
||||
|
||||
/** Whether the preference <code>odata.allow-entityreferences</code> has been set. */
|
||||
public boolean hasAllowEntityReferences();
|
||||
|
||||
/**
|
||||
* Gets the value of the <code>url</code> parameter of the preference
|
||||
* <code>odata.callback</code> or <code>null</code> if not set or the URI is not valid.
|
||||
* @return the callback URI
|
||||
*/
|
||||
public URI getCallback();
|
||||
|
||||
/** Whether the preference <code>odata.continue-on-error</code> has been set. */
|
||||
public boolean hasContinueOnError();
|
||||
|
||||
/**
|
||||
* Gets the value of the preference <code>odata.maxpagesize</code>
|
||||
* or <code>null</code> if not set or an invalid value has been set.
|
||||
* @return the page size for server-driven paging
|
||||
*/
|
||||
public Integer getMaxPageSize();
|
||||
|
||||
/** Whether the preference <code>odata.track-changes</code> has been set. */
|
||||
public boolean hasTrackChanges();
|
||||
|
||||
public enum Return { REPRESENTATION, MINIMAL }
|
||||
/**
|
||||
* Gets the value of the preference <code>return</code> or <code>null</code> if not set
|
||||
* or the value is not valid.
|
||||
*/
|
||||
public Return getReturn();
|
||||
|
||||
/** Whether the preference <code>respond-async</code> has been set. */
|
||||
public boolean hasRespondAsync();
|
||||
|
||||
/**
|
||||
* Gets the value of the preference <code>wait</code> or <code>null</code> if not set
|
||||
* or the value is not valid.
|
||||
* @return the number of seconds the client is prepared to wait for the service
|
||||
* to process the request synchronously
|
||||
*/
|
||||
public Integer getWait();
|
||||
|
||||
/** Generic preference object. */
|
||||
public class Preference {
|
||||
private final String value;
|
||||
private final Map<String, String> parameters;
|
||||
|
||||
public Preference(final String value, final Map<String, String> parameters) {
|
||||
this.value = value;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the preference. It may be <code>null</code> if the preference has
|
||||
* no value; this is not the same as the preference not set.
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parameters of the preference. The value of a parameter may be
|
||||
* <code>null</code> if the parameter has no value; this is not the same as
|
||||
* the parameter not set. Parameter names are all lowercase.
|
||||
* @return a map from parameter names to parameter values
|
||||
*/
|
||||
public Map<String, String> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.server.api.prefer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.olingo.server.api.prefer.Preferences.Return;
|
||||
|
||||
/**
|
||||
* Provides methods to set values suitable for the Preference-Applied HTTP response header
|
||||
* as described in <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
|
||||
* There are named methods for preferences defined in the OData standard.
|
||||
*/
|
||||
public class PreferencesApplied {
|
||||
|
||||
private Map<String, String> applied;
|
||||
|
||||
private PreferencesApplied() {
|
||||
applied = new LinkedHashMap<String, String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the applied preferences.
|
||||
* @return a map from preference names to preference values
|
||||
*/
|
||||
public Map<String, String> getAppliedPreferences() {
|
||||
return Collections.unmodifiableMap(applied);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (final String name : applied.keySet()) {
|
||||
if (result.length() > 0) {
|
||||
result.append(',').append(' ');
|
||||
}
|
||||
result.append(name);
|
||||
if (applied.get(name) != null) {
|
||||
result.append('=').append('"')
|
||||
.append(applied.get(name).replaceAll("\\\\|\"", "\\\\$0"))
|
||||
.append('"');
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/** Initializes the builder. */
|
||||
public static Builder with() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/** Builder of OData serializer options. */
|
||||
public static final class Builder {
|
||||
|
||||
private static final String ALLOW_ENTITY_REFERENCES = "odata.allow-entityreferences";
|
||||
private static final String CALLBACK = "odata.callback";
|
||||
private static final String CONTINUE_ON_ERROR = "odata.continue-on-error";
|
||||
// private static final String INCLUDE_ANNOTATIONS = "odata.include-annotations";
|
||||
private static final String MAX_PAGE_SIZE = "odata.maxpagesize";
|
||||
private static final String TRACK_CHANGES = "odata.track-changes";
|
||||
private static final String RETURN = "return";
|
||||
private static final String RESPOND_ASYNC = "respond-async";
|
||||
private static final String WAIT = "wait";
|
||||
|
||||
private final PreferencesApplied preferencesApplied;
|
||||
|
||||
private Builder() {
|
||||
preferencesApplied = new PreferencesApplied();
|
||||
}
|
||||
|
||||
/** Sets <code>odata.allow-entityreferences</code>. */
|
||||
public Builder allowEntityReferences() {
|
||||
add(ALLOW_ENTITY_REFERENCES, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets <code>odata.callback</code>. */
|
||||
public Builder callback() {
|
||||
add(CALLBACK, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets <code>odata.continue-on-error</code>. */
|
||||
public Builder continueOnError() {
|
||||
add(CONTINUE_ON_ERROR, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the value of the applied preference <code>odata.maxpagesize</code>. */
|
||||
public Builder maxPageSize(final Integer maxPageSize) {
|
||||
add(MAX_PAGE_SIZE, Integer.toString(maxPageSize));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets <code>odata.track-changes</code>. */
|
||||
public Builder trackChanges() {
|
||||
add(TRACK_CHANGES, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the value of the applied preference <code>return</code>. */
|
||||
public Builder returnRepresentation(final Return returnRepresentation) {
|
||||
add(RETURN, returnRepresentation.name().toLowerCase(Locale.ROOT));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets <code>odata.respond-async</code>. */
|
||||
public Builder respondAsync() {
|
||||
add(RESPOND_ASYNC, null);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the value of the applied preference <code>wait</code>. */
|
||||
public Builder waitPreference(final Integer wait) {
|
||||
add(WAIT, Integer.toString(wait));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an arbitrary preference as applied.
|
||||
* The preference name is converted to lowercase.
|
||||
* The value of this preference may be <code>null</code>.
|
||||
* Name and value are not checked for validity.
|
||||
* @param name preference name
|
||||
* @param value preference value
|
||||
*/
|
||||
public Builder preference(final String name, final String value) {
|
||||
if (name != null) {
|
||||
add(name.toLowerCase(Locale.ROOT), value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the applied preferences. */
|
||||
public PreferencesApplied build() {
|
||||
return preferencesApplied;
|
||||
}
|
||||
|
||||
private void add(final String name, final String value) {
|
||||
if (!preferencesApplied.applied.containsKey(name)) {
|
||||
preferencesApplied.applied.put(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ import org.apache.olingo.server.api.uri.UriInfo;
|
|||
/**
|
||||
* Processor interface for handling counting a collection of complex properties, e.g. an EdmComplexType.
|
||||
*/
|
||||
public interface CountComplexCollectionProcessor extends Processor {
|
||||
public interface CountComplexCollectionProcessor extends ComplexCollectionProcessor {
|
||||
|
||||
/**
|
||||
* Counts complex properties from persistence and puts serialized content and status into the response.
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.olingo.server.api.uri.UriInfo;
|
|||
/**
|
||||
* Processor interface for handling counting a collection of entities, e.g. an Entity Set.
|
||||
*/
|
||||
public interface CountEntityCollectionProcessor extends Processor {
|
||||
public interface CountEntityCollectionProcessor extends EntityCollectionProcessor {
|
||||
|
||||
/**
|
||||
* Counts entities from persistence and puts serialized content and status into the response.
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.olingo.server.api.uri.UriInfo;
|
|||
/**
|
||||
* Processor interface for handling counting a collection of primitive properties, e.g. an collection of EdmString.
|
||||
*/
|
||||
public interface CountPrimitiveCollectionProcessor extends Processor {
|
||||
public interface CountPrimitiveCollectionProcessor extends PrimitiveCollectionProcessor {
|
||||
|
||||
/**
|
||||
* Counts primitive properties from persistence and puts serialized content and status into the response.
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface MediaEntityProcessor extends EntityProcessor {
|
|||
throws ODataApplicationException, ODataLibraryException;
|
||||
|
||||
/**
|
||||
* Creates an entity with send media data in the persistence and puts content, status and Location into the response.
|
||||
* Creates an entity with sent media data in the persistence and puts content, status and Location into the response.
|
||||
* @param request OData request object containing raw HTTP information
|
||||
* @param response OData response object for collecting response data
|
||||
* @param uriInfo information of a parsed OData URI
|
||||
|
@ -67,4 +67,15 @@ public interface MediaEntityProcessor extends EntityProcessor {
|
|||
*/
|
||||
void updateMediaEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
|
||||
ContentType requestFormat, ContentType responseFormat) throws ODataApplicationException, ODataLibraryException;
|
||||
|
||||
/**
|
||||
* Deletes entity media data and associated entity from persistence and puts the status into the response.
|
||||
* @param request OData request object containing raw HTTP information
|
||||
* @param response OData response object for collecting response data
|
||||
* @param uriInfo information of a parsed OData URI
|
||||
* @throws ODataApplicationException if the service implementation encounters a failure
|
||||
* @throws ODataLibraryException
|
||||
*/
|
||||
void deleteMediaEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
|
||||
throws ODataApplicationException, ODataLibraryException;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,36 @@ public interface PrimitiveValueProcessor extends PrimitiveProcessor {
|
|||
* @param response OData response object for collecting response data
|
||||
* @param uriInfo information of a parsed OData URI
|
||||
* @param responseFormat requested content type after content negotiation
|
||||
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
|
||||
* @throws ODataApplicationException if the service implementation encounters a failure
|
||||
* @throws ODataLibraryException
|
||||
*/
|
||||
void readPrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
|
||||
throws ODataApplicationException, ODataLibraryException;
|
||||
|
||||
/**
|
||||
* Update primitive-type instance with sent raw data in the persistence and
|
||||
* puts content, status, and Location into the response.
|
||||
* @param request OData request object containing raw HTTP information
|
||||
* @param response OData response object for collecting response data
|
||||
* @param uriInfo information of a parsed OData URI
|
||||
* @param requestFormat content type of body sent with request
|
||||
* @param responseFormat requested content type after content negotiation
|
||||
* @throws ODataApplicationException if the service implementation encounters a failure
|
||||
* @throws ODataLibraryException
|
||||
*/
|
||||
void updatePrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo,
|
||||
ContentType requestFormat, ContentType responseFormat)
|
||||
throws ODataApplicationException, ODataLibraryException;
|
||||
|
||||
/**
|
||||
* Deletes primitive-type raw value from an entity and puts the status into the response.
|
||||
* Deletion of a primitive-type value is equivalent to setting the value to <code>null</code>.
|
||||
* @param request OData request object containing raw HTTP information
|
||||
* @param response OData response object for collecting response data
|
||||
* @param uriInfo information of a parsed OData URI
|
||||
* @throws ODataApplicationException if the service implementation encounters a failure
|
||||
* @throws ODataLibraryException
|
||||
*/
|
||||
void deletePrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo)
|
||||
throws ODataApplicationException, ODataLibraryException;
|
||||
}
|
||||
|
|
|
@ -31,22 +31,21 @@ public interface UriInfo extends
|
|||
UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
|
||||
UriInfoEntityId, UriInfoMetadata, UriInfoResource {
|
||||
|
||||
public UriInfoKind getKind();
|
||||
UriInfoKind getKind();
|
||||
|
||||
public UriInfoService asUriInfoService();
|
||||
UriInfoService asUriInfoService();
|
||||
|
||||
public UriInfoAll asUriInfoAll();
|
||||
UriInfoAll asUriInfoAll();
|
||||
|
||||
public UriInfoBatch asUriInfoBatch();
|
||||
UriInfoBatch asUriInfoBatch();
|
||||
|
||||
public UriInfoCrossjoin asUriInfoCrossjoin();
|
||||
UriInfoCrossjoin asUriInfoCrossjoin();
|
||||
|
||||
public UriInfoEntityId asUriInfoEntityId();
|
||||
UriInfoEntityId asUriInfoEntityId();
|
||||
|
||||
public UriInfoMetadata asUriInfoMetadata();
|
||||
UriInfoMetadata asUriInfoMetadata();
|
||||
|
||||
public UriInfoResource asUriInfoResource();
|
||||
|
||||
public Collection<SystemQueryOption> getSystemQueryOptions();
|
||||
UriInfoResource asUriInfoResource();
|
||||
|
||||
Collection<SystemQueryOption> getSystemQueryOptions();
|
||||
}
|
||||
|
|
|
@ -36,33 +36,32 @@ public interface UriInfoEntityId {
|
|||
/**
|
||||
* @return List of custom query options used in the URI
|
||||
*/
|
||||
public List<CustomQueryOption> getCustomQueryOptions();
|
||||
List<CustomQueryOption> getCustomQueryOptions();
|
||||
|
||||
/**
|
||||
* Behind $entity a optional type cast can be used in the URI.
|
||||
* For example: http://.../serviceroot/$entity/namespace.entitytype
|
||||
* @return Type cast if found, otherwise null
|
||||
*/
|
||||
public EdmEntityType getEntityTypeCast();
|
||||
EdmEntityType getEntityTypeCast();
|
||||
|
||||
/**
|
||||
* @return Object containing information of the $expand option
|
||||
*/
|
||||
public ExpandOption getExpandOption();
|
||||
ExpandOption getExpandOption();
|
||||
|
||||
/**
|
||||
* @return Object containing information of the $format option
|
||||
*/
|
||||
public FormatOption getFormatOption();
|
||||
FormatOption getFormatOption();
|
||||
|
||||
/**
|
||||
* @return Object containing information of the $id option
|
||||
*/
|
||||
public IdOption getIdOption();
|
||||
IdOption getIdOption();
|
||||
|
||||
/**
|
||||
* @return Object containing information of the $select option
|
||||
*/
|
||||
public SelectOption getSelectOption();
|
||||
|
||||
SelectOption getSelectOption();
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@ public interface UriInfoMetadata {
|
|||
/**
|
||||
* @return Object containing information of the $id option
|
||||
*/
|
||||
public FormatOption getFormatOption();
|
||||
FormatOption getFormatOption();
|
||||
|
||||
/**
|
||||
* @return Object containing information of the URI fragment
|
||||
*/
|
||||
public String getFragment();
|
||||
String getFragment();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,26 +28,25 @@ public interface UriParameter {
|
|||
/**
|
||||
* @return Alias name if the parameters values is an alias, otherwise null
|
||||
*/
|
||||
public String getAlias();
|
||||
String getAlias();
|
||||
|
||||
/**
|
||||
* @return Text of the parameters value
|
||||
*/
|
||||
public String getText();
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* @return If the parameters value is a expression and expression is returned, otherwise null
|
||||
*/
|
||||
public Expression getExpression();
|
||||
Expression getExpression();
|
||||
|
||||
/**
|
||||
* @return Name of the parameter
|
||||
*/
|
||||
public String getName();
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return Name of the referenced property when referential constrains are used
|
||||
*/
|
||||
public String getReferencedProperty();
|
||||
|
||||
String getReferencedProperty();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface UriResourceFunction extends UriResourcePartTyped {
|
|||
EdmFunctionImport getFunctionImport();
|
||||
|
||||
/**
|
||||
* @return Key predicates if used, otherwise null
|
||||
* @return Key predicates if used, otherwise an empty list
|
||||
*/
|
||||
List<UriParameter> getKeyPredicates();
|
||||
|
||||
|
|
|
@ -29,11 +29,10 @@ public interface UriResourceLambdaAll extends UriResourcePartTyped {
|
|||
/**
|
||||
* @return Name of the lambda variable
|
||||
*/
|
||||
public String getLambdaVariable();
|
||||
String getLambdaVariable();
|
||||
|
||||
/**
|
||||
* @return Lambda expression
|
||||
*/
|
||||
public Expression getExpression();
|
||||
|
||||
Expression getExpression();
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@ public interface UriResourceLambdaAny extends UriResourcePartTyped {
|
|||
/**
|
||||
* @return Name of the lambda variable
|
||||
*/
|
||||
public String getLamdaVariable();
|
||||
String getLambdaVariable();
|
||||
|
||||
/**
|
||||
* @return Lambda expression
|
||||
*/
|
||||
public Expression getExpression();
|
||||
Expression getExpression();
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,5 @@ public interface UriResourceLambdaVariable extends UriResourcePartTyped {
|
|||
/**
|
||||
* @return Name of the lambda variable
|
||||
*/
|
||||
public String getVariableName();
|
||||
|
||||
String getVariableName();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface UriResourceNavigation extends UriResourcePartTyped {
|
|||
EdmNavigationProperty getProperty();
|
||||
|
||||
/**
|
||||
* @return Key predicates if used, otherwise null
|
||||
* @return Key predicates if used, otherwise an empty list
|
||||
*/
|
||||
List<UriParameter> getKeyPredicates();
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.server.api.prefer;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.olingo.server.api.prefer.Preferences.Return;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PreferencesAppliedTest {
|
||||
|
||||
@Test
|
||||
public void empty() {
|
||||
assertEquals("", PreferencesApplied.with().build().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void all() {
|
||||
assertEquals("odata.allow-entityreferences, odata.callback,"
|
||||
+ " odata.continue-on-error, odata.include-annotations=\"*\", odata.maxpagesize=\"42\","
|
||||
+ " odata.track-changes, return=\"representation\", respond-async, wait=\"12345\"",
|
||||
PreferencesApplied.with().allowEntityReferences().callback().continueOnError()
|
||||
.preference("odata.include-annotations", "*").maxPageSize(42).trackChanges()
|
||||
.returnRepresentation(Return.REPRESENTATION).respondAsync().waitPreference(12345)
|
||||
.build().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void caseSensitivity() {
|
||||
assertEquals("odata.include-annotations=\"*\", odata.maxpagesize=\"255\"",
|
||||
PreferencesApplied.with()
|
||||
.preference("OData.Include-Annotations", "*").maxPageSize(0xFF)
|
||||
.build().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleValues() {
|
||||
assertEquals("return=\"minimal\", wait=\"1\"",
|
||||
PreferencesApplied.with()
|
||||
.returnRepresentation(Return.MINIMAL).returnRepresentation(Return.REPRESENTATION)
|
||||
.preference(null, null).preference(null, "nullValue")
|
||||
.waitPreference(1).waitPreference(2).waitPreference(3)
|
||||
.build().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quotedValue() {
|
||||
assertEquals("strangepreference=\"x\\\\y,\\\"abc\\\"z\"",
|
||||
PreferencesApplied.with().preference("strangePreference", "x\\y,\"abc\"z").build().toString());
|
||||
}
|
||||
}
|
|
@ -441,7 +441,7 @@ public class DataRequest extends ServiceRequest {
|
|||
handler.deleteReference(DataRequest.this, new URI(id), getETag(), new NoContentResponse(
|
||||
getServiceMetaData(), response));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new DeserializerException("failed to read $id", e, MessageKeys.UNKOWN_CONTENT);
|
||||
throw new DeserializerException("failed to read $id", e, MessageKeys.UNKNOWN_CONTENT);
|
||||
}
|
||||
}
|
||||
} else if (isPUT()) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue