values = getHeaders(name);
- return values == null ? null : values.get(0);
+ return values == null || values.isEmpty() ? null : values.get(0);
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
index b5a2b1b79..72625de69 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
@@ -25,50 +25,49 @@ import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
/**
- * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}.
+ * Provides methods to process {@link ODataRequest}s and {@link BatchRequestPart}s
+ * in the context of a batch request.
*
- * Within a {@link org.apache.olingo.server.api.processor.BatchProcessor} implementation BatchRequestsParts
- * should be passed to {@link BatchFacade#handleBatchRequest(BatchRequestPart)}.
- * If only if the BatchRequests part represents a change set, the request will be delegated to
+ * Within a {@link org.apache.olingo.server.api.processor.BatchProcessor BatchProcessor}
+ * implementation BatchRequestParts should be passed to {@link #handleBatchRequest(BatchRequestPart)}.
+ * Only if the BatchRequestPart represents a change set, the request will be delegated to
* {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}.
- * Otherwise the requests will be directly executed.
+ * Otherwise the requests will be directly executed.
*
- * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes
- * requests in a change set.
+ * The processor implementation could use {@link #handleODataRequest(ODataRequest)} to process
+ * requests in a change set.
*/
public interface BatchFacade {
/**
- * Executes a ODataRequest, which must be a part of a change set.
- * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request.
- *
+ * Executes an ODataRequest, which must be a part of a change set.
+ * Each request must have a Content-Id header field, which holds an identifier
+ * that is unique in the whole batch request.
* @param request ODataRequest to process
- * @return Corresponding ODataResult to the given request
+ * @return corresponding ODataResponse to the given request
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public ODataResponse handleODataRequest(ODataRequest request) throws ODataApplicationException,
- ODataLibraryException;
+ public ODataResponse handleODataRequest(ODataRequest request)
+ throws ODataApplicationException, ODataLibraryException;
/**
* Handles a BatchRequestPart.
- *
* @param request Request to process
- * @return Corresponding {@link ODataResponsePart}
+ * @return corresponding {@link ODataResponsePart}
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws ODataApplicationException,
- ODataLibraryException;
+ public ODataResponsePart handleBatchRequest(BatchRequestPart request)
+ throws ODataApplicationException, ODataLibraryException;
/**
* Extracts the boundary of a multipart/mixed header.
* See RFC 2046#5.1
- *
* @param contentType Content Type
- * @return Boundary
+ * @return boundary
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public String extractBoundaryFromContentType(String contentType) throws ODataApplicationException,
- ODataLibraryException;
+ public String extractBoundaryFromContentType(String contentType)
+ throws ODataApplicationException, ODataLibraryException;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
index e2f6933b5..ec6a2c4ba 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
@@ -21,18 +21,14 @@ package org.apache.olingo.server.api.debug;
import org.apache.olingo.server.api.ODataResponse;
/**
- * This class supports applications in creating debug responses.
+ * Support for applications creating debug responses.
*/
public interface DebugResponseHelper {
/**
* Creates a debug response based on the given parameters. Will never throw an exception.
- * @param request
- * @param applicationResponse
- * @param exception
- * @param serverEnvironmentVaribles
- * @param runtimeInformation
- * @return the debug response or the raw application response in case an exception occurred.
+ * @param debugInfo debug information
+ * @return the debug response or the raw application response in case an exception occurred
*/
ODataResponse createDebugResponse(DebugInformation debugInfo);
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
index 41eb60baa..ac4035268 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
@@ -30,10 +30,10 @@ import org.apache.olingo.commons.api.edm.EdmProperty;
public interface ODataDeserializer {
/**
- * Deserializes an entity stream into an {@link org.apache.olingo.commons.api.data.Entity} object.
- * Validates: property types, no double properties, correct json types
- * Returns a deserialized {@link org.apache.olingo.commons.api.data.Entity} object and an
- * {@link org.apache.olingo.server.api.uri.queryoption.ExpandOption} object
+ * Deserializes an entity stream into an {@link org.apache.olingo.commons.api.data.Entity Entity} object.
+ * Validates: property types, no double properties, correct json types.
+ * Returns a deserialized {@link org.apache.olingo.commons.api.data.Entity Entity} object and an
+ * {@link org.apache.olingo.server.api.uri.queryoption.ExpandOption ExpandOption} object.
* @param stream
* @param edmEntityType
* @return {@link DeserializerResult#getEntity()} and {@link DeserializerResult#getExpandTree()}
@@ -42,7 +42,8 @@ public interface ODataDeserializer {
DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
/**
- * Deserializes an entity collection stream into an {@link org.apache.olingo.commons.api.data.EntityCollection} object
+ * Deserializes an entity collection stream into an
+ * {@link org.apache.olingo.commons.api.data.EntityCollection EntityCollection} object.
* @param stream
* @param edmEntityType
* @return {@link DeserializerResult#getEntityCollection()}
@@ -51,7 +52,7 @@ public interface ODataDeserializer {
DeserializerResult entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
/**
- * Deserializes an action-parameters stream into an {@link org.apache.olingo.commons.api.data.Entity} object.
+ * Deserializes an action-parameters stream into a map of key/value pairs.
* Validates: parameter types, no double parameters, correct json types.
* @param stream
* @param edmAction
@@ -61,7 +62,7 @@ public interface ODataDeserializer {
DeserializerResult actionParameters(InputStream stream, EdmAction edmAction) throws DeserializerException;
/**
- * Deserializes the Property or collections of properties (primitive & complex)
+ * Deserializes the Property or collections of properties (primitive & complex).
* @param stream
* @param edmProperty
* @return {@link DeserializerResult#getProperty()}
@@ -70,7 +71,7 @@ public interface ODataDeserializer {
DeserializerResult property(InputStream stream, EdmProperty edmProperty) throws DeserializerException;
/**
- * Read entity references from the provided document
+ * Reads entity references from the provided document.
* @param stream
* @param keys
* @return {@link DeserializerResult#getEntityReferences()}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
index fbc958b5b..cff3b259b 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
@@ -22,26 +22,49 @@ import org.apache.olingo.server.api.deserializer.DeserializerException;
public class BatchDeserializerException extends DeserializerException {
public static enum MessageKeys implements MessageKey {
+ /** parameter: line */
INVALID_BOUNDARY,
+ /** parameter: line */
INVALID_CHANGESET_METHOD,
+ /** parameter: line */
INVALID_CONTENT,
+ /** parameter: line */
INVALID_CONTENT_LENGTH,
+ /** parameter: line */
INVALID_CONTENT_TRANSFER_ENCODING,
+ /** parameter: line */
INVALID_CONTENT_TYPE,
- INVALID_HEADER,
+ /** parameters: line, expected content type, actual content type */
+ UNEXPECTED_CONTENT_TYPE,
+ /** parameter: line */
+ INVALID_CONTENT_ID,
+ /** parameter: line */
INVALID_HTTP_VERSION,
+ /** parameter: line */
INVALID_METHOD,
+ /** parameter: line */
INVALID_QUERY_OPERATION_METHOD,
+ /** parameter: line */
INVALID_STATUS_LINE,
+ /** parameter: line */
INVALID_URI,
+ /** parameter: line */
MISSING_BLANK_LINE,
+ /** parameter: line */
MISSING_BOUNDARY_DELIMITER,
+ /** parameter: line */
MISSING_CLOSE_DELIMITER,
+ /** parameter: line */
MISSING_CONTENT_ID,
+ /** parameter: line */
MISSING_CONTENT_TRANSFER_ENCODING,
+ /** parameter: line */
MISSING_CONTENT_TYPE,
+ /** parameter: line */
MISSING_MANDATORY_HEADER,
+ /** parameter: line */
FORBIDDEN_HEADER,
+ /** parameter: line */
INVALID_BASE_URI;
@Override
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
index 98b0f10f1..b0f929a7e 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
@@ -20,9 +20,8 @@ package org.apache.olingo.server.api.deserializer.batch;
/**
* Options for the batch deserializer.
- * See
- * {@link org.apache.olingo.server.api.deserializer.FixedFormatDeserializer
- * #parseBatchRequest(java.io.InputStream, String, BatchOptions)}
+ * @see org.apache.olingo.server.api.deserializer.FixedFormatDeserializer
+ * #parseBatchRequest(java.io.InputStream, String, BatchOptions)
*/
public final class BatchOptions {
private boolean isStrict = true;
@@ -33,8 +32,7 @@ public final class BatchOptions {
/**
* Returns if the batch parsing is strict.
- * Default is true
- *
+ * Default is true.
* @return true if parsing is strict
*/
public boolean isStrict() {
@@ -42,22 +40,23 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawBaseUri()}
+ * Gets raw base URI.
+ * @see org.apache.olingo.server.api.ODataRequest#getRawBaseUri()
*/
public String getRawBaseUri() {
return rawBaseUri;
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()}
+ * Gets raw service resolution URI.
+ * @see org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()
*/
public String getRawServiceResolutionUri() {
return rawServiceResolutionUri;
}
/**
- * Creates a new BatchOptions builder
- *
+ * Creates a new BatchOptions builder.
* @return new BatchOptions builder instance
*/
public static Builder with() {
@@ -76,7 +75,7 @@ public final class BatchOptions {
}
/**
- * See {@link BatchOptions#isStrict()}
+ * @see BatchOptions#isStrict()
*/
public Builder isStrict(final boolean isStrict) {
options.isStrict = isStrict;
@@ -84,7 +83,7 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawBaseUri()}
+ * @see org.apache.olingo.server.api.ODataRequest#getRawBaseUri()
*/
public Builder rawBaseUri(final String baseUri) {
options.rawBaseUri = baseUri;
@@ -92,7 +91,7 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()}
+ * @see org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()
*/
public Builder rawServiceResolutionUri(final String serviceResolutionUri) {
options.rawServiceResolutionUri = serviceResolutionUri;
@@ -100,8 +99,7 @@ public final class BatchOptions {
}
/**
- * Creates a new BatchOptions instance
- *
+ * Creates a new BatchOptions instance.
* @return new BatchOptions instance
*/
public BatchOptions build() {
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
index f67410bdd..5802c9e01 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
@@ -25,16 +25,14 @@ import java.util.List;
import org.apache.olingo.server.api.ODataRequest;
/**
- * A BatchPart
- * BatchPart represents a distinct MIME part of a Batch Request body. It can be a ChangeSet or a Query Operation
+ * Represents a distinct MIME part of a Batch Request body - either a Change Set or a Query Operation
*/
public class BatchRequestPart {
private List requests = new ArrayList();
private boolean isChangeSet;
/**
- * Creates a new instance of BachRequestPart
- *
+ * Creates a new instance of BachRequestPart.
* @param isChangeSet True, if this instance represents a change set
* @param requests A list of {@link ODataRequest}
*/
@@ -44,8 +42,7 @@ public class BatchRequestPart {
}
/**
- * Creates a new instance of BachRequestPart
- *
+ * Creates a new instance of BachRequestPart.
* @param isChangeSet True, if this instance represents a change set
* @param request A single {@link ODataRequest}
*/
@@ -56,7 +53,7 @@ public class BatchRequestPart {
}
/**
- * Get the info if a BatchPart is a ChangeSet
+ * Gets the info if a BatchPart is a ChangeSet.
* @return true or false
*/
public boolean isChangeSet() {
@@ -64,7 +61,7 @@ public class BatchRequestPart {
}
/**
- * Get requests. If a BatchPart is a Query Operation, the list contains one request.
+ * Gets all requests of this part. If a BatchPart is a Query Operation, the list contains one request.
* @return a list of {@link ODataRequest}
*/
public List getRequests() {
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
index 2e979e694..16f03e314 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.api.serializer;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
-/** Options for the OData serializer. */
+/** Options to pass as additional information to the reference-collection serializer. */
public final class ReferenceCollectionSerializerOptions {
private ContextURL contextURL;
private CountOption count;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
index e3a82cc29..7a5e2e662 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.api.serializer;
import org.apache.olingo.commons.api.data.ContextURL;
/**
- * Use this options calls to pass additional information to the reference serializer.
+ * Options to pass as additional information to the reference serializer.
*/
public final class ReferenceSerializerOptions {
private ContextURL contextURL;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
index 256e05e56..bdb819573 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
@@ -93,7 +93,8 @@ public class BatchParserCommon {
return type;
} else {
throw new BatchDeserializerException("Content type is not the expected content type",
- BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, expected.toContentTypeString());
+ BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE,
+ Integer.toString(line), expected.toContentTypeString(), type.toContentTypeString());
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
index 4e5ef9de9..20ef8eadd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
@@ -84,14 +84,14 @@ public class BatchRequestTransformator {
}
private HeaderField getContentId(final BatchQueryOperation queryOperation) throws BatchDeserializerException {
- final HeaderField contentTypeHeader = queryOperation.getHeaders().getHeaderField(HttpHeader.CONTENT_ID);
+ final HeaderField contentIdHeader = queryOperation.getHeaders().getHeaderField(HttpHeader.CONTENT_ID);
- if (contentTypeHeader != null) {
- if (contentTypeHeader.getValues().size() == 1) {
- return contentTypeHeader;
+ if (contentIdHeader != null) {
+ if (contentIdHeader.getValues().size() == 1) {
+ return contentIdHeader;
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
- Integer.toString(contentTypeHeader.getLineNumber()));
+ throw new BatchDeserializerException("Invalid Content-ID header", MessageKeys.INVALID_CONTENT_ID,
+ Integer.toString(contentIdHeader.getLineNumber()));
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
index 1543c43c5..2f3d8bb37 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
@@ -56,7 +56,8 @@ public class BatchTransformatorCommon {
Integer.toString(headers.getLineNumber()));
}
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
+ throw new BatchDeserializerException("Invalid Content-Transfer-Encoding header",
+ MessageKeys.INVALID_CONTENT_TRANSFER_ENCODING,
Integer.toString(headers.getLineNumber()));
}
} else {
@@ -82,7 +83,7 @@ public class BatchTransformatorCommon {
return contentLength;
} catch (NumberFormatException e) {
- throw new BatchDeserializerException("Invalid header", e, MessageKeys.INVALID_HEADER,
+ throw new BatchDeserializerException("Invalid content length", e, MessageKeys.INVALID_CONTENT_LENGTH,
Integer.toString(contentLengthField.getLineNumber()));
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
index 83c3e1ed6..d99d94303 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
@@ -138,13 +138,13 @@ public class BatchResponseSerializer {
final Map> header = response.getAllHeaders();
for (final Map.Entry> entry : header.entrySet()) {
- // Requests do never has a content id header
+ // Requests never have a content id header.
if (!entry.getKey().equalsIgnoreCase(HttpHeader.CONTENT_ID)) {
appendHeader(entry.getKey(), entry.getValue().get(0), builder);
}
}
- appendHeader(HttpHeader.CONTENT_LENGTH, "" + contentLength, builder);
+ appendHeader(HttpHeader.CONTENT_LENGTH, Integer.toString(contentLength), builder);
}
private void appendBodyPartHeader(final ODataResponse response, final BodyBuilder builder,
@@ -153,7 +153,7 @@ public class BatchResponseSerializer {
appendHeader(BatchParserCommon.CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
if (isChangeSet) {
- if (response.getAllHeaders().get(HttpHeader.CONTENT_ID) != null) {
+ if (response.getHeader(HttpHeader.CONTENT_ID) != null) {
appendHeader(HttpHeader.CONTENT_ID, response.getHeader(HttpHeader.CONTENT_ID), builder);
} else {
throw new BatchSerializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID);
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
index a2b92ca5a..0a2edd7df 100644
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
@@ -126,14 +126,15 @@ DeserializerException.INVALID_NULL_PARAMETER=The parameter '%1$s' must not be nu
BatchDeserializerException.INVALID_BOUNDARY=Invalid boundary at line '%1$s'.
BatchDeserializerException.INVALID_CHANGESET_METHOD=Invalid method: a ChangeSet cannot contain retrieve requests at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT=Retrieve requests must not contain any body content '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_LENGTH=Invalid content length: content length have to be an integer and positive at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TRANSFER_ENCODING=The Content-Transfer-Encoding should be binary: line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TYPE=Content-Type should be '%1$s'.
-BatchDeserializerException.INVALID_HEADER=Invalid header: '%1$s' at line '%2$s'.
-BatchDeserializerException.INVALID_HTTP_VERSION=Invalid HTTP version: The version have to be HTTP/1.1 at line '%1$s'.
+BatchDeserializerException.INVALID_CONTENT=The retrieve request at line '%1$s' must not contain any body content.
+BatchDeserializerException.INVALID_CONTENT_LENGTH=The value of the Content-Length HTTP header at line '%1$s' must be a positive integer.
+BatchDeserializerException.INVALID_CONTENT_TRANSFER_ENCODING=The Content-Transfer-Encoding at line '%1$s' must be binary.
+BatchDeserializerException.INVALID_CONTENT_TYPE=Invalid Content-Type HTTP header at line '%1$s'.
+BatchDeserializerException.UNEXPECTED_CONTENT_TYPE=Content-Type at line '%1$s' should be '%2$s' but is '%3$s'.
+BatchDeserializerException.INVALID_CONTENT_ID=Invalid Content-ID HTTP header at line '%1$s'.
+BatchDeserializerException.INVALID_HTTP_VERSION=The HTTP version must be HTTP/1.1 at line '%1$s'.
BatchDeserializerException.INVALID_METHOD=Invalid HTTP method at line '%1$s'.
-BatchDeserializerException.INVALID_QUERY_OPERATION_METHOD=Invalid method: a query operation can only contain retrieve requests at line '%1$s'.
+BatchDeserializerException.INVALID_QUERY_OPERATION_METHOD=The query operation at line '%1$s' can only contain retrieve requests.
BatchDeserializerException.INVALID_STATUS_LINE=Invalid HTTP status line at line '%1$s'.
BatchDeserializerException.INVALID_URI=Invalid URI at line '%1$s'.
BatchDeserializerException.FORBIDDEN_HEADER=Forbidden header at line '%1$s'.
@@ -144,9 +145,9 @@ BatchDeserializerException.MISSING_CONTENT_ID=Missing content-id at line '%1$s'.
BatchDeserializerException.MISSING_CONTENT_TRANSFER_ENCODING=Missing content transfer encoding at line '%1$s'.
BatchDeserializerException.MISSING_CONTENT_TYPE=Missing content-type at line '%1$s'.
BatchDeserializerException.MISSING_MANDATORY_HEADER=Missing mandatory header at line '%1$s'.
-BatchDeserializerException.INVALID_BASE_URI=The base URI do not match the service base URI at line '%1$s'.
-
-BatchSerializerExecption.MISSING_CONTENT_ID=Each request within a change set required exactly one content id.
+BatchDeserializerException.INVALID_BASE_URI=The base URI does not match the service base URI at line '%1$s'.
+
+BatchSerializerExecption.MISSING_CONTENT_ID=Each request within a change set requires exactly one content id.
PreconditionException.MISSING_HEADER=The Operation you requested on this Entity requires an if-match or if-none-match header.
PreconditionException.FAILED=The If-Match precondition is not fulfilled.
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
index e43840dc4..155c6788e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
@@ -393,7 +393,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testMimeHeaderContentType() throws Exception {
+ public void mimeHeaderContentType() throws Exception {
final String batch = "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: text/plain" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
@@ -403,7 +403,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE);
}
@Test
@@ -536,7 +536,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testNestedChangeset() throws Exception {
+ public void nestedChangeset() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
@@ -559,7 +559,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE);
}
@Test
@@ -801,7 +801,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testNonNumericContentLength() throws Exception {
+ public void nonNumericContentLength() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
@@ -819,7 +819,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_HEADER);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_LENGTH);
}
@Test
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
index b720cb7cf..d70de6225 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
@@ -34,7 +34,7 @@ public class AsyncResponseSerializerTest {
private static final String CRLF = "\r\n";
@Test
- public void testSimpleResponse() throws Exception {
+ public void simpleResponse() throws Exception {
ODataResponse response = new ODataResponse();
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
@@ -45,14 +45,14 @@ public class AsyncResponseSerializerTest {
AsyncResponseSerializer serializer = new AsyncResponseSerializer();
InputStream in = serializer.serialize(response);
String result = IOUtils.toString(in);
- assertEquals("HTTP/1.1 200 OK" + CRLF +
- "Content-Length: 200" + CRLF +
- "Content-Type: application/json" + CRLF + CRLF +
- "Walter Winter" + CRLF, result);
+ assertEquals("HTTP/1.1 200 OK" + CRLF
+ + "Content-Type: application/json" + CRLF
+ + "Content-Length: 200" + CRLF + CRLF
+ + "Walter Winter" + CRLF, result);
}
@Test
- public void testBiggerResponse() throws Exception {
+ public void biggerResponse() throws Exception {
ODataResponse response = new ODataResponse();
response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
@@ -64,10 +64,10 @@ public class AsyncResponseSerializerTest {
AsyncResponseSerializer serializer = new AsyncResponseSerializer();
InputStream in = serializer.serialize(response);
String result = IOUtils.toString(in);
- assertEquals("HTTP/1.1 202 Accepted" + CRLF +
- "Content-Length: 0" + CRLF +
- "Content-Type: application/json" + CRLF + CRLF +
- testData, result);
+ assertEquals("HTTP/1.1 202 Accepted" + CRLF
+ + "Content-Type: application/json" + CRLF
+ + "Content-Length: 0" + CRLF + CRLF
+ + testData, result);
}
private String testData(int amount) {