From 931f1324e64a4cc3bd8d23691e3c8ba264ad6f44 Mon Sep 17 00:00:00 2001 From: Klaus Straubinger Date: Fri, 15 Aug 2014 11:37:19 +0200 Subject: [PATCH] [OLINGO-356] removed several warnings + code clean-up Change-Id: Id7a6ede6309e6f1109a0ded6df9c436df2449764 --- .../http/AndroidHttpClientFactory.java | 2 - .../ext/proxy/api/PrimitiveCollection.java | 5 +- .../ext/proxy/api/StructuredCollection.java | 2 +- .../AbstractCollectionInvocationHandler.java | 4 +- ...ractEntityCollectionInvocationHandler.java | 2 - .../commons/AbstractInvocationHandler.java | 2 - .../AbstractStructuredInvocationHandler.java | 2 - .../AnnotatationsInvocationHandler.java | 2 - .../ComplexCollectionInvocationHandler.java | 2 - .../proxy/commons/EdmStreamValueHandler.java | 2 - .../EntityCollectionInvocationHandler.java | 2 - .../commons/OperationInvocationHandler.java | 2 - .../PrimitiveCollectionInvocationHandler.java | 2 - .../olingo/fit/server/TomcatTestServer.java | 36 ++-------- .../fit/proxy/v3/AbstractTestITCase.java | 2 +- .../types/MessageKey.java | 4 +- .../types/OrderLineKey.java | 4 +- .../types/ProductPhotoKey.java | 4 +- .../types/ProductReviewKey.java | 4 +- .../types/MessageKey.java | 4 +- .../types/OrderLineKey.java | 4 +- .../types/ProductPhotoKey.java | 4 +- .../types/ProductReviewKey.java | 4 +- .../proxy/v4/APIBasicDesignTestITCase.java | 3 +- .../fit/proxy/v4/AbstractTestITCase.java | 2 +- .../odatawcfservice/types/OrderDetailKey.java | 4 +- .../types/ProductDetailKey.java | 4 +- .../types/ProductReviewKey.java | 4 +- .../communication/header/ODataHeaders.java | 4 +- .../communication/request/ODataRequest.java | 31 ++++---- .../streamed/ODataStreamedEntityRequest.java | 2 +- .../response/ODataBatchResponse.java | 2 +- .../response/ODataDeleteResponse.java | 2 +- .../response/ODataEntityCreateResponse.java | 2 +- .../response/ODataEntityUpdateResponse.java | 2 +- .../response/ODataLinkOperationResponse.java | 4 +- .../response/ODataPropertyUpdateResponse.java | 2 +- .../response/ODataRetrieveResponse.java | 2 +- .../response/ODataStreamUpdateResponse.java | 2 +- .../response/ODataValueUpdateResponse.java | 2 +- .../v4/ODataReferenceAddingResponse.java | 2 +- .../client/api/data/ServiceDocument.java | 4 +- .../client/api/uri/CommonURIBuilder.java | 6 +- .../olingo/client/api/uri/URIFilter.java | 2 +- .../batch/AbstractODataBatchRequest.java | 3 - .../olingo/client/core/uri/FilterConst.java | 2 +- .../client/core/uri/FilterProperty.java | 2 +- .../commons/api/domain/ODataInvokeResult.java | 6 +- .../commons/api/edm/EdmStructuredType.java | 4 +- .../core/edm/primitivetype/EdmStream.java | 5 +- .../api/processor/DefaultProcessor.java | 5 +- .../server/tecsvc/TechnicalServlet.java | 4 +- .../server/tecsvc/data/DataProvider.java | 5 +- .../tecsvc/processor/TechnicalProcessor.java | 7 +- .../server/tecsvc/data/DataProviderTest.java | 70 ++++--------------- .../json/ODataJsonSerializerTest.java | 2 +- .../core/uri/testutil/ResourceValidator.java | 14 ++-- 57 files changed, 121 insertions(+), 197 deletions(-) diff --git a/ext/client-android/src/main/java/org/apache/olingo/client/core/android/http/AndroidHttpClientFactory.java b/ext/client-android/src/main/java/org/apache/olingo/client/core/android/http/AndroidHttpClientFactory.java index c11a38fc6..145d5d59f 100644 --- a/ext/client-android/src/main/java/org/apache/olingo/client/core/android/http/AndroidHttpClientFactory.java +++ b/ext/client-android/src/main/java/org/apache/olingo/client/core/android/http/AndroidHttpClientFactory.java @@ -27,8 +27,6 @@ import java.net.URI; public class AndroidHttpClientFactory extends AbstractHttpClientFactory { - private static final long serialVersionUID = -5224104561624556177L; - @Override public AndroidHttpClient create(final HttpMethod method, final URI uri) { return AndroidHttpClient.newInstance(USER_AGENT); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java index 329dce831..e1716d4c2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java @@ -19,13 +19,10 @@ package org.apache.olingo.ext.proxy.api; import java.io.Serializable; -import java.util.Collection; public interface PrimitiveCollection extends GenericCollection>, - CollectionQuery>, - Collection, - Serializable { + CollectionQuery> { void delete(); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java index ad30dcce2..236a38825 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java @@ -25,7 +25,7 @@ import java.util.Collection; */ public interface StructuredCollection< T extends StructuredType, EC extends Collection, CT extends StructuredCollection> - extends GenericCollection, java.io.Serializable { + extends GenericCollection { /** * Explicit paging result handling. diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java index aa6a382d6..073ccb3a2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java @@ -50,8 +50,6 @@ import org.apache.olingo.ext.proxy.utils.CoreUtils; public abstract class AbstractCollectionInvocationHandler> extends AbstractInvocationHandler implements Collection { - private static final long serialVersionUID = 98078202642671726L; - protected URI nextPageURI = null; protected Collection items; @@ -234,7 +232,7 @@ public abstract class AbstractCollectionInvocationHandler T[] toArray(final T[] array) { + public U[] toArray(final U[] array) { return items.toArray(array); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java index b7e436048..92f4d4acf 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java @@ -46,8 +46,6 @@ public abstract class AbstractEntityCollectionInvocationHandler< T extends EntityType, EC extends EntityCollection> extends AbstractCollectionInvocationHandler { - private static final long serialVersionUID = 98078202642671727L; - protected URI targetEntitySetURI; private boolean isSingleton = false; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java index ae303427a..9a907db1f 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java @@ -52,8 +52,6 @@ import org.slf4j.LoggerFactory; abstract class AbstractInvocationHandler implements InvocationHandler { - private static final long serialVersionUID = 358520026931462958L; - /** * Logger. */ diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java index c28741841..43c161f6c 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java @@ -70,8 +70,6 @@ import org.apache.olingo.ext.proxy.utils.ProxyUtils; public abstract class AbstractStructuredInvocationHandler extends AbstractInvocationHandler { - private static final long serialVersionUID = 2629912294765040037L; - protected CommonURIBuilder uri; protected URI baseURI; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatationsInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatationsInvocationHandler.java index d7a0abce3..fcd507899 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatationsInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatationsInvocationHandler.java @@ -28,8 +28,6 @@ import org.apache.olingo.ext.proxy.AbstractService; public class AnnotatationsInvocationHandler extends AbstractInvocationHandler { - private static final long serialVersionUID = -1993362719908718985L; - private final EntityInvocationHandler entityHandler; private final AbstractStructuredInvocationHandler targetHandler; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java index efc650d04..3854490d7 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java @@ -44,8 +44,6 @@ import org.apache.olingo.ext.proxy.api.ComplexType; public class ComplexCollectionInvocationHandler> extends AbstractCollectionInvocationHandler> { - private static final long serialVersionUID = 98078202642671756L; - public ComplexCollectionInvocationHandler( final AbstractService service, final Class itemRef) { diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EdmStreamValueHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EdmStreamValueHandler.java index a910d7a14..d197f58d8 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EdmStreamValueHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EdmStreamValueHandler.java @@ -27,8 +27,6 @@ import org.apache.olingo.ext.proxy.AbstractService; public class EdmStreamValueHandler extends AbstractInvocationHandler { - private static final long serialVersionUID = 2629912294765040047L; - private URI uri; private InputStream stream; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java index 1a16888a9..24c772502 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java @@ -32,8 +32,6 @@ import org.apache.olingo.ext.proxy.api.EntityType; public class EntityCollectionInvocationHandler> extends AbstractEntityCollectionInvocationHandler> { - private static final long serialVersionUID = 98078202642671726L; - public EntityCollectionInvocationHandler( final AbstractService service, final Class> collItemRef) { this(service, new ArrayList(), collItemRef, null, null); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java index 7751d520e..0a2ed7cee 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java @@ -47,8 +47,6 @@ import java.util.Map; final class OperationInvocationHandler extends AbstractInvocationHandler { - private static final long serialVersionUID = 2629912294765040027L; - private final InvocationHandler target; private final FullQualifiedName targetFQN; diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java index 650e36951..c313dcde8 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java @@ -42,8 +42,6 @@ import org.apache.olingo.ext.proxy.api.PrimitiveCollection; public class PrimitiveCollectionInvocationHandler extends AbstractCollectionInvocationHandler> { - private static final long serialVersionUID = 98078202642671756L; - public PrimitiveCollectionInvocationHandler( final AbstractService service, final Class itemRef) { diff --git a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java index d64c1ee9a..ff855c143 100644 --- a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java +++ b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java @@ -35,22 +35,18 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.util.Enumeration; import java.util.Properties; import java.util.UUID; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; import java.util.logging.FileHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.SimpleFormatter; /** - * + * Server for integration tests. */ public class TomcatTestServer { private static final Logger LOG = LoggerFactory.getLogger(TomcatTestServer.class); @@ -105,7 +101,9 @@ public class TomcatTestServer { LOG.info("...and run as long as the thread is running."); server.start(); } - } catch (Exception e) { + } catch (IOException e) { + throw new RuntimeException("Failed to start Tomcat server from main method.", e); + } catch (LifecycleException e) { throw new RuntimeException("Failed to start Tomcat server from main method.", e); } } @@ -257,7 +255,7 @@ public class TomcatTestServer { return this; } - public TestServerBuilder addStaticContent(String uri, String resourceName) throws Exception { + public TestServerBuilder addStaticContent(String uri, String resourceName) throws IOException { File targetResourcesDir = getFileForDirProperty(PROJECT_RESOURCES_DIR); String resource = new File(targetResourcesDir, resourceName).getAbsolutePath(); LOG.info("Added static content from '{}' at uri '{}'.", resource, uri); @@ -265,7 +263,7 @@ public class TomcatTestServer { return addServlet(staticContent, String.valueOf(uri.hashCode()), uri); } - public TestServerBuilder addServlet(HttpServlet httpServlet, String name, String path) throws Exception { + public TestServerBuilder addServlet(HttpServlet httpServlet, String name, String path) throws IOException { if(server != null) { return this; } @@ -315,26 +313,4 @@ public class TomcatTestServer { tomcat.destroy(); } } - - private static void extract(File jarFile, File destDir) throws IOException { - JarFile jar = new JarFile(jarFile); - Enumeration enumEntries = jar.entries(); - while (enumEntries.hasMoreElements()) { - JarEntry file = enumEntries.nextElement(); - File f = new File(destDir, file.getName()); - if (file.isDirectory()) { - if(!f.exists() && !f.mkdir()) { - throw new IOException("Unable to create directory at path '" + f.getAbsolutePath() + "'."); - } - } else { - InputStream is = jar.getInputStream(file); - FileOutputStream fos = new FileOutputStream(f); - while (is.available() > 0) { - fos.write(is.read()); - } - fos.close(); - is.close(); - } - } - } } \ No newline at end of file diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java index 951a4c633..f89d8c6bd 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java @@ -161,7 +161,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected CommonODataClient getClient() { throw new RuntimeException("This method should not be used from proxy tests."); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java index b405c8ec5..e588dbf7e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class MessageKey extends AbstractEntityKey { - private java.lang.String _fromUsername; + private static final long serialVersionUID = 3366500795925894331L; + + private java.lang.String _fromUsername; @CompoundKeyElement(name = "FromUsername", position = 0) public java.lang.String getFromUsername() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java index 4f6d37bae..01cb3049c 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class OrderLineKey extends AbstractEntityKey { - private java.lang.Integer _orderId; + private static final long serialVersionUID = -1727537164739906574L; + + private java.lang.Integer _orderId; @CompoundKeyElement(name = "OrderId", position = 0) public java.lang.Integer getOrderId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java index a8038f2cc..7c81dfa9b 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductPhotoKey extends AbstractEntityKey { - private java.lang.Integer _photoId; + private static final long serialVersionUID = 1910899056846394895L; + + private java.lang.Integer _photoId; @CompoundKeyElement(name = "PhotoId", position = 0) public java.lang.Integer getPhotoId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java index 43277161b..71eaebeab 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductReviewKey extends AbstractEntityKey { - private java.lang.Integer _productId; + private static final long serialVersionUID = -1529404858249138672L; + + private java.lang.Integer _productId; @CompoundKeyElement(name = "ProductId", position = 0) public java.lang.Integer getProductId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java index 50e2b1a86..0f4e44c9a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/MessageKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class MessageKey extends AbstractEntityKey { - private java.lang.String _fromUsername; + private static final long serialVersionUID = -2882168811541786714L; + + private java.lang.String _fromUsername; @CompoundKeyElement(name = "FromUsername", position = 0) public java.lang.String getFromUsername() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java index 7ca6d5a4c..421b2641e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/OrderLineKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class OrderLineKey extends AbstractEntityKey { - private java.lang.Integer _orderId; + private static final long serialVersionUID = 5409689671465693207L; + + private java.lang.Integer _orderId; @CompoundKeyElement(name = "OrderId", position = 0) public java.lang.Integer getOrderId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java index b214f79fe..c72df0f15 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductPhotoKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductPhotoKey extends AbstractEntityKey { - private java.lang.Integer _photoId; + private static final long serialVersionUID = -3057054846709839639L; + + private java.lang.Integer _photoId; @CompoundKeyElement(name = "PhotoId", position = 0) public java.lang.Integer getPhotoId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java index 74076e413..75df950ad 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/microsoft/test/odata/services/astoriadefaultservice/types/ProductReviewKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductReviewKey extends AbstractEntityKey { - private java.lang.Integer _productId; + private static final long serialVersionUID = 2903240760530127688L; + + private java.lang.Integer _productId; @CompoundKeyElement(name = "ProductId", position = 0) public java.lang.Integer getProductId() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java index da0110a48..2a7d6126e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java @@ -577,8 +577,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase { /** * Java client should support the deletion based on locally created entity. - * - * @see https://issues.apache.org/jira/browse/OLINGO-395 + * See also Olingo Issue 395. */ @Test public void issueOLINGO395() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java index 4813ee2a3..41c41d0f0 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java @@ -142,7 +142,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } @Override - protected CommonODataClient getClient() { + protected CommonODataClient getClient() { throw new RuntimeException("This method should not be used from proxy tests."); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java index 81e03c153..10fb2ec8b 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class OrderDetailKey extends AbstractEntityKey { - private java.lang.Integer _orderID; + private static final long serialVersionUID = -4068508671802176607L; + + private java.lang.Integer _orderID; @CompoundKeyElement(name = "OrderID", position = 0) public java.lang.Integer getOrderID() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java index 67936e7f6..db32ab01d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductDetailKey extends AbstractEntityKey { - private java.lang.Integer _productID; + private static final long serialVersionUID = -6268946147639590355L; + + private java.lang.Integer _productID; @CompoundKeyElement(name = "ProductID", position = 0) public java.lang.Integer getProductID() { diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java index 1433d1317..9d45348ba 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java @@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey; @org.apache.olingo.ext.proxy.api.annotations.CompoundKey public class ProductReviewKey extends AbstractEntityKey { - private java.lang.Integer _productID; + private static final long serialVersionUID = 5483520057777167030L; + + private java.lang.Integer _productID; @CompoundKeyElement(name = "ProductID", position = 0) public java.lang.Integer getProductID() { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java index bc00459e5..484d9a634 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java @@ -23,8 +23,8 @@ import java.util.Collection; /** * ODataHeaders wraps OData request/response headers. * - * @see org.apache.olingo.client.core.communication.request.ODataRequest - * @see org.apache.olingo.client.core.communication.response.ODataResponse + * @see org.apache.olingo.client.api.communication.request.ODataRequest + * @see org.apache.olingo.client.api.communication.response.ODataResponse */ public interface ODataHeaders { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java index e3787f699..deb1e1e0d 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java @@ -32,10 +32,8 @@ import java.util.Collection; * @see org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory - * @see org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory - * @see org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory - * @see org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory - * @see org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory + * @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory + * @see org.apache.olingo.client.api.communication.request.streamed.StreamedRequestFactory */ public interface ODataRequest { @@ -50,7 +48,6 @@ public interface ODataRequest { * Sets OData request target URI. * * @param uri target URI. - * @return OData request target URI. */ void setURI(URI uri); @@ -81,7 +78,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#accept + * @see org.apache.olingo.client.api.communication.header.HeaderName#accept */ ODataRequest setAccept(final String value); @@ -89,7 +86,7 @@ public interface ODataRequest { * Gets Accept OData request header. * * @return header value. - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#accept + * @see org.apache.olingo.client.api.communication.header.HeaderName#accept */ String getAccept(); @@ -98,7 +95,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifMatch + * @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch */ ODataRequest setIfMatch(final String value); @@ -106,7 +103,7 @@ public interface ODataRequest { * Gets If-Match OData request header. * * @return header value. - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifMatch + * @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch */ String getIfMatch(); @@ -115,7 +112,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifNoneMatch + * @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch */ ODataRequest setIfNoneMatch(final String value); @@ -123,7 +120,7 @@ public interface ODataRequest { * Gets If-None-Match OData request header. * * @return header value. - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifNoneMatch + * @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch */ String getIfNoneMatch(); @@ -132,7 +129,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#prefer + * @see org.apache.olingo.client.api.communication.header.HeaderName#prefer */ ODataRequest setPrefer(final String value); @@ -140,7 +137,7 @@ public interface ODataRequest { * Gets Prefer OData request header. * * @return header value. - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#prefer + * @see org.apache.olingo.client.api.communication.header.HeaderName#prefer */ String getPrefer(); @@ -149,7 +146,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#contentType + * @see org.apache.olingo.client.api.communication.header.HeaderName#contentType */ ODataRequest setContentType(final String value); @@ -157,7 +154,7 @@ public interface ODataRequest { * Gets contentType OData request header. * * @return header value. - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#contentType + * @see org.apache.olingo.client.api.communication.header.HeaderName#contentType */ String getContentType(); @@ -166,7 +163,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#slug + * @see org.apache.olingo.client.api.communication.header.HeaderName#slug */ ODataRequest setSlug(final String value); @@ -175,7 +172,7 @@ public interface ODataRequest { * * @param value header value. * @return current object - * @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#xHttpMethod + * @see org.apache.olingo.client.api.communication.header.HeaderName#xHttpMethod */ ODataRequest setXHTTPMethod(final String value); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java index 843bd842b..a34e41c4b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java @@ -36,7 +36,7 @@ public interface ODataStreamedEntityRequest concrete ODataEntity implementation - * @see org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest */ public interface ODataEntityCreateResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java index 1208aa189..306315322 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java @@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity; * This class implements the response to an OData update request. * * @param concrete ODataEntity implementation - * @see org.apache.olingo.client.core.communication.request.cud.ODataEntityUpdateRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest */ public interface ODataEntityUpdateResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataLinkOperationResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataLinkOperationResponse.java index 28474fae9..2a0bf8fea 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataLinkOperationResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataLinkOperationResponse.java @@ -21,8 +21,8 @@ package org.apache.olingo.client.api.communication.response; /** * This interface defines the response to an OData link operation request. * - * @see org.apache.olingo.client.core.communication.request.cud.ODataLinkCreateRequest - * @see org.apache.olingo.client.core.communication.request.cud.ODataLinkUpdateRequest + * @see org.apache.olingo.client.api.communication.request.cud.v3.ODataLinkCreateRequest + * @see org.apache.olingo.client.api.communication.request.cud.v3.ODataLinkUpdateRequest */ public interface ODataLinkOperationResponse extends ODataResponse { } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java index 61f5dbdb4..c30d0c70f 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java @@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty; /** * This class implements the response to an OData update entity property request. * - * @see org.apache.olingo.client.core.communication.request.cud.ODataPropertyUpdateRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest */ public interface ODataPropertyUpdateResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataRetrieveResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataRetrieveResponse.java index e01b828cf..03cee731e 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataRetrieveResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataRetrieveResponse.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.api.communication.response; /** * This class implements a response to a specific query request. * - * @see org.apache.olingo.client.core.communication.request.retrieve.ODataRetrieveRequest + * @see org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest */ public interface ODataRetrieveResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataStreamUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataStreamUpdateResponse.java index 74345bd0b..cd6d677d8 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataStreamUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataStreamUpdateResponse.java @@ -23,7 +23,7 @@ import java.io.InputStream; /** * This class implements the response to an Odata stream create/update request. * - * @see org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequest + * @see org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest */ public interface ODataStreamUpdateResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java index 8a0ab1b1d..415ad07f2 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java @@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; /** * This class implements the response to an OData update entity property request. * - * @see org.apache.olingo.client.core.communication.request.cud.ODataPropertyUpdateRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest */ public interface ODataValueUpdateResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java index 12781f4fb..c1750ede8 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.communication.response.*; /** * This class implements the response to an OData delete request. * - * @see org.apache.olingo.client.core.communication.request.cud.ODataDeleteRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest */ public interface ODataReferenceAddingResponse extends ODataResponse { } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java index f3ce7f34e..082716573 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java @@ -24,7 +24,7 @@ import java.util.List; /** * REST resource for an ODataServiceDocument. * - * @see org.apache.olingo.client.api.domain.ODataServiceDocument + * @see org.apache.olingo.commons.api.domain.ODataServiceDocument */ public interface ServiceDocument { @@ -59,7 +59,7 @@ public interface ServiceDocument { */ List getFunctionImports(); - /* + /** * Gets top level function import set with given name. * * @param name function import name diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java index 64bac5f5f..c83123324 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java @@ -170,12 +170,12 @@ public interface CommonURIBuilder> { /** * Adds filter for filter query option. * - * @param filter filter instance (to be obtained via ODataFilterFactory): note that build() method - * will be immediately invoked. + * @param filter filter instance (to be obtained via FilterFactory); + * note that build() method will be immediately invoked. * @return current URIBuilder instance * @see QueryOption#FILTER * @see URIFilter - * @see org.apache.olingo.client.api.uri.filter.FilterFactory + * @see org.apache.olingo.client.api.uri.CommonFilterFactory */ UB filter(URIFilter filter); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java index 22a0aa753..2162b87bc 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.api.uri; /** * Interface for any available filter; obtain instances via FilterFactory. * - * @see FilterFactory + * @see org.apache.olingo.client.api.uri.CommonFilterFactory */ public interface URIFilter { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java index c7b02e752..bea3046fb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java @@ -70,9 +70,6 @@ public abstract class AbstractODataBatchRequestFilterArgFactory. * - * @see org.apache.olingo.client.api.uri.filter.FilterArgFactory + * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory */ public class FilterConst implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java index 5f2fd4edc..bc99eb495 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter property path; obtain instances via FilterArgFactory. * - * @see FilterArgFactory + * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory */ public class FilterProperty implements FilterArg { diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java index 169834eef..213a9e027 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java @@ -21,9 +21,9 @@ package org.apache.olingo.commons.api.domain; /** * Marker interface for any OData domain object that can be returned by an operation invocation. * - * @see ODataEntitySet - * @see ODataEntity - * @see ODataProperty + * @see CommonODataEntitySet + * @see CommonODataEntity + * @see CommonODataProperty * @see ODataNoContent */ public interface ODataInvokeResult {} diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java index e4ecf7334..8d2e59c92 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java @@ -73,10 +73,10 @@ public interface EdmStructuredType extends EdmType, EdmAnnotationsTarget, EdmAnn EdmStructuredType getBaseType(); /** - * Checks if this type is convertible to parameter {@link targetType} + * Checks if this type is convertible to parameter {@code targetType} * * @param targetType - * @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType ) + * @return true if this type is compatible to the testType (i.e., this type is a subtype of targetType) */ boolean compatibleTo(EdmType targetType); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java index 217696838..fa25e954a 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java @@ -21,6 +21,7 @@ package org.apache.olingo.commons.core.edm.primitivetype; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import java.net.URI; +import java.net.URISyntaxException; /** * Implementation of the EDM primitive type Stream as URI. @@ -49,7 +50,7 @@ public final class EdmStream extends SingletonPrimitiveType { try { new URI(value); return true; - } catch (Exception e) { + } catch (final URISyntaxException e) { return false; } } @@ -62,7 +63,7 @@ public final class EdmStream extends SingletonPrimitiveType { URI stream = null; try { stream = new URI(value); - } catch (Exception e) { + } catch (final URISyntaxException e) { throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e); } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java index 359136b35..d62eeb8d0 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java @@ -87,9 +87,8 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce } catch (Exception e) { // This should never happen but to be sure we have this catch here to prevent sending a stacktrace to a client. String responseContent = - "{\"error\":{\"code\":null,\"message\":\"An unexpected exception occoured during " + - "error processing with message: " - + e.getMessage() + "\"}}"; + "{\"error\":{\"code\":null,\"message\":\"An unexpected exception occurred during " + + "error processing with message: " + e.getMessage() + "\"}}"; response.setContent(new ByteArrayInputStream(responseContent.getBytes())); response.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode()); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString()); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java index 7dcf7b789..996385f97 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java @@ -49,7 +49,7 @@ public class TechnicalServlet extends HttpServlet { HttpSession session = req.getSession(true); DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName()); if (dataProvider == null) { - dataProvider = new DataProvider(edm); + dataProvider = new DataProvider(); session.setAttribute(DataProvider.class.getName(), dataProvider); LOG.info("Created new data provider."); } @@ -57,7 +57,7 @@ public class TechnicalServlet extends HttpServlet { ODataHttpHandler handler = odata.createHandler(edm); handler.register(new TechnicalProcessor(dataProvider)); handler.process(req, resp); - } catch (Exception e) { + } catch (RuntimeException e) { LOG.error("Server Error", e); throw new ServletException(e); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java index 3c31fc286..f6c9f3a22 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java @@ -34,7 +34,6 @@ import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.LinkedComplexValue; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; @@ -50,11 +49,9 @@ public class DataProvider { private static final UUID GUID = UUID.fromString("01234567-89ab-cdef-0123-456789abcdef"); - private final Edm edm; private Map data; - public DataProvider(final Edm edm) { - this.edm = edm; + public DataProvider() { data = new HashMap(); data.put("ESTwoPrim", createESTwoPrim()); data.put("ESAllPrim", createESAllPrim()); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java index b35e40da5..49a10ebbd 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java @@ -48,7 +48,6 @@ import java.util.Locale; public class TechnicalProcessor implements EntityCollectionProcessor, EntityProcessor { private OData odata; - private Edm edm; private DataProvider dataProvider; public TechnicalProcessor(final DataProvider dataProvider) { @@ -58,7 +57,6 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc @Override public void init(final OData odata, final Edm edm) { this.odata = odata; - this.edm = edm; } @Override @@ -70,7 +68,7 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc } try { final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource()); - final EntitySet entitySet = readEntitySetInternal(edmEntitySet, request.getRawBaseUri()); + final EntitySet entitySet = readEntitySetInternal(edmEntitySet); if (entitySet == null) { response.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode()); } else { @@ -115,8 +113,7 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc } } - private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet, final String serviceRoot) - throws DataProvider.DataProviderException { + private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet) throws DataProvider.DataProviderException { EntitySet entitySet = dataProvider.readAll(edmEntitySet); // TODO: set count and next link return entitySet; diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java index d476e1a9a..bfeea9024 100644 --- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java +++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.server.tecsvc.data; +import java.util.Arrays; import java.util.List; import org.apache.olingo.commons.api.data.Entity; @@ -25,22 +26,16 @@ import org.apache.olingo.commons.api.data.EntitySet; import org.apache.olingo.commons.api.data.LinkedComplexValue; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmComplexType; -import org.apache.olingo.commons.api.edm.EdmElement; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmStructuredType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.server.api.OData; -import org.apache.olingo.server.tecsvc.provider.ContainerProvider; +import org.apache.olingo.server.api.uri.UriParameter; import org.apache.olingo.server.tecsvc.provider.EdmTechProvider; import org.junit.Assert; import org.junit.Test; +import org.mockito.Mockito; -/** - */ public class DataProviderTest { private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider()); @@ -61,16 +56,19 @@ public class DataProviderTest { @Test public void esAllPrimEntity() throws Exception { - DataProvider jdp = getDataProvider(); - Entity first = jdp.readAll(esAllPrim).getEntities().get(0); - + final DataProvider dataProvider = new DataProvider(); + Entity first = dataProvider.readAll(esAllPrim).getEntities().get(0); Assert.assertEquals(16, first.getProperties().size()); + + UriParameter parameter = Mockito.mock(UriParameter.class); + Mockito.when(parameter.getName()).thenReturn("PropertyInt16"); + Mockito.when(parameter.getText()).thenReturn(Short.toString(Short.MAX_VALUE)); + Assert.assertEquals(first, dataProvider.read(esAllPrim, Arrays.asList(parameter))); } @Test public void esAllPrim() throws Exception { - DataProvider jdp = getDataProvider(); - EntitySet outSet = jdp.readAll(esAllPrim); + EntitySet outSet = new DataProvider().readAll(esAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Entity first = outSet.getEntities().get(0); @@ -81,8 +79,7 @@ public class DataProviderTest { @Test public void esCollAllPrim() throws Exception { - DataProvider jdp = getDataProvider(); - EntitySet outSet = jdp.readAll(esCollAllPrim); + EntitySet outSet = new DataProvider().readAll(esCollAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size()); @@ -95,8 +92,7 @@ public class DataProviderTest { @Test public void esCompAllPrim() throws Exception { - DataProvider jdp = getDataProvider(); - EntitySet outSet = jdp.readAll(esCompAllPrim); + EntitySet outSet = new DataProvider().readAll(esCompAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size()); @@ -109,8 +105,7 @@ public class DataProviderTest { @Test public void esMixPrimCollComp() throws Exception { - DataProvider jdp = getDataProvider(); - EntitySet outSet = jdp.readAll(esMixPrimCollAllPrim); + EntitySet outSet = new DataProvider().readAll(esMixPrimCollAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size()); @@ -130,41 +125,4 @@ public class DataProviderTest { Assert.assertEquals(4, outSet.getEntities().get(1).getProperties().size()); Assert.assertEquals(4, outSet.getEntities().get(2).getProperties().size()); } - - private DataProvider getDataProvider() throws DataProvider.DataProviderException { - OData odata = OData.newInstance(); - Edm edm = odata.createEdm(new EdmTechProvider()); - return new DataProvider(edm); - } - - @Test - public void edm() { - OData odata = OData.newInstance(); - Edm edm = odata.createEdm(new EdmTechProvider()); - EdmEntitySet edmEntitySet = - edm.getEntityContainer(ContainerProvider.nameContainer).getEntitySet("ESCompAllPrim"); - - EdmEntityType et = edmEntitySet.getEntityType(); - printType(edm, et); - } - - private void printType(Edm edm, EdmStructuredType type) { - - List propNames = type.getPropertyNames(); - - for (String propName : propNames) { - EdmElement element = type.getProperty(propName); - if(element instanceof EdmProperty) { - EdmProperty property = (EdmProperty) element; - if(property.isPrimitive()) { - System.out.println("Primitive name/type: " + property.getName() + "/" + property.getType()); - } else { - // recursion - EdmComplexType complex = edm.getComplexType(property.getType().getFullQualifiedName()); - System.out.println("Complex name/type [" + property.getName() + "/" + property.getType() + "]"); - printType(edm, complex); - } - } - } - } } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java index 7e85dc617..f7b4eecfc 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java @@ -47,7 +47,7 @@ public class ODataJsonSerializerTest { private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider()); private final EdmEntityContainer entityContainer = edm.getEntityContainer( new FullQualifiedName("com.sap.odata.test1", "Container")); - private final DataProvider data = new DataProvider(edm); + private final DataProvider data = new DataProvider(); private ODataSerializer serializer = new ODataJsonSerializer(ODataFormat.JSON); @Test diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java index 9095d39b3..ce861a0b9 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java @@ -44,10 +44,12 @@ import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl; import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl; import org.apache.olingo.server.core.uri.UriResourceSingletonImpl; import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl; +import org.apache.olingo.server.core.uri.parser.UriParserException; import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl; import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl; +import org.apache.olingo.server.core.uri.validator.UriValidationException; import org.apache.olingo.server.core.uri.validator.UriValidator; import java.util.List; @@ -91,11 +93,15 @@ public class ResourceValidator implements TestValidator { uriPathInfo = null; try { uriInfoTmp = testParser.parseUri(uri, edm); + } catch (final UriParserException e) { + fail("Exception occurred while parsing the URI: " + uri + "\n" + + " Message: " + e.getMessage()); + } - UriValidator uriValidator = new UriValidator(); - uriValidator.validate(uriInfoTmp, HttpMethod.GET); - } catch (Exception e) { - fail("Exception occured while parsing the URI: " + uri + "\n" + try { + new UriValidator().validate(uriInfoTmp, HttpMethod.GET); + } catch (final UriValidationException e) { + fail("Exception occurred while validating the URI: " + uri + "\n" + " Message: " + e.getMessage()); }