diff --git a/.circleci/config.yml b/.circleci/config.yml index 94ca04c2d..fe7510f46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,9 +111,6 @@ commands: command: mvn -s .circleci/maven-release-settings.xml -Dmaven.test.skip deploy executors: - j17: - docker: - - image: 'cimg/openjdk:17.0' j21: docker: - image: 'cimg/openjdk:21.0' @@ -418,7 +415,7 @@ jobs: - store_cache deploy: - executor: 'j17' + executor: 'j21' steps: - timeout: duration: '30m' @@ -500,16 +497,13 @@ workflows: matrix: parameters: jdk: - - 'j17' - 'j21' - 'j25' filters: tags: only: /^v.*/ branches: - only: - - main - - next + ignore: /.*/ - test: name: test-jackson-<> matrix: @@ -529,9 +523,7 @@ workflows: tags: only: /^v.*/ branches: - only: - - main - - next + ignore: /.*/ - test: name: test-native-ssl=<>-<> matrix: @@ -550,9 +542,7 @@ workflows: tags: only: /^v.*/ branches: - only: - - main - - next + ignore: /.*/ - test-shaded: name: test-native-shaded-ssl=<>-<> matrix: diff --git a/ChangeLog.md b/ChangeLog.md index 9d973aecc..f0a7eb262 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +- updated Vert.x to version 5.0 + ## [7.25.0] - 2026-01-14 - added SSL configuration from files (#623, DE-505) diff --git a/core/pom.xml b/core/pom.xml index 80df59fa8..3eabaeb7f 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT core diff --git a/core/src/main/java/com/arangodb/ArangoCollection.java b/core/src/main/java/com/arangodb/ArangoCollection.java index 8b41d6c53..0f6ce47f7 100644 --- a/core/src/main/java/com/arangodb/ArangoCollection.java +++ b/core/src/main/java/com/arangodb/ArangoCollection.java @@ -625,19 +625,6 @@ MultiDocumentEntity> deleteDocuments( */ IndexEntity ensureGeoIndex(Iterable fields, GeoIndexOptions options); - /** - * Creates a fulltext index for the collection, if it does not already exist. - * - * @param fields A list of attribute paths - * @param options Additional options, can be null - * @return information about the index - * @see API - * Documentation - * @deprecated since ArangoDB 3.10, use ArangoSearch or Inverted indexes instead. - */ - @Deprecated - IndexEntity ensureFulltextIndex(Iterable fields, FulltextIndexOptions options); - /** * Creates a ttl index for the collection, if it does not already exist. * @@ -649,21 +636,6 @@ MultiDocumentEntity> deleteDocuments( */ IndexEntity ensureTtlIndex(Iterable fields, TtlIndexOptions options); - /** - * Creates a ZKD multi-dimensional index for the collection, if it does not already exist. - * Note that zkd indexes are an experimental feature in ArangoDB 3.9. - * - * @param fields A list of attribute paths - * @param options Additional options, can be null - * @return information about the index - * @see API Documentation - * @since ArangoDB 3.9 - * @deprecated since ArangoDB 3.12, use {@link #ensureMDIndex(Iterable, MDIndexOptions)} or - * {@link #ensureMDPrefixedIndex(Iterable, MDPrefixedIndexOptions)} instead. - */ - @Deprecated - IndexEntity ensureZKDIndex(Iterable fields, ZKDIndexOptions options); - /** * Creates a multi-dimensional index for the collection, if it does not already exist. * diff --git a/core/src/main/java/com/arangodb/ArangoCollectionAsync.java b/core/src/main/java/com/arangodb/ArangoCollectionAsync.java index 0bee4b605..8f5e1e90f 100644 --- a/core/src/main/java/com/arangodb/ArangoCollectionAsync.java +++ b/core/src/main/java/com/arangodb/ArangoCollectionAsync.java @@ -292,26 +292,11 @@ CompletableFuture>> deleteDocume */ CompletableFuture ensureGeoIndex(Iterable fields, GeoIndexOptions options); - /** - * Asynchronous version of {@link ArangoCollection#ensureFulltextIndex(Iterable, FulltextIndexOptions)} - */ - @Deprecated - CompletableFuture ensureFulltextIndex(Iterable fields, FulltextIndexOptions options); - /** * Asynchronous version of {@link ArangoCollection#ensureTtlIndex(Iterable, TtlIndexOptions)} */ CompletableFuture ensureTtlIndex(Iterable fields, TtlIndexOptions options); - /** - * Asynchronous version of {@link ArangoCollection#ensureZKDIndex(Iterable, ZKDIndexOptions)} - * - * @deprecated since ArangoDB 3.12, use {@link #ensureMDIndex(Iterable, MDIndexOptions)} or - * {@link #ensureMDPrefixedIndex(Iterable, MDPrefixedIndexOptions)} instead. - */ - @Deprecated - CompletableFuture ensureZKDIndex(Iterable fields, ZKDIndexOptions options); - /** * Asynchronous version of {@link ArangoCollection#ensureMDIndex(Iterable, MDIndexOptions)} */ diff --git a/core/src/main/java/com/arangodb/ArangoDB.java b/core/src/main/java/com/arangodb/ArangoDB.java index 8ccf1668f..6356c1900 100644 --- a/core/src/main/java/com/arangodb/ArangoDB.java +++ b/core/src/main/java/com/arangodb/ArangoDB.java @@ -39,7 +39,6 @@ import javax.annotation.concurrent.ThreadSafe; import javax.net.ssl.SSLContext; import java.util.*; -import java.util.concurrent.Executor; /** * Central access point for applications to communicate with an ArangoDB server. @@ -70,8 +69,7 @@ public interface ArangoDB extends ArangoSerdeAccessor { void shutdown(); /** - * Updates the JWT used for requests authorization. It does not change already existing VST connections, since VST - * connections are authenticated during the initialization phase. + * Updates the JWT used for requests authorization. * * @param jwt token to use */ @@ -613,18 +611,7 @@ public Builder verifyHost(final Boolean verifyHost) { } /** - * Sets the chunk size when {@link Protocol#VST} is used. - * - * @param chunkSize size of a chunk in bytes - * @return {@link ArangoDB.Builder} - */ - public Builder chunkSize(final Integer chunkSize) { - config.setChunkSize(chunkSize); - return this; - } - - /** - * Set whether to use requests pipelining in HTTP/1.1 ({@link Protocol#HTTP_JSON} or {@link Protocol#HTTP_VPACK}). + * Set whether to use requests pipelining in HTTP/1.1 ({@link Protocol#HTTP_1_1}). * * @param pipelining {@code true} if enabled * @return {@link ArangoDB.Builder} @@ -664,11 +651,8 @@ public Builder initialWindowSize(final Integer initialWindowSize) { *

* *
-         * {@link Protocol#VST} == 1
-         * {@link Protocol#HTTP_JSON} == 20
-         * {@link Protocol#HTTP_VPACK} == 20
-         * {@link Protocol#HTTP2_JSON} == 1
-         * {@link Protocol#HTTP2_VPACK} == 1
+         * {@link Protocol#HTTP_1_1} == 20
+         * {@link Protocol#HTTP_2} == 1
          * 
* * @param maxConnections max number of connections @@ -692,25 +676,10 @@ public Builder connectionTtl(final Long connectionTtl) { } /** - * Set the keep-alive interval for VST connections. If set, every VST connection will perform a no-op request - * every {@code keepAliveInterval} seconds, to avoid to be closed due to inactivity by the server (or by the - * external environment, eg. firewall, intermediate routers, operating system). - * - * @param keepAliveInterval interval in seconds - * @return {@link ArangoDB.Builder} - */ - public Builder keepAliveInterval(final Integer keepAliveInterval) { - config.setKeepAliveInterval(keepAliveInterval); - return this; - } - - /** - * Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single - * server with active failover. In case of Active-Failover deployment set to {@code true} to enable automatic - * master discovery. + * Whether the driver should acquire a list of available coordinators in an ArangoDB cluster. * *

- * The host list will be used for failover and load balancing. + * The host list will be used for load balancing. *

* * @param acquireHostList whether automatically acquire a list of available hosts (default: false) @@ -733,8 +702,7 @@ public Builder acquireHostListInterval(final Integer acquireHostListInterval) { } /** - * Sets the load balancing strategy to be used in an ArangoDB cluster setup. In case of Active-Failover - * deployment set to {@link LoadBalancingStrategy#NONE} or not set at all, since that would be the default. + * Sets the load balancing strategy to be used in an ArangoDB cluster setup. * * @param loadBalancingStrategy the load balancing strategy to be used (default: * {@link LoadBalancingStrategy#NONE} @@ -790,20 +758,6 @@ public Builder serdeProviderClass(final Class ser return this; } - /** - * Sets the downstream async executor that will be used to consume the responses of the async API, that are returned - * as {@link java.util.concurrent.CompletableFuture} - * - * @param executor async downstream executor - * @return {@link ArangoDB.Builder} - * @deprecated for removal. To consume the responses in a custom executor use async CompletableFuture methods. - */ - @Deprecated - public Builder asyncExecutor(final Executor executor) { - config.setAsyncExecutor(executor); - return this; - } - /** * Sets the {@code content-encoding} and {@code accept-encoding} to use for HTTP requests and the related * algorithm to encode and decode the transferred data. (default: {@link Compression#NONE}) @@ -896,8 +850,7 @@ protected HostHandler createHostHandler(@UnstableApi final HostResolver hostReso } LOG.debug("HostHandler is {}", hostHandler.getClass().getSimpleName()); - - return new DirtyReadHostHandler(hostHandler, new RoundRobinHostHandler(hostResolver)); + return hostHandler; } @UnstableApi diff --git a/core/src/main/java/com/arangodb/ArangoDBAsync.java b/core/src/main/java/com/arangodb/ArangoDBAsync.java index cd1ba2eb6..e0d9733e0 100644 --- a/core/src/main/java/com/arangodb/ArangoDBAsync.java +++ b/core/src/main/java/com/arangodb/ArangoDBAsync.java @@ -40,8 +40,7 @@ public interface ArangoDBAsync extends ArangoSerdeAccessor { void shutdown(); /** - * Updates the JWT used for requests authorization. It does not change already existing VST connections, since VST - * connections are authenticated during the initialization phase. + * Updates the JWT used for requests authorization. * * @param jwt token to use */ diff --git a/core/src/main/java/com/arangodb/ArangoDBException.java b/core/src/main/java/com/arangodb/ArangoDBException.java index 60798efcc..2dfa374e4 100644 --- a/core/src/main/java/com/arangodb/ArangoDBException.java +++ b/core/src/main/java/com/arangodb/ArangoDBException.java @@ -57,39 +57,6 @@ public ArangoDBException(final String message, final Integer responseCode) { this.requestId = null; } - /** - * @deprecated use {@link com.arangodb.ArangoDBException#of(java.lang.Throwable)} instead - */ - @Deprecated - public ArangoDBException(final Throwable cause) { - super(cause); - this.entity = null; - this.responseCode = null; - this.requestId = null; - } - - /** - * @deprecated use {@link com.arangodb.ArangoDBException#of(String, Throwable)} instead - */ - @Deprecated - public ArangoDBException(final String message, final Throwable cause) { - super(message, cause); - this.entity = null; - this.responseCode = null; - this.requestId = null; - } - - /** - * @deprecated use {@link com.arangodb.ArangoDBException#of(Throwable, Long)} instead - */ - @Deprecated - public ArangoDBException(Throwable cause, long requestId) { - super(cause); - this.entity = null; - this.responseCode = null; - this.requestId = requestId; - } - private ArangoDBException( String message, Throwable cause, diff --git a/core/src/main/java/com/arangodb/ArangoDatabase.java b/core/src/main/java/com/arangodb/ArangoDatabase.java index 80e9cc9dc..9f5a4f4c8 100644 --- a/core/src/main/java/com/arangodb/ArangoDatabase.java +++ b/core/src/main/java/com/arangodb/ArangoDatabase.java @@ -346,35 +346,6 @@ public interface ArangoDatabase extends ArangoSerdeAccessor { */ ArangoCursor cursor(String cursorId, Class type, String nextBatchId, AqlQueryOptions options); - /** - * Explain an AQL query and return information about it - * - * @param query the query which you want explained - * @param bindVars key/value pairs representing the bind parameters - * @param options Additional options, can be null - * @return information about the query - * @see API - * Documentation - * @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, AqlQueryExplainOptions)} instead - */ - @Deprecated - AqlExecutionExplainEntity explainQuery(String query, Map bindVars, AqlQueryExplainOptions options); - - /** - * Explain an AQL query and return information about it - * - * @param query the query which you want explained - * @param bindVars key/value pairs representing the bind parameters - * @param options Additional options, can be null - * @return information about the query - * @see API - * Documentation - * @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead - */ - @Deprecated - AqlQueryExplainEntity explainAqlQuery(String query, Map bindVars, AqlQueryExplainOptions options); - - /** * Explain an AQL query and return information about it * @@ -488,49 +459,6 @@ public interface ArangoDatabase extends ArangoSerdeAccessor { */ void killQuery(String id); - /** - * Create a new AQL user function - * - * @param name A valid AQL function name, e.g.: `"myfuncs::accounting::calculate_vat"` - * @param code A String evaluating to a JavaScript function - * @param options Additional options, can be null - * @see API - * Documentation - * - * @deprecated Removed from ArangoDB 4.0 onwards. - */ - @Deprecated - void createAqlFunction(String name, String code, AqlFunctionCreateOptions options); - - /** - * Deletes the AQL user function with the given name from the database. - * - * @param name The name of the user function to delete - * @param options Additional options, can be null - * @return number of deleted functions (since ArangoDB 3.4.0) - * @see API - * Documentation - * - * @deprecated Removed from ArangoDB 4.0 onwards. - */ - @Deprecated - Integer deleteAqlFunction(String name, AqlFunctionDeleteOptions options); - - /** - * Gets all reqistered AQL user functions - * - * @param options Additional options, can be null - * @return all reqistered AQL user functions - * @see API - * Documentation - * - * @deprecated Removed from ArangoDB 4.0 onwards. - */ - @Deprecated - Collection getAqlFunctions(AqlFunctionGetOptions options); - /** * Returns a {@code ArangoGraph} instance for the given graph name. * @@ -573,21 +501,6 @@ public interface ArangoDatabase extends ArangoSerdeAccessor { */ Collection getGraphs(); - /** - * Performs a server-side transaction and returns its return value. - * - * @param action A String evaluating to a JavaScript function to be executed on the server. - * @param type The type of the result (POJO or {@link com.arangodb.util.RawData}) - * @param options Additional options, can be null - * @return the result of the transaction if it succeeded - * @see API - * Documentation - * - * @deprecated Removed from ArangoDB 4.0 onwards. - */ - @Deprecated - T transaction(String action, Class type, TransactionOptions options); - /** * Begins a Stream Transaction. * @@ -648,18 +561,6 @@ public interface ArangoDatabase extends ArangoSerdeAccessor { */ DatabaseEntity getInfo(); - /** - * Reload the routing table. - * - * @see API - * Documentation - * - * @deprecated Removed from ArangoDB 4.0 onwards. - */ - @Deprecated - void reloadRouting(); - /** * Fetches all views from the database and returns a list of view descriptions. * diff --git a/core/src/main/java/com/arangodb/ArangoDatabaseAsync.java b/core/src/main/java/com/arangodb/ArangoDatabaseAsync.java index 867692239..8e2c8895f 100644 --- a/core/src/main/java/com/arangodb/ArangoDatabaseAsync.java +++ b/core/src/main/java/com/arangodb/ArangoDatabaseAsync.java @@ -162,22 +162,6 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor { CompletableFuture> cursor(String cursorId, Class type, String nextBatchId, AqlQueryOptions options); - /** - * Asynchronous version of {@link ArangoDatabase#explainQuery(String, Map, AqlQueryExplainOptions)} - * - * @deprecated for removal, use {@link ArangoDatabaseAsync#explainAqlQuery(String, Map, AqlQueryExplainOptions)} instead - */ - @Deprecated - CompletableFuture explainQuery(String query, Map bindVars, AqlQueryExplainOptions options); - - /** - * Asynchronous version of {@link ArangoDatabase#explainAqlQuery(String, Map, AqlQueryExplainOptions)} - * - * @deprecated for removal, use {@link ArangoDatabaseAsync#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead - */ - @Deprecated - CompletableFuture explainAqlQuery(String query, Map bindVars, AqlQueryExplainOptions options); - /** * Asynchronous version of {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} */ @@ -233,24 +217,6 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor { */ CompletableFuture killQuery(String id); - /** - * Asynchronous version of {@link ArangoDatabase#createAqlFunction(String, String, AqlFunctionCreateOptions)} - */ - @Deprecated - CompletableFuture createAqlFunction(String name, String code, AqlFunctionCreateOptions options); - - /** - * Asynchronous version of {@link ArangoDatabase#deleteAqlFunction(String, AqlFunctionDeleteOptions)} - */ - @Deprecated - CompletableFuture deleteAqlFunction(String name, AqlFunctionDeleteOptions options); - - /** - * Asynchronous version of {@link ArangoDatabase#getAqlFunctions(AqlFunctionGetOptions)} - */ - @Deprecated - CompletableFuture> getAqlFunctions(AqlFunctionGetOptions options); - /** * Returns a {@code ArangoGraphAsync} instance for the given graph name. * @@ -274,12 +240,6 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor { */ CompletableFuture> getGraphs(); - /** - * Asynchronous version of {@link ArangoDatabase#transaction(String, Class, TransactionOptions)} - */ - @Deprecated - CompletableFuture transaction(String action, Class type, TransactionOptions options); - /** * Asynchronous version of {@link ArangoDatabase#beginStreamTransaction(StreamTransactionOptions)} */ @@ -310,12 +270,6 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor { */ CompletableFuture getInfo(); - /** - * Asynchronous version of {@link ArangoDatabase#reloadRouting()} - */ - @Deprecated - CompletableFuture reloadRouting(); - /** * Asynchronous version of {@link ArangoDatabase#getViews()} */ diff --git a/core/src/main/java/com/arangodb/ArangoEdgeCollection.java b/core/src/main/java/com/arangodb/ArangoEdgeCollection.java index 9dfcd199b..1d45938f6 100644 --- a/core/src/main/java/com/arangodb/ArangoEdgeCollection.java +++ b/core/src/main/java/com/arangodb/ArangoEdgeCollection.java @@ -49,31 +49,6 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor { */ String name(); - /** - * Remove one edge definition from the graph. - * - * @see API - * Documentation - * - * @deprecated use {@link #remove()} instead - */ - @Deprecated - void drop(); - - /** - * Remove one edge definition from the graph. - * - * @param options options - * @see API - * Documentation - * - * @deprecated use {@link #remove(EdgeCollectionRemoveOptions)} instead - */ - @Deprecated - void drop(EdgeCollectionDropOptions options); - /** * Remove one edge definition from the graph. * diff --git a/core/src/main/java/com/arangodb/ArangoEdgeCollectionAsync.java b/core/src/main/java/com/arangodb/ArangoEdgeCollectionAsync.java index b1509f429..9d59c4bce 100644 --- a/core/src/main/java/com/arangodb/ArangoEdgeCollectionAsync.java +++ b/core/src/main/java/com/arangodb/ArangoEdgeCollectionAsync.java @@ -47,22 +47,6 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor { */ String name(); - /** - * Asynchronous version of {@link ArangoEdgeCollection#drop()} - * - * @deprecated use {@link #remove()} instead - */ - @Deprecated - CompletableFuture drop(); - - /** - * Asynchronous version of {@link ArangoEdgeCollection#drop(EdgeCollectionDropOptions)} - * - * @deprecated use {@link #remove(EdgeCollectionRemoveOptions)} instead - */ - @Deprecated - CompletableFuture drop(EdgeCollectionDropOptions options); - /** * Asynchronous version of {@link ArangoEdgeCollection#remove()} */ diff --git a/core/src/main/java/com/arangodb/ArangoVertexCollection.java b/core/src/main/java/com/arangodb/ArangoVertexCollection.java index 6252bc460..5a15178e6 100644 --- a/core/src/main/java/com/arangodb/ArangoVertexCollection.java +++ b/core/src/main/java/com/arangodb/ArangoVertexCollection.java @@ -49,29 +49,6 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor { */ String name(); - /** - * Remove a vertex collection form the graph. - * - * @see API - * Documentation - * - * @deprecated use {@link #remove()} instead - */ - @Deprecated - void drop(); - - /** - * Remove a vertex collection form the graph. - * - * @param options options - * @see API - * Documentation - * - * @deprecated use {@link #remove(VertexCollectionRemoveOptions)} instead - */ - @Deprecated - void drop(VertexCollectionDropOptions options); - /** * Remove a vertex collection form the graph. * diff --git a/core/src/main/java/com/arangodb/ArangoVertexCollectionAsync.java b/core/src/main/java/com/arangodb/ArangoVertexCollectionAsync.java index 65ece4dcb..1fb3f39cf 100644 --- a/core/src/main/java/com/arangodb/ArangoVertexCollectionAsync.java +++ b/core/src/main/java/com/arangodb/ArangoVertexCollectionAsync.java @@ -47,22 +47,6 @@ public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor { */ String name(); - /** - * Asynchronous version of {@link ArangoVertexCollection#drop()} - * - * @deprecated use {@link #remove()} instead - */ - @Deprecated - CompletableFuture drop(); - - /** - * Asynchronous version of {@link ArangoVertexCollection#drop(VertexCollectionDropOptions)} - * - * @deprecated use {@link #remove(VertexCollectionRemoveOptions)} instead - */ - @Deprecated - CompletableFuture drop(VertexCollectionDropOptions options); - /** * Asynchronous version of {@link ArangoVertexCollection#remove()} */ diff --git a/core/src/main/java/com/arangodb/ContentType.java b/core/src/main/java/com/arangodb/ContentType.java deleted file mode 100644 index ec63aaf8d..000000000 --- a/core/src/main/java/com/arangodb/ContentType.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ -package com.arangodb; - -public enum ContentType { - JSON, VPACK -} diff --git a/core/src/main/java/com/arangodb/Protocol.java b/core/src/main/java/com/arangodb/Protocol.java index 1ca4bb4ea..13ba122bf 100644 --- a/core/src/main/java/com/arangodb/Protocol.java +++ b/core/src/main/java/com/arangodb/Protocol.java @@ -24,36 +24,6 @@ * @author Mark Vollmary */ public enum Protocol { - - /** - * VelocyStream - * - * @see VelocyStream specification - */ - VST, - - /** - * HTTP 1.1 with JSON body - */ - HTTP_JSON, - - /** - * HTTP 1.1 with VelocyPack body - * - * @see VelocyPack specification - */ - HTTP_VPACK, - - /** - * HTTP 2 with JSON body - */ - HTTP2_JSON, - - /** - * HTTP 2 with VelocyPack body - * - * @see VelocyPack specification - */ - HTTP2_VPACK, - + HTTP_1_1, + HTTP_2 } diff --git a/core/src/main/java/com/arangodb/config/ArangoConfigProperties.java b/core/src/main/java/com/arangodb/config/ArangoConfigProperties.java index b6a811d80..6c63a3aa7 100644 --- a/core/src/main/java/com/arangodb/config/ArangoConfigProperties.java +++ b/core/src/main/java/com/arangodb/config/ArangoConfigProperties.java @@ -26,13 +26,11 @@ public interface ArangoConfigProperties { String KEY_SSL_TRUST_STORE_PASSWORD = "sslTrustStorePassword"; String KEY_SSL_TRUST_STORE_TYPE = "sslTrustStoreType"; String KEY_VERIFY_HOST = "verifyHost"; - String KEY_CHUNK_SIZE = "chunkSize"; String KEY_PIPELINING = "pipelining"; String KEY_CONNECTION_WINDOW_SIZE = "connectionWindowSize"; String KEY_INITIAL_WINDOW_SIZE = "initialWindowSize"; String KEY_MAX_CONNECTIONS = "maxConnections"; String KEY_CONNECTION_TTL = "connectionTtl"; - String KEY_KEEP_ALIVE_INTERVAL = "keepAliveInterval"; String KEY_ACQUIRE_HOST_LIST = "acquireHostList"; String KEY_ACQUIRE_HOST_LIST_INTERVAL = "acquireHostListInterval"; String KEY_LOAD_BALANCING_STRATEGY = "loadBalancingStrategy"; @@ -139,10 +137,6 @@ default Optional getVerifyHost() { return Optional.empty(); } - default Optional getChunkSize() { - return Optional.empty(); - } - default Optional getPipelining() { return Optional.empty(); } @@ -163,10 +157,6 @@ default Optional getConnectionTtl() { return Optional.empty(); } - default Optional getKeepAliveInterval() { - return Optional.empty(); - } - default Optional getAcquireHostList() { return Optional.empty(); } diff --git a/core/src/main/java/com/arangodb/entity/AqlExecutionExplainEntity.java b/core/src/main/java/com/arangodb/entity/AqlExecutionExplainEntity.java deleted file mode 100644 index eb56fc74b..000000000 --- a/core/src/main/java/com/arangodb/entity/AqlExecutionExplainEntity.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -import com.arangodb.ArangoDatabase; -import com.arangodb.model.ExplainAqlQueryOptions; - -import java.util.Collection; -import java.util.Map; -import java.util.Objects; - -/** - * @author Mark Vollmary - * @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead - */ -@Deprecated -public final class AqlExecutionExplainEntity { - - private ExecutionPlan plan; - private Collection plans; - private Collection warnings; - private ExecutionStats stats; - private Boolean cacheable; - - public ExecutionPlan getPlan() { - return plan; - } - - public Collection getPlans() { - return plans; - } - - public Collection getWarnings() { - return warnings; - } - - public ExecutionStats getStats() { - return stats; - } - - public Boolean getCacheable() { - return cacheable; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof AqlExecutionExplainEntity)) return false; - AqlExecutionExplainEntity that = (AqlExecutionExplainEntity) o; - return Objects.equals(plan, that.plan) && Objects.equals(plans, that.plans) && Objects.equals(warnings, that.warnings) && Objects.equals(stats, that.stats) && Objects.equals(cacheable, that.cacheable); - } - - @Override - public int hashCode() { - return Objects.hash(plan, plans, warnings, stats, cacheable); - } - - public static final class ExecutionPlan { - private Collection nodes; - private Collection rules; - private Collection collections; - private Collection variables; - private Integer estimatedCost; - private Integer estimatedNrItems; - - public Collection getNodes() { - return nodes; - } - - public Collection getRules() { - return rules; - } - - public Collection getCollections() { - return collections; - } - - public Collection getVariables() { - return variables; - } - - public Integer getEstimatedCost() { - return estimatedCost; - } - - public Integer getEstimatedNrItems() { - return estimatedNrItems; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionPlan)) return false; - ExecutionPlan that = (ExecutionPlan) o; - return Objects.equals(nodes, that.nodes) && Objects.equals(rules, that.rules) && Objects.equals(collections, that.collections) && Objects.equals(variables, that.variables) && Objects.equals(estimatedCost, that.estimatedCost) && Objects.equals(estimatedNrItems, that.estimatedNrItems); - } - - @Override - public int hashCode() { - return Objects.hash(nodes, rules, collections, variables, estimatedCost, estimatedNrItems); - } - } - - public static final class ExecutionNode { - private String type; - private Collection dependencies; - private Long id; - private Integer estimatedCost; - private Integer estimatedNrItems; - private Long depth; - private String database; - private String collection; - private ExecutionVariable inVariable; - private ExecutionVariable outVariable; - private ExecutionVariable conditionVariable; - private Boolean random; - private Long offset; - private Long limit; - private Boolean fullCount; - private ExecutionNode subquery; - private Boolean isConst; - private Boolean canThrow; - private String expressionType; - private Collection indexes; - private ExecutionExpression expression; - private ExecutionCollection condition; - private Boolean reverse; - - public String getType() { - return type; - } - - public Collection getDependencies() { - return dependencies; - } - - public Long getId() { - return id; - } - - public Integer getEstimatedCost() { - return estimatedCost; - } - - public Integer getEstimatedNrItems() { - return estimatedNrItems; - } - - public Long getDepth() { - return depth; - } - - public String getDatabase() { - return database; - } - - public String getCollection() { - return collection; - } - - public ExecutionVariable getInVariable() { - return inVariable; - } - - public ExecutionVariable getOutVariable() { - return outVariable; - } - - public ExecutionVariable getConditionVariable() { - return conditionVariable; - } - - public Boolean getRandom() { - return random; - } - - public Long getOffset() { - return offset; - } - - public Long getLimit() { - return limit; - } - - public Boolean getFullCount() { - return fullCount; - } - - public ExecutionNode getSubquery() { - return subquery; - } - - public Boolean getIsConst() { - return isConst; - } - - public Boolean getCanThrow() { - return canThrow; - } - - public String getExpressionType() { - return expressionType; - } - - public Collection getIndexes() { - return indexes; - } - - public ExecutionExpression getExpression() { - return expression; - } - - public ExecutionCollection getCondition() { - return condition; - } - - public Boolean getReverse() { - return reverse; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionNode)) return false; - ExecutionNode that = (ExecutionNode) o; - return Objects.equals(type, that.type) && Objects.equals(dependencies, that.dependencies) && Objects.equals(id, that.id) && Objects.equals(estimatedCost, that.estimatedCost) && Objects.equals(estimatedNrItems, that.estimatedNrItems) && Objects.equals(depth, that.depth) && Objects.equals(database, that.database) && Objects.equals(collection, that.collection) && Objects.equals(inVariable, that.inVariable) && Objects.equals(outVariable, that.outVariable) && Objects.equals(conditionVariable, that.conditionVariable) && Objects.equals(random, that.random) && Objects.equals(offset, that.offset) && Objects.equals(limit, that.limit) && Objects.equals(fullCount, that.fullCount) && Objects.equals(subquery, that.subquery) && Objects.equals(isConst, that.isConst) && Objects.equals(canThrow, that.canThrow) && Objects.equals(expressionType, that.expressionType) && Objects.equals(indexes, that.indexes) && Objects.equals(expression, that.expression) && Objects.equals(condition, that.condition) && Objects.equals(reverse, that.reverse); - } - - @Override - public int hashCode() { - return Objects.hash(type, dependencies, id, estimatedCost, estimatedNrItems, depth, database, collection, inVariable, outVariable, conditionVariable, random, offset, limit, fullCount, subquery, isConst, canThrow, expressionType, indexes, expression, condition, reverse); - } - } - - public static final class ExecutionVariable { - private Long id; - private String name; - - public Long getId() { - return id; - } - - public String getName() { - return name; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionVariable)) return false; - ExecutionVariable that = (ExecutionVariable) o; - return Objects.equals(id, that.id) && Objects.equals(name, that.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - } - - public static final class ExecutionExpression { - private String type; - private String name; - private Long id; - private Object value; - private Boolean sorted; - private String quantifier; - private Collection levels; - private Collection subNodes; - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - public Long getId() { - return id; - } - - public Object getValue() { - return value; - } - - public Boolean getSorted() { - return sorted; - } - - public String getQuantifier() { - return quantifier; - } - - public Collection getLevels() { - return levels; - } - - public Collection getSubNodes() { - return subNodes; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionExpression)) return false; - ExecutionExpression that = (ExecutionExpression) o; - return Objects.equals(type, that.type) && Objects.equals(name, that.name) && Objects.equals(id, that.id) && Objects.equals(value, that.value) && Objects.equals(sorted, that.sorted) && Objects.equals(quantifier, that.quantifier) && Objects.equals(levels, that.levels) && Objects.equals(subNodes, that.subNodes); - } - - @Override - public int hashCode() { - return Objects.hash(type, name, id, value, sorted, quantifier, levels, subNodes); - } - } - - public static final class ExecutionCollection { - private String name; - private String type; - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionCollection)) return false; - ExecutionCollection that = (ExecutionCollection) o; - return Objects.equals(name, that.name) && Objects.equals(type, that.type); - } - - @Override - public int hashCode() { - return Objects.hash(name, type); - } - } - - public static final class ExecutionStats { - private Integer rulesExecuted; - private Integer rulesSkipped; - private Integer plansCreated; - private Long peakMemoryUsage; - private Double executionTime; - - public Integer getRulesExecuted() { - return rulesExecuted; - } - - public Integer getRulesSkipped() { - return rulesSkipped; - } - - public Integer getPlansCreated() { - return plansCreated; - } - - public Long getPeakMemoryUsage() { - return peakMemoryUsage; - } - - public Double getExecutionTime() { - return executionTime; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ExecutionStats)) return false; - ExecutionStats that = (ExecutionStats) o; - return Objects.equals(rulesExecuted, that.rulesExecuted) && Objects.equals(rulesSkipped, that.rulesSkipped) && Objects.equals(plansCreated, that.plansCreated) && Objects.equals(peakMemoryUsage, that.peakMemoryUsage) && Objects.equals(executionTime, that.executionTime); - } - - @Override - public int hashCode() { - return Objects.hash(rulesExecuted, rulesSkipped, plansCreated, peakMemoryUsage, executionTime); - } - } - -} diff --git a/core/src/main/java/com/arangodb/entity/AqlFunctionEntity.java b/core/src/main/java/com/arangodb/entity/AqlFunctionEntity.java deleted file mode 100644 index 78ff58921..000000000 --- a/core/src/main/java/com/arangodb/entity/AqlFunctionEntity.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -import java.util.Objects; - -/** - * @author Mark Vollmary - */ -public final class AqlFunctionEntity { - - private String name; - private String code; - private Boolean isDeterministic; - - public AqlFunctionEntity() { - super(); - } - - /** - * @return The fully qualified name of the user function - */ - public String getName() { - return name; - } - - /** - * @return A string representation of the function body - */ - public String getCode() { - return code; - } - - /** - * @return An optional boolean value to indicate whether the function results are fully deterministic (function - * return value solely depends on the input value and return value is the same for repeated calls with same - * input). The isDeterministic attribute is currently not used but may be used later for optimizations. - */ - public Boolean getIsDeterministic() { - return isDeterministic; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof AqlFunctionEntity)) return false; - AqlFunctionEntity that = (AqlFunctionEntity) o; - return Objects.equals(name, that.name) && Objects.equals(code, that.code) && Objects.equals(isDeterministic, that.isDeterministic); - } - - @Override - public int hashCode() { - return Objects.hash(name, code, isDeterministic); - } -} diff --git a/core/src/main/java/com/arangodb/entity/CollectionEntity.java b/core/src/main/java/com/arangodb/entity/CollectionEntity.java index 45ddeaf12..9cfa8c2e8 100644 --- a/core/src/main/java/com/arangodb/entity/CollectionEntity.java +++ b/core/src/main/java/com/arangodb/entity/CollectionEntity.java @@ -35,7 +35,6 @@ public class CollectionEntity { private String name; private Boolean waitForSync; private Boolean isSystem; - private CollectionStatus status; private CollectionType type; private CollectionSchema schema; private List computedValues; @@ -60,11 +59,6 @@ public Boolean getIsSystem() { return isSystem; } - @Deprecated - public CollectionStatus getStatus() { - return status; - } - public CollectionType getType() { return type; } @@ -89,11 +83,11 @@ public List getComputedValues() { public boolean equals(Object o) { if (!(o instanceof CollectionEntity)) return false; CollectionEntity that = (CollectionEntity) o; - return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(waitForSync, that.waitForSync) && Objects.equals(isSystem, that.isSystem) && status == that.status && type == that.type && Objects.equals(schema, that.schema) && Objects.equals(computedValues, that.computedValues); + return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(waitForSync, that.waitForSync) && Objects.equals(isSystem, that.isSystem) && type == that.type && Objects.equals(schema, that.schema) && Objects.equals(computedValues, that.computedValues); } @Override public int hashCode() { - return Objects.hash(id, name, waitForSync, isSystem, status, type, schema, computedValues); + return Objects.hash(id, name, waitForSync, isSystem, type, schema, computedValues); } } diff --git a/core/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java b/core/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java index 8f5076639..c29d9ae89 100644 --- a/core/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java +++ b/core/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java @@ -38,7 +38,7 @@ public final class CollectionPropertiesEntity extends CollectionEntity { private Collection shardKeys; private String shardingStrategy; // cluster option private String smartGraphAttribute; - private String smartJoinAttribute; // enterprise option + private String smartJoinAttribute; private Integer writeConcern; private Long count; diff --git a/core/src/main/java/com/arangodb/entity/CollectionStatus.java b/core/src/main/java/com/arangodb/entity/CollectionStatus.java deleted file mode 100644 index 39b7863b9..000000000 --- a/core/src/main/java/com/arangodb/entity/CollectionStatus.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -/** - * @author Mark Vollmary - */ -@Deprecated -public enum CollectionStatus { - - LOADED(3), DELETED(5); - - private final int status; - - CollectionStatus(final int status) { - this.status = status; - } - - public static CollectionStatus fromStatus(final int status) { - for (final CollectionStatus cStatus : CollectionStatus.values()) { - if (cStatus.status == status) { - return cStatus; - } - } - return null; - } - - public int getStatus() { - return status; - } - -} diff --git a/core/src/main/java/com/arangodb/entity/EdgeDefinition.java b/core/src/main/java/com/arangodb/entity/EdgeDefinition.java index b89f67417..021aab42c 100644 --- a/core/src/main/java/com/arangodb/entity/EdgeDefinition.java +++ b/core/src/main/java/com/arangodb/entity/EdgeDefinition.java @@ -71,7 +71,7 @@ public Options getOptions() { /** * @param satellites collection names that will be used to create SatelliteCollections - * for a Hybrid (Disjoint) SmartGraph (Enterprise Edition only). Each array element + * for a Hybrid (Disjoint) SmartGraph. Each array element * must be a valid collection name. The collection type cannot be modified later. * @return this * @since ArangoDB 3.9.0 diff --git a/core/src/main/java/com/arangodb/entity/GraphEntity.java b/core/src/main/java/com/arangodb/entity/GraphEntity.java index 9a068c566..26ff52001 100644 --- a/core/src/main/java/com/arangodb/entity/GraphEntity.java +++ b/core/src/main/java/com/arangodb/entity/GraphEntity.java @@ -86,8 +86,7 @@ public String getRev() { } /** - * @return The replication factor used for every new collection in the graph. Can also be satellite for a SmartGraph - * (Enterprise Edition only). + * @return The replication factor used for every new collection in the graph. Can also be satellite for a SmartGraph. */ public ReplicationFactor getReplicationFactor() { return replicationFactor; @@ -104,28 +103,28 @@ public Integer getWriteConcern() { } /** - * @return Whether the graph is a SmartGraph (Enterprise Edition only). + * @return Whether the graph is a SmartGraph. */ public Boolean getIsSmart() { return isSmart; } /** - * @return Whether the graph is a Disjoint SmartGraph (Enterprise Edition only). + * @return Whether the graph is a Disjoint SmartGraph. */ public Boolean getIsDisjoint() { return isDisjoint; } /** - * @return Name of the sharding attribute in the SmartGraph case (Enterprise Edition only). + * @return Name of the sharding attribute in the SmartGraph case. */ public String getSmartGraphAttribute() { return smartGraphAttribute; } /** - * @return Flag if the graph is a SatelliteGraph (Enterprise Edition only) or not. + * @return Flag if the graph is a SatelliteGraph or not. */ public Boolean getIsSatellite() { return isSatellite; diff --git a/core/src/main/java/com/arangodb/entity/IndexType.java b/core/src/main/java/com/arangodb/entity/IndexType.java index 9ea846527..e796a2c0a 100644 --- a/core/src/main/java/com/arangodb/entity/IndexType.java +++ b/core/src/main/java/com/arangodb/entity/IndexType.java @@ -42,12 +42,6 @@ public enum IndexType { geo2, - /** - * @deprecated since ArangoDB 3.10, use ArangoSearch or Inverted indexes instead. - */ - @Deprecated - fulltext, - edge, ttl, diff --git a/core/src/main/java/com/arangodb/entity/InvertedIndexField.java b/core/src/main/java/com/arangodb/entity/InvertedIndexField.java index 5c2494191..a05167612 100644 --- a/core/src/main/java/com/arangodb/entity/InvertedIndexField.java +++ b/core/src/main/java/com/arangodb/entity/InvertedIndexField.java @@ -111,7 +111,7 @@ public Boolean getCache() { * @param cache Enable this option to always cache the field normalization values in memory for this specific field. * This can improve the performance of scoring and ranking queries. Otherwise, these values are * memory-mapped and it is up to the operating system to load them from disk into memory and to evict - * them from memory. (Enterprise Edition only) + * them from memory. * @return this * @since ArangoDB 3.10.2 */ @@ -142,7 +142,7 @@ public Collection getNested() { * @param nested Index the specified sub-objects that are stored in an array. Other than with the fields property, * the values get indexed in a way that lets you query for co-occurring values. For example, you can * search the sub-objects and all the conditions need to be met by a single sub-object instead of - * across all of them. This property is available in the Enterprise Edition only. + * across all of them. * @return this */ public InvertedIndexField nested(InvertedIndexField... nested) { diff --git a/core/src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java b/core/src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java index 776130882..b1b00105f 100644 --- a/core/src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java +++ b/core/src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java @@ -52,7 +52,7 @@ public Boolean getCache() { * @param cache If you enable this option, then the primary sort columns are always cached in memory. This can * improve the performance of queries that utilize the primary sort order. Otherwise, these values are * memory-mapped and it is up to the operating system to load them from disk into memory and to evict - * them from memory (Enterprise Edition only). + * them from memory. * @return this * @since ArangoDB 3.10.2 */ diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/AnalyzerFeature.java b/core/src/main/java/com/arangodb/entity/arangosearch/AnalyzerFeature.java index e0ed2d54f..4948e25a6 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/AnalyzerFeature.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/AnalyzerFeature.java @@ -42,7 +42,7 @@ public enum AnalyzerFeature { position, /** - * enable search highlighting capabilities (Enterprise Edition only). If present, then the `position` and `frequency` features are also required. + * enable search highlighting capabilities. If present, then the `position` and `frequency` features are also required. * @since ArangoDB 3.10 */ offset diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java b/core/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java index fa729e1e0..d17861430 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java @@ -124,7 +124,7 @@ public Collection getStoredValues() { /** * @return An array of strings defining optimized sort expressions. - * @since ArangoDB 3.11, Enterprise Edition only + * @since ArangoDB 3.11 */ public Collection getOptimizeTopK() { return optimizeTopK; diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java b/core/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java index eb33ebb20..467b380c2 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java @@ -143,7 +143,7 @@ public CollectionLink inBackground(final Boolean inBackground) { * and it is up to the operating system to load them from disk into memory and to evict them from * memory. * @return link - * @since ArangoDB 3.9.5, Enterprise Edition only + * @since ArangoDB 3.9.5 */ public CollectionLink cache(final Boolean cache) { this.cache = cache; diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java b/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java index f0e4b3b56..e394c1b71 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java @@ -29,11 +29,7 @@ public final class ConsolidationPolicy { private ConsolidationType type; private Double threshold; - private Long segmentsMin; - private Long segmentsMax; private Long segmentsBytesMax; - private Long segmentsBytesFloor; - private Long minScore; private Double maxSkewThreshold; private Double minDeletionRatio; @@ -63,38 +59,6 @@ public Double getThreshold() { return threshold; } - public Long getSegmentsMin() { - return segmentsMin; - } - - /** - * @param segmentsMin The minimum number of segments that will be evaluated as candidates for consolidation. - * (default: 1) - * @return this - * @deprecated Removed from ArangoDB 3.12.7 onwards. - */ - @Deprecated - public ConsolidationPolicy segmentsMin(final Long segmentsMin) { - this.segmentsMin = segmentsMin; - return this; - } - - public Long getSegmentsMax() { - return segmentsMax; - } - - /** - * @param segmentsMax The maximum number of segments that will be evaluated as candidates for consolidation. - * (default: 10) - * @return this - * @deprecated Removed from ArangoDB 3.12.7 onwards. - */ - @Deprecated - public ConsolidationPolicy segmentsMax(final Long segmentsMax) { - this.segmentsMax = segmentsMax; - return this; - } - public Long getSegmentsBytesMax() { return segmentsBytesMax; } @@ -108,37 +72,6 @@ public ConsolidationPolicy segmentsBytesMax(final Long segmentsBytesMax) { return this; } - public Long getSegmentsBytesFloor() { - return segmentsBytesFloor; - } - - /** - * @param segmentsBytesFloor Defines the value (in bytes) to treat all smaller segments as equal for consolidation - * selection. (default: 2097152) - * @return this - * @deprecated Removed from ArangoDB 3.12.7 onwards. - */ - @Deprecated - public ConsolidationPolicy segmentsBytesFloor(final Long segmentsBytesFloor) { - this.segmentsBytesFloor = segmentsBytesFloor; - return this; - } - - public Long getMinScore() { - return minScore; - } - - /** - * @param minScore Filter out consolidation candidates with a score less than this. (default: 0) - * @return this - * @deprecated Removed from ArangoDB 3.12.7 onwards. - */ - @Deprecated - public ConsolidationPolicy minScore(final Long minScore) { - this.minScore = minScore; - return this; - } - public Double getMaxSkewThreshold() { return maxSkewThreshold; } @@ -174,12 +107,12 @@ public ConsolidationPolicy minDeletionRatio(final Double minDeletionRatio) { public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; ConsolidationPolicy that = (ConsolidationPolicy) o; - return type == that.type && Objects.equals(threshold, that.threshold) && Objects.equals(segmentsMin, that.segmentsMin) && Objects.equals(segmentsMax, that.segmentsMax) && Objects.equals(segmentsBytesMax, that.segmentsBytesMax) && Objects.equals(segmentsBytesFloor, that.segmentsBytesFloor) && Objects.equals(minScore, that.minScore) && Objects.equals(maxSkewThreshold, that.maxSkewThreshold) && Objects.equals(minDeletionRatio, that.minDeletionRatio); + return type == that.type && Objects.equals(threshold, that.threshold) && Objects.equals(segmentsBytesMax, that.segmentsBytesMax) && Objects.equals(maxSkewThreshold, that.maxSkewThreshold) && Objects.equals(minDeletionRatio, that.minDeletionRatio); } @Override public int hashCode() { - return Objects.hash(type, threshold, segmentsMin, segmentsMax, segmentsBytesMax, segmentsBytesFloor, minScore, maxSkewThreshold, minDeletionRatio); + return Objects.hash(type, threshold, segmentsBytesMax, maxSkewThreshold, minDeletionRatio); } @Override @@ -187,11 +120,7 @@ public String toString() { return "ConsolidationPolicy{" + "type=" + type + ", threshold=" + threshold + - ", segmentsMin=" + segmentsMin + - ", segmentsMax=" + segmentsMax + ", segmentsBytesMax=" + segmentsBytesMax + - ", segmentsBytesFloor=" + segmentsBytesFloor + - ", minScore=" + minScore + ", maxSkewThreshold=" + maxSkewThreshold + ", minDeletionRatio=" + minDeletionRatio + '}'; diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java b/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java index 1eb3b1ebc..a4b6df155 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java @@ -4,14 +4,6 @@ public enum ConsolidationType { - /** - * @deprecated The “bytes_accum” policy type is deprecated and remains in ArangoSearch for backwards compatibility - * with the older versions. Please make sure to always use the “tier” policy instead. - */ - @Deprecated - @JsonProperty("bytes_accum") - BYTES_ACCUM, - @JsonProperty("tier") TIER diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java b/core/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java index 1d2f0f8f8..5d76a95db 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java @@ -120,7 +120,7 @@ public FieldLink inBackground(final Boolean inBackground) { * and it is up to the operating system to load them from disk into memory and to evict them from * memory. * @return link - * @since ArangoDB 3.9.5, Enterprise Edition only + * @since ArangoDB 3.9.5 */ public FieldLink cache(final Boolean cache) { this.cache = cache; diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java b/core/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java index 10b054108..5b82d830e 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java @@ -71,15 +71,6 @@ public Direction getDirection() { return ascending ? Direction.asc : Direction.desc; } - /** - * @deprecated for removal, use {@link #getField()} instead - */ - @Deprecated - @JsonIgnore - public String getFieldName() { - return getField(); - } - public String getField() { return fieldName; } diff --git a/core/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java b/core/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java index d300b7f99..824db2066 100644 --- a/core/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java +++ b/core/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java @@ -40,7 +40,7 @@ public final class StoredValue { /** * @param fields A list of attribute paths. The . character denotes sub-attributes. * @param compression Defines how to compress the attribute values. - * @param cache Whether to cache stored values in memory. (Since ArangoDB 3.9.5, Enterprise Edition only) + * @param cache Whether to cache stored values in memory. (Since ArangoDB 3.9.5) */ @JsonCreator public StoredValue(@JsonProperty("fields") List fields, diff --git a/core/src/main/java/com/arangodb/internal/ArangoCollectionAsyncImpl.java b/core/src/main/java/com/arangodb/internal/ArangoCollectionAsyncImpl.java index f96c725b1..9e20f2682 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoCollectionAsyncImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoCollectionAsyncImpl.java @@ -376,22 +376,11 @@ public CompletableFuture ensureGeoIndex(final Iterable fiel return executorAsync().execute(() -> createGeoIndexRequest(fields, options), IndexEntity.class); } - @Deprecated - @Override - public CompletableFuture ensureFulltextIndex(final Iterable fields, final FulltextIndexOptions options) { - return executorAsync().execute(() -> createFulltextIndexRequest(fields, options), IndexEntity.class); - } - @Override public CompletableFuture ensureTtlIndex(final Iterable fields, final TtlIndexOptions options) { return executorAsync().execute(() -> createTtlIndexRequest(fields, options), IndexEntity.class); } - @Override - public CompletableFuture ensureZKDIndex(final Iterable fields, final ZKDIndexOptions options) { - return executorAsync().execute(() -> createZKDIndexRequest(fields, options), IndexEntity.class); - } - @Override public CompletableFuture ensureMDIndex(final Iterable fields, final MDIndexOptions options) { return executorAsync().execute(() -> createMDIndexRequest(fields, options), IndexEntity.class); diff --git a/core/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java b/core/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java index c2abdf9e0..6175ffa4f 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java @@ -367,22 +367,11 @@ public IndexEntity ensureGeoIndex(final Iterable fields, final GeoIndexO return executorSync().execute(createGeoIndexRequest(fields, options), IndexEntity.class); } - @Deprecated - @Override - public IndexEntity ensureFulltextIndex(final Iterable fields, final FulltextIndexOptions options) { - return executorSync().execute(createFulltextIndexRequest(fields, options), IndexEntity.class); - } - @Override public IndexEntity ensureTtlIndex(final Iterable fields, final TtlIndexOptions options) { return executorSync().execute(createTtlIndexRequest(fields, options), IndexEntity.class); } - @Override - public IndexEntity ensureZKDIndex(final Iterable fields, final ZKDIndexOptions options) { - return executorSync().execute(createZKDIndexRequest(fields, options), IndexEntity.class); - } - @Override public IndexEntity ensureMDIndex(final Iterable fields, final MDIndexOptions options) { return executorSync().execute(createMDIndexRequest(fields, options), IndexEntity.class); diff --git a/core/src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java b/core/src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java index 7c7dda594..4009ac482 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java @@ -217,18 +217,6 @@ public CompletableFuture> cursor(String cursorId, Class .thenApply(res -> new ArangoCursorAsyncImpl<>(this, res, type, hostHandle, nextBatchId != null)); } - @Override - public CompletableFuture explainQuery( - final String query, final Map bindVars, final AqlQueryExplainOptions options) { - return executorAsync().execute(() -> explainQueryRequest(query, bindVars, options), AqlExecutionExplainEntity.class); - } - - @Override - public CompletableFuture explainAqlQuery( - String query, Map bindVars, AqlQueryExplainOptions options) { - return executorAsync().execute(() -> explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class); - } - @Override public CompletableFuture explainAqlQuery(String query, Map bindVars, ExplainAqlQueryOptions options) { return executorAsync().execute(() -> explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class); @@ -286,22 +274,6 @@ public CompletableFuture killQuery(final String id) { return executorAsync().execute(() -> killQueryRequest(id), Void.class); } - @Override - public CompletableFuture createAqlFunction( - final String name, final String code, final AqlFunctionCreateOptions options) { - return executorAsync().execute(() -> createAqlFunctionRequest(name, code, options), Void.class); - } - - @Override - public CompletableFuture deleteAqlFunction(final String name, final AqlFunctionDeleteOptions options) { - return executorAsync().execute(() -> deleteAqlFunctionRequest(name, options), deleteAqlFunctionResponseDeserializer()); - } - - @Override - public CompletableFuture> getAqlFunctions(final AqlFunctionGetOptions options) { - return executorAsync().execute(() -> getAqlFunctionsRequest(options), getAqlFunctionsResponseDeserializer()); - } - @Override public ArangoGraphAsync graph(final String name) { return new ArangoGraphAsyncImpl(this, name); @@ -323,11 +295,6 @@ public CompletableFuture> getGraphs() { return executorAsync().execute(this::getGraphsRequest, getGraphsResponseDeserializer()); } - @Override - public CompletableFuture transaction(final String action, final Class type, final TransactionOptions options) { - return executorAsync().execute(() -> transactionRequest(action, options), transactionResponseDeserializer(type)); - } - @Override public CompletableFuture beginStreamTransaction(StreamTransactionOptions options) { return executorAsync().execute(() -> beginStreamTransactionRequest(options), streamTransactionResponseDeserializer()); @@ -358,11 +325,6 @@ public CompletableFuture getInfo() { return executorAsync().execute(this::getInfoRequest, getInfoResponseDeserializer()); } - @Override - public CompletableFuture reloadRouting() { - return executorAsync().execute(this::reloadRoutingRequest, Void.class); - } - @Override public CompletableFuture> getViews() { return executorAsync().execute(this::getViewsRequest, getViewsResponseDeserializer()); diff --git a/core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java b/core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java index 26649883e..a57b6ea75 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java @@ -238,17 +238,6 @@ public void close(final String id) { return new ArangoCursorImpl<>(execute, type, result, options.getAllowRetry()); } - @Override - public AqlExecutionExplainEntity explainQuery( - final String query, final Map bindVars, final AqlQueryExplainOptions options) { - return executorSync().execute(explainQueryRequest(query, bindVars, options), AqlExecutionExplainEntity.class); - } - - @Override - public AqlQueryExplainEntity explainAqlQuery(String query, Map bindVars, AqlQueryExplainOptions options) { - return executorSync().execute(explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class); - } - @Override public AqlQueryExplainEntity explainAqlQuery(String query, Map bindVars, ExplainAqlQueryOptions options) { return executorSync().execute(explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class); @@ -306,22 +295,6 @@ public void killQuery(final String id) { executorSync().execute(killQueryRequest(id), Void.class); } - @Override - public void createAqlFunction( - final String name, final String code, final AqlFunctionCreateOptions options) { - executorSync().execute(createAqlFunctionRequest(name, code, options), Void.class); - } - - @Override - public Integer deleteAqlFunction(final String name, final AqlFunctionDeleteOptions options) { - return executorSync().execute(deleteAqlFunctionRequest(name, options), deleteAqlFunctionResponseDeserializer()); - } - - @Override - public Collection getAqlFunctions(final AqlFunctionGetOptions options) { - return executorSync().execute(getAqlFunctionsRequest(options), getAqlFunctionsResponseDeserializer()); - } - @Override public ArangoGraph graph(final String name) { return new ArangoGraphImpl(this, name); @@ -343,11 +316,6 @@ public Collection getGraphs() { return executorSync().execute(getGraphsRequest(), getGraphsResponseDeserializer()); } - @Override - public T transaction(final String action, final Class type, final TransactionOptions options) { - return executorSync().execute(transactionRequest(action, options), transactionResponseDeserializer(type)); - } - @Override public StreamTransactionEntity beginStreamTransaction(StreamTransactionOptions options) { return executorSync().execute(beginStreamTransactionRequest(options), streamTransactionResponseDeserializer()); @@ -378,11 +346,6 @@ public DatabaseEntity getInfo() { return executorSync().execute(getInfoRequest(), getInfoResponseDeserializer()); } - @Override - public void reloadRouting() { - executorSync().execute(reloadRoutingRequest(), Void.class); - } - @Override public Collection getViews() { return executorSync().execute(getViewsRequest(), getViewsResponseDeserializer()); diff --git a/core/src/main/java/com/arangodb/internal/ArangoDefaults.java b/core/src/main/java/com/arangodb/internal/ArangoDefaults.java index d61fea5b6..d4b2df141 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoDefaults.java +++ b/core/src/main/java/com/arangodb/internal/ArangoDefaults.java @@ -35,18 +35,12 @@ public final class ArangoDefaults { private static final int MB = 1024 * 1024; - - public static final int INTEGER_BYTES = Integer.SIZE / Byte.SIZE; - public static final int LONG_BYTES = Long.SIZE / Byte.SIZE; - public static final int CHUNK_MIN_HEADER_SIZE = INTEGER_BYTES + INTEGER_BYTES + LONG_BYTES; - public static final int CHUNK_MAX_HEADER_SIZE = CHUNK_MIN_HEADER_SIZE + LONG_BYTES; - public static final int MAX_CONNECTIONS_VST_DEFAULT = 1; public static final int MAX_CONNECTIONS_HTTP_DEFAULT = 20; public static final int MAX_CONNECTIONS_HTTP2_DEFAULT = 1; // default config properties public static final List DEFAULT_HOSTS = Collections.emptyList(); - public static final Protocol DEFAULT_PROTOCOL = Protocol.HTTP2_JSON; + public static final Protocol DEFAULT_PROTOCOL = Protocol.HTTP_2; public static final String DEFAULT_USER = "root"; public static final Integer DEFAULT_TIMEOUT = 0; public static final Long DEFAULT_CONNECTION_TTL_HTTP = 30_000L; @@ -54,7 +48,6 @@ public final class ArangoDefaults { public static final String DEFAULT_SSL_PROTOCOL = "TLS"; public static final String DEFAULT_SSL_TRUST_STORE_TYPE = "PKCS12"; public static final Boolean DEFAULT_VERIFY_HOST = true; - public static final Integer DEFAULT_CHUNK_SIZE = 30_000; public static final Boolean DEFAULT_PIPELINING = false; public static final Integer DEFAULT_CONNECTION_WINDOW_SIZE = 32 * MB; public static final Integer DEFAULT_INITIAL_WINDOW_SIZE = 2 * MB; diff --git a/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionAsyncImpl.java b/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionAsyncImpl.java index f6348df26..487c718a6 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionAsyncImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionAsyncImpl.java @@ -49,18 +49,6 @@ public ArangoGraphAsync graph() { return graph; } - @Deprecated - @Override - public CompletableFuture drop() { - return drop(new EdgeCollectionDropOptions()); - } - - @Deprecated - @Override - public CompletableFuture drop(final EdgeCollectionDropOptions options) { - return executorAsync().execute(() -> removeEdgeDefinitionRequest(options), Void.class); - } - @Override public CompletableFuture remove() { return remove(new EdgeCollectionRemoveOptions()); diff --git a/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionImpl.java b/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionImpl.java index 12cc9dce6..73678b341 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoEdgeCollectionImpl.java @@ -46,18 +46,6 @@ public ArangoGraph graph() { return graph; } - @Deprecated - @Override - public void drop() { - drop(new EdgeCollectionDropOptions()); - } - - @Deprecated - @Override - public void drop(final EdgeCollectionDropOptions options) { - executorSync().execute(removeEdgeDefinitionRequest(options), Void.class); - } - @Override public void remove() { remove(new EdgeCollectionRemoveOptions()); diff --git a/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionAsyncImpl.java b/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionAsyncImpl.java index ce009d45c..0b2a6d5d6 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionAsyncImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionAsyncImpl.java @@ -49,18 +49,6 @@ public ArangoGraphAsync graph() { return graph; } - @Deprecated - @Override - public CompletableFuture drop() { - return drop(new VertexCollectionDropOptions()); - } - - @Deprecated - @Override - public CompletableFuture drop(final VertexCollectionDropOptions options) { - return executorAsync().execute(() -> dropRequest(options), Void.class); - } - @Override public CompletableFuture remove() { return remove(new VertexCollectionRemoveOptions()); diff --git a/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionImpl.java b/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionImpl.java index 0b0d1ca3a..3184ad7aa 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionImpl.java +++ b/core/src/main/java/com/arangodb/internal/ArangoVertexCollectionImpl.java @@ -46,18 +46,6 @@ public ArangoGraph graph() { return graph; } - @Deprecated - @Override - public void drop() { - drop(new VertexCollectionDropOptions()); - } - - @Deprecated - @Override - public void drop(final VertexCollectionDropOptions options) { - executorSync().execute(dropRequest(options), Void.class); - } - @Override public void remove() { remove(new VertexCollectionRemoveOptions()); diff --git a/core/src/main/java/com/arangodb/internal/InternalArangoCollection.java b/core/src/main/java/com/arangodb/internal/InternalArangoCollection.java index bbab1857f..1ff995d86 100644 --- a/core/src/main/java/com/arangodb/internal/InternalArangoCollection.java +++ b/core/src/main/java/com/arangodb/internal/InternalArangoCollection.java @@ -365,16 +365,6 @@ protected InternalRequest createGeoIndexRequest(final Iterable fields, f return request; } - @Deprecated - protected InternalRequest createFulltextIndexRequest(final Iterable fields, final FulltextIndexOptions options) { - final InternalRequest request = request(dbName, RequestType.POST, PATH_API_INDEX); - request.putQueryParam(COLLECTION, name); - request.setBody( - getSerde().serialize(OptionsBuilder.build(options != null ? options : new FulltextIndexOptions(), - fields))); - return request; - } - protected InternalRequest createTtlIndexRequest(final Iterable fields, final TtlIndexOptions options) { final InternalRequest request = request(dbName, RequestType.POST, PATH_API_INDEX); request.putQueryParam(COLLECTION, name); @@ -383,15 +373,6 @@ protected InternalRequest createTtlIndexRequest(final Iterable fields, f return request; } - protected InternalRequest createZKDIndexRequest( - final Iterable fields, final ZKDIndexOptions options) { - final InternalRequest request = request(dbName, RequestType.POST, PATH_API_INDEX); - request.putQueryParam(COLLECTION, name); - request.setBody(getSerde().serialize(OptionsBuilder.build(options != null ? options : - new ZKDIndexOptions().fieldValueTypes(ZKDIndexOptions.FieldValueTypes.DOUBLE), fields))); - return request; - } - protected InternalRequest createMDIndexRequest( final Iterable fields, final AbstractMDIndexOptions options) { final InternalRequest request = request(dbName, RequestType.POST, PATH_API_INDEX); diff --git a/core/src/main/java/com/arangodb/internal/InternalArangoDatabase.java b/core/src/main/java/com/arangodb/internal/InternalArangoDatabase.java index 135f4d825..905fd3506 100644 --- a/core/src/main/java/com/arangodb/internal/InternalArangoDatabase.java +++ b/core/src/main/java/com/arangodb/internal/InternalArangoDatabase.java @@ -45,7 +45,6 @@ public abstract class InternalArangoDatabase extends ArangoExecuteable { private static final String PATH_API_CURSOR = "/_api/cursor"; private static final String PATH_API_TRANSACTION = "/_api/transaction"; private static final String PATH_API_BEGIN_STREAM_TRANSACTION = "/_api/transaction/begin"; - private static final String PATH_API_AQLFUNCTION = "/_api/aqlfunction"; private static final String PATH_API_EXPLAIN = "/_api/explain"; private static final String PATH_API_QUERY = "/_api/query"; private static final String PATH_API_QUERY_CACHE = "/_api/query-cache"; @@ -53,7 +52,6 @@ public abstract class InternalArangoDatabase extends ArangoExecuteable { private static final String PATH_API_QUERY_PROPERTIES = "/_api/query/properties"; private static final String PATH_API_QUERY_CURRENT = "/_api/query/current"; private static final String PATH_API_QUERY_SLOW = "/_api/query/slow"; - private static final String PATH_API_ADMIN_ROUTING_RELOAD = "/_admin/routing/reload"; private static final String PATH_API_USER = "/_api/user"; private static final String TRANSACTION_ID = "x-arango-trx-id"; @@ -172,13 +170,6 @@ protected InternalRequest queryCloseRequest(final String id, final AqlQueryOptio return request; } - protected InternalRequest explainQueryRequest(final String query, final Map bindVars, - final AqlQueryExplainOptions options) { - final AqlQueryExplainOptions opt = options != null ? options : new AqlQueryExplainOptions(); - return request(name, RequestType.POST, PATH_API_EXPLAIN) - .setBody(getSerde().serialize(OptionsBuilder.build(opt, query, bindVars))); - } - protected InternalRequest explainQueryRequest(final String query, final Map bindVars, final ExplainAqlQueryOptions options) { final ExplainAqlQueryOptions opt = options != null ? options : new ExplainAqlQueryOptions(); @@ -226,18 +217,6 @@ protected InternalRequest killQueryRequest(final String id) { return request(name, RequestType.DELETE, PATH_API_QUERY, id); } - protected InternalRequest createAqlFunctionRequest(final String name, final String code, - final AqlFunctionCreateOptions options) { - return request(this.name, RequestType.POST, PATH_API_AQLFUNCTION).setBody(getSerde().serialize(OptionsBuilder.build(options != null ? options : new AqlFunctionCreateOptions(), name, code))); - } - - protected InternalRequest deleteAqlFunctionRequest(final String name, final AqlFunctionDeleteOptions options) { - final InternalRequest request = request(this.name, RequestType.DELETE, PATH_API_AQLFUNCTION, name); - final AqlFunctionDeleteOptions params = options != null ? options : new AqlFunctionDeleteOptions(); - request.putQueryParam("group", params.getGroup()); - return request; - } - public ResponseDeserializer> cursorEntityDeserializer(final Class type) { return (response) -> { CursorEntity e = getSerde().deserialize(response.getBody(), constructParametricType(CursorEntity.class, type)); @@ -247,22 +226,6 @@ public ResponseDeserializer> cursorEntityDeserializer(final }; } - protected ResponseDeserializer deleteAqlFunctionResponseDeserializer() { - return (response) -> getSerde().deserialize(response.getBody(), "/deletedCount", Integer.class); - } - - protected InternalRequest getAqlFunctionsRequest(final AqlFunctionGetOptions options) { - final InternalRequest request = request(name, RequestType.GET, PATH_API_AQLFUNCTION); - final AqlFunctionGetOptions params = options != null ? options : new AqlFunctionGetOptions(); - request.putQueryParam("namespace", params.getNamespace()); - return request; - } - - protected ResponseDeserializer> getAqlFunctionsResponseDeserializer() { - return (response) -> getSerde().deserialize(response.getBody(), ArangoResponseField.RESULT_JSON_POINTER, - constructListType(AqlFunctionEntity.class)); - } - protected InternalRequest createGraphRequest(final String name, final Iterable edgeDefinitions, final GraphCreateOptions options) { GraphCreateOptions opts = options != null ? options : new GraphCreateOptions(); @@ -284,17 +247,6 @@ protected ResponseDeserializer> getGraphsResponseDeseria constructListType(GraphEntity.class)); } - protected InternalRequest transactionRequest(final String action, final TransactionOptions options) { - return request(name, RequestType.POST, PATH_API_TRANSACTION).setBody(getSerde().serialize(OptionsBuilder.build(options != null ? options : new TransactionOptions(), action))); - } - - protected ResponseDeserializer transactionResponseDeserializer(final Class type) { - return (response) -> { - byte[] userContent = getSerde().extract(response.getBody(), ArangoResponseField.RESULT_JSON_POINTER); - return getSerde().deserializeUserData(userContent, type); - }; - } - protected InternalRequest beginStreamTransactionRequest(final StreamTransactionOptions options) { StreamTransactionOptions opts = options != null ? options : new StreamTransactionOptions(); InternalRequest r = request(name, RequestType.POST, PATH_API_BEGIN_STREAM_TRANSACTION).setBody(getSerde().serialize(opts)); @@ -339,10 +291,6 @@ protected ResponseDeserializer getInfoResponseDeserializer() { DatabaseEntity.class); } - protected InternalRequest reloadRoutingRequest() { - return request(name, RequestType.POST, PATH_API_ADMIN_ROUTING_RELOAD); - } - protected InternalRequest getViewsRequest() { return request(name, RequestType.GET, InternalArangoView.PATH_API_VIEW); } diff --git a/core/src/main/java/com/arangodb/internal/InternalArangoEdgeCollection.java b/core/src/main/java/com/arangodb/internal/InternalArangoEdgeCollection.java index 2c035f435..33bc6d832 100644 --- a/core/src/main/java/com/arangodb/internal/InternalArangoEdgeCollection.java +++ b/core/src/main/java/com/arangodb/internal/InternalArangoEdgeCollection.java @@ -55,13 +55,6 @@ public String name() { return name; } - @Deprecated - protected InternalRequest removeEdgeDefinitionRequest(final EdgeCollectionDropOptions options) { - return request(dbName, RequestType.DELETE, PATH_API_GHARIAL, graphName, "edge", name) - .putQueryParam("waitForSync", options.getWaitForSync()) - .putQueryParam("dropCollections", options.getDropCollections()); - } - protected InternalRequest removeEdgeDefinitionRequest(final EdgeCollectionRemoveOptions options) { return request(dbName, RequestType.DELETE, PATH_API_GHARIAL, graphName, "edge", name) .putQueryParam("waitForSync", options.getWaitForSync()) diff --git a/core/src/main/java/com/arangodb/internal/InternalArangoVertexCollection.java b/core/src/main/java/com/arangodb/internal/InternalArangoVertexCollection.java index 991201661..5706ec034 100644 --- a/core/src/main/java/com/arangodb/internal/InternalArangoVertexCollection.java +++ b/core/src/main/java/com/arangodb/internal/InternalArangoVertexCollection.java @@ -55,12 +55,6 @@ public String name() { return name; } - @Deprecated - protected InternalRequest dropRequest(final VertexCollectionDropOptions options) { - return request(dbName, RequestType.DELETE, PATH_API_GHARIAL, graphName, VERTEX_PATH, name) - .putQueryParam("dropCollection", options.getDropCollection()); - } - protected InternalRequest removeVertexCollectionRequest(final VertexCollectionRemoveOptions options) { return request(dbName, RequestType.DELETE, PATH_API_GHARIAL, graphName, VERTEX_PATH, name) .putQueryParam("dropCollection", options.getDropCollection()); diff --git a/core/src/main/java/com/arangodb/internal/RequestType.java b/core/src/main/java/com/arangodb/internal/RequestType.java index 5b9d27aae..380ee72bb 100644 --- a/core/src/main/java/com/arangodb/internal/RequestType.java +++ b/core/src/main/java/com/arangodb/internal/RequestType.java @@ -33,11 +33,7 @@ public enum RequestType { PUT(3), HEAD(4), PATCH(5), - OPTIONS(6), - VSTREAM_CRED(7), - VSTREAM_REGISTER(8), - VSTREAM_STATUS(9), - ILLEGAL(10); + OPTIONS(6); private final int type; diff --git a/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java b/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java index bc4e907fa..f4c08e0cc 100644 --- a/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java +++ b/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java @@ -8,7 +8,6 @@ import com.arangodb.config.ProtocolConfig; import com.arangodb.entity.LoadBalancingStrategy; import com.arangodb.internal.ArangoDefaults; -import com.arangodb.internal.serde.ContentTypeFactory; import com.arangodb.internal.serde.InternalSerde; import com.arangodb.internal.serde.InternalSerdeProvider; import com.arangodb.serde.ArangoSerde; @@ -46,13 +45,11 @@ public class ArangoConfig { private String sslTrustStoreType; private SSLContext sslContext; private Boolean verifyHost; - private Integer chunkSize; private Boolean pipelining; private Integer connectionWindowSize; private Integer initialWindowSize; private Integer maxConnections; private Long connectionTtl; - private Integer keepAliveInterval; private Boolean acquireHostList; private Integer acquireHostListInterval; private LoadBalancingStrategy loadBalancingStrategy; @@ -92,16 +89,12 @@ public void loadProperties(final ArangoConfigProperties properties) { sslTrustStorePassword = properties.getSslTrustStorePassword(); sslTrustStoreType = properties.getSslTrustStoreType().orElse(ArangoDefaults.DEFAULT_SSL_TRUST_STORE_TYPE); verifyHost = properties.getVerifyHost().orElse(ArangoDefaults.DEFAULT_VERIFY_HOST); - chunkSize = properties.getChunkSize().orElse(ArangoDefaults.DEFAULT_CHUNK_SIZE); pipelining = properties.getPipelining().orElse(ArangoDefaults.DEFAULT_PIPELINING); connectionWindowSize = properties.getConnectionWindowSize().orElse(ArangoDefaults.DEFAULT_CONNECTION_WINDOW_SIZE); initialWindowSize = properties.getInitialWindowSize().orElse(ArangoDefaults.DEFAULT_INITIAL_WINDOW_SIZE); // FIXME: make maxConnections field Optional maxConnections = properties.getMaxConnections().orElse(null); - // FIXME: make connectionTtl field Optional - connectionTtl = properties.getConnectionTtl().orElse(null); - // FIXME: make keepAliveInterval field Optional - keepAliveInterval = properties.getKeepAliveInterval().orElse(null); + connectionTtl = properties.getConnectionTtl().orElse(ArangoDefaults.DEFAULT_CONNECTION_TTL_HTTP); acquireHostList = properties.getAcquireHostList().orElse(ArangoDefaults.DEFAULT_ACQUIRE_HOST_LIST); acquireHostListInterval = properties.getAcquireHostListInterval().orElse(ArangoDefaults.DEFAULT_ACQUIRE_HOST_LIST_INTERVAL); loadBalancingStrategy = properties.getLoadBalancingStrategy().orElse(ArangoDefaults.DEFAULT_LOAD_BALANCING_STRATEGY); @@ -218,14 +211,6 @@ public void setVerifyHost(Boolean verifyHost) { this.verifyHost = verifyHost; } - public Integer getChunkSize() { - return chunkSize; - } - - public void setChunkSize(Integer chunkSize) { - this.chunkSize = chunkSize; - } - public Boolean getPipelining() { return pipelining; } @@ -260,15 +245,10 @@ public Integer getMaxConnections() { private int getDefaultMaxConnections() { int defaultMaxConnections; switch (getProtocol()) { - case VST: - defaultMaxConnections = ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT; - break; - case HTTP_JSON: - case HTTP_VPACK: + case HTTP_1_1: defaultMaxConnections = ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT; break; - case HTTP2_JSON: - case HTTP2_VPACK: + case HTTP_2: defaultMaxConnections = ArangoDefaults.MAX_CONNECTIONS_HTTP2_DEFAULT; break; default: @@ -282,9 +262,6 @@ public void setMaxConnections(Integer maxConnections) { } public Long getConnectionTtl() { - if (connectionTtl == null && getProtocol() != Protocol.VST) { - connectionTtl = ArangoDefaults.DEFAULT_CONNECTION_TTL_HTTP; - } return connectionTtl; } @@ -292,14 +269,6 @@ public void setConnectionTtl(Long connectionTtl) { this.connectionTtl = connectionTtl; } - public Integer getKeepAliveInterval() { - return keepAliveInterval; - } - - public void setKeepAliveInterval(Integer keepAliveInterval) { - this.keepAliveInterval = keepAliveInterval; - } - public Boolean getAcquireHostList() { return acquireHostList; } @@ -339,13 +308,13 @@ public ArangoSerde getUserDataSerde() { throw new RuntimeException(e); } } else { - return ArangoSerdeProvider.of(ContentTypeFactory.of(getProtocol())).create(); + return ArangoSerdeProvider.load().create(); } } public InternalSerde getInternalSerde() { if (internalSerde == null) { - internalSerde = new InternalSerdeProvider(ContentTypeFactory.of(getProtocol())).create(getUserDataSerde(), protocolModule); + internalSerde = new InternalSerdeProvider().create(getUserDataSerde(), protocolModule); } return internalSerde; } diff --git a/core/src/main/java/com/arangodb/internal/config/ArangoConfigPropertiesImpl.java b/core/src/main/java/com/arangodb/internal/config/ArangoConfigPropertiesImpl.java index 8978518f2..c28c47e08 100644 --- a/core/src/main/java/com/arangodb/internal/config/ArangoConfigPropertiesImpl.java +++ b/core/src/main/java/com/arangodb/internal/config/ArangoConfigPropertiesImpl.java @@ -144,11 +144,6 @@ public Optional getVerifyHost() { return Optional.ofNullable(getProperty(KEY_VERIFY_HOST)).map(Boolean::valueOf); } - @Override - public Optional getChunkSize() { - return Optional.ofNullable(getProperty(KEY_CHUNK_SIZE)).map(Integer::valueOf); - } - @Override public Optional getPipelining() { return Optional.ofNullable(getProperty(KEY_PIPELINING)).map(Boolean::valueOf); @@ -174,11 +169,6 @@ public Optional getConnectionTtl() { return Optional.ofNullable(getProperty(KEY_CONNECTION_TTL)).map(Long::valueOf); } - @Override - public Optional getKeepAliveInterval() { - return Optional.ofNullable(getProperty(KEY_KEEP_ALIVE_INTERVAL)).map(Integer::valueOf); - } - @Override public Optional getAcquireHostList() { return Optional.ofNullable(getProperty(KEY_ACQUIRE_HOST_LIST)).map(Boolean::valueOf); diff --git a/core/src/main/java/com/arangodb/internal/net/AccessType.java b/core/src/main/java/com/arangodb/internal/net/AccessType.java deleted file mode 100644 index c228074c5..000000000 --- a/core/src/main/java/com/arangodb/internal/net/AccessType.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2018 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.internal.net; - -/** - * @author Mark Vollmary - */ -public enum AccessType { - - WRITE, READ, DIRTY_READ - -} diff --git a/core/src/main/java/com/arangodb/internal/net/Communication.java b/core/src/main/java/com/arangodb/internal/net/Communication.java index d869ebdef..f293b2edd 100644 --- a/core/src/main/java/com/arangodb/internal/net/Communication.java +++ b/core/src/main/java/com/arangodb/internal/net/Communication.java @@ -9,7 +9,6 @@ import com.arangodb.internal.config.ArangoConfig; import com.arangodb.internal.serde.InternalSerde; import com.arangodb.internal.util.HostUtils; -import com.arangodb.internal.util.RequestUtils; import com.arangodb.internal.util.ResponseUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +44,7 @@ public void close() throws IOException { } public CompletableFuture executeAsync(final InternalRequest request, final HostHandle hostHandle) { - return executeAsync(request, hostHandle, hostHandler.get(hostHandle, RequestUtils.determineAccessType(request)), 0); + return executeAsync(request, hostHandle, hostHandler.get(hostHandle), 0); } private CompletableFuture executeAsync(final InternalRequest request, final HostHandle hostHandle, final Host host, final int attemptCount) { @@ -97,7 +96,7 @@ private CompletableFuture doExecuteAsync( final HostDescription redirectHost = HostUtils.createFromLocation(location); hostHandler.failIfNotMatch(redirectHost, errorEntityEx); mirror( - executeAsync(request, new HostHandle().setHost(redirectHost), hostHandler.get(hostHandle, RequestUtils.determineAccessType(request)), attemptCount + 1), + executeAsync(request, new HostHandle().setHost(redirectHost), hostHandler.get(hostHandle), attemptCount + 1), rfuture ); } @@ -124,9 +123,9 @@ private void handleException(boolean isSafe, Throwable e, HostHandle hostHandle, if (hostHandle != null && hostHandle.getHost() != null) { hostHandle.setHost(null); } - hostHandler.checkNext(hostHandle, RequestUtils.determineAccessType(request)); + hostHandler.checkNext(hostHandle); if (isSafe) { - Host nextHost = hostHandler.get(hostHandle, RequestUtils.determineAccessType(request)); + Host nextHost = hostHandler.get(hostHandle); LOGGER.warn("Could not connect to {} while executing request [id={}]", host.getDescription(), reqId, ioEx); LOGGER.debug("Try connecting to {}", nextHost.getDescription()); diff --git a/core/src/main/java/com/arangodb/internal/net/ConnectionPoolImpl.java b/core/src/main/java/com/arangodb/internal/net/ConnectionPoolImpl.java index 9f22ee50a..b46c94199 100644 --- a/core/src/main/java/com/arangodb/internal/net/ConnectionPoolImpl.java +++ b/core/src/main/java/com/arangodb/internal/net/ConnectionPoolImpl.java @@ -54,8 +54,7 @@ public ConnectionPoolImpl(final HostDescription host, final ArangoConfig config, this.factory = factory; connections = new CopyOnWriteArrayList<>(); switch (config.getProtocol()) { - case HTTP_JSON: - case HTTP_VPACK: + case HTTP_1_1: maxSlots = config.getPipelining() ? HTTP1_SLOTS_PIPELINING : HTTP1_SLOTS; break; default: diff --git a/core/src/main/java/com/arangodb/internal/net/DirtyReadHostHandler.java b/core/src/main/java/com/arangodb/internal/net/DirtyReadHostHandler.java deleted file mode 100644 index b54354dcb..000000000 --- a/core/src/main/java/com/arangodb/internal/net/DirtyReadHostHandler.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2018 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.internal.net; - -import com.arangodb.config.HostDescription; - -import java.io.IOException; - -/** - * @author Mark Vollmary - */ -public class DirtyReadHostHandler implements HostHandler { - - private final HostHandler master; - private final HostHandler follower; - private AccessType currentAccessType; - - public DirtyReadHostHandler(final HostHandler master, final HostHandler follower) { - super(); - this.master = master; - this.follower = follower; - } - - private HostHandler determineHostHandler() { - if (currentAccessType == AccessType.DIRTY_READ) { - return follower; - } - return master; - } - - @Override - public Host get(final HostHandle hostHandle, final AccessType accessType) { - this.currentAccessType = accessType; - return determineHostHandler().get(hostHandle, accessType); - } - - @Override - public void checkNext(HostHandle hostHandle, AccessType accessType) { - this.currentAccessType = accessType; - determineHostHandler().checkNext(hostHandle, accessType); - } - - @Override - public void success() { - determineHostHandler().success(); - } - - @Override - public void fail(Exception exception) { - determineHostHandler().fail(exception); - } - - @Override - public void failIfNotMatch(HostDescription host, Exception exception) { - determineHostHandler().failIfNotMatch(host, exception); - } - - @Override - public void reset() { - determineHostHandler().reset(); - } - - @Override - public void close() throws IOException { - master.close(); - follower.close(); - } - - @Override - public void setJwt(String jwt) { - master.setJwt(jwt); - follower.setJwt(jwt); - } - -} diff --git a/core/src/main/java/com/arangodb/internal/net/FallbackHostHandler.java b/core/src/main/java/com/arangodb/internal/net/FallbackHostHandler.java index f1d9b3b75..305f5d1f1 100644 --- a/core/src/main/java/com/arangodb/internal/net/FallbackHostHandler.java +++ b/core/src/main/java/com/arangodb/internal/net/FallbackHostHandler.java @@ -49,8 +49,8 @@ public FallbackHostHandler(final HostResolver resolver) { } @Override - public Host get(final HostHandle hostHandle, AccessType accessType) { - checkNext(hostHandle, accessType); + public Host get(final HostHandle hostHandle) { + checkNext(hostHandle); if (current.isMarkforDeletion()) { fail(new ArangoDBException("Host marked for deletion")); } @@ -58,7 +58,7 @@ public Host get(final HostHandle hostHandle, AccessType accessType) { } @Override - public void checkNext(HostHandle hostHandle, AccessType accessType) { + public void checkNext(HostHandle hostHandle) { if (current == lastSuccess && iterations >= 3) { ArangoDBException e = ArangoDBException.of("Cannot contact any host!", new ArangoDBMultipleException(new ArrayList<>(lastFailExceptions))); diff --git a/core/src/main/java/com/arangodb/internal/net/HostHandler.java b/core/src/main/java/com/arangodb/internal/net/HostHandler.java index d9ec2ddb7..7c8274f3e 100644 --- a/core/src/main/java/com/arangodb/internal/net/HostHandler.java +++ b/core/src/main/java/com/arangodb/internal/net/HostHandler.java @@ -31,9 +31,9 @@ @UsedInApi public interface HostHandler { - Host get(HostHandle hostHandle, AccessType accessType); + Host get(HostHandle hostHandle); - void checkNext(HostHandle hostHandle, AccessType accessType); + void checkNext(HostHandle hostHandle); void success(); diff --git a/core/src/main/java/com/arangodb/internal/net/ProtocolProvider.java b/core/src/main/java/com/arangodb/internal/net/ProtocolProvider.java index 9420a1cb5..9e573e993 100644 --- a/core/src/main/java/com/arangodb/internal/net/ProtocolProvider.java +++ b/core/src/main/java/com/arangodb/internal/net/ProtocolProvider.java @@ -12,16 +12,8 @@ public interface ProtocolProvider { boolean supportsProtocol(Protocol protocol); - /** - * @deprecated use {@link #createConnectionFactory(ProtocolConfig)} instead - */ - @Deprecated - default ConnectionFactory createConnectionFactory() { - throw new UnsupportedOperationException(); - } - default ConnectionFactory createConnectionFactory(ProtocolConfig config) { - return createConnectionFactory(); + throw new UnsupportedOperationException(); } CommunicationProtocol createProtocol(ArangoConfig config, HostHandler hostHandler); diff --git a/core/src/main/java/com/arangodb/internal/net/RandomHostHandler.java b/core/src/main/java/com/arangodb/internal/net/RandomHostHandler.java index b483765c4..217b57a7b 100644 --- a/core/src/main/java/com/arangodb/internal/net/RandomHostHandler.java +++ b/core/src/main/java/com/arangodb/internal/net/RandomHostHandler.java @@ -44,7 +44,7 @@ public RandomHostHandler(final HostResolver resolver, final HostHandler fallback } @Override - public Host get(final HostHandle hostHandle, AccessType accessType) { + public Host get(final HostHandle hostHandle) { if (current == null || current.isMarkforDeletion()) { hosts = resolver.getHosts(); current = getRandomHost(); @@ -53,7 +53,7 @@ public Host get(final HostHandle hostHandle, AccessType accessType) { } @Override - public void checkNext(HostHandle hostHandle, AccessType accessType) { + public void checkNext(HostHandle hostHandle) { } @Override @@ -64,7 +64,7 @@ public void success() { @Override public void fail(Exception exception) { fallback.fail(exception); - current = fallback.get(null, null); + current = fallback.get(null); } @Override diff --git a/core/src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java b/core/src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java index ec70f8e13..55c5694d4 100644 --- a/core/src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java +++ b/core/src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java @@ -53,8 +53,8 @@ public RoundRobinHostHandler(final HostResolver resolver) { } @Override - public Host get(final HostHandle hostHandle, AccessType accessType) { - checkNext(hostHandle, accessType); + public Host get(final HostHandle hostHandle) { + checkNext(hostHandle); final int size = hosts.getHostsList().size(); final int index = (int) ((current++) % size); Host host = hosts.getHostsList().get(index); @@ -76,7 +76,7 @@ public Host get(final HostHandle hostHandle, AccessType accessType) { } @Override - public void checkNext(HostHandle hostHandle, AccessType accessType) { + public void checkNext(HostHandle hostHandle) { hosts = resolver.getHosts(); final int size = hosts.getHostsList().size(); diff --git a/core/src/main/java/com/arangodb/internal/serde/ContentTypeFactory.java b/core/src/main/java/com/arangodb/internal/serde/ContentTypeFactory.java deleted file mode 100644 index 453cc2a0f..000000000 --- a/core/src/main/java/com/arangodb/internal/serde/ContentTypeFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.arangodb.internal.serde; - -import com.arangodb.ContentType; -import com.arangodb.Protocol; - -public final class ContentTypeFactory { - private ContentTypeFactory() { - } - - public static ContentType of(Protocol protocol) { - switch (protocol) { - case HTTP_JSON: - case HTTP2_JSON: - return ContentType.JSON; - case VST: - case HTTP_VPACK: - case HTTP2_VPACK: - return ContentType.VPACK; - default: - throw new IllegalArgumentException("Unexpected value: " + protocol); - } - } - -} diff --git a/core/src/main/java/com/arangodb/internal/serde/InternalDeserializers.java b/core/src/main/java/com/arangodb/internal/serde/InternalDeserializers.java index 20b3ce3b7..3ff874ad7 100644 --- a/core/src/main/java/com/arangodb/internal/serde/InternalDeserializers.java +++ b/core/src/main/java/com/arangodb/internal/serde/InternalDeserializers.java @@ -1,6 +1,5 @@ package com.arangodb.internal.serde; -import com.arangodb.entity.CollectionStatus; import com.arangodb.entity.CollectionType; import com.arangodb.entity.InvertedIndexPrimarySort; import com.arangodb.entity.ReplicationFactor; @@ -51,13 +50,6 @@ public RawBytes deserialize(JsonParser p, DeserializationContext ctxt) throws IO } }; - static final JsonDeserializer COLLECTION_STATUS = new JsonDeserializer() { - @Override - public CollectionStatus deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException { - return CollectionStatus.fromStatus(p.getIntValue()); - } - }; - static final JsonDeserializer COLLECTION_TYPE = new JsonDeserializer() { @Override public CollectionType deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException { diff --git a/core/src/main/java/com/arangodb/internal/serde/InternalMapperProvider.java b/core/src/main/java/com/arangodb/internal/serde/InternalMapperProvider.java index e7b0fbda9..eed6cfb18 100644 --- a/core/src/main/java/com/arangodb/internal/serde/InternalMapperProvider.java +++ b/core/src/main/java/com/arangodb/internal/serde/InternalMapperProvider.java @@ -1,7 +1,6 @@ package com.arangodb.internal.serde; import com.arangodb.ArangoDBException; -import com.arangodb.ContentType; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; @@ -14,16 +13,7 @@ class InternalMapperProvider { private static final Logger LOG = LoggerFactory.getLogger(InternalMapperProvider.class); - static ObjectMapper of(final ContentType contentType) { - String formatName; - if (contentType == ContentType.JSON) { - formatName = "JSON"; - } else if (contentType == ContentType.VPACK) { - formatName = "Velocypack"; - } else { - throw new IllegalArgumentException("Unexpected value: " + contentType); - } - + static ObjectMapper load() { ServiceLoader sl = ServiceLoader.load(JsonFactory.class); Iterator iterator = sl.iterator(); while (iterator.hasNext()) { @@ -34,14 +24,12 @@ static ObjectMapper of(final ContentType contentType) { LOG.warn("ServiceLoader failed to load JsonFactory", e); continue; } - if (formatName.equals(jf.getFormatName())) { - if (contentType == ContentType.JSON) { - JacksonUtils.tryConfigureJsonFactory(jf); - } + if ("JSON".equals(jf.getFormatName())) { + JacksonUtils.tryConfigureJsonFactory(jf); return new ObjectMapper(jf); } - LOG.debug("Required format ({}) not supported by JsonFactory: {}", formatName, jf.getClass().getName()); + LOG.debug("JSON not supported by JsonFactory: {}", jf.getClass().getName()); } - throw new ArangoDBException("No JsonFactory found for content type: " + contentType); + throw new ArangoDBException("No JsonFactory found for content type JSON"); } } diff --git a/core/src/main/java/com/arangodb/internal/serde/InternalModule.java b/core/src/main/java/com/arangodb/internal/serde/InternalModule.java index 392a9c334..9cfecd8bb 100644 --- a/core/src/main/java/com/arangodb/internal/serde/InternalModule.java +++ b/core/src/main/java/com/arangodb/internal/serde/InternalModule.java @@ -1,6 +1,5 @@ package com.arangodb.internal.serde; -import com.arangodb.entity.CollectionStatus; import com.arangodb.entity.CollectionType; import com.arangodb.entity.InvertedIndexPrimarySort; import com.arangodb.entity.MultiDocumentEntity; @@ -25,7 +24,6 @@ static Module get(InternalSerde serde) { module.addDeserializer(RawJson.class, InternalDeserializers.RAW_JSON_DESERIALIZER); module.addDeserializer(RawBytes.class, InternalDeserializers.RAW_BYTES_DESERIALIZER); - module.addDeserializer(CollectionStatus.class, InternalDeserializers.COLLECTION_STATUS); module.addDeserializer(CollectionType.class, InternalDeserializers.COLLECTION_TYPE); module.addDeserializer(ReplicationFactor.class, InternalDeserializers.REPLICATION_FACTOR); module.addDeserializer(InternalResponse.class, InternalDeserializers.RESPONSE); diff --git a/core/src/main/java/com/arangodb/internal/serde/InternalSerde.java b/core/src/main/java/com/arangodb/internal/serde/InternalSerde.java index 1459e9970..6f17a8ed1 100644 --- a/core/src/main/java/com/arangodb/internal/serde/InternalSerde.java +++ b/core/src/main/java/com/arangodb/internal/serde/InternalSerde.java @@ -2,7 +2,6 @@ import com.arangodb.arch.UsedInApi; import com.arangodb.serde.ArangoSerde; -import com.arangodb.ContentType; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; @@ -32,9 +31,8 @@ public interface InternalSerde extends ArangoSerde { /** * Deserializes the content and binds it to the target data type. - * For data type {@link ContentType#JSON}, the byte array is the JSON string encoded using the UTF-8 charset. * - * @param content byte array to deserialize + * @param content UTF-8 byte encoded JSON string * @param type target data type * @return deserialized object */ @@ -63,7 +61,7 @@ default T deserialize(JsonNode node, Class clazz) { /** * Parses the content at json pointer. * - * @param content VPack or byte encoded JSON string + * @param content UTF-8 byte encoded JSON string * @param jsonPointer location of data to be parsed * @return root of the parsed tree */ @@ -71,9 +69,8 @@ default T deserialize(JsonNode node, Class clazz) { /** * Deserializes the content at json pointer and binds it to the target data type. - * For data type {@link ContentType#JSON}, the byte array is the JSON string encoded using the UTF-8 charset. * - * @param content byte array to deserialize + * @param content UTF-8 byte encoded JSON string * @param jsonPointer location of data to be deserialized * @param clazz class of target data type * @return deserialized object @@ -84,9 +81,8 @@ default T deserialize(byte[] content, String jsonPointer, Class clazz) { /** * Deserializes the content at json pointer and binds it to the target data type. - * For data type {@link ContentType#JSON}, the byte array is the JSON string encoded using the UTF-8 charset. * - * @param content byte array to deserialize + * @param content UTF-8 byte encoded JSON string * @param jsonPointer location of data to be deserialized * @param type target data type * @return deserialized object diff --git a/core/src/main/java/com/arangodb/internal/serde/InternalSerdeProvider.java b/core/src/main/java/com/arangodb/internal/serde/InternalSerdeProvider.java index b19d627f0..069068370 100644 --- a/core/src/main/java/com/arangodb/internal/serde/InternalSerdeProvider.java +++ b/core/src/main/java/com/arangodb/internal/serde/InternalSerdeProvider.java @@ -1,21 +1,11 @@ package com.arangodb.internal.serde; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerde; import com.arangodb.serde.ArangoSerdeProvider; import com.fasterxml.jackson.databind.Module; public class InternalSerdeProvider implements ArangoSerdeProvider { - private final ContentType contentType; - - /** - * @param contentType serialization target data type - */ - public InternalSerdeProvider(final ContentType contentType) { - this.contentType = contentType; - } - /** * Creates a new InternalSerde with default settings. * @@ -34,12 +24,7 @@ public InternalSerde create() { * @return the created InternalSerde */ public InternalSerde create(ArangoSerde userSerde, Module protocolModule) { - return new InternalSerdeImpl(InternalMapperProvider.of(contentType), userSerde, protocolModule); - } - - @Override - public ContentType getContentType() { - return contentType; + return new InternalSerdeImpl(InternalMapperProvider.load(), userSerde, protocolModule); } } diff --git a/core/src/main/java/com/arangodb/internal/serde/RawUserDataValue.java b/core/src/main/java/com/arangodb/internal/serde/RawUserDataValue.java index 4bfde90f2..039741043 100644 --- a/core/src/main/java/com/arangodb/internal/serde/RawUserDataValue.java +++ b/core/src/main/java/com/arangodb/internal/serde/RawUserDataValue.java @@ -6,6 +6,7 @@ import java.io.OutputStream; import java.nio.ByteBuffer; +// TODO: since VPACK has been dropped, we can simplify this class RawUserDataValue implements SerializableString { private final byte[] data; diff --git a/core/src/main/java/com/arangodb/internal/serde/SerdeUtils.java b/core/src/main/java/com/arangodb/internal/serde/SerdeUtils.java index 8bfb9205a..e8e903fe9 100644 --- a/core/src/main/java/com/arangodb/internal/serde/SerdeUtils.java +++ b/core/src/main/java/com/arangodb/internal/serde/SerdeUtils.java @@ -95,7 +95,7 @@ public String writeJson(final JsonNode data) { } /** - * Extract raw bytes for the current JSON (or VPACK) node + * Extract raw bytes for the current JSON node * * @param parser JsonParser with current token pointing to the node to extract * @return byte array diff --git a/core/src/main/java/com/arangodb/internal/util/RequestUtils.java b/core/src/main/java/com/arangodb/internal/util/RequestUtils.java index 7074cfc3b..9bf9e72a1 100644 --- a/core/src/main/java/com/arangodb/internal/util/RequestUtils.java +++ b/core/src/main/java/com/arangodb/internal/util/RequestUtils.java @@ -20,9 +20,7 @@ package com.arangodb.internal.util; -import com.arangodb.internal.net.AccessType; import com.arangodb.internal.InternalRequest; -import com.arangodb.internal.RequestType; /** * @author Mark Vollmary @@ -39,14 +37,4 @@ public static InternalRequest allowDirtyRead(final InternalRequest request) { return request.putHeaderParam(HEADER_ALLOW_DIRTY_READ, "true"); } - public static AccessType determineAccessType(final InternalRequest request) { - if (request.containsHeaderParam(HEADER_ALLOW_DIRTY_READ)) { - return AccessType.DIRTY_READ; - } - if (request.getRequestType() == RequestType.GET) { - return AccessType.READ; - } - return AccessType.WRITE; - } - } diff --git a/core/src/main/java/com/arangodb/model/AqlFunctionCreateOptions.java b/core/src/main/java/com/arangodb/model/AqlFunctionCreateOptions.java deleted file mode 100644 index 7357ca898..000000000 --- a/core/src/main/java/com/arangodb/model/AqlFunctionCreateOptions.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -/** - * @author Mark Vollmary - */ -public final class AqlFunctionCreateOptions { - - private String name; - private String code; - private Boolean isDeterministic; - - public AqlFunctionCreateOptions() { - super(); - } - - /** - * @param name the fully qualified name of the user functions - * @return options - */ - AqlFunctionCreateOptions name(final String name) { - this.name = name; - return this; - } - - public String getName() { - return name; - } - - /** - * @param code a string representation of the function body - * @return options - */ - AqlFunctionCreateOptions code(final String code) { - this.code = code; - return this; - } - - public String getCode() { - return code; - } - - /** - * @param isDeterministic an optional boolean value to indicate that the function results are fully deterministic - * (function - * return value solely depends on the input value and return value is the same for - * repeated calls with - * same input) - * @return options - */ - public AqlFunctionCreateOptions isDeterministic(final Boolean isDeterministic) { - this.isDeterministic = isDeterministic; - return this; - } - - public Boolean getIsDeterministic() { - return isDeterministic; - } - -} diff --git a/core/src/main/java/com/arangodb/model/AqlFunctionDeleteOptions.java b/core/src/main/java/com/arangodb/model/AqlFunctionDeleteOptions.java deleted file mode 100644 index b3d168a38..000000000 --- a/core/src/main/java/com/arangodb/model/AqlFunctionDeleteOptions.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -/** - * @author Mark Vollmary - */ -public final class AqlFunctionDeleteOptions { - - private Boolean group; - - public AqlFunctionDeleteOptions() { - super(); - } - - public Boolean getGroup() { - return group; - } - - /** - * @param group If set to true, then the function name provided in name is treated as a namespace prefix, and all - * functions in the specified namespace will be deleted. If set to false, the function name provided in - * name must be fully qualified, including any namespaces. - * @return options - */ - public AqlFunctionDeleteOptions group(final Boolean group) { - this.group = group; - return this; - } - -} diff --git a/core/src/main/java/com/arangodb/model/AqlFunctionGetOptions.java b/core/src/main/java/com/arangodb/model/AqlFunctionGetOptions.java deleted file mode 100644 index 9f845ff4a..000000000 --- a/core/src/main/java/com/arangodb/model/AqlFunctionGetOptions.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -/** - * @author Mark Vollmary - */ -public final class AqlFunctionGetOptions { - - private String namespace; - - public AqlFunctionGetOptions() { - super(); - } - - public String getNamespace() { - return namespace; - } - - /** - * @param namespace Returns all registered AQL user functions from namespace - * @return options - */ - public AqlFunctionGetOptions namespace(final String namespace) { - this.namespace = namespace; - return this; - } - -} diff --git a/core/src/main/java/com/arangodb/model/AqlQueryExplainOptions.java b/core/src/main/java/com/arangodb/model/AqlQueryExplainOptions.java deleted file mode 100644 index ac4d1d161..000000000 --- a/core/src/main/java/com/arangodb/model/AqlQueryExplainOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -import com.arangodb.ArangoDatabase; -import com.arangodb.internal.serde.UserDataInside; - -import java.util.Collection; -import java.util.Map; - -/** - * @author Mark Vollmary - * @author Michele Rastelli - * - * @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead - */ -@Deprecated -public final class AqlQueryExplainOptions { - - private Map bindVars; - private String query; - private Options options; - - public AqlQueryExplainOptions() { - super(); - } - - @UserDataInside - public Map getBindVars() { - return bindVars; - } - - /** - * @param bindVars key/value pairs representing the bind parameters - * @return options - */ - AqlQueryExplainOptions bindVars(final Map bindVars) { - this.bindVars = bindVars; - return this; - } - - public String getQuery() { - return query; - } - - /** - * @param query the query which you want explained - * @return options - */ - AqlQueryExplainOptions query(final String query) { - this.query = query; - return this; - } - - public Integer getMaxNumberOfPlans() { - return getOptions().maxNumberOfPlans; - } - - /** - * @param maxNumberOfPlans an optional maximum number of plans that the optimizer is allowed to generate. Setting - * this attribute - * to a low value allows to put a cap on the amount of work the optimizer does. - * @return options - */ - public AqlQueryExplainOptions maxNumberOfPlans(final Integer maxNumberOfPlans) { - getOptions().maxNumberOfPlans = maxNumberOfPlans; - return this; - } - - public Boolean getAllPlans() { - return getOptions().allPlans; - } - - /** - * @param allPlans if set to true, all possible execution plans will be returned. The default is false, meaning - * only the - * optimal plan will be returned. - * @return options - */ - public AqlQueryExplainOptions allPlans(final Boolean allPlans) { - getOptions().allPlans = allPlans; - return this; - } - - public Collection getRules() { - return getOptions().getOptimizer().rules; - } - - /** - * @param rules an array of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling - * the optimizer to include or exclude specific rules. - * @return options - */ - public AqlQueryExplainOptions rules(final Collection rules) { - getOptions().getOptimizer().rules = rules; - return this; - } - - public Options getOptions() { - if (options == null) { - options = new Options(); - } - return options; - } - - public static final class Options { - private Optimizer optimizer; - private Integer maxNumberOfPlans; - private Boolean allPlans; - - public Optimizer getOptimizer() { - if (optimizer == null) { - optimizer = new Optimizer(); - } - return optimizer; - } - - public Integer getMaxNumberOfPlans() { - return maxNumberOfPlans; - } - - public Boolean getAllPlans() { - return allPlans; - } - } - - public static final class Optimizer { - private Collection rules; - - public Collection getRules() { - return rules; - } - } -} diff --git a/core/src/main/java/com/arangodb/model/AqlQueryOptions.java b/core/src/main/java/com/arangodb/model/AqlQueryOptions.java index e0266269b..e799fbb76 100644 --- a/core/src/main/java/com/arangodb/model/AqlQueryOptions.java +++ b/core/src/main/java/com/arangodb/model/AqlQueryOptions.java @@ -299,15 +299,6 @@ public Integer getMaxNumberOfPlans() { return maxNumberOfPlans; } - /** - * @deprecated for removal, use {@link Options#getMaxNumberOfPlans()} instead - */ - @Deprecated - @JsonIgnore - public Integer getMaxPlans() { - return getMaxNumberOfPlans(); - } - public Double getMaxRuntime() { return maxRuntime; } @@ -524,7 +515,7 @@ public Boolean getAllowDirtyReads() { * You may observe data inconsistencies (dirty reads) when reading from followers, namely * obsolete revisions of documents because changes have not yet been replicated to the * follower, as well as changes to documents before they are officially committed on the - * leader. This feature is only available in the Enterprise Edition. + * leader. * @return this */ public AqlQueryOptions allowDirtyReads(final Boolean allowDirtyReads) { @@ -747,25 +738,6 @@ public AqlQueryOptions maxNumberOfPlans(final Integer maxNumberOfPlans) { return this; } - /** - * @deprecated for removal, use {@link AqlQueryOptions#getMaxNumberOfPlans()} instead - */ - @Deprecated - @JsonIgnore - public Integer getMaxPlans() { - return getMaxNumberOfPlans(); - } - - /** - * @param maxPlans Limits the maximum number of plans that are created by the AQL query optimizer. - * @return this - * @deprecated for removal, use {@link AqlQueryOptions#maxNumberOfPlans(Integer)} instead - */ - @Deprecated - public AqlQueryOptions maxPlans(final Integer maxPlans) { - return maxNumberOfPlans(maxPlans); - } - @JsonIgnore public Double getMaxRuntime() { return getOptions().getMaxRuntime(); @@ -850,7 +822,7 @@ public Double getSatelliteSyncWait() { } /** - * @param satelliteSyncWait This enterprise parameter allows to configure how long a DBServer will have time to + * @param satelliteSyncWait This parameter allows to configure how long a DBServer will have time to * bring the * satellite collections involved in the query into sync. The default value is 60.0 * (seconds). When the @@ -894,8 +866,6 @@ public Boolean getSkipInaccessibleCollections() { * collections and different users execute AQL queries on that graph. You can * now naturally limit the * accessible results by changing the access rights of users on collections. - * This feature is only - * available in the Enterprise Edition. * @return this * @since ArangoDB 3.2.0 */ diff --git a/core/src/main/java/com/arangodb/model/CollectionCreateOptions.java b/core/src/main/java/com/arangodb/model/CollectionCreateOptions.java index 143765c09..75e89cc2a 100644 --- a/core/src/main/java/com/arangodb/model/CollectionCreateOptions.java +++ b/core/src/main/java/com/arangodb/model/CollectionCreateOptions.java @@ -47,7 +47,7 @@ public final class CollectionCreateOptions { private String distributeShardsLike; private String shardingStrategy; // cluster option - private String smartJoinAttribute; // enterprise option + private String smartJoinAttribute; private CollectionSchema schema; @@ -255,7 +255,7 @@ public String getDistributeShardsLike() { } /** - * @param distributeShardsLike (The default is ""): in an enterprise cluster, this attribute binds the specifics + * @param distributeShardsLike (The default is ""): this attribute binds the specifics * of sharding for the * newly created collection to follow that of a specified existing collection. Note: * Using this parameter diff --git a/core/src/main/java/com/arangodb/model/CollectionPropertiesOptions.java b/core/src/main/java/com/arangodb/model/CollectionPropertiesOptions.java index 691b4344d..66de62730 100644 --- a/core/src/main/java/com/arangodb/model/CollectionPropertiesOptions.java +++ b/core/src/main/java/com/arangodb/model/CollectionPropertiesOptions.java @@ -86,7 +86,7 @@ public ReplicationFactor getReplicationFactor() { * different DB-Servers. The value 1 means that only one copy (no synchronous replication) * is kept. A value of k means that k-1 replicas are kept. For SatelliteCollections, it * needs to be the string "satellite", which matches the replication factor to the number - * of DB-Servers (Enterprise Edition only). + * of DB-Servers. *

* Any two copies reside on different DB-Servers. Replication between them is synchronous, * that is, every write operation to the “leader” copy will be replicated to all “follower” diff --git a/core/src/main/java/com/arangodb/model/EdgeCollectionDropOptions.java b/core/src/main/java/com/arangodb/model/EdgeCollectionDropOptions.java deleted file mode 100644 index 6cc2d3a08..000000000 --- a/core/src/main/java/com/arangodb/model/EdgeCollectionDropOptions.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.arangodb.model; - -/** - * @deprecated use {@link EdgeCollectionRemoveOptions} instead - */ -@Deprecated -public class EdgeCollectionDropOptions { - private Boolean waitForSync; - private Boolean dropCollections; - - public Boolean getWaitForSync() { - return waitForSync; - } - - /** - * @param waitForSync Define if the request should wait until synced to disk. - * @return this - */ - public EdgeCollectionDropOptions waitForSync(Boolean waitForSync) { - this.waitForSync = waitForSync; - return this; - } - - public Boolean getDropCollections() { - return dropCollections; - } - - /** - * @param dropCollections Drop the collection as well. Collection will only be dropped if it is not used in other - * graphs. - * @return this - */ - public EdgeCollectionDropOptions dropCollections(Boolean dropCollections) { - this.dropCollections = dropCollections; - return this; - } -} diff --git a/core/src/main/java/com/arangodb/model/ExplainAqlQueryOptions.java b/core/src/main/java/com/arangodb/model/ExplainAqlQueryOptions.java index 827670cf5..bb76c4839 100644 --- a/core/src/main/java/com/arangodb/model/ExplainAqlQueryOptions.java +++ b/core/src/main/java/com/arangodb/model/ExplainAqlQueryOptions.java @@ -127,7 +127,7 @@ public Boolean getAllowDirtyReads() { * You may observe data inconsistencies (dirty reads) when reading from followers, namely * obsolete revisions of documents because changes have not yet been replicated to the * follower, as well as changes to documents before they are officially committed on the - * leader. This feature is only available in the Enterprise Edition. + * leader. * @return this */ public ExplainAqlQueryOptions allowDirtyReads(final Boolean allowDirtyReads) { @@ -434,7 +434,7 @@ public Double getSatelliteSyncWait() { } /** - * @param satelliteSyncWait This enterprise parameter allows to configure how long a DBServer will have time to + * @param satelliteSyncWait This parameter allows to configure how long a DBServer will have time to * bring the * satellite collections involved in the query into sync. The default value is 60.0 * (seconds). When the @@ -478,8 +478,6 @@ public Boolean getSkipInaccessibleCollections() { * collections and different users execute AQL queries on that graph. You can * now naturally limit the * accessible results by changing the access rights of users on collections. - * This feature is only - * available in the Enterprise Edition. * @return this * @since ArangoDB 3.2.0 */ diff --git a/core/src/main/java/com/arangodb/model/FulltextIndexOptions.java b/core/src/main/java/com/arangodb/model/FulltextIndexOptions.java deleted file mode 100644 index 6d34c2d65..000000000 --- a/core/src/main/java/com/arangodb/model/FulltextIndexOptions.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -import com.arangodb.entity.IndexType; - -/** - * @author Mark Vollmary - * @deprecated since ArangoDB 3.10, use ArangoSearch or Inverted indexes instead. - */ -@Deprecated -public final class FulltextIndexOptions extends IndexOptions { - - private final IndexType type = IndexType.fulltext; - private Iterable fields; - private Integer minLength; - - public FulltextIndexOptions() { - super(); - } - - @Override - FulltextIndexOptions getThis() { - return this; - } - - public Iterable getFields() { - return fields; - } - - /** - * @param fields A list of attribute paths - * @return options - */ - FulltextIndexOptions fields(final Iterable fields) { - this.fields = fields; - return this; - } - - public IndexType getType() { - return type; - } - - public Integer getMinLength() { - return minLength; - } - - /** - * @param minLength Minimum character length of words to index. Will default to a server-defined value if - * unspecified. It - * is thus recommended to set this value explicitly when creating the index. - * @return options - */ - public FulltextIndexOptions minLength(final Integer minLength) { - this.minLength = minLength; - return this; - } - -} diff --git a/core/src/main/java/com/arangodb/model/GraphCreateOptions.java b/core/src/main/java/com/arangodb/model/GraphCreateOptions.java index 957a64221..ded79177e 100644 --- a/core/src/main/java/com/arangodb/model/GraphCreateOptions.java +++ b/core/src/main/java/com/arangodb/model/GraphCreateOptions.java @@ -85,7 +85,7 @@ public Boolean getIsSmart() { } /** - * @param isSmart Define if the created graph should be smart. This only has effect in Enterprise version. + * @param isSmart Define if the created graph should be smart. * @return options */ public GraphCreateOptions isSmart(final Boolean isSmart) { @@ -190,7 +190,7 @@ public Collection getSatellites() { /** * @param satellites collection names that will be used to create SatelliteCollections - * for a Hybrid (Disjoint) SmartGraph (Enterprise Edition only). Each array element + * for a Hybrid (Disjoint) SmartGraph. Each array element * must be a valid collection name. The collection type cannot be modified later. * @return options * @since ArangoDB 3.9.0 diff --git a/core/src/main/java/com/arangodb/model/InvertedIndexOptions.java b/core/src/main/java/com/arangodb/model/InvertedIndexOptions.java index 46a10eb84..3c22156c6 100644 --- a/core/src/main/java/com/arangodb/model/InvertedIndexOptions.java +++ b/core/src/main/java/com/arangodb/model/InvertedIndexOptions.java @@ -119,7 +119,7 @@ public Collection getOptimizeTopK() { /** * @param optimizeTopK An array of strings defining sort expressions that you want to optimize. * @return options - * @since ArangoDB 3.11, Enterprise Edition only + * @since ArangoDB 3.11 */ public InvertedIndexOptions optimizeTopK(String... optimizeTopK) { Collections.addAll(this.optimizeTopK, optimizeTopK); @@ -373,7 +373,7 @@ public Boolean getCache() { * are memory-mapped and it is up to the operating system to load them from disk into memory and to * evict them from memory. *

- * Default: `false`. (Enterprise Edition only) + * Default: `false` * @return this * @since ArangoDB 3.10.2 */ @@ -390,7 +390,7 @@ public Boolean getPrimaryKeyCache() { * @param primaryKeyCache If you enable this option, then the primary key columns are always cached in memory. This * can improve the performance of queries that return many documents. Otherwise, these values * are memory-mapped and it is up to the operating system to load them from disk into memory - * and to evict them from memory (Enterprise Edition only). (default: false) + * and to evict them from memory. (default: false) * @return this * @since ArangoDB 3.10.2 */ diff --git a/core/src/main/java/com/arangodb/model/OptionsBuilder.java b/core/src/main/java/com/arangodb/model/OptionsBuilder.java index b429e273e..a9c489b0c 100644 --- a/core/src/main/java/com/arangodb/model/OptionsBuilder.java +++ b/core/src/main/java/com/arangodb/model/OptionsBuilder.java @@ -53,19 +53,10 @@ public static GeoIndexOptions build(final GeoIndexOptions options, final Iterabl return options.fields(fields); } - @Deprecated - public static FulltextIndexOptions build(final FulltextIndexOptions options, final Iterable fields) { - return options.fields(fields); - } - public static TtlIndexOptions build(final TtlIndexOptions options, final Iterable fields) { return options.fields(fields); } - public static ZKDIndexOptions build(final ZKDIndexOptions options, final Iterable fields) { - return options.fields(fields); - } - public static AbstractMDIndexOptions build(final AbstractMDIndexOptions options, final Iterable fields) { return options.fields(fields); } @@ -79,13 +70,6 @@ public static AqlQueryOptions build(final AqlQueryOptions options, final String return options.query(query).bindVars(bindVars); } - public static AqlQueryExplainOptions build( - final AqlQueryExplainOptions options, - final String query, - final Map bindVars) { - return options.query(query).bindVars(bindVars); - } - public static ExplainAqlQueryOptions build( final ExplainAqlQueryOptions options, final String query, @@ -108,10 +92,6 @@ public static GraphCreateOptions build( return options.name(name).edgeDefinitions(edCol); } - public static TransactionOptions build(final TransactionOptions options, final String action) { - return options.action(action); - } - public static CollectionRenameOptions build(final CollectionRenameOptions options, final String name) { return options.name(name); } @@ -120,13 +100,6 @@ public static UserAccessOptions build(final UserAccessOptions options, final Per return options.grant(grant); } - public static AqlFunctionCreateOptions build( - final AqlFunctionCreateOptions options, - final String name, - final String code) { - return options.name(name).code(code); - } - public static VertexCollectionCreateOptions build( final VertexCollectionCreateOptions options, final String collection) { diff --git a/core/src/main/java/com/arangodb/model/TransactionOptions.java b/core/src/main/java/com/arangodb/model/TransactionOptions.java deleted file mode 100644 index a547f7732..000000000 --- a/core/src/main/java/com/arangodb/model/TransactionOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -import com.arangodb.internal.serde.UserData; - -/** - * @author Mark Vollmary - * @author Michele Rastelli - */ -public final class TransactionOptions { - - private final TransactionCollectionOptions collections; - private String action; - private Object params; - private Integer lockTimeout; - private Boolean waitForSync; - private Long maxTransactionSize; - - public TransactionOptions() { - super(); - collections = new TransactionCollectionOptions(); - } - - public TransactionCollectionOptions getCollections() { - return collections; - } - - public String getAction() { - return action; - } - - /** - * @param action the actual transaction operations to be executed, in the form of stringified JavaScript code - * @return options - */ - TransactionOptions action(final String action) { - this.action = action; - return this; - } - - @UserData - public Object getParams() { - return params; - } - - /** - * @param params optional arguments passed to action - * @return options - */ - public TransactionOptions params(final Object params) { - this.params = params; - return this; - } - - public Integer getLockTimeout() { - return lockTimeout; - } - - /** - * @param lockTimeout a numeric value that can be used to set a timeout in seconds for - * waiting on collection locks. This option is only meaningful when using - * exclusive locks. If not specified, a default value of 900 seconds will be - * used. Setting lockTimeout to 0 will make ArangoDB not time out - * waiting for a lock. - * @return options - */ - public TransactionOptions lockTimeout(final Integer lockTimeout) { - this.lockTimeout = lockTimeout; - return this; - } - - public Boolean getWaitForSync() { - return waitForSync; - } - - /** - * @param waitForSync an optional boolean flag that, if set, will force the transaction to write all data to disk - * before - * returning - * @return options - */ - public TransactionOptions waitForSync(final Boolean waitForSync) { - this.waitForSync = waitForSync; - return this; - } - - /** - * @param read contains the array of collection-names to be used in the transaction (mandatory) for read - * @return options - */ - public TransactionOptions readCollections(final String... read) { - collections.read(read); - return this; - } - - /** - * @param write contains the array of collection-names to be used in the transaction (mandatory) for write - * @return options - */ - public TransactionOptions writeCollections(final String... write) { - collections.write(write); - return this; - } - - /** - * @param exclusive contains the array of collection-names to be used in the transaction (mandatory) for - * exclusive write - * @return options - * @since ArangoDB 3.4.0 - */ - public TransactionOptions exclusiveCollections(final String... exclusive) { - collections.exclusive(exclusive); - return this; - } - - /** - * @param allowImplicit Collections that will be written to in the transaction must be declared with the write - * attribute or it - * will fail, whereas non-declared collections from which is solely read will be added - * lazily. The - * optional attribute allowImplicit can be set to false to let transactions fail in case of - * undeclared - * collections for reading. Collections for reading should be fully declared if possible, to - * avoid - * deadlocks. - * @return options - */ - public TransactionOptions allowImplicit(final Boolean allowImplicit) { - collections.allowImplicit(allowImplicit); - return this; - } - - public Long getMaxTransactionSize() { - return maxTransactionSize; - } - - /** - * @param maxTransactionSize Transaction size limit in bytes. Honored by the RocksDB storage engine only. - * @return options - * @since ArangoDB 3.2.0 - */ - public TransactionOptions maxTransactionSize(final Long maxTransactionSize) { - this.maxTransactionSize = maxTransactionSize; - return this; - } - -} diff --git a/core/src/main/java/com/arangodb/model/VertexCollectionCreateOptions.java b/core/src/main/java/com/arangodb/model/VertexCollectionCreateOptions.java index d7ab02a70..ce526c6bf 100644 --- a/core/src/main/java/com/arangodb/model/VertexCollectionCreateOptions.java +++ b/core/src/main/java/com/arangodb/model/VertexCollectionCreateOptions.java @@ -58,7 +58,7 @@ public Collection getSatellites() { /** * @param satellites collection names that will be used to create SatelliteCollections - * for a Hybrid (Disjoint) SmartGraph (Enterprise Edition only). Each array element + * for a Hybrid (Disjoint) SmartGraph. Each array element * must be a valid collection name. The collection type cannot be modified later. * @return options * @since ArangoDB 3.9.0 diff --git a/core/src/main/java/com/arangodb/model/VertexCollectionDropOptions.java b/core/src/main/java/com/arangodb/model/VertexCollectionDropOptions.java deleted file mode 100644 index aa940d3bd..000000000 --- a/core/src/main/java/com/arangodb/model/VertexCollectionDropOptions.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.arangodb.model; - -/** - * @deprecated use {@link VertexCollectionRemoveOptions} instead - */ -@Deprecated -public class VertexCollectionDropOptions { - private Boolean dropCollection; - - public Boolean getDropCollection() { - return dropCollection; - } - - /** - * @param dropCollection Drop the collection as well. Collection will only be dropped if it is not used in other - * graphs. - * @return this - */ - public VertexCollectionDropOptions dropCollection(Boolean dropCollection) { - this.dropCollection = dropCollection; - return this; - } -} diff --git a/core/src/main/java/com/arangodb/model/ZKDIndexOptions.java b/core/src/main/java/com/arangodb/model/ZKDIndexOptions.java deleted file mode 100644 index cb428fe08..000000000 --- a/core/src/main/java/com/arangodb/model/ZKDIndexOptions.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.model; - -import com.arangodb.entity.IndexType; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author Michele Rastelli - * @since ArangoDB 3.9 - * @deprecated since ArangoDB 3.12, use {@link MDIndexOptions} instead. - */ -@Deprecated -public final class ZKDIndexOptions extends IndexOptions { - - final IndexType type = IndexType.zkd; - private Iterable fields; - private Boolean unique; - private FieldValueTypes fieldValueTypes; - - public ZKDIndexOptions() { - super(); - } - - @Override - ZKDIndexOptions getThis() { - return this; - } - - public Iterable getFields() { - return fields; - } - - /** - * @param fields A list of attribute paths - * @return options - */ - ZKDIndexOptions fields(final Iterable fields) { - this.fields = fields; - return this; - } - - public IndexType getType() { - return type; - } - - public Boolean getUnique() { - return unique; - } - - /** - * @param unique if true, then create a unique index - * @return options - */ - public ZKDIndexOptions unique(final Boolean unique) { - this.unique = unique; - return this; - } - - public FieldValueTypes getFieldValueTypes() { - return fieldValueTypes; - } - - /** - * @param fieldValueTypes must be {@link FieldValueTypes#DOUBLE}, currently only doubles are supported as values. - * @return options - */ - public ZKDIndexOptions fieldValueTypes(final FieldValueTypes fieldValueTypes) { - this.fieldValueTypes = fieldValueTypes; - return this; - } - - public enum FieldValueTypes { - @JsonProperty("double") - DOUBLE - } - -} diff --git a/core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java b/core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java index 1361f9c9d..baf67f9e3 100644 --- a/core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java +++ b/core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java @@ -156,7 +156,7 @@ public ArangoSearchCreateOptions storedValues(final StoredValue... storedValues) /** * @param optimizeTopK An array of strings defining sort expressions that you want to optimize. * @return options - * @since ArangoDB 3.11, Enterprise Edition only + * @since ArangoDB 3.11 */ public ArangoSearchCreateOptions optimizeTopK(final String... optimizeTopK) { this.optimizeTopK = Arrays.asList(optimizeTopK); @@ -169,7 +169,7 @@ public ArangoSearchCreateOptions optimizeTopK(final String... optimizeTopK) { * Otherwise, these values are memory-mapped and it is up to the operating system to load * them from disk into memory and to evict them from memory. * @return options - * @since ArangoDB 3.9.6, Enterprise Edition only + * @since ArangoDB 3.9.6 */ public ArangoSearchCreateOptions primarySortCache(final Boolean primarySortCache) { this.primarySortCache = primarySortCache; @@ -182,7 +182,7 @@ public ArangoSearchCreateOptions primarySortCache(final Boolean primarySortCache * are memory-mapped and it is up to the operating system to load them from disk into memory * and to evict them from memory. * @return options - * @since ArangoDB 3.9.6, Enterprise Edition only + * @since ArangoDB 3.9.6 */ public ArangoSearchCreateOptions primaryKeyCache(final Boolean primaryKeyCache) { this.primaryKeyCache = primaryKeyCache; @@ -218,15 +218,6 @@ public Collection getLinks() { return links; } - /** - * @deprecated for removal, use {@link #getPrimarySort()} instead - */ - @Deprecated - @JsonIgnore - public Collection getPrimarySorts() { - return getPrimarySort(); - } - public Collection getPrimarySort() { return primarySorts; } diff --git a/core/src/main/java/com/arangodb/serde/ArangoSerde.java b/core/src/main/java/com/arangodb/serde/ArangoSerde.java index d7a4ff8e7..5e6713b4c 100644 --- a/core/src/main/java/com/arangodb/serde/ArangoSerde.java +++ b/core/src/main/java/com/arangodb/serde/ArangoSerde.java @@ -1,6 +1,5 @@ package com.arangodb.serde; -import com.arangodb.ContentType; import com.arangodb.RequestContext; import java.util.Objects; @@ -12,13 +11,12 @@ * - serialization libraries for specific JVM languages (e.g. Scala, Kotlin, ...) * - serialization libraries already in use in frameworks (e.g. JSON-B, Micronaut Serialization, ...) * - high performance serialization libraries (e.g. supporting compile-time data binding code generation) - * - low-level libraries without support to data binding + * - low-level libraries without support for data binding */ public interface ArangoSerde { /** - * Serializes the object into the target data type. For data type {@link ContentType#JSON}, the serialized JSON string - * must be encoded into a byte array using the UTF-8 charset. + * Serializes the object to UTF-8 byte encoded JSON string * * @param value object to serialize * @return serialized byte array @@ -27,9 +25,8 @@ public interface ArangoSerde { /** * Deserializes the content and binds it to the target data type. - * For data type {@link ContentType#JSON}, the byte array is the JSON string encoded using the UTF-8 charset. * - * @param content byte array to deserialize + * @param content UTF-8 byte encoded JSON string * @param clazz class of target data type * @return deserialized object */ @@ -37,9 +34,8 @@ public interface ArangoSerde { /** * Deserializes the content and binds it to the target data type. - * For data type {@link ContentType#JSON}, the byte array is the JSON string encoded using the UTF-8 charset. * - * @param content byte array to deserialize + * @param content UTF-8 byte encoded JSON string * @param clazz class of target data type * @param ctx serde context, cannot be null * @return deserialized object diff --git a/core/src/main/java/com/arangodb/serde/ArangoSerdeProvider.java b/core/src/main/java/com/arangodb/serde/ArangoSerdeProvider.java index 7fa1e048a..744132588 100644 --- a/core/src/main/java/com/arangodb/serde/ArangoSerdeProvider.java +++ b/core/src/main/java/com/arangodb/serde/ArangoSerdeProvider.java @@ -1,7 +1,6 @@ package com.arangodb.serde; import com.arangodb.ArangoDBException; -import com.arangodb.ContentType; import com.arangodb.internal.serde.InternalSerdeProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +11,7 @@ public interface ArangoSerdeProvider { - static ArangoSerdeProvider of(ContentType contentType) { + static ArangoSerdeProvider load() { Logger LOG = LoggerFactory.getLogger(ArangoSerdeProvider.class); ServiceLoader loader = ServiceLoader.load(ArangoSerdeProvider.class); @@ -26,17 +25,15 @@ static ArangoSerdeProvider of(ContentType contentType) { LOG.warn("ServiceLoader failed to load ArangoSerdeProvider", e); continue; } - if (contentType.equals(p.getContentType())) { - if (serdeProvider != null) { - throw new ArangoDBException("Found multiple serde providers! Please set explicitly the one to use."); - } - serdeProvider = p; + if (serdeProvider != null) { + throw new ArangoDBException("Found multiple serde providers! Please set explicitly the one to use."); } + serdeProvider = p; } if (serdeProvider == null) { LOG.warn("No ArangoSerdeProvider found, using InternalSerdeProvider. Please consider registering a custom " + "ArangoSerdeProvider to avoid depending on internal classes which are not part of the public API."); - serdeProvider = new InternalSerdeProvider(contentType); + serdeProvider = new InternalSerdeProvider(); } return serdeProvider; } @@ -46,8 +43,4 @@ static ArangoSerdeProvider of(ContentType contentType) { */ ArangoSerde create(); - /** - * @return the supported content type - */ - ContentType getContentType(); } diff --git a/core/src/main/java/com/arangodb/util/RawBytes.java b/core/src/main/java/com/arangodb/util/RawBytes.java index 9d4230a59..f735504d1 100644 --- a/core/src/main/java/com/arangodb/util/RawBytes.java +++ b/core/src/main/java/com/arangodb/util/RawBytes.java @@ -12,9 +12,7 @@ *

* No validation is performed, the user is responsible for providing a valid byte array for the used content type. *

- * The raw value byte array can represent either: - * - a valid VPack - * - a valid JSON UTF-8 encoded string + * The raw value byte array is the UTF-8 encoded JSON string *

* The driver's {@link InternalSerde} supports serializing and deserializing to and from * {@code RawBytes}. diff --git a/dev-README.md b/dev-README.md index 0eaaa61f0..1e789eac7 100644 --- a/dev-README.md +++ b/dev-README.md @@ -28,9 +28,7 @@ mvn -Dgpg.skip=true -Dmaven.javadoc.skip=true -Dmaven.test.skip verify Reports: - [core](core/target/site/jacoco/index.html) - [jackson-serde-json](jackson-serde-json/target/site/jacoco/index.html) -- [jackson-serde-vpack](jackson-serde-vpack/target/site/jacoco/index.html) - [http-protocol](http-protocol/target/site/jacoco/index.html) -- [vst-protocol](vst-protocol/target/site/jacoco/index.html) ## update native image reflection configuration To generate reflection configuration run [NativeImageHelper](./driver/src/test/java/helper/NativeImageHelper.java) and diff --git a/docker/start_db.sh b/docker/start_db.sh index 42de82aa9..596ae8724 100755 --- a/docker/start_db.sh +++ b/docker/start_db.sh @@ -1,7 +1,7 @@ #!/bin/bash # Configuration environment variables: -# STARTER_MODE: (single|cluster|activefailover), default single +# STARTER_MODE: (single|cluster), default single # DOCKER_IMAGE: ArangoDB docker image, default docker.io/arangodb/enterprise:latest # STARTER_DOCKER_IMAGE: ArangoDB Starter docker image, default docker.io/arangodb/arangodb-starter:latest # SSL: (true|false), default false @@ -113,9 +113,3 @@ for a in ${COORDINATORS[*]} ; do echo "$SCHEME://$a" echo "" done - -if [ "$STARTER_MODE" == "activefailover" ]; then - LEADER=$("$LOCATION"/find_active_endpoint.sh) - echo "Leader: $SCHEME://$LEADER" - echo "" -fi diff --git a/driver/pom.xml b/driver/pom.xml index aadcc4f43..e7e83a076 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT arangodb-java-driver diff --git a/driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/native-image.properties b/driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/native-image.properties index f60b51cea..2b1890523 100644 --- a/driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/native-image.properties +++ b/driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/native-image.properties @@ -1,5 +1,5 @@ Args=\ --H:ResourceConfigurationResources=${.}/resource-config.json,${.}/resource-config-spi.json \ +-H:ResourceConfigurationResources=${.}/resource-config-spi.json \ -H:ReflectionConfigurationResources=${.}/reflect-config.json,${.}/reflect-config-serde.json,${.}/reflect-config-spi.json,${.}/reflect-config-mp-config.json \ -H:SerializationConfigurationResources=${.}/serialization-config.json \ -H:DynamicProxyConfigurationResources=${.}/proxy-config.json diff --git a/http-protocol/pom.xml b/http-protocol/pom.xml index ae5cc07cc..fa4277c7e 100644 --- a/http-protocol/pom.xml +++ b/http-protocol/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT http-protocol @@ -31,4 +31,16 @@ + + + + io.vertx + vertx-stack-depchain + 5.0.8 + pom + import + + + + \ No newline at end of file diff --git a/http-protocol/src/main/java/com/arangodb/http/HttpConnection.java b/http-protocol/src/main/java/com/arangodb/http/HttpConnection.java index 0efce80f6..8c9680e9b 100644 --- a/http-protocol/src/main/java/com/arangodb/http/HttpConnection.java +++ b/http-protocol/src/main/java/com/arangodb/http/HttpConnection.java @@ -30,7 +30,6 @@ import com.arangodb.internal.config.ArangoConfig; import com.arangodb.internal.net.Connection; import com.arangodb.internal.net.ConnectionPool; -import com.arangodb.internal.serde.ContentTypeFactory; import com.arangodb.internal.util.EncodeUtils; import io.netty.handler.ssl.ApplicationProtocolConfig; import io.netty.handler.ssl.ClientAuth; @@ -40,10 +39,7 @@ import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.buffer.Buffer; -import io.vertx.core.http.Http2Settings; -import io.vertx.core.http.HttpHeaders; -import io.vertx.core.http.HttpMethod; -import io.vertx.core.http.HttpVersion; +import io.vertx.core.http.*; import io.vertx.core.net.JdkSSLEngineOptions; import io.vertx.core.spi.tls.SslContextFactory; import io.vertx.ext.auth.authentication.TokenCredentials; @@ -76,7 +72,6 @@ public class HttpConnection implements Connection { private static final Logger LOGGER = LoggerFactory.getLogger(HttpConnection.class); private static final String CONTENT_TYPE_APPLICATION_JSON_UTF8 = "application/json; charset=utf-8"; - private static final String CONTENT_TYPE_VPACK = "application/x-velocypack"; private static final String USER_AGENT = getUserAgent(); private static final AtomicInteger THREAD_COUNT = new AtomicInteger(); private volatile String auth; @@ -96,16 +91,8 @@ private static String getUserAgent() { HttpConnection(final ArangoConfig config, final HttpProtocolConfig protocolConfig, final HostDescription host, final ConnectionPool pool) { this.pool = pool; Protocol protocol = config.getProtocol(); - ContentType contentType = ContentTypeFactory.of(protocol); - if (contentType == ContentType.VPACK) { - commonHeaders.add(HttpHeaders.ACCEPT.toString(), CONTENT_TYPE_VPACK); - commonHeaders.add(HttpHeaders.CONTENT_TYPE.toString(), CONTENT_TYPE_VPACK); - } else if (contentType == ContentType.JSON) { - commonHeaders.add(HttpHeaders.ACCEPT.toString(), CONTENT_TYPE_APPLICATION_JSON_UTF8); - commonHeaders.add(HttpHeaders.CONTENT_TYPE.toString(), CONTENT_TYPE_APPLICATION_JSON_UTF8); - } else { - throw new IllegalArgumentException("Unsupported protocol: " + protocol); - } + commonHeaders.add(HttpHeaders.ACCEPT.toString(), CONTENT_TYPE_APPLICATION_JSON_UTF8); + commonHeaders.add(HttpHeaders.CONTENT_TYPE.toString(), CONTENT_TYPE_APPLICATION_JSON_UTF8); compressionThreshold = config.getCompressionThreshold(); Compression compression = config.getCompression(); encoder = Encoder.of(compression, config.getCompressionLevel()); @@ -137,12 +124,10 @@ private static String getUserAgent() { .map(ttl -> Math.toIntExact(ttl / 1000)) .orElse(0); - HttpVersion httpVersion = protocol == Protocol.HTTP_JSON || protocol == Protocol.HTTP_VPACK ? + HttpVersion httpVersion = protocol == Protocol.HTTP_1_1 ? HttpVersion.HTTP_1_1 : HttpVersion.HTTP_2; WebClientOptions webClientOptions = new WebClientOptions() - .setMaxPoolSize(1) - .setHttp2MaxPoolSize(1) .setConnectTimeout(timeout) .setIdleTimeoutUnit(TimeUnit.MILLISECONDS) .setIdleTimeout(timeout) @@ -167,7 +152,7 @@ private static String getUserAgent() { .setInitialSettings(new Http2Settings().setInitialWindowSize(config.getInitialWindowSize())); if (compression != Compression.NONE) { - webClientOptions.setTryUseCompression(true); + webClientOptions.setDecompressionSupported(true); } if (Boolean.TRUE.equals(config.getUseSsl())) { @@ -177,7 +162,7 @@ private static String getUserAgent() { .setUseAlpn(true) .setAlpnVersions(Collections.singletonList(httpVersion)) .setVerifyHost(config.getVerifyHost()) - .setJdkSslEngineOptions(new JdkSSLEngineOptions() { + .setSslEngineOptions(new JdkSSLEngineOptions() { @Override public JdkSSLEngineOptions copy() { return this; @@ -204,7 +189,10 @@ public SslContextFactory sslContextFactory() { }); } - client = WebClient.create(vertx, webClientOptions); + PoolOptions poolOptions = new PoolOptions() + .setHttp1MaxSize(1) + .setHttp2MaxSize(1); + client = WebClient.create(vertx, webClientOptions, poolOptions); } private static String buildUrl(final InternalRequest request) { diff --git a/http-protocol/src/main/java/com/arangodb/http/HttpProtocolProvider.java b/http-protocol/src/main/java/com/arangodb/http/HttpProtocolProvider.java index a85abe9d8..7783b1d52 100644 --- a/http-protocol/src/main/java/com/arangodb/http/HttpProtocolProvider.java +++ b/http-protocol/src/main/java/com/arangodb/http/HttpProtocolProvider.java @@ -15,10 +15,8 @@ public class HttpProtocolProvider implements ProtocolProvider { @Override public boolean supportsProtocol(Protocol protocol) { - return Protocol.HTTP_VPACK.equals(protocol) || - Protocol.HTTP_JSON.equals(protocol) || - Protocol.HTTP2_VPACK.equals(protocol) || - Protocol.HTTP2_JSON.equals(protocol); + return Protocol.HTTP_1_1.equals(protocol) || + Protocol.HTTP_2.equals(protocol); } @Override diff --git a/http-protocol/src/main/java/com/arangodb/http/compression/ZlibEncoder.java b/http-protocol/src/main/java/com/arangodb/http/compression/ZlibEncoder.java index f8ad91014..ab9beb571 100644 --- a/http-protocol/src/main/java/com/arangodb/http/compression/ZlibEncoder.java +++ b/http-protocol/src/main/java/com/arangodb/http/compression/ZlibEncoder.java @@ -19,7 +19,9 @@ class ZlibEncoder implements Encoder { public Buffer encode(byte[] data) { JdkZlibEncoder encoder = new JdkZlibEncoder(wrapper, level); ByteBuf bb = encoder.encode(data); - Buffer out = Buffer.buffer(bb); + byte[] bytes = new byte[bb.readableBytes()]; + bb.readBytes(bytes); + Buffer out = Buffer.buffer(bytes); encoder.close(); return out; } diff --git a/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/native-image.properties b/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/native-image.properties index 6323e7ae3..d16e67f3f 100644 --- a/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/native-image.properties +++ b/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/native-image.properties @@ -1,3 +1,3 @@ Args=\ --H:ResourceConfigurationResources=${.}/resource-config-spi.json \ --H:ReflectionConfigurationResources=${.}/reflect-config-spi.json,${.}/reflect-config-serde.json +-H:ResourceConfigurationResources=${.}/resource-config.json,${.}/resource-config-spi.json \ +-H:ReflectionConfigurationResources=${.}/reflect-config-spi.json diff --git a/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/reflect-config-serde.json b/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/reflect-config-serde.json deleted file mode 100644 index c50a5e113..000000000 --- a/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/reflect-config-serde.json +++ /dev/null @@ -1,146 +0,0 @@ -[ - { - "name": "com.arangodb.internal.serde.JacksonUtils$JsonFactory", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamReadConstraints", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamReadConstraints$Builder", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamReadConstraints$Static", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamWriteConstraints", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamWriteConstraints$Builder", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$StreamWriteConstraints$Static", - "queryAllDeclaredMethods": true - }, - { - "name": "com.arangodb.internal.serde.JacksonUtils$Version", - "queryAllDeclaredMethods": true - }, - { - "name": "com.fasterxml.jackson.core.JsonFactory", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "setStreamReadConstraints", - "parameterTypes": [ - "com.fasterxml.jackson.core.StreamReadConstraints" - ] - }, - { - "name": "setStreamWriteConstraints", - "parameterTypes": [ - "com.fasterxml.jackson.core.StreamWriteConstraints" - ] - }, - { - "name": "version", - "parameterTypes": [] - } - ] - }, - { - "name": "com.fasterxml.jackson.core.StreamReadConstraints", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "builder", - "parameterTypes": [] - } - ] - }, - { - "name": "com.fasterxml.jackson.core.StreamReadConstraints$Builder", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "build", - "parameterTypes": [] - }, - { - "name": "maxDocumentLength", - "parameterTypes": [ - "long" - ] - }, - { - "name": "maxNameLength", - "parameterTypes": [ - "int" - ] - }, - { - "name": "maxNestingDepth", - "parameterTypes": [ - "int" - ] - }, - { - "name": "maxNumberLength", - "parameterTypes": [ - "int" - ] - }, - { - "name": "maxStringLength", - "parameterTypes": [ - "int" - ] - } - ] - }, - { - "name": "com.fasterxml.jackson.core.StreamWriteConstraints", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "builder", - "parameterTypes": [] - } - ] - }, - { - "name": "com.fasterxml.jackson.core.StreamWriteConstraints$Builder", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "build", - "parameterTypes": [] - }, - { - "name": "maxNestingDepth", - "parameterTypes": [ - "int" - ] - } - ] - }, - { - "name": "com.fasterxml.jackson.core.Version", - "queryAllPublicMethods": true, - "methods": [ - { - "name": "getMajorVersion", - "parameterTypes": [] - }, - { - "name": "getMinorVersion", - "parameterTypes": [] - } - ] - } -] \ No newline at end of file diff --git a/driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/resource-config.json b/http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/resource-config.json similarity index 100% rename from driver/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver/resource-config.json rename to http-protocol/src/main/resources/META-INF/native-image/com.arangodb/http-protocol/resource-config.json diff --git a/jackson-serde-json/pom.xml b/jackson-serde-json/pom.xml index 8bc75edc0..9ff2d6e9d 100644 --- a/jackson-serde-json/pom.xml +++ b/jackson-serde-json/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT jackson-serde-json diff --git a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonMapperProvider.java b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonMapperProvider.java index 39c6065a0..2008cba72 100644 --- a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonMapperProvider.java +++ b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonMapperProvider.java @@ -1,7 +1,6 @@ package com.arangodb.serde.jackson; import com.arangodb.ArangoDBException; -import com.arangodb.ContentType; import com.arangodb.internal.serde.JacksonUtils; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; @@ -18,16 +17,7 @@ public class JacksonMapperProvider { private static final Logger LOG = LoggerFactory.getLogger(JacksonMapperProvider.class); - public static ObjectMapper of(final ContentType contentType) { - String formatName; - if (contentType == ContentType.JSON) { - formatName = "JSON"; - } else if (contentType == ContentType.VPACK) { - formatName = "Velocypack"; - } else { - throw new IllegalArgumentException("Unexpected value: " + contentType); - } - + public static ObjectMapper load() { ServiceLoader sl = ServiceLoader.load(JsonFactory.class); Iterator iterator = sl.iterator(); while (iterator.hasNext()) { @@ -38,15 +28,13 @@ public static ObjectMapper of(final ContentType contentType) { LOG.warn("ServiceLoader failed to load JsonFactory", e); continue; } - if (formatName.equals(jf.getFormatName())) { - if (contentType == ContentType.JSON) { - JacksonUtils.tryConfigureJsonFactory(jf); - } + if ("JSON".equals(jf.getFormatName())) { + JacksonUtils.tryConfigureJsonFactory(jf); return new ObjectMapper(jf); } - LOG.debug("Required format ({}) not supported by JsonFactory: {}", formatName, jf.getClass().getName()); + LOG.debug("JSON not supported by JsonFactory: {}", jf.getClass().getName()); } - throw new ArangoDBException("No JsonFactory found for content type: " + contentType); + throw new ArangoDBException("No JsonFactory found for content type JSON"); } } diff --git a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonSerde.java b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonSerde.java index 8a749121e..8059960b5 100644 --- a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonSerde.java +++ b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/JacksonSerde.java @@ -1,6 +1,5 @@ package com.arangodb.serde.jackson; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerde; import com.arangodb.RequestContext; import com.arangodb.serde.jackson.internal.JacksonSerdeImpl; @@ -17,13 +16,12 @@ public interface JacksonSerde extends ArangoSerde { /** - * Creates a new JacksonSerde with default settings for the specified data type. + * Creates a new JacksonSerde with default settings. * - * @param contentType serialization target data type * @return the created JacksonSerde */ - static JacksonSerde of(final ContentType contentType) { - return create(JacksonMapperProvider.of(contentType)); + static JacksonSerde load() { + return create(JacksonMapperProvider.load()); } /** diff --git a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/json/JacksonJsonSerdeProvider.java b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/json/JacksonJsonSerdeProvider.java index 90dfdf5c1..7a3ba8967 100644 --- a/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/json/JacksonJsonSerdeProvider.java +++ b/jackson-serde-json/src/main/java/com/arangodb/serde/jackson/json/JacksonJsonSerdeProvider.java @@ -1,6 +1,5 @@ package com.arangodb.serde.jackson.json; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerde; import com.arangodb.serde.ArangoSerdeProvider; import com.arangodb.serde.jackson.JacksonSerde; @@ -8,11 +7,6 @@ public class JacksonJsonSerdeProvider implements ArangoSerdeProvider { @Override public ArangoSerde create() { - return JacksonSerde.of(ContentType.JSON); - } - - @Override - public ContentType getContentType() { - return ContentType.JSON; + return JacksonSerde.load(); } } diff --git a/jackson-serde-vpack/pom.xml b/jackson-serde-vpack/pom.xml deleted file mode 100644 index 2d16a99c2..000000000 --- a/jackson-serde-vpack/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - - com.arangodb - arangodb-java-driver-parent - 7.25.0 - - - jackson-serde-vpack - jackson-serde-vpack - Jackson Serde VPACK module for ArangoDB Java Driver - - - com.arangodb.serde.jackson.vpack - - - - - com.arangodb - core - provided - - - com.arangodb - jackson-serde-json - compile - - - com.arangodb - jackson-dataformat-velocypack - compile - - - com.arangodb - velocypack - compile - - - - diff --git a/jackson-serde-vpack/src/main/java/com/arangodb/serde/jackson/vpack/JacksonVPackSerdeProvider.java b/jackson-serde-vpack/src/main/java/com/arangodb/serde/jackson/vpack/JacksonVPackSerdeProvider.java deleted file mode 100644 index 6e52ec179..000000000 --- a/jackson-serde-vpack/src/main/java/com/arangodb/serde/jackson/vpack/JacksonVPackSerdeProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.arangodb.serde.jackson.vpack; - -import com.arangodb.ContentType; -import com.arangodb.serde.ArangoSerde; -import com.arangodb.serde.ArangoSerdeProvider; -import com.arangodb.serde.jackson.JacksonSerde; - -public class JacksonVPackSerdeProvider implements ArangoSerdeProvider { - @Override - public ArangoSerde create() { - return JacksonSerde.of(ContentType.VPACK); - } - - @Override - public ContentType getContentType() { - return ContentType.VPACK; - } -} diff --git a/jackson-serde-vpack/src/main/resources/META-INF/services/com.arangodb.serde.ArangoSerdeProvider b/jackson-serde-vpack/src/main/resources/META-INF/services/com.arangodb.serde.ArangoSerdeProvider deleted file mode 100644 index 977adc7a9..000000000 --- a/jackson-serde-vpack/src/main/resources/META-INF/services/com.arangodb.serde.ArangoSerdeProvider +++ /dev/null @@ -1 +0,0 @@ -com.arangodb.serde.jackson.vpack.JacksonVPackSerdeProvider diff --git a/jackson3-serde-json/pom.xml b/jackson3-serde-json/pom.xml index 00220a531..235377f66 100644 --- a/jackson3-serde-json/pom.xml +++ b/jackson3-serde-json/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT jackson3-serde-json diff --git a/jackson3-serde-json/src/main/java/com/arangodb/serde/jackson3/json/JacksonJsonSerdeProvider.java b/jackson3-serde-json/src/main/java/com/arangodb/serde/jackson3/json/JacksonJsonSerdeProvider.java index b4d2ea169..ab1b33014 100644 --- a/jackson3-serde-json/src/main/java/com/arangodb/serde/jackson3/json/JacksonJsonSerdeProvider.java +++ b/jackson3-serde-json/src/main/java/com/arangodb/serde/jackson3/json/JacksonJsonSerdeProvider.java @@ -1,6 +1,5 @@ package com.arangodb.serde.jackson3.json; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerde; import com.arangodb.serde.ArangoSerdeProvider; import com.arangodb.serde.jackson3.JacksonSerde; @@ -12,8 +11,4 @@ public ArangoSerde create() { return JacksonSerde.create(new JsonMapper()); } - @Override - public ContentType getContentType() { - return ContentType.JSON; - } } diff --git a/jsonb-serde/pom.xml b/jsonb-serde/pom.xml index 416ca58f9..77313fe35 100644 --- a/jsonb-serde/pom.xml +++ b/jsonb-serde/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT jsonb-serde diff --git a/jsonb-serde/src/main/java/com/arangodb/serde/jsonb/JsonbSerdeProvider.java b/jsonb-serde/src/main/java/com/arangodb/serde/jsonb/JsonbSerdeProvider.java index 152d8f3fd..27838a50a 100644 --- a/jsonb-serde/src/main/java/com/arangodb/serde/jsonb/JsonbSerdeProvider.java +++ b/jsonb-serde/src/main/java/com/arangodb/serde/jsonb/JsonbSerdeProvider.java @@ -1,6 +1,5 @@ package com.arangodb.serde.jsonb; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerdeProvider; import jakarta.json.bind.JsonbConfig; @@ -26,9 +25,4 @@ static JsonbSerde create(final JsonbConfig config) { return new JsonbSerde(config); } - @Override - public ContentType getContentType() { - return ContentType.JSON; - } - } diff --git a/pom.xml b/pom.xml index d3c6fba98..604b0bdc5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT 2016 core @@ -13,10 +13,8 @@ shaded jackson-serde-json jackson3-serde-json - jackson-serde-vpack jsonb-serde http-protocol - vst-protocol pom @@ -252,13 +250,6 @@ import pom - - io.vertx - vertx-stack-depchain - 4.5.21 - pom - import - com.google.code.findbugs jsr305 @@ -289,11 +280,6 @@ http-protocol ${project.version} - - com.arangodb - vst-protocol - ${project.version} - com.arangodb jackson-serde-json @@ -304,21 +290,6 @@ jackson3-serde-json ${project.version} - - com.arangodb - jackson-serde-vpack - ${project.version} - - - com.arangodb - jackson-dataformat-velocypack - 4.6.2 - - - com.arangodb - velocypack - 3.1.0 - com.arangodb jsonb-serde @@ -356,13 +327,7 @@ compile - 1.8 - - jakarta.json:jakarta.json-api - jakarta.json.bind:jakarta.json.bind-api - tools.jackson.core:jackson-core - tools.jackson.core:jackson-databind - + 21 @@ -397,33 +362,6 @@ - - io.vertx - - - regex - 5..* - - - - - io.netty - - - regex - .* - - - - - org.junit.jupiter - - - regex - 6..* - - - diff --git a/shaded/pom.xml b/shaded/pom.xml index 0a3f6cee5..fb9a1ca97 100644 --- a/shaded/pom.xml +++ b/shaded/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT arangodb-java-driver-shaded @@ -30,16 +30,6 @@ http-protocol compile - - com.arangodb - vst-protocol - compile - - - com.arangodb - jackson-dataformat-velocypack - compile - org.slf4j slf4j-api @@ -93,10 +83,6 @@ com.fasterxml.jackson com.arangodb.shaded.fasterxml.jackson - - com.arangodb.jackson.dataformat.velocypack - com.arangodb.shaded.jackson.dataformat.velocypack - io.netty com.arangodb.shaded.netty @@ -113,14 +99,6 @@ META-INF/** - - com.arangodb:vst-protocol - - META-INF/MANIFEST.MF - META-INF/services/** - META-INF/maven/** - - com.arangodb:http-protocol @@ -129,18 +107,6 @@ META-INF/maven/** - - com.arangodb:velocypack - - META-INF/** - - - - com.arangodb:jackson-dataformat-velocypack - - META-INF/** - - com.fasterxml.jackson.core:* diff --git a/shaded/src/main/java/graal/BrotliSubstitutions.java b/shaded/src/main/java/graal/BrotliSubstitutions.java index 6f067fc6d..ccd245cf4 100644 --- a/shaded/src/main/java/graal/BrotliSubstitutions.java +++ b/shaded/src/main/java/graal/BrotliSubstitutions.java @@ -3,20 +3,18 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; +public class BrotliSubstitutions { -@TargetClass(className = "io.netty.handler.codec.compression.Brotli") -final class Target_io_netty_handler_codec_compression_Brotli { - @Substitute - public static boolean isAvailable() { - return false; - } + @TargetClass(className = "io.netty.handler.codec.compression.Brotli") + static final class Target_io_netty_handler_codec_compression_Brotli { + @Substitute + public static boolean isAvailable() { + return false; + } - @Substitute - public static void ensureAvailability() throws Throwable { - throw new UnsupportedOperationException(); + @Substitute + public static void ensureAvailability() throws Throwable { + throw new UnsupportedOperationException(); + } } } - -public class BrotliSubstitutions { - -} diff --git a/shaded/src/main/java/graal/netty/graal/HttpContentCompressorSubstitutions.java b/shaded/src/main/java/graal/netty/graal/HttpContentCompressorSubstitutions.java index 92251b77b..3ff99c61a 100644 --- a/shaded/src/main/java/graal/netty/graal/HttpContentCompressorSubstitutions.java +++ b/shaded/src/main/java/graal/netty/graal/HttpContentCompressorSubstitutions.java @@ -1,17 +1,22 @@ package graal.netty.graal; -import java.util.function.BooleanSupplier; - import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; - import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; public class HttpContentCompressorSubstitutions { - @TargetClass(className = "io.netty.handler.codec.compression.ZstdEncoder", onlyWith = IsZstdAbsent.class) - public static final class ZstdEncoderFactorySubstitution { + @TargetClass(className = "io.netty.handler.codec.compression.Zstd") + public static final class Target_io_netty_handler_codec_compression_Zstd { + @Substitute + public static boolean isAvailable() { + return false; + } + } + + @TargetClass(className = "io.netty.handler.codec.compression.ZstdEncoder") + public static final class Target_io_netty_handler_codec_compression_ZstdEncoder { @Substitute protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception { @@ -30,8 +35,8 @@ public void flush(final ChannelHandlerContext ctx) { } @Substitute - @TargetClass(className = "io.netty.handler.codec.compression.ZstdConstants", onlyWith = IsZstdAbsent.class) - public static final class ZstdConstants { + @TargetClass(className = "io.netty.handler.codec.compression.ZstdConstants") + public static final class Target_io_netty_handler_codec_compression_ZstdConstants { // The constants make calls to com.github.luben.zstd.Zstd so we cut links with that substitution. @@ -41,29 +46,9 @@ public static final class ZstdConstants { static final int MAX_COMPRESSION_LEVEL = 0; - static final int MAX_BLOCK_SIZE = 0; + static final int DEFAULT_MAX_ENCODE_SIZE = 0; static final int DEFAULT_BLOCK_SIZE = 0; } - public static class IsZstdAbsent implements BooleanSupplier { - - private boolean zstdAbsent; - - public IsZstdAbsent() { - try { - Class.forName("com.github.luben.zstd.Zstd"); - zstdAbsent = false; - } catch (Exception e) { - // It can be a classloading issue (the library is not available), or a native issue - // (the library for the current OS/arch is not available) - zstdAbsent = true; - } - } - - @Override - public boolean getAsBoolean() { - return zstdAbsent; - } - } } diff --git a/shaded/src/main/java/graal/netty/graal/NettySubstitutions.java b/shaded/src/main/java/graal/netty/graal/NettySubstitutions.java index d910cf1e7..a28eb3921 100644 --- a/shaded/src/main/java/graal/netty/graal/NettySubstitutions.java +++ b/shaded/src/main/java/graal/netty/graal/NettySubstitutions.java @@ -28,6 +28,7 @@ import javax.crypto.NoSuchPaddingException; import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SNIServerName; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; import javax.net.ssl.TrustManagerFactory; @@ -47,6 +48,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.DefaultChannelPromise; +import io.netty.channel.EventLoopTaskQueueFactory; import io.netty.channel.embedded.EmbeddedChannel; import io.netty.handler.codec.compression.Brotli; import io.netty.handler.codec.compression.BrotliDecoder; @@ -141,7 +143,7 @@ final class Target_io_netty_handler_ssl_OpenSsl { @Alias @RecomputeFieldValue(kind = Kind.FromAlias) - static Set SUPPORTED_PROTOCOLS_SET = Collections.emptySet(); + static Set CLIENT_DEFAULT_PROTOCOLS = Collections.emptySet(); @Substitute public static boolean isAvailable() { @@ -164,20 +166,6 @@ public static boolean isCipherSuiteAvailable(String cipherSuite) { } } -@TargetClass(className = "io.netty.handler.ssl.JdkSslServerContext") -final class Target_io_netty_handler_ssl_JdkSslServerContext { - @Alias - Target_io_netty_handler_ssl_JdkSslServerContext(Provider provider, - X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, - X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, - KeyManagerFactory keyManagerFactory, Iterable ciphers, CipherSuiteFilter cipherFilter, - ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout, - ClientAuth clientAuth, String[] protocols, boolean startTls, - SecureRandom secureRandom, String keyStore, Target_io_netty_handler_ssl_ResumptionController resumptionController) - throws SSLException { - } -} - @TargetClass(className = "io.netty.handler.ssl.JdkSslClientContext") final class Target_io_netty_handler_ssl_JdkSslClientContext { @@ -188,7 +176,7 @@ final class Target_io_netty_handler_ssl_JdkSslClientContext { KeyManagerFactory keyManagerFactory, Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, long sessionCacheSize, long sessionTimeout, SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, - Target_io_netty_handler_ssl_ResumptionController resumptionController) throws SSLException { + List serverNames, Target_io_netty_handler_ssl_ResumptionController resumptionController) throws SSLException { } } @@ -237,22 +225,16 @@ final class Target_io_netty_handler_ssl_ResumptionController { final class Target_io_netty_handler_ssl_SslContext { @Substitute - static SslContext newServerContextInternal(SslProvider provider, - Provider sslContextProvider, - X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, - X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, KeyManagerFactory keyManagerFactory, - Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, - long sessionCacheSize, long sessionTimeout, ClientAuth clientAuth, String[] protocols, boolean startTls, - boolean enableOcsp, SecureRandom secureRandom, String keyStoreType, - Map.Entry, Object>... ctxOptions) throws SSLException { - if (enableOcsp) { - throw new IllegalArgumentException("OCSP is not supported with this SslProvider: " + provider); - } - Target_io_netty_handler_ssl_ResumptionController resumptionController = new Target_io_netty_handler_ssl_ResumptionController(); - return (SslContext) (Object) new Target_io_netty_handler_ssl_JdkSslServerContext(sslContextProvider, - trustCertCollection, trustManagerFactory, keyCertChain, key, keyPassword, - keyManagerFactory, ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout, - clientAuth, protocols, startTls, secureRandom, keyStoreType, resumptionController); + static SslContext newServerContextInternal(SslProvider provider, Provider sslContextProvider, + X509Certificate[] trustCert, TrustManagerFactory trustManagerFactory, + X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, + KeyManagerFactory keyManagerFactory, Iterable ciphers, + CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, + long sessionCacheSize, long sessionTimeout, ClientAuth clientAuth, + String[] protocols, boolean startTls, boolean enableOcsp, + SecureRandom secureRandom, String keyStoreType, + Map.Entry, Object>... options) throws SSLException { + throw new SSLException("not supported"); } @Substitute @@ -263,6 +245,7 @@ static SslContext newClientContextInternal(SslProvider provider, Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, long sessionCacheSize, long sessionTimeout, boolean enableOcsp, SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, + List serverNames, Map.Entry, Object>... options) throws SSLException { if (enableOcsp) { throw new IllegalArgumentException("OCSP is not supported with this SslProvider: " + provider); @@ -272,7 +255,7 @@ static SslContext newClientContextInternal(SslProvider provider, trustCert, trustManagerFactory, keyCertChain, key, keyPassword, keyManagerFactory, ciphers, cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, secureRandom, keyStoreType, endpointIdentificationAlgorithm, - resumptionController); + serverNames, resumptionController); } } @@ -402,7 +385,7 @@ final ChannelFuture initAndRegister() { final class Target_io_netty_channel_nio_NioEventLoop { @Substitute - private static Queue newTaskQueue0(int maxPendingTasks) { + private static Queue newTaskQueue(EventLoopTaskQueueFactory queueFactory) { return new LinkedBlockingDeque<>(); } } @@ -456,11 +439,11 @@ static Class tryToLoadClass(final ClassLoader loader, final Class helper) final class Target_io_netty_buffer_EmptyByteBuf { @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) + @RecomputeFieldValue(kind = Kind.Reset) private static ByteBuffer EMPTY_BYTE_BUFFER; @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) + @RecomputeFieldValue(kind = Kind.Reset) private static long EMPTY_BYTE_BUFFER_ADDRESS; @Substitute @@ -470,7 +453,7 @@ public ByteBuffer nioBuffer() { @Substitute public ByteBuffer[] nioBuffers() { - return new ByteBuffer[] { EmptyByteBufStub.emptyByteBuffer() }; + return new ByteBuffer[]{EmptyByteBufStub.emptyByteBuffer()}; } @Substitute @@ -622,10 +605,19 @@ private static PrivateKey getPrivateKeyFromByteBuffer(ByteBuf encodedKeyBuf, Str final class Target_io_netty_util_internal_shaded_org_jctools_util_UnsafeRefArrayAccess { @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.ArrayIndexShift, declClass = Object[].class) + @RecomputeFieldValue(kind = Kind.ArrayIndexShift, declClass = Object[].class) public static int LONG_ELEMENT_SHIFT; } +@TargetClass(className = "io.netty.util.internal.CleanerJava25$CleanableDirectBufferImpl") +final class Target_io_netty_util_internal_CleanerJava25_CleanableDirectBufferImpl { + @Substitute + public void clean() { + // No-op: bypasses Arena.ofShared().close() which is unsupported + // in GraalVM native image without -H:+SharedArenaSupport + } +} + class IsBouncyNotThere implements BooleanSupplier { @Override diff --git a/shaded/src/main/java/graal/vertx/graal/VertxSubstitutions.java b/shaded/src/main/java/graal/vertx/graal/VertxSubstitutions.java index d8ca211b6..6390b18ab 100644 --- a/shaded/src/main/java/graal/vertx/graal/VertxSubstitutions.java +++ b/shaded/src/main/java/graal/vertx/graal/VertxSubstitutions.java @@ -4,22 +4,13 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import io.netty.handler.ssl.*; -import io.vertx.core.MultiMap; -import io.vertx.core.Promise; import io.vertx.core.Vertx; import io.vertx.core.dns.AddressResolverOptions; -import io.vertx.core.eventbus.EventBusOptions; -import io.vertx.core.eventbus.impl.HandlerHolder; -import io.vertx.core.eventbus.impl.HandlerRegistration; -import io.vertx.core.eventbus.impl.MessageImpl; -import io.vertx.core.eventbus.impl.OutboundDeliveryContext; -import io.vertx.core.impl.ContextInternal; -import io.vertx.core.impl.VertxInternal; -import io.vertx.core.impl.resolver.DefaultResolverProvider; -import io.vertx.core.impl.transports.JDKTransport; +import io.vertx.core.dns.impl.DefaultAddressResolverProvider; import io.vertx.core.net.NetServerOptions; -import io.vertx.core.spi.resolver.ResolverProvider; -import io.vertx.core.spi.transport.Transport; +import io.vertx.core.net.impl.NetServerImpl; +import io.vertx.core.spi.dns.AddressResolverProvider; +import io.vertx.core.transport.Transport; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLException; @@ -27,27 +18,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; -import java.util.concurrent.ConcurrentMap; -@TargetClass(className = "io.vertx.core.impl.VertxBuilder") -final class Target_io_vertx_core_impl_VertxBuilder { - @Substitute - public static Transport nativeTransport() { - return JDKTransport.INSTANCE; - } -} - -/** - * This substitution forces the usage of the blocking DNS resolver - */ -@TargetClass(className = "io.vertx.core.spi.resolver.ResolverProvider") -final class TargetResolverProvider { - - @Substitute - public static ResolverProvider factory(Vertx vertx, AddressResolverOptions options) { - return new DefaultResolverProvider(); - } -} @TargetClass(className = "io.vertx.core.net.OpenSSLEngineOptions") final class Target_io_vertx_core_net_OpenSSLEngineOptions { @@ -63,80 +34,42 @@ public static boolean isAlpnAvailable() { } } -@SuppressWarnings("rawtypes") -@TargetClass(className = "io.vertx.core.eventbus.impl.clustered.ClusteredEventBus") -final class Target_io_vertx_core_eventbus_impl_clustered_ClusteredEventBusClusteredEventBus { - - @Substitute - private NetServerOptions getServerOptions() { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public void start(Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public void close(Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public MessageImpl createMessage(boolean send, boolean isLocal, String address, MultiMap headers, Object body, - String codecName) { - throw new RuntimeException("Not Implemented"); - } - +@TargetClass(className = "io.vertx.core.transport.Transport") +final class Target_io_vertx_core_transport_Transport { @Substitute - protected void onLocalRegistration(HandlerHolder handlerHolder, Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected HandlerHolder createHandlerHolder(HandlerRegistration registration, boolean replyHandler, - boolean localOnly, ContextInternal context) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected void onLocalUnregistration(HandlerHolder handlerHolder, Promise completionHandler) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected void sendOrPub(OutboundDeliveryContext sendContext) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected String generateReplyAddress() { - throw new RuntimeException("Not Implemented"); + public static Transport nativeTransport() { + return Transport.NIO; } +} +@TargetClass(className = "io.vertx.core.spi.dns.AddressResolverProvider") +interface Target_io_vertx_core_spi_dns_AddressResolverProvider { @Substitute - protected boolean isMessageLocal(MessageImpl msg) { - throw new RuntimeException("Not Implemented"); + static AddressResolverProvider factory(Vertx vertx, AddressResolverOptions options) { + return new DefaultAddressResolverProvider(); } +} +@TargetClass(className = "io.vertx.core.impl.transports.TransportLoader") +final class Target_io_vertx_core_impl_transports_TransportLoader { @Substitute - ConcurrentMap connections() { - throw new RuntimeException("Not Implemented"); + public static Transport epoll() { + return Transport.NIO; } @Substitute - VertxInternal vertx() { - throw new RuntimeException("Not Implemented"); + public static Transport io_uring() { + return Transport.NIO; } @Substitute - EventBusOptions options() { - throw new RuntimeException("Not Implemented"); + public static Transport kqueue() { + return Transport.NIO; } } @TargetClass(className = "io.vertx.core.spi.tls.DefaultSslContextFactory") -final class Target_DefaultSslContextFactory { +final class Target_io_vertx_core_spi_tls_DefaultSslContextFactory { @Alias private Set enabledCipherSuites; @@ -157,7 +90,7 @@ private SslContext createContext(boolean useAlpn, boolean client, KeyManagerFact builder.keyManager(kmf); } } else { - builder = SslContextBuilder.forServer(kmf); + throw new SSLException("not supported"); } Collection cipherSuites = enabledCipherSuites; builder.sslProvider(SslProvider.JDK); @@ -192,6 +125,15 @@ static List get() { } } -class VertxSubstitutions { +@TargetClass(className = "io.vertx.core.impl.VertxImpl") +final class Target_io_vertx_core_impl_VertxImpl { + + @Substitute + public NetServerImpl createNetServer(NetServerOptions options) { + return null; + } +} + +public class VertxSubstitutions { } diff --git a/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/native-image.properties b/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/native-image.properties index d3c564e31..e37561fd4 100644 --- a/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/native-image.properties +++ b/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/native-image.properties @@ -40,5 +40,7 @@ Args=\ com.arangodb.shaded.netty.resolver.dns.DnsNameResolver,\ com.arangodb.shaded.netty.resolver.HostsFileEntriesResolver,\ com.arangodb.shaded.netty.resolver.dns.ResolvConf$ResolvConfLazy,\ - com.arangodb.shaded.netty.resolver.dns.DefaultDnsServerAddressStreamProvider,\ + com.arangodb.shaded.netty.handler.ssl.ReferenceCountedOpenSslContext,\ + com.arangodb.shaded.netty.handler.ssl.ReferenceCountedOpenSslClientContext,\ + com.arangodb.shaded.netty.handler.ssl.ReferenceCountedOpenSslServerContext,\ com.arangodb.shaded.vertx.core.buffer.impl.VertxByteBufAllocator diff --git a/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/reflect-config-spi.json b/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/reflect-config-spi.json index e14d4bf2e..65309b136 100644 --- a/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/reflect-config-spi.json +++ b/shaded/src/main/resources/META-INF/native-image/com.arangodb/arangodb-java-driver-shaded/reflect-config-spi.json @@ -7,14 +7,5 @@ "parameterTypes": [] } ] - }, - { - "name": "com.arangodb.shaded.jackson.dataformat.velocypack.VPackFactory", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] } ] diff --git a/shaded/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider b/shaded/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider index faf8cac63..f48d178b7 100644 --- a/shaded/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider +++ b/shaded/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider @@ -1,2 +1 @@ com.arangodb.http.HttpProtocolProvider -com.arangodb.vst.VstProtocolProvider diff --git a/shaded/src/main/resources/META-INF/services/com.arangodb.shaded.fasterxml.jackson.core.JsonFactory b/shaded/src/main/resources/META-INF/services/com.arangodb.shaded.fasterxml.jackson.core.JsonFactory index 89123f5a5..01906064f 100644 --- a/shaded/src/main/resources/META-INF/services/com.arangodb.shaded.fasterxml.jackson.core.JsonFactory +++ b/shaded/src/main/resources/META-INF/services/com.arangodb.shaded.fasterxml.jackson.core.JsonFactory @@ -1,2 +1 @@ com.arangodb.shaded.fasterxml.jackson.core.JsonFactory -com.arangodb.shaded.jackson.dataformat.velocypack.VPackFactory diff --git a/spotbugs/spotbugs-exclude.xml b/spotbugs/spotbugs-exclude.xml index c7e8ee070..0f75877b4 100644 --- a/spotbugs/spotbugs-exclude.xml +++ b/spotbugs/spotbugs-exclude.xml @@ -17,14 +17,6 @@ - - - - - - - - diff --git a/test-functional/pom.xml b/test-functional/pom.xml index 08edd0ba0..8d7f45af4 100644 --- a/test-functional/pom.xml +++ b/test-functional/pom.xml @@ -8,7 +8,7 @@ ../test-parent com.arangodb test-parent - 7.25.0 + 8.0.0-SNAPSHOT test-functional @@ -163,8 +163,10 @@ true false - --no-fallback --verbose - --link-at-build-time -H:+ReportExceptionStackTraces + --no-fallback + --verbose + --link-at-build-time + -H:+ReportExceptionStackTraces diff --git a/test-functional/src/test-default/java/graal/netty/graal/HttpContentCompressorSubstitutions.java b/test-functional/src/test-default/java/graal/netty/graal/HttpContentCompressorSubstitutions.java index 92251b77b..3ff99c61a 100644 --- a/test-functional/src/test-default/java/graal/netty/graal/HttpContentCompressorSubstitutions.java +++ b/test-functional/src/test-default/java/graal/netty/graal/HttpContentCompressorSubstitutions.java @@ -1,17 +1,22 @@ package graal.netty.graal; -import java.util.function.BooleanSupplier; - import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; - import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; public class HttpContentCompressorSubstitutions { - @TargetClass(className = "io.netty.handler.codec.compression.ZstdEncoder", onlyWith = IsZstdAbsent.class) - public static final class ZstdEncoderFactorySubstitution { + @TargetClass(className = "io.netty.handler.codec.compression.Zstd") + public static final class Target_io_netty_handler_codec_compression_Zstd { + @Substitute + public static boolean isAvailable() { + return false; + } + } + + @TargetClass(className = "io.netty.handler.codec.compression.ZstdEncoder") + public static final class Target_io_netty_handler_codec_compression_ZstdEncoder { @Substitute protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception { @@ -30,8 +35,8 @@ public void flush(final ChannelHandlerContext ctx) { } @Substitute - @TargetClass(className = "io.netty.handler.codec.compression.ZstdConstants", onlyWith = IsZstdAbsent.class) - public static final class ZstdConstants { + @TargetClass(className = "io.netty.handler.codec.compression.ZstdConstants") + public static final class Target_io_netty_handler_codec_compression_ZstdConstants { // The constants make calls to com.github.luben.zstd.Zstd so we cut links with that substitution. @@ -41,29 +46,9 @@ public static final class ZstdConstants { static final int MAX_COMPRESSION_LEVEL = 0; - static final int MAX_BLOCK_SIZE = 0; + static final int DEFAULT_MAX_ENCODE_SIZE = 0; static final int DEFAULT_BLOCK_SIZE = 0; } - public static class IsZstdAbsent implements BooleanSupplier { - - private boolean zstdAbsent; - - public IsZstdAbsent() { - try { - Class.forName("com.github.luben.zstd.Zstd"); - zstdAbsent = false; - } catch (Exception e) { - // It can be a classloading issue (the library is not available), or a native issue - // (the library for the current OS/arch is not available) - zstdAbsent = true; - } - } - - @Override - public boolean getAsBoolean() { - return zstdAbsent; - } - } } diff --git a/test-functional/src/test-default/java/graal/netty/graal/NettySubstitutions.java b/test-functional/src/test-default/java/graal/netty/graal/NettySubstitutions.java index d910cf1e7..a28eb3921 100644 --- a/test-functional/src/test-default/java/graal/netty/graal/NettySubstitutions.java +++ b/test-functional/src/test-default/java/graal/netty/graal/NettySubstitutions.java @@ -28,6 +28,7 @@ import javax.crypto.NoSuchPaddingException; import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SNIServerName; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; import javax.net.ssl.TrustManagerFactory; @@ -47,6 +48,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.DefaultChannelPromise; +import io.netty.channel.EventLoopTaskQueueFactory; import io.netty.channel.embedded.EmbeddedChannel; import io.netty.handler.codec.compression.Brotli; import io.netty.handler.codec.compression.BrotliDecoder; @@ -141,7 +143,7 @@ final class Target_io_netty_handler_ssl_OpenSsl { @Alias @RecomputeFieldValue(kind = Kind.FromAlias) - static Set SUPPORTED_PROTOCOLS_SET = Collections.emptySet(); + static Set CLIENT_DEFAULT_PROTOCOLS = Collections.emptySet(); @Substitute public static boolean isAvailable() { @@ -164,20 +166,6 @@ public static boolean isCipherSuiteAvailable(String cipherSuite) { } } -@TargetClass(className = "io.netty.handler.ssl.JdkSslServerContext") -final class Target_io_netty_handler_ssl_JdkSslServerContext { - @Alias - Target_io_netty_handler_ssl_JdkSslServerContext(Provider provider, - X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, - X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, - KeyManagerFactory keyManagerFactory, Iterable ciphers, CipherSuiteFilter cipherFilter, - ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout, - ClientAuth clientAuth, String[] protocols, boolean startTls, - SecureRandom secureRandom, String keyStore, Target_io_netty_handler_ssl_ResumptionController resumptionController) - throws SSLException { - } -} - @TargetClass(className = "io.netty.handler.ssl.JdkSslClientContext") final class Target_io_netty_handler_ssl_JdkSslClientContext { @@ -188,7 +176,7 @@ final class Target_io_netty_handler_ssl_JdkSslClientContext { KeyManagerFactory keyManagerFactory, Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, long sessionCacheSize, long sessionTimeout, SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, - Target_io_netty_handler_ssl_ResumptionController resumptionController) throws SSLException { + List serverNames, Target_io_netty_handler_ssl_ResumptionController resumptionController) throws SSLException { } } @@ -237,22 +225,16 @@ final class Target_io_netty_handler_ssl_ResumptionController { final class Target_io_netty_handler_ssl_SslContext { @Substitute - static SslContext newServerContextInternal(SslProvider provider, - Provider sslContextProvider, - X509Certificate[] trustCertCollection, TrustManagerFactory trustManagerFactory, - X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, KeyManagerFactory keyManagerFactory, - Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, - long sessionCacheSize, long sessionTimeout, ClientAuth clientAuth, String[] protocols, boolean startTls, - boolean enableOcsp, SecureRandom secureRandom, String keyStoreType, - Map.Entry, Object>... ctxOptions) throws SSLException { - if (enableOcsp) { - throw new IllegalArgumentException("OCSP is not supported with this SslProvider: " + provider); - } - Target_io_netty_handler_ssl_ResumptionController resumptionController = new Target_io_netty_handler_ssl_ResumptionController(); - return (SslContext) (Object) new Target_io_netty_handler_ssl_JdkSslServerContext(sslContextProvider, - trustCertCollection, trustManagerFactory, keyCertChain, key, keyPassword, - keyManagerFactory, ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout, - clientAuth, protocols, startTls, secureRandom, keyStoreType, resumptionController); + static SslContext newServerContextInternal(SslProvider provider, Provider sslContextProvider, + X509Certificate[] trustCert, TrustManagerFactory trustManagerFactory, + X509Certificate[] keyCertChain, PrivateKey key, String keyPassword, + KeyManagerFactory keyManagerFactory, Iterable ciphers, + CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, + long sessionCacheSize, long sessionTimeout, ClientAuth clientAuth, + String[] protocols, boolean startTls, boolean enableOcsp, + SecureRandom secureRandom, String keyStoreType, + Map.Entry, Object>... options) throws SSLException { + throw new SSLException("not supported"); } @Substitute @@ -263,6 +245,7 @@ static SslContext newClientContextInternal(SslProvider provider, Iterable ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, String[] protocols, long sessionCacheSize, long sessionTimeout, boolean enableOcsp, SecureRandom secureRandom, String keyStoreType, String endpointIdentificationAlgorithm, + List serverNames, Map.Entry, Object>... options) throws SSLException { if (enableOcsp) { throw new IllegalArgumentException("OCSP is not supported with this SslProvider: " + provider); @@ -272,7 +255,7 @@ static SslContext newClientContextInternal(SslProvider provider, trustCert, trustManagerFactory, keyCertChain, key, keyPassword, keyManagerFactory, ciphers, cipherFilter, apn, protocols, sessionCacheSize, sessionTimeout, secureRandom, keyStoreType, endpointIdentificationAlgorithm, - resumptionController); + serverNames, resumptionController); } } @@ -402,7 +385,7 @@ final ChannelFuture initAndRegister() { final class Target_io_netty_channel_nio_NioEventLoop { @Substitute - private static Queue newTaskQueue0(int maxPendingTasks) { + private static Queue newTaskQueue(EventLoopTaskQueueFactory queueFactory) { return new LinkedBlockingDeque<>(); } } @@ -456,11 +439,11 @@ static Class tryToLoadClass(final ClassLoader loader, final Class helper) final class Target_io_netty_buffer_EmptyByteBuf { @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) + @RecomputeFieldValue(kind = Kind.Reset) private static ByteBuffer EMPTY_BYTE_BUFFER; @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) + @RecomputeFieldValue(kind = Kind.Reset) private static long EMPTY_BYTE_BUFFER_ADDRESS; @Substitute @@ -470,7 +453,7 @@ public ByteBuffer nioBuffer() { @Substitute public ByteBuffer[] nioBuffers() { - return new ByteBuffer[] { EmptyByteBufStub.emptyByteBuffer() }; + return new ByteBuffer[]{EmptyByteBufStub.emptyByteBuffer()}; } @Substitute @@ -622,10 +605,19 @@ private static PrivateKey getPrivateKeyFromByteBuffer(ByteBuf encodedKeyBuf, Str final class Target_io_netty_util_internal_shaded_org_jctools_util_UnsafeRefArrayAccess { @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.ArrayIndexShift, declClass = Object[].class) + @RecomputeFieldValue(kind = Kind.ArrayIndexShift, declClass = Object[].class) public static int LONG_ELEMENT_SHIFT; } +@TargetClass(className = "io.netty.util.internal.CleanerJava25$CleanableDirectBufferImpl") +final class Target_io_netty_util_internal_CleanerJava25_CleanableDirectBufferImpl { + @Substitute + public void clean() { + // No-op: bypasses Arena.ofShared().close() which is unsupported + // in GraalVM native image without -H:+SharedArenaSupport + } +} + class IsBouncyNotThere implements BooleanSupplier { @Override diff --git a/test-functional/src/test-default/java/graal/vertx/graal/VertxSubstitutions.java b/test-functional/src/test-default/java/graal/vertx/graal/VertxSubstitutions.java index d8ca211b6..6390b18ab 100644 --- a/test-functional/src/test-default/java/graal/vertx/graal/VertxSubstitutions.java +++ b/test-functional/src/test-default/java/graal/vertx/graal/VertxSubstitutions.java @@ -4,22 +4,13 @@ import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import io.netty.handler.ssl.*; -import io.vertx.core.MultiMap; -import io.vertx.core.Promise; import io.vertx.core.Vertx; import io.vertx.core.dns.AddressResolverOptions; -import io.vertx.core.eventbus.EventBusOptions; -import io.vertx.core.eventbus.impl.HandlerHolder; -import io.vertx.core.eventbus.impl.HandlerRegistration; -import io.vertx.core.eventbus.impl.MessageImpl; -import io.vertx.core.eventbus.impl.OutboundDeliveryContext; -import io.vertx.core.impl.ContextInternal; -import io.vertx.core.impl.VertxInternal; -import io.vertx.core.impl.resolver.DefaultResolverProvider; -import io.vertx.core.impl.transports.JDKTransport; +import io.vertx.core.dns.impl.DefaultAddressResolverProvider; import io.vertx.core.net.NetServerOptions; -import io.vertx.core.spi.resolver.ResolverProvider; -import io.vertx.core.spi.transport.Transport; +import io.vertx.core.net.impl.NetServerImpl; +import io.vertx.core.spi.dns.AddressResolverProvider; +import io.vertx.core.transport.Transport; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLException; @@ -27,27 +18,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; -import java.util.concurrent.ConcurrentMap; -@TargetClass(className = "io.vertx.core.impl.VertxBuilder") -final class Target_io_vertx_core_impl_VertxBuilder { - @Substitute - public static Transport nativeTransport() { - return JDKTransport.INSTANCE; - } -} - -/** - * This substitution forces the usage of the blocking DNS resolver - */ -@TargetClass(className = "io.vertx.core.spi.resolver.ResolverProvider") -final class TargetResolverProvider { - - @Substitute - public static ResolverProvider factory(Vertx vertx, AddressResolverOptions options) { - return new DefaultResolverProvider(); - } -} @TargetClass(className = "io.vertx.core.net.OpenSSLEngineOptions") final class Target_io_vertx_core_net_OpenSSLEngineOptions { @@ -63,80 +34,42 @@ public static boolean isAlpnAvailable() { } } -@SuppressWarnings("rawtypes") -@TargetClass(className = "io.vertx.core.eventbus.impl.clustered.ClusteredEventBus") -final class Target_io_vertx_core_eventbus_impl_clustered_ClusteredEventBusClusteredEventBus { - - @Substitute - private NetServerOptions getServerOptions() { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public void start(Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public void close(Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - public MessageImpl createMessage(boolean send, boolean isLocal, String address, MultiMap headers, Object body, - String codecName) { - throw new RuntimeException("Not Implemented"); - } - +@TargetClass(className = "io.vertx.core.transport.Transport") +final class Target_io_vertx_core_transport_Transport { @Substitute - protected void onLocalRegistration(HandlerHolder handlerHolder, Promise promise) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected HandlerHolder createHandlerHolder(HandlerRegistration registration, boolean replyHandler, - boolean localOnly, ContextInternal context) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected void onLocalUnregistration(HandlerHolder handlerHolder, Promise completionHandler) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected void sendOrPub(OutboundDeliveryContext sendContext) { - throw new RuntimeException("Not Implemented"); - } - - @Substitute - protected String generateReplyAddress() { - throw new RuntimeException("Not Implemented"); + public static Transport nativeTransport() { + return Transport.NIO; } +} +@TargetClass(className = "io.vertx.core.spi.dns.AddressResolverProvider") +interface Target_io_vertx_core_spi_dns_AddressResolverProvider { @Substitute - protected boolean isMessageLocal(MessageImpl msg) { - throw new RuntimeException("Not Implemented"); + static AddressResolverProvider factory(Vertx vertx, AddressResolverOptions options) { + return new DefaultAddressResolverProvider(); } +} +@TargetClass(className = "io.vertx.core.impl.transports.TransportLoader") +final class Target_io_vertx_core_impl_transports_TransportLoader { @Substitute - ConcurrentMap connections() { - throw new RuntimeException("Not Implemented"); + public static Transport epoll() { + return Transport.NIO; } @Substitute - VertxInternal vertx() { - throw new RuntimeException("Not Implemented"); + public static Transport io_uring() { + return Transport.NIO; } @Substitute - EventBusOptions options() { - throw new RuntimeException("Not Implemented"); + public static Transport kqueue() { + return Transport.NIO; } } @TargetClass(className = "io.vertx.core.spi.tls.DefaultSslContextFactory") -final class Target_DefaultSslContextFactory { +final class Target_io_vertx_core_spi_tls_DefaultSslContextFactory { @Alias private Set enabledCipherSuites; @@ -157,7 +90,7 @@ private SslContext createContext(boolean useAlpn, boolean client, KeyManagerFact builder.keyManager(kmf); } } else { - builder = SslContextBuilder.forServer(kmf); + throw new SSLException("not supported"); } Collection cipherSuites = enabledCipherSuites; builder.sslProvider(SslProvider.JDK); @@ -192,6 +125,15 @@ static List get() { } } -class VertxSubstitutions { +@TargetClass(className = "io.vertx.core.impl.VertxImpl") +final class Target_io_vertx_core_impl_VertxImpl { + + @Substitute + public NetServerImpl createNetServer(NetServerOptions options) { + return null; + } +} + +public class VertxSubstitutions { } diff --git a/test-functional/src/test-ssl/java/com/arangodb/ArangoSslTest.java b/test-functional/src/test-ssl/java/com/arangodb/ArangoSslTest.java index 5643fc254..d7c2ebfe4 100644 --- a/test-functional/src/test-ssl/java/com/arangodb/ArangoSslTest.java +++ b/test-functional/src/test-ssl/java/com/arangodb/ArangoSslTest.java @@ -23,14 +23,15 @@ import com.arangodb.config.ArangoConfigProperties; import com.arangodb.entity.ArangoDBVersion; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import javax.net.ssl.SSLHandshakeException; import java.util.List; +import org.junit.jupiter.params.provider.EnumSource; +import utils.ProtocolSource; + import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** @@ -40,10 +41,8 @@ class ArangoSslTest extends BaseTest { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void connect(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) @@ -60,8 +59,6 @@ void connect(Protocol protocol) { @ParameterizedTest @EnumSource(Protocol.class) void connectWithCertConf(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) @@ -77,8 +74,6 @@ void connectWithCertConf(Protocol protocol) { @ParameterizedTest @EnumSource(Protocol.class) void connectWithFileProperties(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile("arangodb-ssl.properties")) .protocol(protocol) @@ -88,10 +83,8 @@ void connectWithFileProperties(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void connectWithoutValidSslContext(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) diff --git a/test-functional/src/test-ssl/java/com/arangodb/HttpProxyTest.java b/test-functional/src/test-ssl/java/com/arangodb/HttpProxyTest.java index aa2ca6bff..7f093d973 100644 --- a/test-functional/src/test-ssl/java/com/arangodb/HttpProxyTest.java +++ b/test-functional/src/test-ssl/java/com/arangodb/HttpProxyTest.java @@ -26,13 +26,12 @@ import io.vertx.core.net.ProxyOptions; import io.vertx.core.net.ProxyType; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import utils.ProtocolSource; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** @@ -41,10 +40,8 @@ class HttpProxyTest extends BaseTest { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void httpProxy(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) @@ -68,10 +65,8 @@ void httpProxy(Protocol protocol) { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void httpProxyWrongPassword(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) diff --git a/test-functional/src/test-ssl/java/com/arangodb/SslExampleTest.java b/test-functional/src/test-ssl/java/com/arangodb/SslExampleTest.java index 0a7b560a7..cf444d8e7 100644 --- a/test-functional/src/test-ssl/java/com/arangodb/SslExampleTest.java +++ b/test-functional/src/test-ssl/java/com/arangodb/SslExampleTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; -import utils.TestUtils; +import utils.ProtocolSource; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; @@ -35,7 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Mark Vollmary @@ -45,9 +44,8 @@ class SslExampleTest extends BaseTest { @Disabled("Only local execution, in CircleCI port 8529 exposed to localhost") @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void connect(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || TestUtils.isLessThanVersion(version.getVersion(), 3, 12, 0)); final ArangoDB arangoDB = new ArangoDB.Builder() .host("localhost", 8529) .password("test") @@ -61,9 +59,8 @@ void connect(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void noopHostnameVerifier(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || TestUtils.isLessThanVersion(version.getVersion(), 3, 12, 0)); final ArangoDB arangoDB = new ArangoDB.Builder() .host("172.28.0.1", 8529) .password("test") @@ -78,9 +75,8 @@ void noopHostnameVerifier(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void hostnameVerifierFailure(Protocol protocol) { - assumeTrue(protocol != Protocol.VST, "VST does not support hostname verification"); final ArangoDB arangoDB = new ArangoDB.Builder() .host("172.28.0.1", 8529) .password("test") @@ -101,8 +97,6 @@ void hostnameVerifierFailure(Protocol protocol) { @ParameterizedTest @EnumSource(Protocol.class) void connectWithSslContext(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); - final ArangoDB arangoDB = new ArangoDB.Builder() .protocol(protocol) .host("172.28.0.1", 8529) diff --git a/test-functional/src/test-ssl/java/utils/ProtocolSource.java b/test-functional/src/test-ssl/java/utils/ProtocolSource.java new file mode 100644 index 000000000..3b27f64f6 --- /dev/null +++ b/test-functional/src/test-ssl/java/utils/ProtocolSource.java @@ -0,0 +1,15 @@ +package utils; + +import com.arangodb.Protocol; +import org.junit.jupiter.params.provider.EnumSource; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@EnumSource(Protocol.class) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ProtocolSource { +} diff --git a/test-functional/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java index 179e78edd..6af96a7cd 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java @@ -145,7 +145,6 @@ void insertDocumentReturnNew(ArangoCollectionAsync collection) throws ExecutionE @ParameterizedTest @MethodSource("asyncCols") void insertDocumentWithTypeOverwriteModeReplace(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); assumeTrue(collection.getSerde().getUserSerde() instanceof JacksonSerde, "polymorphic deserialization support" + " required"); @@ -180,8 +179,6 @@ void insertDocumentWithTypeOverwriteModeReplace(ArangoCollectionAsync collection @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeIgnore(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -199,8 +196,6 @@ void insertDocumentOverwriteModeIgnore(ArangoCollectionAsync collection) throws @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeConflict(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -218,8 +213,6 @@ void insertDocumentOverwriteModeConflict(ArangoCollectionAsync collection) throw @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeReplace(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -239,8 +232,6 @@ void insertDocumentOverwriteModeReplace(ArangoCollectionAsync collection) throws @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdate(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "a"); final DocumentCreateEntity meta = collection.insertDocument(doc).get(); @@ -258,8 +249,6 @@ void insertDocumentOverwriteModeUpdate(ArangoCollectionAsync collection) throws @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdateMergeObjectsFalse(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); Map fieldA = Collections.singletonMap("a", "a"); doc.addAttribute("foo", fieldA); @@ -278,8 +267,6 @@ void insertDocumentOverwriteModeUpdateMergeObjectsFalse(ArangoCollectionAsync co @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdateKeepNullTrue(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "bar"); collection.insertDocument(doc).get(); @@ -296,8 +283,6 @@ void insertDocumentOverwriteModeUpdateKeepNullTrue(ArangoCollectionAsync collect @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdateKeepNullFalse(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "bar"); collection.insertDocument(doc).get(); @@ -314,8 +299,6 @@ void insertDocumentOverwriteModeUpdateKeepNullFalse(ArangoCollectionAsync collec @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdateWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -333,8 +316,6 @@ void insertDocumentOverwriteModeUpdateWithExternalVersioning(ArangoCollectionAsy @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeUpdateWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -353,8 +334,6 @@ void insertDocumentOverwriteModeUpdateWithExternalVersioningFail(ArangoCollectio @ParameterizedTest @MethodSource("asyncCols") void insertDocumentsOverwriteModeUpdateWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -382,8 +361,6 @@ void insertDocumentsOverwriteModeUpdateWithExternalVersioning(ArangoCollectionAs @ParameterizedTest @MethodSource("asyncCols") void insertDocumentsOverwriteModeUpdateWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -411,8 +388,6 @@ void insertDocumentsOverwriteModeUpdateWithExternalVersioningFail(ArangoCollecti @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeReplaceWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -430,8 +405,6 @@ void insertDocumentOverwriteModeReplaceWithExternalVersioning(ArangoCollectionAs @ParameterizedTest @MethodSource("asyncCols") void insertDocumentOverwriteModeReplaceUpdateWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -450,8 +423,6 @@ void insertDocumentOverwriteModeReplaceUpdateWithExternalVersioningFail(ArangoCo @ParameterizedTest @MethodSource("asyncCols") void insertDocumentsOverwriteModeReplaceWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -479,8 +450,6 @@ void insertDocumentsOverwriteModeReplaceWithExternalVersioning(ArangoCollectionA @ParameterizedTest @MethodSource("asyncCols") void insertDocumentsOverwriteModeReplaceWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -754,7 +723,7 @@ void getDocumentsWithCustomShardingKey(ArangoCollectionAsync c) throws Execution @ParameterizedTest @MethodSource("asyncCols") void getDocumentsDirtyRead(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isCluster()); // skip activefailover + assumeTrue(isCluster()); final Collection values = new ArrayList<>(); values.add(new BaseDocument("1")); values.add(new BaseDocument("2")); @@ -763,9 +732,7 @@ void getDocumentsDirtyRead(ArangoCollectionAsync collection) throws ExecutionExc final MultiDocumentEntity documents = collection.getDocuments(Arrays.asList("1", "2", "3"), BaseDocument.class, new DocumentReadOptions().allowDirtyRead(true)).get(); assertThat(documents).isNotNull(); - if (isAtLeastVersion(3, 10)) { - assertThat(documents.isPotentialDirtyRead()).isTrue(); - } + assertThat(documents.isPotentialDirtyRead()).isTrue(); assertThat(documents.getDocuments()).hasSize(3); for (final BaseDocument document : documents.getDocuments()) { assertThat(document.getId()).isIn(COLLECTION_NAME + "/" + "1", COLLECTION_NAME + "/" + "2", @@ -902,8 +869,6 @@ void updateDocumentIfMatchFail(ArangoCollectionAsync collection) throws Executio @ParameterizedTest @MethodSource("asyncCols") void updateDocumentWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -919,8 +884,6 @@ void updateDocumentWithExternalVersioning(ArangoCollectionAsync collection) thro @ParameterizedTest @MethodSource("asyncCols") void updateDocumentWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -936,8 +899,6 @@ void updateDocumentWithExternalVersioningFail(ArangoCollectionAsync collection) @ParameterizedTest @MethodSource("asyncCols") void updateDocumentsWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -962,8 +923,6 @@ void updateDocumentsWithExternalVersioning(ArangoCollectionAsync collection) thr @ParameterizedTest @MethodSource("asyncCols") void updateDocumentsWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1361,8 +1320,6 @@ void replaceDocumentIgnoreRevsFalse(ArangoCollectionAsync collection) throws Exe @ParameterizedTest @MethodSource("asyncCols") void replaceDocumentWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -1378,8 +1335,6 @@ void replaceDocumentWithExternalVersioning(ArangoCollectionAsync collection) thr @ParameterizedTest @MethodSource("asyncCols") void replaceDocumentWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc).get(); @@ -1395,8 +1350,6 @@ void replaceDocumentWithExternalVersioningFail(ArangoCollectionAsync collection) @ParameterizedTest @MethodSource("asyncCols") void replaceDocumentsWithExternalVersioning(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1421,8 +1374,6 @@ void replaceDocumentsWithExternalVersioning(ArangoCollectionAsync collection) th @ParameterizedTest @MethodSource("asyncCols") void replaceDocumentsWithExternalVersioningFail(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1738,21 +1689,13 @@ void createGeoIndex(ArangoCollectionAsync collection) throws ExecutionException, assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isFalse(); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); + assertThat(indexResult.getLegacyPolygons()).isFalse(); } @ParameterizedTest @MethodSource("asyncCols") void createGeoIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1767,22 +1710,14 @@ void createGeoIndexWithOptions(ArangoCollectionAsync collection) throws Executio assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isFalse(); - } + assertThat(indexResult.getLegacyPolygons()).isFalse(); } @ParameterizedTest @MethodSource("asyncCols") void createGeoIndexLegacyPolygons(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1798,15 +1733,9 @@ void createGeoIndexLegacyPolygons(ArangoCollectionAsync collection) throws Execu assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isTrue(); - } + assertThat(indexResult.getLegacyPolygons()).isTrue(); } @ParameterizedTest @@ -1825,18 +1754,12 @@ void createGeo2Index(ArangoCollectionAsync collection) throws ExecutionException assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo2); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); } @ParameterizedTest @MethodSource("asyncCols") void createGeo2IndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1854,11 +1777,7 @@ void createGeo2IndexWithOptions(ArangoCollectionAsync collection) throws Executi assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo2); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); } @@ -1881,16 +1800,12 @@ void createPersistentIndex(ArangoCollectionAsync collection) throws ExecutionExc assertThat(indexResult.getType()).isEqualTo(IndexType.persistent); assertThat(indexResult.getUnique()).isFalse(); assertThat(indexResult.getDeduplicate()).isTrue(); - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getCacheEnabled()).isFalse(); - } + assertThat(indexResult.getCacheEnabled()).isFalse(); } @ParameterizedTest @MethodSource("asyncCols") void createPersistentIndexCacheEnabled(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - String f1 = "field-" + rnd(); String f2 = "field-" + rnd(); final Collection fields = Arrays.asList(f1, f2); @@ -1913,8 +1828,6 @@ void createPersistentIndexCacheEnabled(ArangoCollectionAsync collection) throws @ParameterizedTest @MethodSource("asyncCols") void createPersistentIndexStoredValues(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - String f1 = "field-" + rnd(); String f2 = "field-" + rnd(); final Collection fields = Arrays.asList(f1, f2); @@ -1940,8 +1853,6 @@ void createPersistentIndexStoredValues(ArangoCollectionAsync collection) throws @ParameterizedTest @MethodSource("asyncCols") void createPersistentIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2031,60 +1942,11 @@ void createAndGetVectorIndex(ArangoCollectionAsync collection) throws ExecutionE cleanCollection(collection); } - @ParameterizedTest - @MethodSource("asyncCols") - void createZKDIndex(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); - collection.truncate().get(); - String f1 = "field-" + rnd(); - String f2 = "field-" + rnd(); - final Collection fields = Arrays.asList(f1, f2); - final IndexEntity indexResult = collection.ensureZKDIndex(fields, null).get(); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getFields()).contains(f2); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getMinLength()).isNull(); - assertThat(indexResult.getType()).isEqualTo(IndexType.zkd); - assertThat(indexResult.getUnique()).isFalse(); - collection.deleteIndex(indexResult.getId()); - } - - @ParameterizedTest - @MethodSource("asyncCols") - void createZKDIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); - collection.truncate().get(); - - String name = "ZKDIndex-" + rnd(); - final ZKDIndexOptions options = - new ZKDIndexOptions().name(name).fieldValueTypes(ZKDIndexOptions.FieldValueTypes.DOUBLE); - - String f1 = "field-" + rnd(); - String f2 = "field-" + rnd(); - - final Collection fields = Arrays.asList(f1, f2); - final IndexEntity indexResult = collection.ensureZKDIndex(fields, options).get(); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getFields()).contains(f2); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getMinLength()).isNull(); - assertThat(indexResult.getType()).isEqualTo(IndexType.zkd); - assertThat(indexResult.getUnique()).isFalse(); - assertThat(indexResult.getName()).isEqualTo(name); - collection.deleteIndex(indexResult.getId()).get(); - } @ParameterizedTest @MethodSource("asyncCols") void createMDIndex(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate().get(); String f1 = "field-" + rnd(); @@ -2106,7 +1968,6 @@ void createMDIndex(ArangoCollectionAsync collection) throws ExecutionException, @ParameterizedTest @MethodSource("asyncCols") void createMDIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate().get(); String name = "MDIndex-" + rnd(); @@ -2140,7 +2001,6 @@ void createMDIndexWithOptions(ArangoCollectionAsync collection) throws Execution @ParameterizedTest @MethodSource("asyncCols") void createMDPrefixedIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate().get(); String name = "MDPrefixedIndex-" + rnd(); @@ -2176,7 +2036,6 @@ void createMDPrefixedIndexWithOptions(ArangoCollectionAsync collection) throws E @ParameterizedTest @MethodSource("asyncCols") void indexEstimates(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2197,7 +2056,6 @@ void indexEstimates(ArangoCollectionAsync collection) throws ExecutionException, @ParameterizedTest @MethodSource("asyncCols") void indexEstimatesFalse(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2218,8 +2076,6 @@ void indexEstimatesFalse(ArangoCollectionAsync collection) throws ExecutionExcep @ParameterizedTest @MethodSource("asyncCols") void indexDeduplicate(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2237,8 +2093,6 @@ void indexDeduplicate(ArangoCollectionAsync collection) throws ExecutionExceptio @ParameterizedTest @MethodSource("asyncCols") void indexDeduplicateFalse(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2253,49 +2107,11 @@ void indexDeduplicateFalse(ArangoCollectionAsync collection) throws ExecutionExc assertThat(indexResult.getDeduplicate()).isFalse(); } - @ParameterizedTest - @MethodSource("asyncCols") - void createFulltextIndex(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - String f1 = "field-" + rnd(); - final Collection fields = Collections.singletonList(f1); - final IndexEntity indexResult = collection.ensureFulltextIndex(fields, null).get(); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getSparse()).isTrue(); - assertThat(indexResult.getType()).isEqualTo(IndexType.fulltext); - assertThat(indexResult.getUnique()).isFalse(); - } - - @ParameterizedTest - @MethodSource("asyncCols") - void createFulltextIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "fulltextIndex-" + rnd(); - final FulltextIndexOptions options = new FulltextIndexOptions(); - options.name(name); - String f = "field-" + rnd(); - final Collection fields = Collections.singletonList(f); - final IndexEntity indexResult = collection.ensureFulltextIndex(fields, options).get(); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getSparse()).isTrue(); - assertThat(indexResult.getType()).isEqualTo(IndexType.fulltext); - assertThat(indexResult.getUnique()).isFalse(); - assertThat(indexResult.getName()).isEqualTo(name); - } @ParameterizedTest @MethodSource("asyncCols") void createTtlIndexWithoutOptions(ArangoCollectionAsync collection) { - assumeTrue(isAtLeastVersion(3, 5)); final Collection fields = new ArrayList<>(); fields.add("a"); @@ -2310,8 +2126,6 @@ void createTtlIndexWithoutOptions(ArangoCollectionAsync collection) { @ParameterizedTest @MethodSource("asyncCols") void createTtlIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String f1 = "field-" + rnd(); final Collection fields = Collections.singletonList(f1); @@ -2458,8 +2272,6 @@ void insertDocuments(ArangoCollectionAsync collection) throws ExecutionException @ParameterizedTest @MethodSource("asyncCols") void insertDocumentsOverwriteModeUpdate(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc1 = new BaseDocument(UUID.randomUUID().toString()); doc1.addAttribute("foo", "a"); final DocumentCreateEntity meta1 = collection.insertDocument(doc1).get(); @@ -3441,9 +3253,7 @@ void getPropeties(ArangoCollectionAsync collection) throws ExecutionException, I void changeProperties(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { final CollectionPropertiesEntity properties = collection.getProperties().get(); assertThat(properties.getWaitForSync()).isNotNull(); - if (isAtLeastVersion(3, 7)) { - assertThat(properties.getSchema()).isNull(); - } + assertThat(properties.getSchema()).isNull(); String schemaRule = ("{ " + " \"properties\": {" + " \"number\": {" + " " + " \"type\": \"number\"" + " }" + " }" + " }").replaceAll("\\s", ""); @@ -3455,20 +3265,15 @@ void changeProperties(ArangoCollectionAsync collection) throws ExecutionExceptio final CollectionPropertiesEntity changedProperties = collection.changeProperties(updatedOptions).get(); assertThat(changedProperties.getWaitForSync()).isNotNull(); assertThat(changedProperties.getWaitForSync()).isEqualTo(!properties.getWaitForSync()); - if (isAtLeastVersion(3, 7)) { - assertThat(changedProperties.getSchema()).isNotNull(); - assertThat(changedProperties.getSchema().getLevel()).isEqualTo(CollectionSchema.Level.NEW); - assertThat(changedProperties.getSchema().getMessage()).isEqualTo(schemaMessage); - assertThat(changedProperties.getSchema().getRule()).isEqualTo(schemaRule); - } + assertThat(changedProperties.getSchema()).isNotNull(); + assertThat(changedProperties.getSchema().getLevel()).isEqualTo(CollectionSchema.Level.NEW); + assertThat(changedProperties.getSchema().getMessage()).isEqualTo(schemaMessage); + assertThat(changedProperties.getSchema().getRule()).isEqualTo(schemaRule); // revert changes CollectionPropertiesEntity revertedProperties = collection.changeProperties(new CollectionPropertiesOptions() .waitForSync(properties.getWaitForSync()).schema(new CollectionSchema())).get(); - if (isAtLeastVersion(3, 7)) { - assertThat(revertedProperties.getSchema()).isNull(); - } - + assertThat(revertedProperties.getSchema()).isNull(); } @ParameterizedTest @@ -3502,7 +3307,6 @@ void rename(ArangoCollectionAsync collection) throws ExecutionException, Interru @MethodSource("asyncCols") void responsibleShard(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 5)); ShardEntity shard = collection.getResponsibleShard(new BaseDocument("testKey")).get(); assertThat(shard).isNotNull(); assertThat(shard.getShardId()).isNotNull(); diff --git a/test-functional/src/test/java/com/arangodb/ArangoCollectionTest.java b/test-functional/src/test/java/com/arangodb/ArangoCollectionTest.java index 0c9e6461c..9e43f7a64 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoCollectionTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoCollectionTest.java @@ -148,7 +148,6 @@ void insertDocumentReturnNew(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentWithTypeOverwriteModeReplace(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); assumeTrue(collection.getSerde().getUserSerde() instanceof JacksonSerde, "polymorphic deserialization support" + " required"); @@ -183,8 +182,6 @@ void insertDocumentWithTypeOverwriteModeReplace(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeIgnore(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -202,8 +199,6 @@ void insertDocumentOverwriteModeIgnore(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeConflict(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -221,8 +216,6 @@ void insertDocumentOverwriteModeConflict(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeReplace(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - String key = "key-" + UUID.randomUUID(); final BaseDocument doc = new BaseDocument(key); doc.addAttribute("foo", "a"); @@ -242,8 +235,6 @@ void insertDocumentOverwriteModeReplace(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdate(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "a"); final DocumentCreateEntity meta = collection.insertDocument(doc); @@ -261,8 +252,6 @@ void insertDocumentOverwriteModeUpdate(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdateMergeObjectsFalse(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); Map fieldA = Collections.singletonMap("a", "a"); doc.addAttribute("foo", fieldA); @@ -281,8 +270,6 @@ void insertDocumentOverwriteModeUpdateMergeObjectsFalse(ArangoCollection collect @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdateKeepNullTrue(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "bar"); collection.insertDocument(doc); @@ -299,8 +286,6 @@ void insertDocumentOverwriteModeUpdateKeepNullTrue(ArangoCollection collection) @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdateKeepNullFalse(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("foo", "bar"); collection.insertDocument(doc); @@ -317,8 +302,6 @@ void insertDocumentOverwriteModeUpdateKeepNullFalse(ArangoCollection collection) @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdateWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -336,8 +319,6 @@ void insertDocumentOverwriteModeUpdateWithExternalVersioning(ArangoCollection co @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeUpdateWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -356,8 +337,6 @@ void insertDocumentOverwriteModeUpdateWithExternalVersioningFail(ArangoCollectio @ParameterizedTest @MethodSource("cols") void insertDocumentsOverwriteModeUpdateWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -385,8 +364,6 @@ void insertDocumentsOverwriteModeUpdateWithExternalVersioning(ArangoCollection c @ParameterizedTest @MethodSource("cols") void insertDocumentsOverwriteModeUpdateWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -414,8 +391,6 @@ void insertDocumentsOverwriteModeUpdateWithExternalVersioningFail(ArangoCollecti @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeReplaceWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -433,8 +408,6 @@ void insertDocumentOverwriteModeReplaceWithExternalVersioning(ArangoCollection c @ParameterizedTest @MethodSource("cols") void insertDocumentOverwriteModeReplaceUpdateWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -453,8 +426,6 @@ void insertDocumentOverwriteModeReplaceUpdateWithExternalVersioningFail(ArangoCo @ParameterizedTest @MethodSource("cols") void insertDocumentsOverwriteModeReplaceWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -482,8 +453,6 @@ void insertDocumentsOverwriteModeReplaceWithExternalVersioning(ArangoCollection @ParameterizedTest @MethodSource("cols") void insertDocumentsOverwriteModeReplaceWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -606,9 +575,6 @@ void insertDocumentsSilent(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentsWithErrors(ArangoCollection collection) { - // BTS-615 - assumeTrue(isAtLeastVersion(3, 11)); - final MultiDocumentEntity> res = collection.insertDocuments(Arrays.asList( new BaseDocument(), @@ -807,7 +773,7 @@ void getDocumentsWithCustomShardingKey(ArangoCollection c) { @ParameterizedTest @MethodSource("cols") void getDocumentsDirtyRead(ArangoCollection collection) { - assumeTrue(isCluster()); // skip activefailover + assumeTrue(isCluster()); final Collection values = new ArrayList<>(); values.add(new BaseDocument("1")); values.add(new BaseDocument("2")); @@ -816,9 +782,7 @@ void getDocumentsDirtyRead(ArangoCollection collection) { final MultiDocumentEntity documents = collection.getDocuments(Arrays.asList("1", "2", "3"), BaseDocument.class, new DocumentReadOptions().allowDirtyRead(true)); assertThat(documents).isNotNull(); - if (isAtLeastVersion(3, 10)) { - assertThat(documents.isPotentialDirtyRead()).isTrue(); - } + assertThat(documents.isPotentialDirtyRead()).isTrue(); assertThat(documents.getDocuments()).hasSize(3); for (final BaseDocument document : documents.getDocuments()) { assertThat(document.getId()).isIn(COLLECTION_NAME + "/" + "1", COLLECTION_NAME + "/" + "2", @@ -955,8 +919,6 @@ void updateDocumentIfMatchFail(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void updateDocumentWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -972,8 +934,6 @@ void updateDocumentWithExternalVersioning(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void updateDocumentWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -989,8 +949,6 @@ void updateDocumentWithExternalVersioningFail(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void updateDocumentsWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1015,8 +973,6 @@ void updateDocumentsWithExternalVersioning(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void updateDocumentsWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1414,8 +1370,6 @@ void replaceDocumentIgnoreRevsFalse(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void replaceDocumentWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -1431,8 +1385,6 @@ void replaceDocumentWithExternalVersioning(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void replaceDocumentWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("_version", 1); collection.insertDocument(doc); @@ -1448,8 +1400,6 @@ void replaceDocumentWithExternalVersioningFail(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void replaceDocumentsWithExternalVersioning(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1474,8 +1424,6 @@ void replaceDocumentsWithExternalVersioning(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void replaceDocumentsWithExternalVersioningFail(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); - BaseDocument d1 = new BaseDocument(UUID.randomUUID().toString()); d1.addAttribute("_version", 1); BaseDocument d2 = new BaseDocument(UUID.randomUUID().toString()); @@ -1791,21 +1739,13 @@ void createGeoIndex(ArangoCollection collection) { assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isFalse(); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); + assertThat(indexResult.getLegacyPolygons()).isFalse(); } @ParameterizedTest @MethodSource("cols") void createGeoIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1820,22 +1760,14 @@ void createGeoIndexWithOptions(ArangoCollection collection) { assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isFalse(); - } + assertThat(indexResult.getLegacyPolygons()).isFalse(); } @ParameterizedTest @MethodSource("cols") void createGeoIndexLegacyPolygons(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1851,15 +1783,9 @@ void createGeoIndexLegacyPolygons(ArangoCollection collection) { assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo1); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); - if (isAtLeastVersion(3, 10)) { - assertThat(indexResult.getLegacyPolygons()).isTrue(); - } + assertThat(indexResult.getLegacyPolygons()).isTrue(); } @ParameterizedTest @@ -1878,18 +1804,12 @@ void createGeo2Index(ArangoCollection collection) { assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo2); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); } @ParameterizedTest @MethodSource("cols") void createGeo2IndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "geoIndex-" + rnd(); final GeoIndexOptions options = new GeoIndexOptions(); options.name(name); @@ -1907,11 +1827,7 @@ void createGeo2IndexWithOptions(ArangoCollection collection) { assertThat(indexResult.getMinLength()).isNull(); assertThat(indexResult.getSparse()).isTrue(); assertThat(indexResult.getUnique()).isFalse(); - if (isAtLeastVersion(3, 4)) { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo); - } else { - assertThat(indexResult.getType()).isEqualTo(IndexType.geo2); - } + assertThat(indexResult.getType()).isEqualTo(IndexType.geo); assertThat(indexResult.getName()).isEqualTo(name); } @@ -1934,16 +1850,12 @@ void createPersistentIndex(ArangoCollection collection) { assertThat(indexResult.getType()).isEqualTo(IndexType.persistent); assertThat(indexResult.getUnique()).isFalse(); assertThat(indexResult.getDeduplicate()).isTrue(); - if (isAtLeastVersion(3, 10)) { assertThat(indexResult.getCacheEnabled()).isFalse(); - } } @ParameterizedTest @MethodSource("cols") void createPersistentIndexCacheEnabled(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); - String f1 = "field-" + rnd(); String f2 = "field-" + rnd(); final Collection fields = Arrays.asList(f1, f2); @@ -1966,8 +1878,6 @@ void createPersistentIndexCacheEnabled(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createPersistentIndexStoredValues(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); - String f1 = "field-" + rnd(); String f2 = "field-" + rnd(); final Collection fields = Arrays.asList(f1, f2); @@ -1993,8 +1903,6 @@ void createPersistentIndexStoredValues(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createPersistentIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2084,60 +1992,11 @@ void createAndGetVectorIndex(ArangoCollection collection) { cleanCollection(collection); } - @ParameterizedTest - @MethodSource("cols") - void createZKDIndex(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 9)); - collection.truncate(); - String f1 = "field-" + rnd(); - String f2 = "field-" + rnd(); - final Collection fields = Arrays.asList(f1, f2); - - final IndexEntity indexResult = collection.ensureZKDIndex(fields, null); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getFields()).contains(f2); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getMinLength()).isNull(); - assertThat(indexResult.getType()).isEqualTo(IndexType.zkd); - assertThat(indexResult.getUnique()).isFalse(); - collection.deleteIndex(indexResult.getId()); - } - - @ParameterizedTest - @MethodSource("cols") - void createZKDIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 9)); - collection.truncate(); - - String name = "ZKDIndex-" + rnd(); - final ZKDIndexOptions options = - new ZKDIndexOptions().name(name).fieldValueTypes(ZKDIndexOptions.FieldValueTypes.DOUBLE); - String f1 = "field-" + rnd(); - String f2 = "field-" + rnd(); - - final Collection fields = Arrays.asList(f1, f2); - final IndexEntity indexResult = collection.ensureZKDIndex(fields, options); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getFields()).contains(f2); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getMinLength()).isNull(); - assertThat(indexResult.getType()).isEqualTo(IndexType.zkd); - assertThat(indexResult.getUnique()).isFalse(); - assertThat(indexResult.getName()).isEqualTo(name); - collection.deleteIndex(indexResult.getId()); - } @ParameterizedTest @MethodSource("cols") void createMDIndex(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String f1 = "field-" + rnd(); @@ -2159,7 +2018,6 @@ void createMDIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createMDIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String name = "MDIndex-" + rnd(); @@ -2193,7 +2051,6 @@ void createMDIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createMDPrefixedIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String name = "MDPrefixedIndex-" + rnd(); @@ -2229,7 +2086,6 @@ void createMDPrefixedIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexEstimates(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2250,7 +2106,6 @@ void indexEstimates(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexEstimatesFalse(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2271,8 +2126,6 @@ void indexEstimatesFalse(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexDeduplicate(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2290,8 +2143,6 @@ void indexDeduplicate(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexDeduplicateFalse(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); - String name = "persistentIndex-" + rnd(); final PersistentIndexOptions options = new PersistentIndexOptions(); options.name(name); @@ -2306,49 +2157,11 @@ void indexDeduplicateFalse(ArangoCollection collection) { assertThat(indexResult.getDeduplicate()).isFalse(); } - @ParameterizedTest - @MethodSource("cols") - void createFulltextIndex(ArangoCollection collection) { - String f1 = "field-" + rnd(); - final Collection fields = Collections.singletonList(f1); - final IndexEntity indexResult = collection.ensureFulltextIndex(fields, null); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f1); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getSparse()).isTrue(); - assertThat(indexResult.getType()).isEqualTo(IndexType.fulltext); - assertThat(indexResult.getUnique()).isFalse(); - } - @ParameterizedTest - @MethodSource("cols") - void createFulltextIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "fulltextIndex-" + rnd(); - final FulltextIndexOptions options = new FulltextIndexOptions(); - options.name(name); - - String f = "field-" + rnd(); - final Collection fields = Collections.singletonList(f); - final IndexEntity indexResult = collection.ensureFulltextIndex(fields, options); - assertThat(indexResult).isNotNull(); - assertThat(indexResult.getConstraint()).isNull(); - assertThat(indexResult.getFields()).contains(f); - assertThat(indexResult.getId()).startsWith(COLLECTION_NAME); - assertThat(indexResult.getIsNewlyCreated()).isTrue(); - assertThat(indexResult.getSparse()).isTrue(); - assertThat(indexResult.getType()).isEqualTo(IndexType.fulltext); - assertThat(indexResult.getUnique()).isFalse(); - assertThat(indexResult.getName()).isEqualTo(name); - } @ParameterizedTest @MethodSource("cols") void createTtlIndexWithoutOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); final Collection fields = new ArrayList<>(); fields.add("a"); @@ -2363,8 +2176,6 @@ void createTtlIndexWithoutOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createTtlIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - String f1 = "field-" + rnd(); final Collection fields = Collections.singletonList(f1); @@ -2538,8 +2349,6 @@ void insertDocumentsReturnNewUserData(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void insertDocumentsOverwriteModeUpdate(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 7)); - final BaseDocument doc1 = new BaseDocument(UUID.randomUUID().toString()); doc1.addAttribute("foo", "a"); final DocumentCreateEntity meta1 = collection.insertDocument(doc1); @@ -3598,7 +3407,6 @@ void rename(ArangoCollection collection) { @MethodSource("cols") void responsibleShard(ArangoCollection collection) { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 5)); ShardEntity shard = collection.getResponsibleShard(new BaseDocument("testKey")); assertThat(shard).isNotNull(); assertThat(shard.getShardId()).isNotNull(); diff --git a/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java b/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java index c017ef718..741728e1f 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java @@ -16,7 +16,7 @@ public class ArangoConfigTest { void ArangoConfigDefaultValues() throws NoSuchAlgorithmException { ArangoConfig cfg = new ArangoConfig(); assertThat(cfg.getHosts()).isEqualTo(ArangoDefaults.DEFAULT_HOSTS); - assertThat(cfg.getProtocol()).isEqualTo(Protocol.HTTP2_JSON); + assertThat(cfg.getProtocol()).isEqualTo(Protocol.HTTP_2); assertThat(cfg.getTimeout()).isEqualTo(ArangoDefaults.DEFAULT_TIMEOUT); assertThat(cfg.getUser()).isEqualTo(ArangoDefaults.DEFAULT_USER); assertThat(cfg.getPassword()).isNull(); @@ -24,10 +24,8 @@ void ArangoConfigDefaultValues() throws NoSuchAlgorithmException { assertThat(cfg.getUseSsl()).isEqualTo(ArangoDefaults.DEFAULT_USE_SSL); assertThat(cfg.getSslContext()).isEqualTo(SSLContext.getDefault()); assertThat(cfg.getVerifyHost()).isEqualTo(ArangoDefaults.DEFAULT_VERIFY_HOST); - assertThat(cfg.getChunkSize()).isEqualTo(ArangoDefaults.DEFAULT_CHUNK_SIZE); assertThat(cfg.getMaxConnections()).isEqualTo(ArangoDefaults.MAX_CONNECTIONS_HTTP2_DEFAULT); assertThat(cfg.getConnectionTtl()).isEqualTo(ArangoDefaults.DEFAULT_CONNECTION_TTL_HTTP); - assertThat(cfg.getKeepAliveInterval()).isNull(); assertThat(cfg.getAcquireHostList()).isEqualTo(ArangoDefaults.DEFAULT_ACQUIRE_HOST_LIST); assertThat(cfg.getAcquireHostListInterval()).isEqualTo(ArangoDefaults.DEFAULT_ACQUIRE_HOST_LIST_INTERVAL); assertThat(cfg.getLoadBalancingStrategy()).isEqualTo(ArangoDefaults.DEFAULT_LOAD_BALANCING_STRATEGY); diff --git a/test-functional/src/test/java/com/arangodb/ArangoDBAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoDBAsyncTest.java index cce45b9f6..cadce9bcb 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoDBAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoDBAsyncTest.java @@ -25,6 +25,7 @@ import com.arangodb.internal.serde.SerdeUtils; import com.arangodb.model.*; import com.arangodb.model.LogOptions.SortOrder; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.RawJson; import com.arangodb.util.SlowTest; import com.arangodb.util.UnicodeUtils; @@ -33,7 +34,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; import java.time.LocalDateTime; @@ -114,7 +114,6 @@ void createWithNotNormalizedName(ArangoDBAsync arangoDB) throws ExecutionExcepti @MethodSource("asyncArangos") void createDatabaseWithOptions(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 6)); final String dbName = rndDbName(); final Boolean resultCreate = arangoDB.createDatabase(new DBCreateOptions() .name(dbName) @@ -140,8 +139,6 @@ void createDatabaseWithOptions(ArangoDBAsync arangoDB) throws ExecutionException @MethodSource("asyncArangos") void createDatabaseWithOptionsSatellite(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { assumeTrue(isCluster()); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 6)); final String dbName = rndDbName(); final Boolean resultCreate = arangoDB.createDatabase(new DBCreateOptions() @@ -192,9 +189,6 @@ void createDatabaseWithUsers(ArangoDBAsync arangoDB) throws InterruptedException assertThat(retrievedUser.getActive()).isTrue(); assertThat(retrievedUser.getExtra()).isEqualTo(extra); - // needed for active-failover tests only - Thread.sleep(2_000); - ArangoDBAsync arangoDBTestUser = new ArangoDB.Builder() .loadProperties(config) .user("testUser") @@ -391,10 +385,8 @@ void updateUserDefaultCollectionAccess(ArangoDBAsync arangoDB) throws ExecutionE } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticationFailPassword(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - final ArangoDBAsync arangoDB = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) @@ -408,10 +400,8 @@ void authenticationFailPassword(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticationFailUser(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - final ArangoDBAsync arangoDB = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) @@ -438,16 +428,13 @@ void executeGetVersion(ArangoDBAsync arangoDB) throws ExecutionException, Interr assertThat(body.get("version").isTextual()).isTrue(); assertThat(body.get("details").isObject()).isTrue(); assertThat(response.getResponseCode()).isEqualTo(200); - if (isAtLeastVersion(3, 9)) { - String header = response.getHeaders().get("x-arango-queue-time-seconds"); - assertThat(header).isNotNull(); - } + String header = response.getHeaders().get("x-arango-queue-time-seconds"); + assertThat(header).isNotNull(); } @ParameterizedTest @MethodSource("asyncArangos") void getLogEntries(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null).get(); assertThat(logs.getTotal()).isPositive(); assertThat(logs.getMessages()).hasSize(logs.getTotal().intValue()); @@ -456,7 +443,6 @@ void getLogEntries(ArangoDBAsync arangoDB) throws ExecutionException, Interrupte @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesUpto(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logsUpto = arangoDB.getLogEntries(new LogOptions().upto(LogLevel.WARNING)).get(); assertThat(logsUpto.getMessages()) .map(LogEntriesEntity.Message::getLevel) @@ -466,7 +452,6 @@ void getLogEntriesUpto(ArangoDBAsync arangoDB) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logsInfo = arangoDB.getLogEntries(new LogOptions().level(LogLevel.INFO)).get(); assertThat(logsInfo.getMessages()) .map(LogEntriesEntity.Message::getLevel) @@ -476,7 +461,6 @@ void getLogEntriesLevel(ArangoDBAsync arangoDB) throws ExecutionException, Inter @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesStart(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null).get(); final Long firstId = logs.getMessages().get(0).getId(); final LogEntriesEntity logsStart = arangoDB.getLogEntries(new LogOptions().start(firstId + 1)).get(); @@ -488,7 +472,6 @@ void getLogEntriesStart(ArangoDBAsync arangoDB) throws ExecutionException, Inter @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesSize(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null).get(); int count = logs.getMessages().size(); assertThat(count).isPositive(); @@ -499,7 +482,6 @@ void getLogEntriesSize(ArangoDBAsync arangoDB) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesOffset(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null).get(); assertThat(logs.getTotal()).isPositive(); Long firstId = logs.getMessages().get(0).getId(); @@ -512,7 +494,6 @@ void getLogEntriesOffset(ArangoDBAsync arangoDB) throws ExecutionException, Inte @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesSearch(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null).get(); final LogEntriesEntity logsSearch = arangoDB.getLogEntries(new LogOptions().search(getTestDb())).get(); assertThat(logs.getTotal()).isGreaterThan(logsSearch.getTotal()); @@ -521,7 +502,6 @@ void getLogEntriesSearch(ArangoDBAsync arangoDB) throws ExecutionException, Inte @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesSortAsc(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(new LogOptions().sort(SortOrder.asc)).get(); long lastId = -1; List ids = logs.getMessages().stream() @@ -536,7 +516,6 @@ void getLogEntriesSortAsc(ArangoDBAsync arangoDB) throws ExecutionException, Int @ParameterizedTest @MethodSource("asyncArangos") void getLogEntriesSortDesc(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(new LogOptions().sort(SortOrder.desc)).get(); long lastId = Long.MAX_VALUE; List ids = logs.getMessages().stream() @@ -551,7 +530,6 @@ void getLogEntriesSortDesc(ArangoDBAsync arangoDB) throws ExecutionException, In @ParameterizedTest @MethodSource("asyncArangos") void getLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362) final LogLevelEntity logLevel = arangoDB.getLogLevel().get(); assertThat(logLevel.getAgency()).isEqualTo(LogLevelEntity.LogLevel.INFO); } @@ -559,7 +537,6 @@ void getLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedE @ParameterizedTest @MethodSource("asyncArangos") void setLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362) final LogLevelEntity entity = new LogLevelEntity(); try { entity.setAgency(LogLevelEntity.LogLevel.ERROR); @@ -574,7 +551,6 @@ void setLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedE @ParameterizedTest @MethodSource("asyncArangos") void setAllLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); final LogLevelEntity entity = new LogLevelEntity(); try { entity.setAll(LogLevelEntity.LogLevel.ERROR); @@ -592,7 +568,6 @@ void setAllLogLevel(ArangoDBAsync arangoDB) throws ExecutionException, Interrupt @ParameterizedTest @MethodSource("asyncArangos") void logLevelWithServerId(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); assumeTrue(isCluster()); String serverId = arangoDB.getServerId().get(); LogLevelOptions options = new LogLevelOptions().serverId(serverId); @@ -611,7 +586,6 @@ void logLevelWithServerId(ArangoDBAsync arangoDB) throws ExecutionException, Int @ParameterizedTest @MethodSource("asyncArangos") void resetLogLevels(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); LogLevelOptions options = new LogLevelOptions(); LogLevelEntity entity = new LogLevelEntity(); entity.setGraphs(LogLevelEntity.LogLevel.ERROR); @@ -626,7 +600,6 @@ void resetLogLevels(ArangoDBAsync arangoDB) throws ExecutionException, Interrupt @ParameterizedTest @MethodSource("asyncArangos") void resetLogLevelsWithServerId(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); assumeTrue(isCluster()); String serverId = arangoDB.getServerId().get(); LogLevelOptions options = new LogLevelOptions().serverId(serverId); @@ -644,7 +617,6 @@ void resetLogLevelsWithServerId(ArangoDBAsync arangoDB) throws ExecutionExceptio @ParameterizedTest @MethodSource("asyncArangos") void getQueryOptimizerRules(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); final Collection rules = arangoDB.getQueryOptimizerRules().get(); assertThat(rules).isNotEmpty(); for (QueryOptimizerRule rule : rules) { @@ -751,27 +723,22 @@ void queueTime(ArangoDBAsync arangoDB) throws InterruptedException, ExecutionExc QueueTimeMetrics qt = arangoDB.metrics().getQueueTime(); double avg = qt.getAvg(); QueueTimeSample[] values = qt.getValues(); - if (isAtLeastVersion(3, 9)) { - assertThat(values).hasSize(20); - for (int i = 0; i < values.length; i++) { - assertThat(values[i].value).isNotNegative(); - if (i > 0) { - assertThat(values[i].timestamp).isGreaterThanOrEqualTo(values[i - 1].timestamp); - } + assertThat(values).hasSize(20); + for (int i = 0; i < values.length; i++) { + assertThat(values[i].value).isNotNegative(); + if (i > 0) { + assertThat(values[i].timestamp).isGreaterThanOrEqualTo(values[i - 1].timestamp); } + } - if (avg < 0.0) { - System.err.println("avg < 0: " + avg); - System.err.println("got values:"); - for (QueueTimeSample v : values) { - System.err.println(v.value); - } + if (avg < 0.0) { + System.err.println("avg < 0: " + avg); + System.err.println("got values:"); + for (QueueTimeSample v : values) { + System.err.println(v.value); } - assertThat(avg).isNotNegative(); - } else { - assertThat(avg).isEqualTo(0.0); - assertThat(values).isEmpty(); } + assertThat(avg).isNotNegative(); } } diff --git a/test-functional/src/test/java/com/arangodb/ArangoDBTest.java b/test-functional/src/test/java/com/arangodb/ArangoDBTest.java index f15cd6097..969bcf152 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoDBTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoDBTest.java @@ -26,6 +26,7 @@ import com.arangodb.internal.serde.SerdeUtils; import com.arangodb.model.*; import com.arangodb.model.LogOptions.SortOrder; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.RawJson; import com.arangodb.util.SlowTest; import com.arangodb.util.UnicodeUtils; @@ -36,7 +37,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; import java.time.LocalDateTime; @@ -119,7 +119,6 @@ void createWithNotNormalizedName(ArangoDB arangoDB) { @MethodSource("arangos") void createDatabaseWithOptions(ArangoDB arangoDB) { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 6)); final String dbName = rndDbName(); final Boolean resultCreate = arangoDB.createDatabase(new DBCreateOptions() .name(dbName) @@ -145,8 +144,6 @@ void createDatabaseWithOptions(ArangoDB arangoDB) { @MethodSource("arangos") void createDatabaseWithOptionsSatellite(ArangoDB arangoDB) { assumeTrue(isCluster()); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 6)); final String dbName = rndDbName(); final Boolean resultCreate = arangoDB.createDatabase(new DBCreateOptions() @@ -197,9 +194,6 @@ void createDatabaseWithUsers(ArangoDB arangoDB) throws InterruptedException { assertThat(retrievedUser.getActive()).isTrue(); assertThat(retrievedUser.getExtra()).isEqualTo(extra); - // needed for active-failover tests only - Thread.sleep(2_000); - ArangoDB arangoDBTestUser = new ArangoDB.Builder() .loadProperties(config) .user("testUser") @@ -390,10 +384,8 @@ void updateUserDefaultCollectionAccess(ArangoDB arangoDB) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticationFailPassword(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - final ArangoDB arangoDB = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) @@ -405,10 +397,8 @@ void authenticationFailPassword(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticationFailUser(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - final ArangoDB arangoDB = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) @@ -433,10 +423,8 @@ void executeGetVersion(ArangoDB arangoDB) { assertThat(body.get("version").isTextual()).isTrue(); assertThat(body.get("details").isObject()).isTrue(); assertThat(response.getResponseCode()).isEqualTo(200); - if (isAtLeastVersion(3, 9)) { - String header = response.getHeaders().get("x-arango-queue-time-seconds"); - assertThat(header).isNotNull(); - } + String header = response.getHeaders().get("x-arango-queue-time-seconds"); + assertThat(header).isNotNull(); } @ParameterizedTest @@ -457,7 +445,6 @@ void executeJS(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntries(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null); assertThat(logs.getTotal()).isPositive(); assertThat(logs.getMessages()).hasSize(logs.getTotal().intValue()); @@ -466,7 +453,6 @@ void getLogEntries(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesUpto(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logsUpto = arangoDB.getLogEntries(new LogOptions().upto(LogLevel.WARNING)); assertThat(logsUpto.getMessages()) .map(LogEntriesEntity.Message::getLevel) @@ -476,7 +462,6 @@ void getLogEntriesUpto(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesLevel(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logsInfo = arangoDB.getLogEntries(new LogOptions().level(LogLevel.INFO)); assertThat(logsInfo.getMessages()) .map(LogEntriesEntity.Message::getLevel) @@ -486,7 +471,6 @@ void getLogEntriesLevel(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesStart(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null); final Long firstId = logs.getMessages().get(0).getId(); final LogEntriesEntity logsStart = arangoDB.getLogEntries(new LogOptions().start(firstId + 1)); @@ -498,7 +482,6 @@ void getLogEntriesStart(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesSize(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null); int count = logs.getMessages().size(); assertThat(count).isPositive(); @@ -509,7 +492,6 @@ void getLogEntriesSize(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesOffset(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null); assertThat(logs.getTotal()).isPositive(); Long firstId = logs.getMessages().get(0).getId(); @@ -522,7 +504,6 @@ void getLogEntriesOffset(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesSearch(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(null); final LogEntriesEntity logsSearch = arangoDB.getLogEntries(new LogOptions().search(getTestDb())); assertThat(logs.getTotal()).isGreaterThan(logsSearch.getTotal()); @@ -531,7 +512,6 @@ void getLogEntriesSearch(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesSortAsc(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(new LogOptions().sort(SortOrder.asc)); long lastId = -1; List ids = logs.getMessages().stream() @@ -546,7 +526,6 @@ void getLogEntriesSortAsc(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogEntriesSortDesc(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 8)); final LogEntriesEntity logs = arangoDB.getLogEntries(new LogOptions().sort(SortOrder.desc)); long lastId = Long.MAX_VALUE; List ids = logs.getMessages().stream() @@ -561,7 +540,6 @@ void getLogEntriesSortDesc(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getLogLevel(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362) final LogLevelEntity logLevel = arangoDB.getLogLevel(); assertThat(logLevel.getAgency()).isEqualTo(LogLevelEntity.LogLevel.INFO); } @@ -569,7 +547,6 @@ void getLogLevel(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void setLogLevel(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 7)); // it fails in 3.6 active-failover (BTS-362) final LogLevelEntity entity = new LogLevelEntity(); try { entity.setAgency(LogLevelEntity.LogLevel.ERROR); @@ -584,7 +561,6 @@ void setLogLevel(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void setAllLogLevel(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 12)); final LogLevelEntity entity = new LogLevelEntity(); try { entity.setAll(LogLevelEntity.LogLevel.ERROR); @@ -604,7 +580,6 @@ void setAllLogLevel(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void logLevelWithServerId(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 10)); assumeTrue(isCluster()); String serverId = arangoDB.getServerId(); LogLevelOptions options = new LogLevelOptions().serverId(serverId); @@ -623,7 +598,6 @@ void logLevelWithServerId(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void resetLogLevels(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 12)); LogLevelOptions options = new LogLevelOptions(); LogLevelEntity entity = new LogLevelEntity(); entity.setGraphs(LogLevelEntity.LogLevel.ERROR); @@ -638,7 +612,6 @@ void resetLogLevels(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void resetLogLevelsWithServerId(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 12)); assumeTrue(isCluster()); String serverId = arangoDB.getServerId(); LogLevelOptions options = new LogLevelOptions().serverId(serverId); @@ -656,7 +629,6 @@ void resetLogLevelsWithServerId(ArangoDB arangoDB) { @ParameterizedTest @MethodSource("arangos") void getQueryOptimizerRules(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 10)); final Collection rules = arangoDB.getQueryOptimizerRules(); assertThat(rules).isNotEmpty(); for (QueryOptimizerRule rule : rules) { @@ -775,27 +747,22 @@ void queueTime(ArangoDB arangoDB) throws InterruptedException, ExecutionExceptio QueueTimeMetrics qt = arangoDB.metrics().getQueueTime(); double avg = qt.getAvg(); QueueTimeSample[] values = qt.getValues(); - if (isAtLeastVersion(3, 9)) { - assertThat(values).hasSize(20); - for (int i = 0; i < values.length; i++) { - assertThat(values[i].value).isNotNegative(); - if (i > 0) { - assertThat(values[i].timestamp).isGreaterThanOrEqualTo(values[i - 1].timestamp); - } + assertThat(values).hasSize(20); + for (int i = 0; i < values.length; i++) { + assertThat(values[i].value).isNotNegative(); + if (i > 0) { + assertThat(values[i].timestamp).isGreaterThanOrEqualTo(values[i - 1].timestamp); } + } - if (avg < 0.0) { - System.err.println("avg < 0: " + avg); - System.err.println("got values:"); - for (QueueTimeSample v : values) { - System.err.println(v.value); - } + if (avg < 0.0) { + System.err.println("avg < 0: " + avg); + System.err.println("got values:"); + for (QueueTimeSample v : values) { + System.err.println(v.value); } - assertThat(avg).isNotNegative(); - } else { - assertThat(avg).isEqualTo(0.0); - assertThat(values).isEmpty(); } + assertThat(avg).isNotNegative(); } @ParameterizedTest diff --git a/test-functional/src/test/java/com/arangodb/ArangoDatabaseAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoDatabaseAsyncTest.java index d96a36cd5..55bb857a3 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoDatabaseAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoDatabaseAsyncTest.java @@ -130,7 +130,6 @@ void createCollectionWithReplicationFactor(ArangoDatabaseAsync db) throws Execut @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithWriteConcern(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); assumeTrue(isCluster()); String name = rndName(); @@ -146,7 +145,6 @@ void createCollectionWithWriteConcern(ArangoDatabaseAsync db) throws ExecutionEx @ParameterizedTest @MethodSource("asyncDbs") void createSatelliteCollection(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String name = rndName(); @@ -176,7 +174,6 @@ void createCollectionWithNumberOfShards(ArangoDatabaseAsync db) throws Execution @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithShardingStrategys(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); assumeTrue(isCluster()); String name = rndName(); @@ -192,8 +189,6 @@ void createCollectionWithShardingStrategys(ArangoDatabaseAsync db) throws Execut @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithSmartJoinAttribute(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String fooName = rndName(); @@ -210,8 +205,6 @@ void createCollectionWithSmartJoinAttribute(ArangoDatabaseAsync db) throws Execu @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithSmartJoinAttributeWrong(ArangoDatabaseAsync db) { - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String name = rndName(); @@ -254,7 +247,6 @@ void createCollectionWithNumberOfShardsAndShardKeys(ArangoDatabaseAsync db) thro @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithDistributeShardsLike(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); assumeTrue(isCluster()); final Integer numberOfShards = 3; @@ -289,7 +281,6 @@ void createCollectionWithKeyTypeAutoincrement(ArangoDatabaseAsync db) throws Exe @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithKeyTypePadded(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); createCollectionWithKeyType(db, KeyType.padded); } @@ -302,14 +293,12 @@ void createCollectionWithKeyTypeTraditional(ArangoDatabaseAsync db) throws Execu @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithKeyTypeUuid(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); createCollectionWithKeyType(db, KeyType.uuid); } @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithJsonSchema(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); String name = rndName(); String rule = ("{ " + " \"properties\": {" + @@ -357,7 +346,6 @@ void createCollectionWithJsonSchema(ArangoDatabaseAsync db) throws ExecutionExce @ParameterizedTest @MethodSource("asyncDbs") void createCollectionWithComputedFields(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String cName = rndName(); ComputedValue cv = new ComputedValue() .name("foo") @@ -658,10 +646,8 @@ void queryStats(ArangoDatabaseAsync db) throws ExecutionException, InterruptedEx assertThat(cursor.getExtra().getStats().getExecutionTime()).isNotNull(); assertThat(cursor.getExtra().getStats().getPeakMemoryUsage()).isNotNull(); assertThat(cursor.getExtra().getStats().getIntermediateCommits()).isNotNull(); - if (isAtLeastVersion(3, 12)) { - assertThat(cursor.getExtra().getStats().getDocumentLookups()).isNotNull(); - assertThat(cursor.getExtra().getStats().getSeeks()).isNotNull(); - } + assertThat(cursor.getExtra().getStats().getDocumentLookups()).isNotNull(); + assertThat(cursor.getExtra().getStats().getSeeks()).isNotNull(); } @ParameterizedTest @@ -787,7 +773,6 @@ void queryWithFailOnWarningFalse(ArangoDatabaseAsync db) throws ExecutionExcepti @ParameterizedTest @MethodSource("asyncDbs") void queryWithTimeout(ArangoDatabaseAsync db) { - assumeTrue(isAtLeastVersion(3, 6)); Throwable thrown = catchThrowable(() -> db.query("RETURN SLEEP(1)", String.class, new AqlQueryOptions().maxRuntime(0.1)).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -846,7 +831,6 @@ void queryCursorInTx(ArangoDatabaseAsync db) throws ExecutionException, Interrup @ParameterizedTest @MethodSource("asyncDbs") void queryCursorRetry(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); ArangoCursorAsync c1 = db.query("for i in 1..4 return i", Integer.class, new AqlQueryOptions().batchSize(1).allowRetry(true)).get(); List result = new ArrayList<>(); @@ -865,7 +849,6 @@ void queryCursorRetry(ArangoDatabaseAsync db) throws ExecutionException, Interru @ParameterizedTest @MethodSource("asyncDbs") void queryCursorRetryInTx(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); StreamTransactionEntity tx = db.beginStreamTransaction(new StreamTransactionOptions()).get(); ArangoCursorAsync c1 = db.query("for i in 1..4 return i", Integer.class, new AqlQueryOptions().batchSize(1).allowRetry(true).streamTransactionId(tx.getId())).get(); @@ -962,9 +945,7 @@ void queryStream(ArangoDatabaseAsync db) throws ExecutionException, InterruptedE @ParameterizedTest @MethodSource("asyncDbs") void queryForceOneShardAttributeValue(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); assumeTrue(isCluster()); - assumeTrue(isEnterprise()); String cname = "forceOneShardAttr-" + UUID.randomUUID(); db.createCollection(cname, new CollectionCreateOptions() @@ -1043,7 +1024,6 @@ BaseDocument.class, new MapBuilder().put("@col", CNAME1).put("test", null).get() @ParameterizedTest @MethodSource("asyncArangos") void queryAllowRetry(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursorAsync cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)).get(); assertThat(cursor.getResult()).containsExactly("1"); @@ -1061,7 +1041,6 @@ void queryAllowRetry(ArangoDBAsync arangoDB) throws ExecutionException, Interrup @ParameterizedTest @MethodSource("asyncArangos") void queryAllowRetryClose(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursorAsync cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)).get(); assertThat(cursor.getResult()).containsExactly("1"); @@ -1075,7 +1054,6 @@ void queryAllowRetryClose(ArangoDBAsync arangoDB) throws ExecutionException, Int @ParameterizedTest @MethodSource("asyncArangos") void queryAllowRetryCloseBeforeLatestBatch(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursorAsync cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)).get(); assertThat(cursor.getResult()).containsExactly("1"); @@ -1086,7 +1064,6 @@ void queryAllowRetryCloseBeforeLatestBatch(ArangoDBAsync arangoDB) throws Execut @ParameterizedTest @MethodSource("asyncArangos") void queryAllowRetryCloseSingleBatch(ArangoDBAsync arangoDB) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursorAsync cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true)).get(); assertThat(cursor.getResult()).containsExactly("1", "2"); @@ -1112,88 +1089,8 @@ private String getExplainQuery(ArangoDatabaseAsync db) throws ExecutionException " RETURN {`character`, `actor`}"; } - void checkExecutionPlan(AqlExecutionExplainEntity.ExecutionPlan plan) { - assertThat(plan).isNotNull(); - assertThat(plan.getEstimatedNrItems()) - .isNotNull() - .isNotNegative(); - assertThat(plan.getNodes()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionNode node = plan.getNodes().iterator().next(); - assertThat(node.getEstimatedCost()).isNotNull(); - - assertThat(plan.getEstimatedCost()).isNotNull().isNotNegative(); - assertThat(plan.getCollections()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionCollection collection = plan.getCollections().iterator().next(); - assertThat(collection.getName()) - .isNotNull() - .isNotEmpty(); - - assertThat(plan.getRules()).isNotEmpty(); - assertThat(plan.getVariables()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionVariable variable = plan.getVariables().iterator().next(); - assertThat(variable.getName()) - .isNotNull() - .isNotEmpty(); - } - - @SuppressWarnings("deprecation") - @ParameterizedTest - @MethodSource("asyncDbs") - void explainQuery(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - AqlExecutionExplainEntity explain = db.explainQuery( - getExplainQuery(db), - Collections.singletonMap("myId", "123"), - new AqlQueryExplainOptions()).get(); - assertThat(explain).isNotNull(); - - checkExecutionPlan(explain.getPlan()); - assertThat(explain.getPlans()).isNull(); - assertThat(explain.getWarnings()).isNotEmpty(); - - CursorWarning warning = explain.getWarnings().iterator().next(); - assertThat(warning).isNotNull(); - assertThat(warning.getCode()).isEqualTo(1562); - assertThat(warning.getMessage()).contains("division by zero"); - - assertThat(explain.getStats()).isNotNull(); - - assertThat(explain.getStats().getExecutionTime()) - .isNotNull() - .isPositive(); - - assertThat(explain.getCacheable()).isFalse(); - } - - @SuppressWarnings("deprecation") - @ParameterizedTest - @MethodSource("asyncDbs") - void explainQueryAllPlans(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - AqlExecutionExplainEntity explain = db.explainQuery( - getExplainQuery(db), - Collections.singletonMap("myId", "123"), - new AqlQueryExplainOptions().allPlans(true)).get(); - assertThat(explain).isNotNull(); - assertThat(explain.getPlan()).isNull(); - assertThat(explain.getPlans()).allSatisfy(this::checkExecutionPlan); - assertThat(explain.getWarnings()).isNotEmpty(); - CursorWarning warning = explain.getWarnings().iterator().next(); - assertThat(warning).isNotNull(); - assertThat(warning.getCode()).isEqualTo(1562); - assertThat(warning.getMessage()).contains("division by zero"); - - assertThat(explain.getStats()).isNotNull(); - - assertThat(explain.getStats().getExecutionTime()) - .isNotNull() - .isPositive(); - - assertThat(explain.getCacheable()).isNull(); - } void checkUntypedExecutionPlan(AqlQueryExplainEntity.ExecutionPlan plan) { assertThat(plan).isNotNull(); @@ -1342,9 +1239,7 @@ void getCurrentlyRunningQueries(ArangoDatabaseAsync db) throws InterruptedExcept assertThat(queryEntity.getBindVars()).isEmpty(); assertThat(queryEntity.getStarted()).isInThePast(); assertThat(queryEntity.getRunTime()).isPositive(); - if (isAtLeastVersion(3, 11)) { - assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); - } + assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); assertThat(queryEntity.getState()).isEqualTo(QueryExecutionState.EXECUTING); assertThat(queryEntity.getStream()).isFalse(); q.get(); @@ -1398,9 +1293,7 @@ void getAndClearSlowQueries(ArangoDatabaseAsync db) throws ExecutionException, I assertThat(queryEntity.getBindVars()).isEmpty(); assertThat(queryEntity.getStarted()).isInThePast(); assertThat(queryEntity.getRunTime()).isPositive(); - if (isAtLeastVersion(3, 11)) { - assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); - } + assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); assertThat(queryEntity.getState()).isEqualTo(QueryExecutionState.FINISHED); assertThat(queryEntity.getStream()).isFalse(); @@ -1410,56 +1303,7 @@ void getAndClearSlowQueries(ArangoDatabaseAsync db) throws ExecutionException, I db.setQueryTrackingProperties(properties).get(); } - @ParameterizedTest - @MethodSource("asyncDbs") - void createGetDeleteAqlFunction(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final Collection aqlFunctionsInitial = db.getAqlFunctions(null).get(); - assertThat(aqlFunctionsInitial).isEmpty(); - try { - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit", - "function (celsius) { return celsius * 1.8 + 32; }", null).get(); - - final Collection aqlFunctions = db.getAqlFunctions(null).get(); - assertThat(aqlFunctions).hasSizeGreaterThan(aqlFunctionsInitial.size()); - } finally { - final Integer deleteCount = db.deleteAqlFunction("myfunctions::temperature::celsiustofahrenheit", null).get(); - // compatibility with ArangoDB < 3.4 - if (isAtLeastVersion(3, 4)) { - assertThat(deleteCount).isEqualTo(1); - } else { - assertThat(deleteCount).isNull(); - } - final Collection aqlFunctions = db.getAqlFunctions(null).get(); - assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); - } - } - - @ParameterizedTest - @MethodSource("asyncDbs") - void createGetDeleteAqlFunctionWithNamespace(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final Collection aqlFunctionsInitial = db.getAqlFunctions(null).get(); - assertThat(aqlFunctionsInitial).isEmpty(); - try { - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit1", - "function (celsius) { return celsius * 1.8 + 32; }", null).get(); - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit2", - "function (celsius) { return celsius * 1.8 + 32; }", null).get(); - } finally { - final Integer deleteCount = db - .deleteAqlFunction("myfunctions::temperature", new AqlFunctionDeleteOptions().group(true)).get(); - // compatibility with ArangoDB < 3.4 - if (isAtLeastVersion(3, 4)) { - assertThat(deleteCount).isEqualTo(2); - } else { - assertThat(deleteCount).isNull(); - } - final Collection aqlFunctions = db.getAqlFunctions(null).get(); - assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); - } - } @ParameterizedTest @MethodSource("asyncDbs") @@ -1472,9 +1316,7 @@ void createGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedE @ParameterizedTest @MethodSource("asyncDbs") void createGraphSatellite(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 7)); assumeTrue(isCluster()); - assumeTrue(isEnterprise()); String name = "graph-" + rnd(); final GraphEntity result = db.createGraph(name, null, new GraphCreateOptions().replicationFactor(ReplicationFactor.ofSatellite())).get(); @@ -1535,155 +1377,18 @@ void getGraphs(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExc assertThat(count).isEqualTo(1L); } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionString(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params("test"); - final RawJson result = db.transaction("function (params) {return params;}", RawJson.class, options).get(); - assertThat(result.get()).isEqualTo("\"test\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionNumber(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params(5); - final Integer result = db.transaction("function (params) {return params;}", Integer.class, options).get(); - assertThat(result).isEqualTo(5); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionJsonNode(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params(JsonNodeFactory.instance.textNode("test")); - final JsonNode result = db.transaction("function (params) {return params;}", JsonNode.class, options).get(); - assertThat(result.isTextual()).isTrue(); - assertThat(result.asText()).isEqualTo("test"); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionJsonObject(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - ObjectNode params = JsonNodeFactory.instance.objectNode().put("foo", "hello").put("bar", "world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params['foo'] + ' ' + params['bar'];}", RawJson.class, - options).get(); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionJsonArray(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - ArrayNode params = JsonNodeFactory.instance.arrayNode().add("hello").add("world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options).get(); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionMap(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final Map params = new MapBuilder().put("foo", "hello").put("bar", "world").get(); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params['foo'] + ' ' + params['bar'];}", RawJson.class, - options).get(); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionArray(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final String[] params = new String[]{"hello", "world"}; - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options).get(); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionCollection(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final Collection params = new ArrayList<>(); - params.add("hello"); - params.add("world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options).get(); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionInsertJson(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - String key = "key-" + rnd(); - final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") - .writeCollections(CNAME1); - db.transaction("function (params) { " - + "var db = require('internal').db;" - + "db." + CNAME1 + ".save(JSON.parse(params));" - + "}", Void.class, options).get(); - assertThat(db.collection(CNAME1).getDocument(key, RawJson.class).get()).isNotNull(); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionExclusiveWrite(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); - assumeTrue(supportsV8()); - String key = "key-" + rnd(); - final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") - .exclusiveCollections(CNAME1); - db.transaction("function (params) { " - + "var db = require('internal').db;" - + "db." + CNAME1 + ".save(JSON.parse(params));" - + "}", Void.class, options).get(); - assertThat(db.collection(CNAME1).getDocument(key, RawJson.class).get()).isNotNull(); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionEmpty(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - db.transaction("function () {}", Void.class, null).get(); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionAllowImplicit(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final String action = "function (params) {" + "var db = require('internal').db;" - + "return {'a':db." + CNAME1 + ".all().toArray()[0], 'b':db." + CNAME2 + ".all().toArray()[0]};" - + "}"; - final TransactionOptions options = new TransactionOptions().readCollections(CNAME1); - db.transaction(action, JsonNode.class, options).get(); - options.allowImplicit(false); - Throwable thrown = catchThrowable(() -> db.transaction(action, JsonNode.class, options).get()).getCause(); - assertThat(thrown) - .isInstanceOf(ArangoDBException.class) - .extracting(it -> ((ArangoDBException) it).getResponseCode()) - .isEqualTo(400); - } - @ParameterizedTest - @MethodSource("asyncDbs") - void transactionPojoReturn(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(supportsV8()); - final String action = "function() { return {'value':'hello world'}; }"; - final TransactionTestEntity res = db.transaction(action, TransactionTestEntity.class, new TransactionOptions()).get(); - assertThat(res).isNotNull(); - assertThat(res.value).isEqualTo("hello world"); - } @ParameterizedTest @MethodSource("asyncDbs") @@ -1695,41 +1400,13 @@ void getInfo(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcep assertThat(info.getPath()).isNotNull(); assertThat(info.getIsSystem()).isFalse(); - if (isAtLeastVersion(3, 6) && isCluster()) { + if (isCluster()) { assertThat(info.getSharding()).isNotNull(); assertThat(info.getWriteConcern()).isNotNull(); assertThat(info.getReplicationFactor()).isNotNull(); } } - @ParameterizedTest - @MethodSource("asyncDbs") - void shouldIncludeExceptionMessage(ArangoDatabaseAsync db) { - assumeTrue(isAtLeastVersion(3, 4)); - assumeTrue(supportsV8()); - - final String exceptionMessage = "My error context"; - final String action = "function (params) {" + "throw '" + exceptionMessage + "';" + "}"; - Throwable thrown = catchThrowable(() -> db.transaction(action, Void.class, null).get()).getCause(); - assertThat(thrown).isInstanceOf(ArangoDBException.class); - assertThat(((ArangoDBException) thrown).getErrorMessage()).isEqualTo(exceptionMessage); - } - - @ParameterizedTest - @MethodSource("asyncDbs") - void reloadRouting(ArangoDatabaseAsync db) { - db.reloadRouting(); - } - - public static class TransactionTestEntity { - private String value; - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - } } diff --git a/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java b/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java index b7b770ce5..20d574b8f 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java @@ -134,7 +134,6 @@ void createCollectionWithReplicationFactor(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithWriteConcern(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); assumeTrue(isCluster()); String name = rndName(); @@ -150,7 +149,6 @@ void createCollectionWithWriteConcern(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createSatelliteCollection(ArangoDatabase db) { - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String name = rndName(); @@ -180,7 +178,6 @@ void createCollectionWithNumberOfShards(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithShardingStrategys(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); assumeTrue(isCluster()); String name = rndName(); @@ -196,8 +193,6 @@ void createCollectionWithShardingStrategys(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithSmartJoinAttribute(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String fooName = rndName(); @@ -214,8 +209,6 @@ void createCollectionWithSmartJoinAttribute(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithSmartJoinAttributeWrong(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isEnterprise()); assumeTrue(isCluster()); String name = rndName(); @@ -260,7 +253,6 @@ void createCollectionWithNumberOfShardsAndShardKeys(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithDistributeShardsLike(ArangoDatabase db) { - assumeTrue(isEnterprise()); assumeTrue(isCluster()); final Integer numberOfShards = 3; @@ -295,7 +287,6 @@ void createCollectionWithKeyTypeAutoincrement(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithKeyTypePadded(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); createCollectionWithKeyType(db, KeyType.padded); } @@ -308,14 +299,12 @@ void createCollectionWithKeyTypeTraditional(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithKeyTypeUuid(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); createCollectionWithKeyType(db, KeyType.uuid); } @ParameterizedTest @MethodSource("dbs") void createCollectionWithJsonSchema(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 7)); String name = rndName(); String rule = ("{ " + " \"properties\": {" + @@ -363,7 +352,6 @@ void createCollectionWithJsonSchema(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createCollectionWithComputedFields(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String cName = rndName(); ComputedValue cv = new ComputedValue() .name("foo") @@ -715,10 +703,8 @@ void queryStats(ArangoDatabase db) { assertThat(cursor.getStats().getCacheHits()).isNotNull(); assertThat(cursor.getStats().getCacheMisses()).isNotNull(); assertThat(cursor.getStats().getIntermediateCommits()).isNotNull(); - if (isAtLeastVersion(3, 12)) { - assertThat(cursor.getStats().getDocumentLookups()).isNotNull(); - assertThat(cursor.getStats().getSeeks()).isNotNull(); - } + assertThat(cursor.getStats().getDocumentLookups()).isNotNull(); + assertThat(cursor.getStats().getSeeks()).isNotNull(); } @ParameterizedTest @@ -910,7 +896,6 @@ void queryWithFailOnWarningFalse(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void queryWithTimeout(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 6)); Throwable thrown = catchThrowable(() -> db.query("RETURN SLEEP(1)", String.class, new AqlQueryOptions().maxRuntime(0.1)).next()); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -966,7 +951,6 @@ void queryCursorInTx(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void queryCursorRetry(ArangoDatabase db) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); ArangoCursor cursor = db.query("for i in 1..4 return i", Integer.class, new AqlQueryOptions().batchSize(1).allowRetry(true)); List result = new ArrayList<>(); @@ -983,7 +967,6 @@ void queryCursorRetry(ArangoDatabase db) throws IOException { @ParameterizedTest @MethodSource("dbs") void queryCursorRetryInTx(ArangoDatabase db) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); StreamTransactionEntity tx = db.beginStreamTransaction(new StreamTransactionOptions()); ArangoCursor cursor = db.query("for i in 1..4 return i", Integer.class, new AqlQueryOptions().batchSize(1).allowRetry(true).streamTransactionId(tx.getId())); @@ -1081,9 +1064,7 @@ void queryStream(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void queryForceOneShardAttributeValue(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); assumeTrue(isCluster()); - assumeTrue(isEnterprise()); String cname = "forceOneShardAttr-" + UUID.randomUUID(); db.createCollection(cname, new CollectionCreateOptions() @@ -1163,16 +1144,13 @@ void queryAllowDirtyRead(ArangoDatabase db) throws IOException { final ArangoCursor cursor = db.query("FOR i IN @@col FILTER i.test == @test RETURN i", BaseDocument.class, new MapBuilder().put("@col", CNAME1).put("test", null).get(), new AqlQueryOptions().allowDirtyRead(true)); - if (isAtLeastVersion(3, 10)) { - assertThat(cursor.isPotentialDirtyRead()).isTrue(); - } + assertThat(cursor.isPotentialDirtyRead()).isTrue(); cursor.close(); } @ParameterizedTest @MethodSource("arangos") void queryAllowRetry(ArangoDB arangoDB) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursor cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)); assertThat(cursor.asListRemaining()).containsExactly("1", "2"); @@ -1181,7 +1159,6 @@ void queryAllowRetry(ArangoDB arangoDB) throws IOException { @ParameterizedTest @MethodSource("arangos") void queryAllowRetryClose(ArangoDB arangoDB) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursor cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)); assertThat(cursor.hasNext()).isTrue(); @@ -1195,7 +1172,6 @@ void queryAllowRetryClose(ArangoDB arangoDB) throws IOException { @ParameterizedTest @MethodSource("arangos") void queryAllowRetryCloseBeforeLatestBatch(ArangoDB arangoDB) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursor cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true).batchSize(1)); assertThat(cursor.hasNext()).isTrue(); @@ -1207,7 +1183,6 @@ void queryAllowRetryCloseBeforeLatestBatch(ArangoDB arangoDB) throws IOException @ParameterizedTest @MethodSource("arangos") void queryAllowRetryCloseSingleBatch(ArangoDB arangoDB) throws IOException { - assumeTrue(isAtLeastVersion(3, 11)); final ArangoCursor cursor = arangoDB.db() .query("for i in 1..2 return i", String.class, new AqlQueryOptions().allowRetry(true)); assertThat(cursor.hasNext()).isTrue(); @@ -1218,6 +1193,10 @@ void queryAllowRetryCloseSingleBatch(ArangoDB arangoDB) throws IOException { cursor.close(); } + + + + private String getExplainQuery(ArangoDatabase db) { ArangoCollection character = db.collection("got_characters"); ArangoCollection actor = db.collection("got_actors"); @@ -1236,89 +1215,6 @@ private String getExplainQuery(ArangoDatabase db) { " RETURN {`character`, `actor`}"; } - void checkExecutionPlan(AqlExecutionExplainEntity.ExecutionPlan plan) { - assertThat(plan).isNotNull(); - assertThat(plan.getEstimatedNrItems()) - .isNotNull() - .isNotNegative(); - assertThat(plan.getNodes()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionNode node = plan.getNodes().iterator().next(); - assertThat(node.getEstimatedCost()).isNotNull(); - - assertThat(plan.getEstimatedCost()).isNotNull().isNotNegative(); - assertThat(plan.getCollections()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionCollection collection = plan.getCollections().iterator().next(); - assertThat(collection.getName()) - .isNotNull() - .isNotEmpty(); - - assertThat(plan.getRules()).isNotEmpty(); - assertThat(plan.getVariables()).isNotEmpty(); - - AqlExecutionExplainEntity.ExecutionVariable variable = plan.getVariables().iterator().next(); - assertThat(variable.getName()) - .isNotNull() - .isNotEmpty(); - } - - @SuppressWarnings("deprecation") - @ParameterizedTest - @MethodSource("dbs") - void explainQuery(ArangoDatabase db) { - AqlExecutionExplainEntity explain = db.explainQuery( - getExplainQuery(db), - Collections.singletonMap("myId", "123"), - new AqlQueryExplainOptions()); - assertThat(explain).isNotNull(); - - checkExecutionPlan(explain.getPlan()); - assertThat(explain.getPlans()).isNull(); - assertThat(explain.getWarnings()).isNotEmpty(); - - CursorWarning warning = explain.getWarnings().iterator().next(); - assertThat(warning).isNotNull(); - assertThat(warning.getCode()).isEqualTo(1562); - assertThat(warning.getMessage()).contains("division by zero"); - - assertThat(explain.getStats()).isNotNull(); - - assertThat(explain.getStats().getExecutionTime()) - .isNotNull() - .isPositive(); - - assertThat(explain.getCacheable()).isFalse(); - } - - @SuppressWarnings("deprecation") - @ParameterizedTest - @MethodSource("dbs") - void explainQueryAllPlans(ArangoDatabase db) { - AqlExecutionExplainEntity explain = db.explainQuery( - getExplainQuery(db), - Collections.singletonMap("myId", "123"), - new AqlQueryExplainOptions().allPlans(true)); - assertThat(explain).isNotNull(); - - assertThat(explain.getPlan()).isNull(); - assertThat(explain.getPlans()).allSatisfy(this::checkExecutionPlan); - assertThat(explain.getWarnings()).isNotEmpty(); - - CursorWarning warning = explain.getWarnings().iterator().next(); - assertThat(warning).isNotNull(); - assertThat(warning.getCode()).isEqualTo(1562); - assertThat(warning.getMessage()).contains("division by zero"); - - assertThat(explain.getStats()).isNotNull(); - - assertThat(explain.getStats().getExecutionTime()) - .isNotNull() - .isPositive(); - - assertThat(explain.getCacheable()).isNull(); - } - void checkUntypedExecutionPlan(AqlQueryExplainEntity.ExecutionPlan plan) { assertThat(plan).isNotNull(); assertThat(plan.get("estimatedNrItems")) @@ -1467,9 +1363,7 @@ void getCurrentlyRunningQueries(ArangoDatabase db) throws InterruptedException { assertThat(queryEntity.getBindVars()).isEmpty(); assertThat(queryEntity.getStarted()).isInThePast(); assertThat(queryEntity.getRunTime()).isPositive(); - if (isAtLeastVersion(3, 11)) { - assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); - } + assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); assertThat(queryEntity.getState()).isEqualTo(QueryExecutionState.EXECUTING); assertThat(queryEntity.getStream()).isFalse(); t.join(); @@ -1529,9 +1423,7 @@ void getAndClearSlowQueries(ArangoDatabase db) { assertThat(queryEntity.getBindVars()).isEmpty(); assertThat(queryEntity.getStarted()).isInThePast(); assertThat(queryEntity.getRunTime()).isPositive(); - if (isAtLeastVersion(3, 11)) { - assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); - } + assertThat(queryEntity.getPeakMemoryUsage()).isNotNull(); assertThat(queryEntity.getState()).isEqualTo(QueryExecutionState.FINISHED); assertThat(queryEntity.getStream()).isFalse(); @@ -1541,56 +1433,7 @@ void getAndClearSlowQueries(ArangoDatabase db) { db.setQueryTrackingProperties(properties); } - @ParameterizedTest - @MethodSource("dbs") - void createGetDeleteAqlFunction(ArangoDatabase db) { - assumeTrue(supportsV8()); - final Collection aqlFunctionsInitial = db.getAqlFunctions(null); - assertThat(aqlFunctionsInitial).isEmpty(); - try { - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit", - "function (celsius) { return celsius * 1.8 + 32; }", null); - - final Collection aqlFunctions = db.getAqlFunctions(null); - assertThat(aqlFunctions).hasSizeGreaterThan(aqlFunctionsInitial.size()); - } finally { - final Integer deleteCount = db.deleteAqlFunction("myfunctions::temperature::celsiustofahrenheit", null); - // compatibility with ArangoDB < 3.4 - if (isAtLeastVersion(3, 4)) { - assertThat(deleteCount).isEqualTo(1); - } else { - assertThat(deleteCount).isNull(); - } - final Collection aqlFunctions = db.getAqlFunctions(null); - assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); - } - } - - @ParameterizedTest - @MethodSource("dbs") - void createGetDeleteAqlFunctionWithNamespace(ArangoDatabase db) { - assumeTrue(supportsV8()); - final Collection aqlFunctionsInitial = db.getAqlFunctions(null); - assertThat(aqlFunctionsInitial).isEmpty(); - try { - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit1", - "function (celsius) { return celsius * 1.8 + 32; }", null); - db.createAqlFunction("myfunctions::temperature::celsiustofahrenheit2", - "function (celsius) { return celsius * 1.8 + 32; }", null); - } finally { - final Integer deleteCount = db - .deleteAqlFunction("myfunctions::temperature", new AqlFunctionDeleteOptions().group(true)); - // compatibility with ArangoDB < 3.4 - if (isAtLeastVersion(3, 4)) { - assertThat(deleteCount).isEqualTo(2); - } else { - assertThat(deleteCount).isNull(); - } - final Collection aqlFunctions = db.getAqlFunctions(null); - assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); - } - } @ParameterizedTest @MethodSource("dbs") @@ -1603,9 +1446,7 @@ void createGraph(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createGraphSatellite(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 7)); assumeTrue(isCluster()); - assumeTrue(isEnterprise()); String name = "graph-" + rnd(); final GraphEntity result = db.createGraph(name, null, new GraphCreateOptions().replicationFactor(ReplicationFactor.ofSatellite())); @@ -1666,155 +1507,18 @@ void getGraphs(ArangoDatabase db) { assertThat(count).isEqualTo(1L); } - @ParameterizedTest - @MethodSource("dbs") - void transactionString(ArangoDatabase db) { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params("test"); - final RawJson result = db.transaction("function (params) {return params;}", RawJson.class, options); - assertThat(result.get()).isEqualTo("\"test\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionNumber(ArangoDatabase db) { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params(5); - final Integer result = db.transaction("function (params) {return params;}", Integer.class, options); - assertThat(result).isEqualTo(5); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionJsonNode(ArangoDatabase db) { - assumeTrue(supportsV8()); - final TransactionOptions options = new TransactionOptions().params(JsonNodeFactory.instance.textNode("test")); - final JsonNode result = db.transaction("function (params) {return params;}", JsonNode.class, options); - assertThat(result.isTextual()).isTrue(); - assertThat(result.asText()).isEqualTo("test"); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionJsonObject(ArangoDatabase db) { - assumeTrue(supportsV8()); - ObjectNode params = JsonNodeFactory.instance.objectNode().put("foo", "hello").put("bar", "world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params['foo'] + ' ' + params['bar'];}", RawJson.class, - options); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionJsonArray(ArangoDatabase db) { - assumeTrue(supportsV8()); - ArrayNode params = JsonNodeFactory.instance.arrayNode().add("hello").add("world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionMap(ArangoDatabase db) { - assumeTrue(supportsV8()); - final Map params = new MapBuilder().put("foo", "hello").put("bar", "world").get(); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params['foo'] + ' ' + params['bar'];}", RawJson.class, - options); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionArray(ArangoDatabase db) { - assumeTrue(supportsV8()); - final String[] params = new String[]{"hello", "world"}; - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionCollection(ArangoDatabase db) { - assumeTrue(supportsV8()); - final Collection params = new ArrayList<>(); - params.add("hello"); - params.add("world"); - final TransactionOptions options = new TransactionOptions().params(params); - final RawJson result = db - .transaction("function (params) { return params[0] + ' ' + params[1];}", RawJson.class, options); - assertThat(result.get()).isEqualTo("\"hello world\""); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionInsertJson(ArangoDatabase db) { - assumeTrue(supportsV8()); - String key = "key-" + rnd(); - final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") - .writeCollections(CNAME1); - db.transaction("function (params) { " - + "var db = require('internal').db;" - + "db." + CNAME1 + ".save(JSON.parse(params));" - + "}", Void.class, options); - assertThat(db.collection(CNAME1).getDocument(key, RawJson.class)).isNotNull(); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionExclusiveWrite(ArangoDatabase db) { - assumeTrue(supportsV8()); - assumeTrue(isAtLeastVersion(3, 4)); - String key = "key-" + rnd(); - final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") - .exclusiveCollections(CNAME1); - db.transaction("function (params) { " - + "var db = require('internal').db;" - + "db." + CNAME1 + ".save(JSON.parse(params));" - + "}", Void.class, options); - assertThat(db.collection(CNAME1).getDocument(key, RawJson.class)).isNotNull(); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionEmpty(ArangoDatabase db) { - assumeTrue(supportsV8()); - db.transaction("function () {}", Void.class, null); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionAllowImplicit(ArangoDatabase db) { - assumeTrue(supportsV8()); - final String action = "function (params) {" + "var db = require('internal').db;" - + "return {'a':db." + CNAME1 + ".all().toArray()[0], 'b':db." + CNAME2 + ".all().toArray()[0]};" - + "}"; - final TransactionOptions options = new TransactionOptions().readCollections(CNAME1); - db.transaction(action, JsonNode.class, options); - options.allowImplicit(false); - Throwable thrown = catchThrowable(() -> db.transaction(action, JsonNode.class, options)); - assertThat(thrown) - .isInstanceOf(ArangoDBException.class) - .extracting(it -> ((ArangoDBException) it).getResponseCode()) - .isEqualTo(400); - } - @ParameterizedTest - @MethodSource("dbs") - void transactionPojoReturn(ArangoDatabase db) { - assumeTrue(supportsV8()); - final String action = "function() { return {'value':'hello world'}; }"; - final TransactionTestEntity res = db.transaction(action, TransactionTestEntity.class, new TransactionOptions()); - assertThat(res).isNotNull(); - assertThat(res.value).isEqualTo("hello world"); - } @ParameterizedTest @MethodSource("dbs") @@ -1826,45 +1530,13 @@ void getInfo(ArangoDatabase db) { assertThat(info.getPath()).isNotNull(); assertThat(info.getIsSystem()).isFalse(); - if (isAtLeastVersion(3, 6) && isCluster()) { + if (isCluster()) { assertThat(info.getSharding()).isNotNull(); assertThat(info.getWriteConcern()).isNotNull(); assertThat(info.getReplicationFactor()).isNotNull(); } } - @ParameterizedTest - @MethodSource("dbs") - void shouldIncludeExceptionMessage(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); - assumeTrue(supportsV8()); - - final String exceptionMessage = "My error context"; - final String action = "function (params) {" + "throw '" + exceptionMessage + "';" + "}"; - try { - db.transaction(action, Void.class, null); - fail(); - } catch (final ArangoDBException e) { - assertThat(e.getErrorMessage()).isEqualTo(exceptionMessage); - } - } - - @ParameterizedTest - @MethodSource("dbs") - void reloadRouting(ArangoDatabase db) { - assumeTrue(supportsV8()); - db.reloadRouting(); - } - public static class TransactionTestEntity { - private String value; - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } } diff --git a/test-functional/src/test/java/com/arangodb/ArangoGraphAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoGraphAsyncTest.java index ecda8505f..f1165b243 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoGraphAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoGraphAsyncTest.java @@ -96,7 +96,6 @@ void exists(ArangoGraphAsync graph) throws ExecutionException, InterruptedExcept @ParameterizedTest @MethodSource("asyncDbs") void createWithReplicationAndWriteConcern(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); assumeTrue(isCluster()); final Collection edgeDefinitions = new ArrayList<>(); @@ -171,10 +170,6 @@ void addVertexCollection(ArangoGraphAsync graph) throws ExecutionException, Inte @ParameterizedTest @MethodSource("asyncDbs") void addSatelliteVertexCollection(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 9)); - String v1Name = "vertex-" + rnd(); ArangoGraphAsync g = db.graph(GRAPH_NAME + rnd()); @@ -232,10 +227,6 @@ void addEdgeDefinition(ArangoGraphAsync graph) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void addSatelliteEdgeDefinition(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 9)); - String eName = "edge-" + rnd(); String v1Name = "vertex-" + rnd(); String v2Name = "vertex-" + rnd(); @@ -349,9 +340,6 @@ void removeEdgeDefinitionDropCollections(ArangoGraphAsync graph) throws Executio @ParameterizedTest @MethodSource("asyncDbs") void smartGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("smartGraph-edge-" + rnd()).from("smartGraph-vertex-" + rnd()).to("smartGraph-vertex-" + rnd())); @@ -368,10 +356,6 @@ void smartGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedEx @ParameterizedTest @MethodSource("asyncDbs") void hybridSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 9))); - final Collection edgeDefinitions = new ArrayList<>(); String eName = "hybridSmartGraph-edge-" + rnd(); String v1Name = "hybridSmartGraph-vertex-" + rnd(); @@ -396,10 +380,6 @@ void hybridSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, Interru @ParameterizedTest @MethodSource("asyncDbs") void disjointSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 7))); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("smartGraph-edge-" + rnd()).from("smartGraph-vertex-" + rnd()).to("smartGraph-vertex-" + rnd())); @@ -417,10 +397,6 @@ void disjointSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, Inter @ParameterizedTest @MethodSource("asyncDbs") void hybridDisjointSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 9))); - final Collection edgeDefinitions = new ArrayList<>(); String eName = "hybridDisjointSmartGraph-edge-" + rnd(); String v1Name = "hybridDisjointSmartGraph-vertex-" + rnd(); @@ -445,9 +421,6 @@ void hybridDisjointSmartGraph(ArangoDatabaseAsync db) throws ExecutionException, @ParameterizedTest @MethodSource("asyncDbs") void enterpriseGraph(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("enterpriseGraph-edge-" + rnd()).from("enterpriseGraph-vertex-" + rnd()).to("enterpriseGraph-vertex-" + rnd())); @@ -457,11 +430,7 @@ void enterpriseGraph(ArangoDatabaseAsync db) throws ExecutionException, Interrup assertThat(g).isNotNull(); assertThat(g.getSmartGraphAttribute()).isNull(); assertThat(g.getNumberOfShards()).isEqualTo(2); - if (isAtLeastVersion(3, 10)) { - assertThat(g.getIsSmart()).isTrue(); - } else { - assertThat(g.getIsSmart()).isFalse(); - } + assertThat(g.getIsSmart()).isTrue(); } @ParameterizedTest diff --git a/test-functional/src/test/java/com/arangodb/ArangoGraphTest.java b/test-functional/src/test/java/com/arangodb/ArangoGraphTest.java index 730db4e10..e8fa2a597 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoGraphTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoGraphTest.java @@ -92,7 +92,6 @@ void exists(ArangoGraph graph) { @ParameterizedTest @MethodSource("dbs") void createWithReplicationAndWriteConcern(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); assumeTrue(isCluster()); final Collection edgeDefinitions = new ArrayList<>(); @@ -167,10 +166,6 @@ void addVertexCollection(ArangoGraph graph) { @ParameterizedTest @MethodSource("dbs") void addSatelliteVertexCollection(ArangoDatabase db) { - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 9)); - String v1Name = "vertex-" + rnd(); ArangoGraph g = db.graph(GRAPH_NAME + rnd()); @@ -228,10 +223,6 @@ void addEdgeDefinition(ArangoGraph graph) { @ParameterizedTest @MethodSource("dbs") void addSatelliteEdgeDefinition(ArangoDatabase db) { - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 9)); - String eName = "edge-" + rnd(); String v1Name = "vertex-" + rnd(); String v2Name = "vertex-" + rnd(); @@ -286,7 +277,7 @@ void replaceEdgeDefinition(ArangoGraph graph) { @ParameterizedTest @MethodSource("graphs") @Disabled - // FIXME: with dropCollections=true the vertex collections remain in the graph as orphan and not dropped + // FIXME: with dropCollections=true the vertex collections remain in the graph as orphan and not dropped void replaceEdgeDefinitionDropCollections(ArangoGraph graph) { final GraphEntity g = graph .replaceEdgeDefinition(new EdgeDefinition().collection(EDGE_COL_1).from(VERTEX_COL_3).to(VERTEX_COL_4), @@ -345,9 +336,6 @@ void removeEdgeDefinitionDropCollections(ArangoGraph graph) { @ParameterizedTest @MethodSource("dbs") void smartGraph(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("smartGraph-edge-" + rnd()).from("smartGraph-vertex-" + rnd()).to("smartGraph-vertex-" + rnd())); @@ -364,10 +352,6 @@ void smartGraph(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void hybridSmartGraph(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 9))); - final Collection edgeDefinitions = new ArrayList<>(); String eName = "hybridSmartGraph-edge-" + rnd(); String v1Name = "hybridSmartGraph-vertex-" + rnd(); @@ -392,10 +376,6 @@ void hybridSmartGraph(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void disjointSmartGraph(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 7))); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("smartGraph-edge-" + rnd()).from("smartGraph-vertex-" + rnd()).to("smartGraph-vertex-" + rnd())); @@ -413,10 +393,6 @@ void disjointSmartGraph(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void hybridDisjointSmartGraph(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - assumeTrue((isAtLeastVersion(3, 9))); - final Collection edgeDefinitions = new ArrayList<>(); String eName = "hybridDisjointSmartGraph-edge-" + rnd(); String v1Name = "hybridDisjointSmartGraph-vertex-" + rnd(); @@ -441,9 +417,6 @@ void hybridDisjointSmartGraph(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void enterpriseGraph(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isCluster() || isAtLeastVersion(3, 10)); - final Collection edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection("enterpriseGraph-edge-" + rnd()).from("enterpriseGraph-vertex-" + rnd()).to("enterpriseGraph-vertex-" + rnd())); @@ -453,11 +426,7 @@ void enterpriseGraph(ArangoDatabase db) { assertThat(g).isNotNull(); assertThat(g.getSmartGraphAttribute()).isNull(); assertThat(g.getNumberOfShards()).isEqualTo(2); - if (isAtLeastVersion(3, 10)) { - assertThat(g.getIsSmart()).isTrue(); - } else { - assertThat(g.getIsSmart()).isFalse(); - } + assertThat(g.getIsSmart()).isTrue(); } @ParameterizedTest diff --git a/test-functional/src/test/java/com/arangodb/ArangoSearchAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoSearchAsyncTest.java index 0154f66c3..7a871cffa 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoSearchAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoSearchAsyncTest.java @@ -56,7 +56,6 @@ static void init() { @ParameterizedTest @MethodSource("asyncDbs") void exists(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()).get(); assertThat(db.arangoSearch(viewName).exists().get()).isTrue(); @@ -65,7 +64,6 @@ void exists(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcept @ParameterizedTest @MethodSource("asyncDbs") void createAndExistsSearchAlias(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); db.createSearchAlias(viewName, new SearchAliasCreateOptions()).get(); assertThat(db.arangoSearch(viewName).exists().get()).isTrue(); @@ -74,7 +72,6 @@ void createAndExistsSearchAlias(ArangoDatabaseAsync db) throws ExecutionExceptio @ParameterizedTest @MethodSource("asyncDbs") void getInfo(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()).get(); final ViewEntity info = db.arangoSearch(viewName).getInfo().get(); @@ -87,7 +84,6 @@ void getInfo(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcep @ParameterizedTest @MethodSource("asyncDbs") void drop(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()).get(); final ArangoSearchAsync view = db.arangoSearch(viewName); @@ -99,7 +95,6 @@ void drop(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExceptio @MethodSource("asyncDbs") void rename(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final String name = viewName + "_new"; db.createArangoSearch(name, new ArangoSearchCreateOptions()).get(); @@ -111,7 +106,6 @@ void rename(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcept @ParameterizedTest @MethodSource("asyncDbs") void createArangoSearchView(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ViewEntity info = db.arangoSearch(viewName).create().get(); assertThat(info).isNotNull(); @@ -124,7 +118,6 @@ void createArangoSearchView(ArangoDatabaseAsync db) throws ExecutionException, I @ParameterizedTest @MethodSource("asyncDbs") void createSearchAliasView(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); final ViewEntity info = db.searchAlias(viewName).create().get(); assertThat(info).isNotNull(); @@ -137,7 +130,6 @@ void createSearchAliasView(ArangoDatabaseAsync db) throws ExecutionException, In @ParameterizedTest @MethodSource("asyncDbs") void createArangoSearchViewWithOptions(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); final ViewEntity info = db.arangoSearch(viewName).create(options).get(); @@ -151,7 +143,6 @@ void createArangoSearchViewWithOptions(ArangoDatabaseAsync db) throws ExecutionE @ParameterizedTest @MethodSource("asyncDbs") void createArangoSearchViewWithPrimarySort(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); @@ -172,23 +163,20 @@ void createArangoSearchViewWithPrimarySort(ArangoDatabaseAsync db) throws Execut assertThat(info.getType()).isEqualTo(ViewType.ARANGO_SEARCH); assertThat(db.arangoSearch(viewName).exists().get()).isTrue(); - if (isAtLeastVersion(3, 7)) { - final ArangoSearchPropertiesEntity properties = view.getProperties().get(); - assertThat(properties.getPrimarySortCompression()).isEqualTo(ArangoSearchCompression.none); - Collection retrievedStoredValues = properties.getStoredValues(); - assertThat(retrievedStoredValues).isNotNull(); - assertThat(retrievedStoredValues).hasSize(1); - StoredValue retrievedStoredValue = retrievedStoredValues.iterator().next(); - assertThat(retrievedStoredValue).isNotNull(); - assertThat(retrievedStoredValue.getFields()).isEqualTo(storedValue.getFields()); - assertThat(retrievedStoredValue.getCompression()).isEqualTo(storedValue.getCompression()); - } + final ArangoSearchPropertiesEntity properties = view.getProperties().get(); + assertThat(properties.getPrimarySortCompression()).isEqualTo(ArangoSearchCompression.none); + Collection retrievedStoredValues = properties.getStoredValues(); + assertThat(retrievedStoredValues).isNotNull(); + assertThat(retrievedStoredValues).hasSize(1); + StoredValue retrievedStoredValue = retrievedStoredValues.iterator().next(); + assertThat(retrievedStoredValue).isNotNull(); + assertThat(retrievedStoredValue.getFields()).isEqualTo(storedValue.getFields()); + assertThat(retrievedStoredValue.getCompression()).isEqualTo(storedValue.getCompression()); } @ParameterizedTest @MethodSource("asyncDbs") void createArangoSearchViewWithCommitIntervalMsec(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); options.commitIntervalMsec(666666L); @@ -209,7 +197,6 @@ void createArangoSearchViewWithCommitIntervalMsec(ArangoDatabaseAsync db) throws @ParameterizedTest @MethodSource("asyncDbs") void createSearchAliasViewWithOptions(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); final SearchAliasCreateOptions options = new SearchAliasCreateOptions(); final ViewEntity info = db.searchAlias(viewName).create(options).get(); @@ -223,7 +210,6 @@ void createSearchAliasViewWithOptions(ArangoDatabaseAsync db) throws ExecutionEx @ParameterizedTest @MethodSource("asyncDbs") void createSearchAliasViewWithIndexesAndGetProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollectionAsync col = db.collection(COLL_1); String idxName1 = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -262,7 +248,6 @@ void createSearchAliasViewWithIndexesAndGetProperties(ArangoDatabaseAsync db) th @ParameterizedTest @MethodSource("asyncDbs") void getArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearchAsync view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()).get(); @@ -282,14 +267,13 @@ void getArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionExcep @ParameterizedTest @MethodSource("asyncDbs") void updateArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearchAsync view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()).get(); final ArangoSearchPropertiesOptions options = new ArangoSearchPropertiesOptions(); options.cleanupIntervalStep(15L); options.consolidationIntervalMsec(65000L); - options.consolidationPolicy(ConsolidationPolicy.of(ConsolidationType.BYTES_ACCUM).threshold(1.)); + options.consolidationPolicy(ConsolidationPolicy.of(ConsolidationType.TIER)); options.link(CollectionLink.on(COLL_2) .fields(FieldLink.on("value").analyzers("identity").trackListPositions(true).includeAllFields(true) .storeValues(StoreValuesType.ID))); @@ -299,8 +283,7 @@ void updateArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionEx assertThat(properties.getConsolidationIntervalMsec()).isEqualTo(65000L); final ConsolidationPolicy consolidate = properties.getConsolidationPolicy(); assertThat(consolidate).isNotNull(); - assertThat(consolidate.getType()).isEqualTo(ConsolidationType.BYTES_ACCUM); - assertThat(consolidate.getThreshold()).isEqualTo(1.); + assertThat(consolidate.getType()).isEqualTo(ConsolidationType.TIER); assertThat(properties.getLinks()).hasSize(1); final CollectionLink link = properties.getLinks().iterator().next(); assertThat(link.getName()).isEqualTo(COLL_2); @@ -315,7 +298,6 @@ void updateArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionEx @ParameterizedTest @MethodSource("asyncDbs") void updateSearchAliasViewWithIndexesAndGetProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollectionAsync col = db.collection(COLL_1); String idxName = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -355,7 +337,6 @@ void updateSearchAliasViewWithIndexesAndGetProperties(ArangoDatabaseAsync db) th @ParameterizedTest @MethodSource("asyncDbs") void replaceArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearchAsync view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()).get(); @@ -374,7 +355,6 @@ void replaceArangoSearchViewProperties(ArangoDatabaseAsync db) throws ExecutionE @ParameterizedTest @MethodSource("asyncDbs") void replaceSearchAliasViewWithIndexesAndGetProperties(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollectionAsync col = db.collection(COLL_1); String idxName = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -445,8 +425,6 @@ private void createGetAndDeleteTypedAnalyzer(ArangoDatabaseAsync db, SearchAnaly @ParameterizedTest @MethodSource("asyncDbs") void identityAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -464,8 +442,6 @@ void identityAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, In @ParameterizedTest @MethodSource("asyncDbs") void delimiterAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -487,8 +463,6 @@ void delimiterAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, I @ParameterizedTest @MethodSource("asyncDbs") void multiDelimiterAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -510,8 +484,6 @@ void multiDelimiterAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionExcepti @ParameterizedTest @MethodSource("asyncDbs") void stemAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -533,8 +505,6 @@ void stemAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void normAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -558,8 +528,6 @@ void normAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void ngramAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -584,8 +552,6 @@ void ngramAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, Inter @ParameterizedTest @MethodSource("asyncDbs") void enhancedNgramAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 6)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -612,8 +578,6 @@ void enhancedNgramAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionExceptio @ParameterizedTest @MethodSource("asyncDbs") void textAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -639,8 +603,6 @@ void textAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void enhancedTextAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 6)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -671,14 +633,11 @@ void enhancedTextAnalyzerTyped(ArangoDatabaseAsync db) throws ExecutionException @ParameterizedTest @MethodSource("asyncDbs") void arangoSearchOptions(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); FieldLink field = FieldLink.on("f1") .inBackground(true) .cache(false); - if (isEnterprise()) { - field.nested(FieldLink.on("f2")); - } + field.nested(FieldLink.on("f2")); CollectionLink link = CollectionLink.on(COLL_1) .analyzers("identity") .fields(field) @@ -687,10 +646,7 @@ void arangoSearchOptions(ArangoDatabaseAsync db) throws ExecutionException, Inte .trackListPositions(false) .inBackground(true) .cache(true); - - if (isEnterprise()) { - link.nested(FieldLink.on("f3")); - } + link.nested(FieldLink.on("f3")); ArangoSearchCreateOptions options = new ArangoSearchCreateOptions() .link(link) .primarySortCache(true) @@ -719,40 +675,27 @@ void arangoSearchOptions(ArangoDatabaseAsync db) throws ExecutionException, Inte assertThat(createdLink.getTrackListPositions()).isFalse(); FieldLink fieldLink = createdLink.getFields().iterator().next(); - if (isEnterprise()) { - assertThat(createdLink.getCache()).isTrue(); - assertThat(fieldLink.getCache()).isFalse(); - assertThat(properties.getPrimaryKeyCache()).isTrue(); - assertThat(properties.getPrimarySortCache()).isTrue(); - assertThat(properties.getStoredValues()) - .isNotEmpty() - .allSatisfy(it -> assertThat(it.getCache()).isTrue()); - } - - if (isEnterprise() && isAtLeastVersion(3, 10)) { - assertThat(createdLink.getNested()).isNotEmpty(); - FieldLink nested = createdLink.getNested().iterator().next(); - assertThat(nested.getName()).isEqualTo("f3"); - } + assertThat(createdLink.getCache()).isTrue(); + assertThat(fieldLink.getCache()).isFalse(); + assertThat(properties.getPrimaryKeyCache()).isTrue(); + assertThat(properties.getPrimarySortCache()).isTrue(); + assertThat(properties.getStoredValues()) + .isNotEmpty() + .allSatisfy(it -> assertThat(it.getCache()).isTrue()); + assertThat(createdLink.getNested()).isNotEmpty(); + FieldLink nested = createdLink.getNested().iterator().next(); + assertThat(nested.getName()).isEqualTo("f3"); assertThat(fieldLink.getName()).isEqualTo("f1"); - if (isEnterprise() && isAtLeastVersion(3, 10)) { - assertThat(fieldLink.getNested()).isNotEmpty(); - FieldLink nested = fieldLink.getNested().iterator().next(); - assertThat(nested.getName()).isEqualTo("f2"); - } - - if (isEnterprise() && isAtLeastVersion(3, 12)) { - assertThat(properties.getOptimizeTopK()).containsExactly(optimizeTopK); - } - + assertThat(fieldLink.getNested()).isNotEmpty(); + FieldLink nested2 = fieldLink.getNested().iterator().next(); + assertThat(nested2.getName()).isEqualTo("f2"); + assertThat(properties.getOptimizeTopK()).containsExactly(optimizeTopK); } @ParameterizedTest @MethodSource("asyncDbs") void pipelineAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - // comma delimiter DelimiterAnalyzerProperties commaDelimiterProperties = new DelimiterAnalyzerProperties(); commaDelimiterProperties.setDelimiter(","); @@ -796,8 +739,6 @@ void pipelineAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interru @ParameterizedTest @MethodSource("asyncDbs") void stopwordsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - Set features = new HashSet<>(); features.add(AnalyzerFeature.frequency); features.add(AnalyzerFeature.norm); @@ -828,8 +769,6 @@ void stopwordsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void aqlAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - AQLAnalyzerProperties properties = new AQLAnalyzerProperties(); properties.setBatchSize(2); properties.setCollapsePositions(true); @@ -854,8 +793,6 @@ void aqlAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedE @ParameterizedTest @MethodSource("asyncDbs") void geoJsonAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -883,9 +820,6 @@ void geoJsonAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interrup @ParameterizedTest @MethodSource("asyncDbs") void geoS2Analyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 10, 5)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -913,8 +847,6 @@ void geoS2Analyzer(ArangoDatabaseAsync db) throws ExecutionException, Interrupte @ParameterizedTest @MethodSource("asyncDbs") void geoPointAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 8)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -942,8 +874,6 @@ void geoPointAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interru @ParameterizedTest @MethodSource("asyncDbs") void segmentationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); - SegmentationAnalyzerProperties properties = new SegmentationAnalyzerProperties(); properties.setBreakMode(SegmentationAnalyzerProperties.BreakMode.graphic); properties.setAnalyzerCase(SearchAnalyzerCase.upper); @@ -964,8 +894,6 @@ void segmentationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Int @ParameterizedTest @MethodSource("asyncDbs") void collationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); - CollationAnalyzerProperties properties = new CollationAnalyzerProperties(); properties.setLocale("ru"); @@ -987,9 +915,6 @@ void collationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interr @ParameterizedTest @MethodSource("asyncDbs") void classificationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties(); properties.setModelLocation("/tmp/foo.bin"); properties.setTopK(2); @@ -1012,9 +937,6 @@ void classificationAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, I @ParameterizedTest @MethodSource("asyncDbs") void nearestNeighborsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties(); properties.setModelLocation("/tmp/foo.bin"); properties.setTopK(2); @@ -1035,9 +957,6 @@ void nearestNeighborsAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, @ParameterizedTest @MethodSource("asyncDbs") void MinHashAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - SegmentationAnalyzerProperties segProperties = new SegmentationAnalyzerProperties(); segProperties.setBreakMode(SegmentationAnalyzerProperties.BreakMode.alpha); segProperties.setAnalyzerCase(SearchAnalyzerCase.lower); @@ -1065,8 +984,6 @@ void MinHashAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interrup @ParameterizedTest @MethodSource("asyncDbs") void WildcardAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); - NormAnalyzerProperties properties = new NormAnalyzerProperties(); properties.setLocale("ru"); properties.setAnalyzerCase(SearchAnalyzerCase.lower); @@ -1094,8 +1011,6 @@ void WildcardAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interru @ParameterizedTest @MethodSource("asyncDbs") void offsetFeature(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -1112,21 +1027,10 @@ void offsetFeature(ArangoDatabaseAsync db) throws ExecutionException, Interrupte } private ConsolidationPolicy createConsolidationPolicy() { - ConsolidationPolicy consolidationPolicy; - if (isAtLeastVersion(3, 12, 7)) { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) + return ConsolidationPolicy.of(ConsolidationType.TIER) .segmentsBytesMax(55555L) .maxSkewThreshold(0.3) .minDeletionRatio(0.4); - } else { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) - .segmentsMin(3L) - .segmentsMax(44L) - .segmentsBytesMax(55555L) - .segmentsBytesFloor(666L) - .minScore(77L); - } - return consolidationPolicy; } } diff --git a/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java b/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java index 1f14c1a7b..7693a9981 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java @@ -55,7 +55,6 @@ static void init() { @ParameterizedTest @MethodSource("dbs") void exists(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()); assertThat(db.arangoSearch(viewName).exists()).isTrue(); @@ -64,7 +63,6 @@ void exists(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createAndExistsSearchAlias(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); db.createSearchAlias(viewName, new SearchAliasCreateOptions()); assertThat(db.arangoSearch(viewName).exists()).isTrue(); @@ -73,7 +71,6 @@ void createAndExistsSearchAlias(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void getInfo(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()); final ViewEntity info = db.arangoSearch(viewName).getInfo(); @@ -86,7 +83,6 @@ void getInfo(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void drop(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); db.createArangoSearch(viewName, new ArangoSearchCreateOptions()); final ArangoView view = db.arangoSearch(viewName); @@ -98,7 +94,6 @@ void drop(ArangoDatabase db) { @MethodSource("dbs") void rename(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final String name = viewName + "_new"; db.createArangoSearch(name, new ArangoSearchCreateOptions()); @@ -110,7 +105,6 @@ void rename(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createArangoSearchView(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ViewEntity info = db.arangoSearch(viewName).create(); assertThat(info).isNotNull(); @@ -123,7 +117,6 @@ void createArangoSearchView(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createSearchAliasView(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); final ViewEntity info = db.searchAlias(viewName).create(); assertThat(info).isNotNull(); @@ -136,7 +129,6 @@ void createSearchAliasView(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createArangoSearchViewWithOptions(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); final ViewEntity info = db.arangoSearch(viewName).create(options); @@ -150,7 +142,6 @@ void createArangoSearchViewWithOptions(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createArangoSearchViewWithPrimarySort(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); @@ -171,30 +162,27 @@ void createArangoSearchViewWithPrimarySort(ArangoDatabase db) { assertThat(info.getType()).isEqualTo(ViewType.ARANGO_SEARCH); assertThat(db.arangoSearch(viewName).exists()).isTrue(); - if (isAtLeastVersion(3, 7)) { - final ArangoSearchPropertiesEntity properties = view.getProperties(); - assertThat(properties.getPrimarySortCompression()).isEqualTo(ArangoSearchCompression.none); - Collection retrievedStoredValues = properties.getStoredValues(); - assertThat(retrievedStoredValues).isNotNull(); - assertThat(retrievedStoredValues).hasSize(1); - StoredValue retrievedStoredValue = retrievedStoredValues.iterator().next(); - assertThat(retrievedStoredValue).isNotNull(); - assertThat(retrievedStoredValue.getFields()).isEqualTo(storedValue.getFields()); - assertThat(retrievedStoredValue.getCompression()).isEqualTo(storedValue.getCompression()); - assertThat(properties.getPrimarySort()) - .hasSize(1) - .allSatisfy(ps -> { - assertThat(ps).isNotNull(); - assertThat(ps.getField()).isEqualTo(primarySort.getField()); - assertThat(ps.getAscending()).isEqualTo(primarySort.getAscending()); - }); - } + final ArangoSearchPropertiesEntity properties = view.getProperties(); + assertThat(properties.getPrimarySortCompression()).isEqualTo(ArangoSearchCompression.none); + Collection retrievedStoredValues = properties.getStoredValues(); + assertThat(retrievedStoredValues).isNotNull(); + assertThat(retrievedStoredValues).hasSize(1); + StoredValue retrievedStoredValue = retrievedStoredValues.iterator().next(); + assertThat(retrievedStoredValue).isNotNull(); + assertThat(retrievedStoredValue.getFields()).isEqualTo(storedValue.getFields()); + assertThat(retrievedStoredValue.getCompression()).isEqualTo(storedValue.getCompression()); + assertThat(properties.getPrimarySort()) + .hasSize(1) + .allSatisfy(ps -> { + assertThat(ps).isNotNull(); + assertThat(ps.getField()).isEqualTo(primarySort.getField()); + assertThat(ps.getAscending()).isEqualTo(primarySort.getAscending()); + }); } @ParameterizedTest @MethodSource("dbs") void createArangoSearchViewWithCommitIntervalMsec(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); String viewName = rndName(); final ArangoSearchCreateOptions options = new ArangoSearchCreateOptions(); options.commitIntervalMsec(666666L); @@ -215,7 +203,6 @@ void createArangoSearchViewWithCommitIntervalMsec(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createSearchAliasViewWithOptions(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String viewName = rndName(); final SearchAliasCreateOptions options = new SearchAliasCreateOptions(); final ViewEntity info = db.searchAlias(viewName).create(options); @@ -229,7 +216,6 @@ void createSearchAliasViewWithOptions(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void createSearchAliasViewWithIndexesAndGetProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollection col = db.collection(COLL_1); String idxName1 = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -268,7 +254,6 @@ void createSearchAliasViewWithIndexesAndGetProperties(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void getArangoSearchViewProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearch view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()); @@ -288,14 +273,13 @@ void getArangoSearchViewProperties(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void updateArangoSearchViewProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearch view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()); final ArangoSearchPropertiesOptions options = new ArangoSearchPropertiesOptions(); options.cleanupIntervalStep(15L); options.consolidationIntervalMsec(65000L); - options.consolidationPolicy(ConsolidationPolicy.of(ConsolidationType.BYTES_ACCUM).threshold(1.)); + options.consolidationPolicy(ConsolidationPolicy.of(ConsolidationType.TIER)); options.link(CollectionLink.on(COLL_2) .fields(FieldLink.on("value").analyzers("identity").trackListPositions(true).includeAllFields(true) .storeValues(StoreValuesType.ID))); @@ -305,8 +289,7 @@ void updateArangoSearchViewProperties(ArangoDatabase db) { assertThat(properties.getConsolidationIntervalMsec()).isEqualTo(65000L); final ConsolidationPolicy consolidate = properties.getConsolidationPolicy(); assertThat(consolidate).isNotNull(); - assertThat(consolidate.getType()).isEqualTo(ConsolidationType.BYTES_ACCUM); - assertThat(consolidate.getThreshold()).isEqualTo(1.); + assertThat(consolidate.getType()).isEqualTo(ConsolidationType.TIER); assertThat(properties.getLinks()).hasSize(1); final CollectionLink link = properties.getLinks().iterator().next(); assertThat(link.getName()).isEqualTo(COLL_2); @@ -321,7 +304,6 @@ void updateArangoSearchViewProperties(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void updateSearchAliasViewWithIndexesAndGetProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollection col = db.collection(COLL_1); String idxName = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -361,7 +343,6 @@ void updateSearchAliasViewWithIndexesAndGetProperties(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void replaceArangoSearchViewProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); final ArangoSearch view = db.arangoSearch(viewName); view.create(new ArangoSearchCreateOptions()); @@ -380,7 +361,6 @@ void replaceArangoSearchViewProperties(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void replaceSearchAliasViewWithIndexesAndGetProperties(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollection col = db.collection(COLL_1); String idxName = rndName(); col.ensureInvertedIndex(new InvertedIndexOptions() @@ -451,8 +431,6 @@ private void createGetAndDeleteTypedAnalyzer(ArangoDatabase db, SearchAnalyzer a @ParameterizedTest @MethodSource("dbs") void identityAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -470,8 +448,6 @@ void identityAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void delimiterAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -493,8 +469,6 @@ void delimiterAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void multiDelimiterAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 12)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -516,8 +490,6 @@ void multiDelimiterAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void stemAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -539,8 +511,6 @@ void stemAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void normAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -564,8 +534,6 @@ void normAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void ngramAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -590,8 +558,6 @@ void ngramAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void enhancedNgramAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 6)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -618,8 +584,6 @@ void enhancedNgramAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void textAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -645,8 +609,6 @@ void textAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void enhancedTextAnalyzerTyped(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 6)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -677,14 +639,11 @@ void enhancedTextAnalyzerTyped(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void arangoSearchOptions(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String viewName = rndName(); FieldLink field = FieldLink.on("f1") .inBackground(true) .cache(false); - if (isEnterprise()) { - field.nested(FieldLink.on("f2")); - } + field.nested(FieldLink.on("f2")); CollectionLink link = CollectionLink.on(COLL_1) .analyzers("identity") .fields(field) @@ -694,9 +653,7 @@ void arangoSearchOptions(ArangoDatabase db) { .inBackground(true) .cache(true); - if (isEnterprise()) { - link.nested(FieldLink.on("f3")); - } + link.nested(FieldLink.on("f3")); ArangoSearchCreateOptions options = new ArangoSearchCreateOptions() .link(link) .primarySortCache(true) @@ -725,40 +682,26 @@ void arangoSearchOptions(ArangoDatabase db) { assertThat(createdLink.getTrackListPositions()).isFalse(); FieldLink fieldLink = createdLink.getFields().iterator().next(); - if (isEnterprise()) { - assertThat(createdLink.getCache()).isTrue(); - assertThat(fieldLink.getCache()).isFalse(); - assertThat(properties.getPrimaryKeyCache()).isTrue(); - assertThat(properties.getPrimarySortCache()).isTrue(); - assertThat(properties.getStoredValues()) - .isNotEmpty() - .allSatisfy(it -> assertThat(it.getCache()).isTrue()); - } - - if (isEnterprise() && isAtLeastVersion(3, 10)) { - assertThat(createdLink.getNested()).isNotEmpty(); - FieldLink nested = createdLink.getNested().iterator().next(); - assertThat(nested.getName()).isEqualTo("f3"); - } - + assertThat(createdLink.getCache()).isTrue(); + assertThat(fieldLink.getCache()).isFalse(); + assertThat(properties.getPrimaryKeyCache()).isTrue(); + assertThat(properties.getPrimarySortCache()).isTrue(); + assertThat(properties.getStoredValues()) + .isNotEmpty() + .allSatisfy(it -> assertThat(it.getCache()).isTrue()); + assertThat(createdLink.getNested()).isNotEmpty(); + FieldLink nested = createdLink.getNested().iterator().next(); + assertThat(nested.getName()).isEqualTo("f3"); assertThat(fieldLink.getName()).isEqualTo("f1"); - if (isEnterprise() && isAtLeastVersion(3, 10)) { - assertThat(fieldLink.getNested()).isNotEmpty(); - FieldLink nested = fieldLink.getNested().iterator().next(); - assertThat(nested.getName()).isEqualTo("f2"); - } - - if (isEnterprise() && isAtLeastVersion(3, 12)) { - assertThat(properties.getOptimizeTopK()).containsExactly(optimizeTopK); - } - + assertThat(fieldLink.getNested()).isNotEmpty(); + FieldLink nested2 = fieldLink.getNested().iterator().next(); + assertThat(nested2.getName()).isEqualTo("f2"); + assertThat(properties.getOptimizeTopK()).containsExactly(optimizeTopK); } @ParameterizedTest @MethodSource("dbs") void pipelineAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 8)); - // comma delimiter DelimiterAnalyzerProperties commaDelimiterProperties = new DelimiterAnalyzerProperties(); commaDelimiterProperties.setDelimiter(","); @@ -802,8 +745,6 @@ void pipelineAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void stopwordsAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 8)); - Set features = new HashSet<>(); features.add(AnalyzerFeature.frequency); features.add(AnalyzerFeature.norm); @@ -834,8 +775,6 @@ void stopwordsAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void aqlAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 8)); - AQLAnalyzerProperties properties = new AQLAnalyzerProperties(); properties.setBatchSize(2); properties.setCollapsePositions(true); @@ -860,8 +799,6 @@ void aqlAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void geoJsonAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 8)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -889,9 +826,6 @@ void geoJsonAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void geoS2Analyzer(ArangoDatabase db) { - assumeTrue(isEnterprise()); - assumeTrue(isAtLeastVersion(3, 10, 5)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -919,8 +853,6 @@ void geoS2Analyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void geoPointAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 8)); - GeoAnalyzerOptions options = new GeoAnalyzerOptions(); options.setMaxLevel(10); options.setMaxCells(11); @@ -948,8 +880,6 @@ void geoPointAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void segmentationAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 9)); - SegmentationAnalyzerProperties properties = new SegmentationAnalyzerProperties(); properties.setBreakMode(SegmentationAnalyzerProperties.BreakMode.graphic); properties.setAnalyzerCase(SearchAnalyzerCase.upper); @@ -970,8 +900,6 @@ void segmentationAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void collationAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 9)); - CollationAnalyzerProperties properties = new CollationAnalyzerProperties(); properties.setLocale("ru"); @@ -993,9 +921,6 @@ void collationAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void classificationAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - ClassificationAnalyzerProperties properties = new ClassificationAnalyzerProperties(); properties.setModelLocation("/tmp/foo.bin"); properties.setTopK(2); @@ -1018,9 +943,6 @@ void classificationAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void nearestNeighborsAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - NearestNeighborsAnalyzerProperties properties = new NearestNeighborsAnalyzerProperties(); properties.setModelLocation("/tmp/foo.bin"); properties.setTopK(2); @@ -1041,9 +963,6 @@ void nearestNeighborsAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void MinHashAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); - assumeTrue(isEnterprise()); - SegmentationAnalyzerProperties segProperties = new SegmentationAnalyzerProperties(); segProperties.setBreakMode(SegmentationAnalyzerProperties.BreakMode.alpha); segProperties.setAnalyzerCase(SearchAnalyzerCase.lower); @@ -1071,8 +990,6 @@ void MinHashAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void WildcardAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 12)); - NormAnalyzerProperties properties = new NormAnalyzerProperties(); properties.setLocale("ru"); properties.setAnalyzerCase(SearchAnalyzerCase.lower); @@ -1100,8 +1017,6 @@ void WildcardAnalyzer(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void offsetFeature(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); - String name = "test-" + UUID.randomUUID(); Set features = new HashSet<>(); @@ -1118,21 +1033,10 @@ void offsetFeature(ArangoDatabase db) { } private ConsolidationPolicy createConsolidationPolicy() { - ConsolidationPolicy consolidationPolicy; - if (isAtLeastVersion(3, 12, 7)) { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) + return ConsolidationPolicy.of(ConsolidationType.TIER) .segmentsBytesMax(55555L) .maxSkewThreshold(0.3) .minDeletionRatio(0.4); - } else { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) - .segmentsMin(3L) - .segmentsMax(44L) - .segmentsBytesMax(55555L) - .segmentsBytesFloor(666L) - .minScore(77L); - } - return consolidationPolicy; } } diff --git a/test-functional/src/test/java/com/arangodb/ArangoViewAsyncTest.java b/test-functional/src/test/java/com/arangodb/ArangoViewAsyncTest.java index a1cd046f0..c881de101 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoViewAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoViewAsyncTest.java @@ -86,7 +86,6 @@ void getInfo(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcep @ParameterizedTest @MethodSource("asyncDbs") void getInfoSearchAlias(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String name = rndName(); db.createView(name, ViewType.SEARCH_ALIAS).get(); final ViewEntity info = db.view(name).getInfo().get(); @@ -99,7 +98,6 @@ void getInfoSearchAlias(ArangoDatabaseAsync db) throws ExecutionException, Inter @ParameterizedTest @MethodSource("asyncDbs") void getViews(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String name1 = rndName(); String name2 = rndName(); db.createView(name1, ViewType.ARANGO_SEARCH).get(); diff --git a/test-functional/src/test/java/com/arangodb/ArangoViewTest.java b/test-functional/src/test/java/com/arangodb/ArangoViewTest.java index 67482161b..b8b877eb8 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoViewTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoViewTest.java @@ -85,7 +85,6 @@ void getInfo(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void getInfoSearchAlias(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String name = rndName(); db.createView(name, ViewType.SEARCH_ALIAS); final ViewEntity info = db.view(name).getInfo(); @@ -98,7 +97,6 @@ void getInfoSearchAlias(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void getViews(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 10)); String name1 = rndName(); String name2 = rndName(); db.createView(name1, ViewType.ARANGO_SEARCH); diff --git a/test-functional/src/test/java/com/arangodb/BaseJunit5.java b/test-functional/src/test/java/com/arangodb/BaseJunit5.java index f04456b6d..a9c0d8576 100644 --- a/test-functional/src/test/java/com/arangodb/BaseJunit5.java +++ b/test-functional/src/test/java/com/arangodb/BaseJunit5.java @@ -28,7 +28,7 @@ public class BaseJunit5 { protected static final ArangoConfigProperties config = ConfigUtils.loadConfig(); private static final ArangoDB adb = new ArangoDB.Builder() .loadProperties(config) - .protocol(Protocol.HTTP_JSON) + .protocol(Protocol.HTTP_1_1) .build(); private static final ArangoDBVersion version = adb.getVersion(); @@ -36,7 +36,6 @@ public class BaseJunit5 { private static final boolean supportsV8 = supportsV8(adb); private static final List> adbs = Arrays.stream(Protocol.values()) - .filter(p -> !p.equals(Protocol.VST) || isLessThanVersion(3, 12)) .map(p -> Named.of(p.toString(), new ArangoDB.Builder() .loadProperties(config) .protocol(p) @@ -208,10 +207,6 @@ public static boolean isLessThanVersion(final int major, final int minor, final return TestUtils.isLessThanVersion(version.getVersion(), major, minor, patch); } - public static boolean isStorageEngine(ArangoDBEngine.StorageEngineName name) { - return name.equals(adb.getEngine().getName()); - } - public static boolean isSingleServer() { return role == ServerRole.SINGLE; } diff --git a/test-functional/src/test/java/com/arangodb/CompressionTest.java b/test-functional/src/test/java/com/arangodb/CompressionTest.java index 4d7cc53c0..9becbaf7b 100644 --- a/test-functional/src/test/java/com/arangodb/CompressionTest.java +++ b/test-functional/src/test/java/com/arangodb/CompressionTest.java @@ -1,9 +1,9 @@ package com.arangodb; import com.arangodb.config.ArangoConfigProperties; +import com.arangodb.util.ProtocolSource; import com.fasterxml.jackson.databind.JsonNode; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.Locale; import java.util.UUID; @@ -20,23 +20,20 @@ class CompressionTest extends BaseJunit5 { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void gzip(Protocol protocol) { assumeTrue(supportsV8()); doTest(protocol, Compression.GZIP); } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void deflate(Protocol protocol) { assumeTrue(supportsV8()); doTest(protocol, Compression.DEFLATE); } void doTest(Protocol protocol, Compression compression) { - assumeTrue(isAtLeastVersion(3, 12)); - assumeTrue(protocol != Protocol.VST); - ArangoDB adb = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) .protocol(protocol) diff --git a/test-functional/src/test/java/com/arangodb/ConcurrencyAsyncTests.java b/test-functional/src/test/java/com/arangodb/ConcurrencyAsyncTests.java index 2b9c20e09..7d1bf9684 100644 --- a/test-functional/src/test/java/com/arangodb/ConcurrencyAsyncTests.java +++ b/test-functional/src/test/java/com/arangodb/ConcurrencyAsyncTests.java @@ -2,11 +2,11 @@ import com.arangodb.config.ConfigUtils; import com.arangodb.entity.ArangoDBVersion; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.SlowTest; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.ArrayList; import java.util.List; @@ -18,17 +18,14 @@ import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.Assumptions.assumeTrue; class ConcurrencyAsyncTests { @SlowTest @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource @Timeout(2) void executorLimit(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ExecutorService asyncExecutor = Executors.newCachedThreadPool(); ArangoDBAsync adb = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) @@ -62,7 +59,7 @@ void executorLimit(Protocol protocol) { @Disabled @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource @Timeout(2) void outgoingRequestsParallelismTest(Protocol protocol) throws ExecutionException, InterruptedException { ArangoDBAsync adb = new ArangoDB.Builder() @@ -82,10 +79,8 @@ void outgoingRequestsParallelismTest(Protocol protocol) throws ExecutionExceptio @SlowTest @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void concurrentPendingRequests(Protocol protocol) throws ExecutionException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDBAsync adb = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) .protocol(protocol).build().async(); diff --git a/test-functional/src/test/java/com/arangodb/ConcurrencyTests.java b/test-functional/src/test/java/com/arangodb/ConcurrencyTests.java index 80aaa3ff9..9b303c6ee 100644 --- a/test-functional/src/test/java/com/arangodb/ConcurrencyTests.java +++ b/test-functional/src/test/java/com/arangodb/ConcurrencyTests.java @@ -1,9 +1,9 @@ package com.arangodb; import com.arangodb.config.ConfigUtils; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.SlowTest; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -13,16 +13,12 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - class ConcurrencyTests { @SlowTest @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void concurrentPendingRequests(Protocol protocol) throws ExecutionException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ExecutorService es = Executors.newFixedThreadPool(10); ArangoDB adb = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) diff --git a/test-functional/src/test/java/com/arangodb/ConsumerThreadAsyncTest.java b/test-functional/src/test/java/com/arangodb/ConsumerThreadAsyncTest.java index c7c219d06..ba7c92b6c 100644 --- a/test-functional/src/test/java/com/arangodb/ConsumerThreadAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ConsumerThreadAsyncTest.java @@ -1,20 +1,16 @@ package com.arangodb; import com.arangodb.config.ArangoConfigProperties; +import com.arangodb.util.ProtocolSource; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.concurrent.ExecutionException; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - public class ConsumerThreadAsyncTest extends BaseJunit5 { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void nestedRequests(Protocol protocol) throws ExecutionException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDBAsync adb = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) .protocol(protocol) diff --git a/test-functional/src/test/java/com/arangodb/InvertedIndexAsyncTest.java b/test-functional/src/test/java/com/arangodb/InvertedIndexAsyncTest.java index 8a57ec1b3..d1212aec8 100644 --- a/test-functional/src/test/java/com/arangodb/InvertedIndexAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/InvertedIndexAsyncTest.java @@ -48,8 +48,8 @@ private void createAnalyzer(String analyzerName, ArangoDatabaseAsync db) throws } private InvertedIndexOptions createOptions(String analyzerName) { - Boolean cache = isEnterprise() ? true : null; - Boolean fieldCache = cache != null ? false : null; + Boolean cache = true; + Boolean fieldCache = false; InvertedIndexField field = new InvertedIndexField() .name("foo") .analyzer(AnalyzerType.identity.toString()) @@ -64,22 +64,20 @@ private InvertedIndexOptions createOptions(String analyzerName) { AnalyzerFeature.offset ); - if (isEnterprise()) { - field.nested( - new InvertedIndexField() - .name("bar") - .analyzer(analyzerName) - .searchField(true) - .features(AnalyzerFeature.position, AnalyzerFeature.frequency) - .nested( - new InvertedIndexField() - .name("baz") - .analyzer(AnalyzerType.identity.toString()) - .searchField(false) - .features(AnalyzerFeature.frequency) - ) - ); - } + field.nested( + new InvertedIndexField() + .name("bar") + .analyzer(analyzerName) + .searchField(true) + .features(AnalyzerFeature.position, AnalyzerFeature.frequency) + .nested( + new InvertedIndexField() + .name("baz") + .analyzer(AnalyzerType.identity.toString()) + .searchField(false) + .features(AnalyzerFeature.frequency) + ) + ); return new InvertedIndexOptions() .name(rndName()) @@ -113,21 +111,10 @@ private InvertedIndexOptions createOptions(String analyzerName) { } private ConsolidationPolicy createConsolidationPolicy() { - ConsolidationPolicy consolidationPolicy; - if (isAtLeastVersion(3, 12, 7)) { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) + return ConsolidationPolicy.of(ConsolidationType.TIER) .segmentsBytesMax(55555L) .maxSkewThreshold(0.3) .minDeletionRatio(0.4); - } else { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) - .segmentsMin(3L) - .segmentsMax(44L) - .segmentsBytesMax(55555L) - .segmentsBytesFloor(666L) - .minScore(77L); - } - return consolidationPolicy; } private void assertCorrectIndexEntity(InvertedIndexEntity indexResult, InvertedIndexOptions options) { @@ -158,16 +145,12 @@ private void assertCorrectIndexEntity(InvertedIndexEntity indexResult, InvertedI assertThat(indexResult.getWritebufferSizeMax()).isEqualTo(options.getWritebufferSizeMax()); assertThat(indexResult.getCache()).isEqualTo(options.getCache()); assertThat(indexResult.getPrimaryKeyCache()).isEqualTo(options.getPrimaryKeyCache()); - - if (isEnterprise() && isAtLeastVersion(3, 12)) { - assertThat(indexResult.getOptimizeTopK()).containsExactlyElementsOf(options.getOptimizeTopK()); - } + assertThat(indexResult.getOptimizeTopK()).containsExactlyElementsOf(options.getOptimizeTopK()); } @ParameterizedTest @MethodSource("asyncCols") void createAndGetInvertedIndex(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); String analyzerName = "delimiter-" + UUID.randomUUID(); createAnalyzer(analyzerName, collection.db()); InvertedIndexOptions options = createOptions(analyzerName); @@ -180,8 +163,6 @@ void createAndGetInvertedIndex(ArangoCollectionAsync collection) throws Executio @ParameterizedTest @MethodSource("asyncCols") void getInvertedIndexesShouldNotReturnOtherIndexTypes(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - // create persistent index collection.ensurePersistentIndex(Collections.singletonList("foo"), new PersistentIndexOptions().name("persistentIndex")); @@ -200,8 +181,6 @@ void getInvertedIndexesShouldNotReturnOtherIndexTypes(ArangoCollectionAsync coll @ParameterizedTest @MethodSource("asyncCols") void getIndexesShouldNotReturnInvertedIndexes(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 10)); - // create persistent index collection.ensurePersistentIndex(Collections.singletonList("foo"), new PersistentIndexOptions().name("persistentIndex")); diff --git a/test-functional/src/test/java/com/arangodb/InvertedIndexTest.java b/test-functional/src/test/java/com/arangodb/InvertedIndexTest.java index 5a6c2a069..410e976a5 100644 --- a/test-functional/src/test/java/com/arangodb/InvertedIndexTest.java +++ b/test-functional/src/test/java/com/arangodb/InvertedIndexTest.java @@ -47,8 +47,8 @@ private void createAnalyzer(String analyzerName, ArangoDatabase db) { } private InvertedIndexOptions createOptions(String analyzerName) { - Boolean cache = isEnterprise() ? true : null; - Boolean fieldCache = cache != null ? false : null; + Boolean cache = true; + Boolean fieldCache = false; InvertedIndexField field = new InvertedIndexField() .name("foo") .analyzer(AnalyzerType.identity.toString()) @@ -63,22 +63,20 @@ private InvertedIndexOptions createOptions(String analyzerName) { AnalyzerFeature.offset ); - if (isEnterprise()) { - field.nested( - new InvertedIndexField() - .name("bar") - .analyzer(analyzerName) - .searchField(true) - .features(AnalyzerFeature.position, AnalyzerFeature.frequency) - .nested( - new InvertedIndexField() - .name("baz") - .analyzer(AnalyzerType.identity.toString()) - .searchField(false) - .features(AnalyzerFeature.frequency) - ) - ); - } + field.nested( + new InvertedIndexField() + .name("bar") + .analyzer(analyzerName) + .searchField(true) + .features(AnalyzerFeature.position, AnalyzerFeature.frequency) + .nested( + new InvertedIndexField() + .name("baz") + .analyzer(AnalyzerType.identity.toString()) + .searchField(false) + .features(AnalyzerFeature.frequency) + ) + ); return new InvertedIndexOptions() .name(rndName()) @@ -112,21 +110,10 @@ private InvertedIndexOptions createOptions(String analyzerName) { } private ConsolidationPolicy createConsolidationPolicy() { - ConsolidationPolicy consolidationPolicy; - if (isAtLeastVersion(3, 12, 7)) { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) + return ConsolidationPolicy.of(ConsolidationType.TIER) .segmentsBytesMax(55555L) .maxSkewThreshold(0.3) .minDeletionRatio(0.4); - } else { - consolidationPolicy = ConsolidationPolicy.of(ConsolidationType.TIER) - .segmentsMin(3L) - .segmentsMax(44L) - .segmentsBytesMax(55555L) - .segmentsBytesFloor(666L) - .minScore(77L); - } - return consolidationPolicy; } private void assertCorrectIndexEntity(InvertedIndexEntity indexResult, InvertedIndexOptions options) { @@ -157,16 +144,12 @@ private void assertCorrectIndexEntity(InvertedIndexEntity indexResult, InvertedI assertThat(indexResult.getWritebufferSizeMax()).isEqualTo(options.getWritebufferSizeMax()); assertThat(indexResult.getCache()).isEqualTo(options.getCache()); assertThat(indexResult.getPrimaryKeyCache()).isEqualTo(options.getPrimaryKeyCache()); - - if (isEnterprise() && isAtLeastVersion(3, 12)) { - assertThat(indexResult.getOptimizeTopK()).containsExactlyElementsOf(options.getOptimizeTopK()); - } + assertThat(indexResult.getOptimizeTopK()).containsExactlyElementsOf(options.getOptimizeTopK()); } @ParameterizedTest @MethodSource("cols") void createAndGetInvertedIndex(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); String analyzerName = "delimiter-" + UUID.randomUUID(); createAnalyzer(analyzerName, collection.db()); InvertedIndexOptions options = createOptions(analyzerName); @@ -179,8 +162,6 @@ void createAndGetInvertedIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void getInvertedIndexesShouldNotReturnOtherIndexTypes(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); - // create persistent index collection.ensurePersistentIndex(Collections.singletonList("foo"), new PersistentIndexOptions().name("persistentIndex")); @@ -199,8 +180,6 @@ void getInvertedIndexesShouldNotReturnOtherIndexTypes(ArangoCollection collectio @ParameterizedTest @MethodSource("cols") void getIndexesShouldNotReturnInvertedIndexes(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 10)); - // create persistent index collection.ensurePersistentIndex(Collections.singletonList("foo"), new PersistentIndexOptions().name("persistentIndex")); diff --git a/test-functional/src/test/java/com/arangodb/JwtAuthAsyncTest.java b/test-functional/src/test/java/com/arangodb/JwtAuthAsyncTest.java index f4c63d7d0..5f964fe5a 100644 --- a/test-functional/src/test/java/com/arangodb/JwtAuthAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/JwtAuthAsyncTest.java @@ -3,9 +3,9 @@ import com.arangodb.config.ArangoConfigProperties; import com.arangodb.config.ConfigUtils; import com.arangodb.internal.ArangoRequestParam; +import com.arangodb.util.ProtocolSource; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.HashMap; import java.util.Map; @@ -13,7 +13,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** @@ -50,10 +49,8 @@ private static String getJwt(ArangoDB arangoDB) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void notAuthenticated(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDBAsync arangoDB = getBuilder(protocol).acquireHostList(false).build().async(); Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -63,10 +60,8 @@ void notAuthenticated(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticated(Protocol protocol) throws ExecutionException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDBAsync arangoDB = getBuilder(protocol) .jwt(jwt) .build() @@ -76,9 +71,8 @@ void authenticated(Protocol protocol) throws ExecutionException, InterruptedExce } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void updateJwt(Protocol protocol) throws ExecutionException, InterruptedException { - assumeTrue(protocol != Protocol.VST, "DE-423"); ArangoDBAsync arangoDB = getBuilder(protocol) .jwt(jwt) .build() diff --git a/test-functional/src/test/java/com/arangodb/JwtAuthTest.java b/test-functional/src/test/java/com/arangodb/JwtAuthTest.java index b743db4a1..1720b22d8 100644 --- a/test-functional/src/test/java/com/arangodb/JwtAuthTest.java +++ b/test-functional/src/test/java/com/arangodb/JwtAuthTest.java @@ -3,16 +3,15 @@ import com.arangodb.config.ArangoConfigProperties; import com.arangodb.config.ConfigUtils; import com.arangodb.internal.ArangoRequestParam; +import com.arangodb.util.ProtocolSource; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.HashMap; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** @@ -49,10 +48,8 @@ private static String getJwt(ArangoDB arangoDB) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void notAuthenticated(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDB arangoDB = getBuilder(protocol).acquireHostList(false).build(); Throwable thrown = catchThrowable(arangoDB::getVersion); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -62,10 +59,8 @@ void notAuthenticated(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void authenticated(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDB arangoDB = getBuilder(protocol) .jwt(jwt) .build(); @@ -74,9 +69,8 @@ void authenticated(Protocol protocol) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void updateJwt(Protocol protocol) { - assumeTrue(protocol != Protocol.VST, "DE-423"); ArangoDB arangoDB = getBuilder(protocol) .jwt(jwt) .build(); diff --git a/test-functional/src/test/java/com/arangodb/JwtTest.java b/test-functional/src/test/java/com/arangodb/JwtTest.java index 23b18a3d3..0669b0c21 100644 --- a/test-functional/src/test/java/com/arangodb/JwtTest.java +++ b/test-functional/src/test/java/com/arangodb/JwtTest.java @@ -1,20 +1,18 @@ package com.arangodb; import com.arangodb.entity.ArangoDBVersion; +import com.arangodb.util.ProtocolSource; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assumptions.assumeTrue; public class JwtTest extends BaseJunit5 { private final String jwt = getJwt(); @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void getVersion(Protocol p) { - assumeTrue(!p.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); ArangoDB.Builder builder = new ArangoDB.Builder() .protocol(p) .jwt(jwt); diff --git a/test-functional/src/test/java/com/arangodb/ParallelAsyncTest.java b/test-functional/src/test/java/com/arangodb/ParallelAsyncTest.java index 5a697f7f4..63d354603 100644 --- a/test-functional/src/test/java/com/arangodb/ParallelAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/ParallelAsyncTest.java @@ -1,9 +1,9 @@ package com.arangodb; import com.arangodb.config.ConfigUtils; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.SlowTest; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.ArrayList; import java.util.List; @@ -16,13 +16,11 @@ class ParallelAsyncTest { @SlowTest @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void connectionParallelism(Protocol protocol) throws InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - // test that connections are internally async and can have multiple pending requests // BTS-1102: the server does not run pipelined HTTP/1.1 requests in parallel - assumeTrue(protocol != Protocol.HTTP_JSON && protocol != Protocol.HTTP_VPACK); + assumeTrue(protocol != Protocol.HTTP_1_1); ArangoDBAsync adb = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) .protocol(protocol) diff --git a/test-functional/src/test/java/com/arangodb/ParallelTest.java b/test-functional/src/test/java/com/arangodb/ParallelTest.java index 00bf1eaba..3fac6c6bf 100644 --- a/test-functional/src/test/java/com/arangodb/ParallelTest.java +++ b/test-functional/src/test/java/com/arangodb/ParallelTest.java @@ -1,9 +1,9 @@ package com.arangodb; import com.arangodb.config.ConfigUtils; +import com.arangodb.util.ProtocolSource; import com.arangodb.util.SlowTest; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.ArrayList; import java.util.List; @@ -18,13 +18,11 @@ class ParallelTest { @SlowTest @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void connectionParallelism(Protocol protocol) throws InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - // test that connections are internally async and can have multiple pending requests // BTS-1102: the server does not run pipelined HTTP/1.1 requests in parallel - assumeTrue(protocol != Protocol.HTTP_JSON && protocol != Protocol.HTTP_VPACK); + assumeTrue(protocol != Protocol.HTTP_1_1); ArangoDB adb = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) .protocol(protocol) diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionAsyncTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionAsyncTest.java index 2ad090146..990b7cb66 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionAsyncTest.java @@ -51,8 +51,6 @@ static void init() { @MethodSource("asyncDbs") void beginStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction(null).get(); assertThat(tx.getId()).isNotNull(); @@ -64,8 +62,6 @@ void beginStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, I @MethodSource("asyncDbs") void beginStreamTransactionWithNonExistingCollectionsShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.beginStreamTransaction(new StreamTransactionOptions().writeCollections("notExistingCollection")).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -75,8 +71,6 @@ void beginStreamTransactionWithNonExistingCollectionsShouldThrow(ArangoDatabaseA @MethodSource("asyncDbs") void abortStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity begunTx = db.beginStreamTransaction(null).get(); StreamTransactionEntity abortedTx = db.abortStreamTransaction(begunTx.getId()).get(); @@ -90,8 +84,6 @@ void abortStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, I @MethodSource("asyncDbs") void abortStreamTransactionTwice(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity begunTx = db.beginStreamTransaction(null).get(); db.abortStreamTransaction(begunTx.getId()); @@ -102,8 +94,6 @@ void abortStreamTransactionTwice(ArangoDatabaseAsync db) throws ExecutionExcepti @MethodSource("asyncDbs") void abortStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.abortStreamTransaction("000000").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); } @@ -112,8 +102,6 @@ void abortStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatab @MethodSource("asyncDbs") void abortStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.abortStreamTransaction("invalidTransactionId").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); } @@ -122,8 +110,6 @@ void abortStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsy @MethodSource("asyncDbs") void abortCommittedStreamTransactionShouldThrow(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null).get(); db.commitStreamTransaction(createdTx.getId()).get(); @@ -135,8 +121,6 @@ void abortCommittedStreamTransactionShouldThrow(ArangoDatabaseAsync db) throws E @MethodSource("asyncDbs") void getStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null).get(); StreamTransactionEntity gotTx = db.getStreamTransaction(createdTx.getId()).get(); @@ -152,8 +136,6 @@ void getStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, Int @MethodSource("asyncDbs") void getStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.getStreamTransaction("000000").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -163,8 +145,6 @@ void getStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabas @MethodSource("asyncDbs") void getStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.getStreamTransaction("invalidTransactionId").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -174,8 +154,6 @@ void getStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync @MethodSource("asyncDbs") void commitStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null).get(); StreamTransactionEntity committedTx = db.commitStreamTransaction(createdTx.getId()).get(); @@ -189,8 +167,6 @@ void commitStreamTransaction(ArangoDatabaseAsync db) throws ExecutionException, @MethodSource("asyncDbs") void commitStreamTransactionTwice(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null).get(); db.commitStreamTransaction(createdTx.getId()); @@ -201,8 +177,6 @@ void commitStreamTransactionTwice(ArangoDatabaseAsync db) throws ExecutionExcept @MethodSource("asyncDbs") void commitStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.commitStreamTransaction("000000").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -212,8 +186,6 @@ void commitStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoData @MethodSource("asyncDbs") void commitStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.commitStreamTransaction("invalidTransactionId").get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -223,8 +195,6 @@ void commitStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabaseAs @MethodSource("asyncDbs") void commitAbortedStreamTransactionShouldThrow(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null).get(); db.abortStreamTransaction(createdTx.getId()).get(); @@ -236,8 +206,6 @@ void commitAbortedStreamTransactionShouldThrow(ArangoDatabaseAsync db) throws Ex @MethodSource("asyncDbs") void getDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)).get(); @@ -258,8 +226,6 @@ void getDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedE @MethodSource("asyncDbs") void getDocumentWithNonExistingTransactionIdShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); @@ -272,8 +238,6 @@ void getDocumentWithNonExistingTransactionIdShouldThrow(ArangoDatabaseAsync db) @MethodSource("asyncDbs") void getDocumentWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); Throwable thrown = catchThrowable(() -> collection @@ -285,8 +249,6 @@ void getDocumentWithInvalidTransactionIdShouldThrow(ArangoDatabaseAsync db) { @MethodSource("asyncDbs") void getDocuments(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)).get(); @@ -313,8 +275,6 @@ void getDocuments(ArangoDatabaseAsync db) throws ExecutionException, Interrupted @MethodSource("asyncDbs") void insertDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)).get(); @@ -341,8 +301,6 @@ void insertDocument(ArangoDatabaseAsync db) throws ExecutionException, Interrupt @MethodSource("asyncDbs") void insertDocuments(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)).get(); @@ -373,8 +331,6 @@ void insertDocuments(ArangoDatabaseAsync db) throws ExecutionException, Interrup @MethodSource("asyncDbs") void replaceDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -410,8 +366,6 @@ void replaceDocument(ArangoDatabaseAsync db) throws ExecutionException, Interrup @MethodSource("asyncDbs") void replaceDocuments(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); List docs = IntStream.range(0, 3).mapToObj(it -> new BaseDocument()) .peek(doc -> doc.addAttribute("test", "foo")).collect(Collectors.toList()); @@ -455,8 +409,6 @@ void replaceDocuments(ArangoDatabaseAsync db) throws ExecutionException, Interru @MethodSource("asyncDbs") void updateDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -492,8 +444,6 @@ void updateDocument(ArangoDatabaseAsync db) throws ExecutionException, Interrupt @MethodSource("asyncDbs") void updateDocuments(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); List docs = IntStream.range(0, 3).mapToObj(it -> new BaseDocument()) .peek(doc -> doc.addAttribute("test", "foo")).collect(Collectors.toList()); @@ -537,8 +487,6 @@ void updateDocuments(ArangoDatabaseAsync db) throws ExecutionException, Interrup @MethodSource("asyncDbs") void deleteDocument(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); DocumentCreateEntity createdDoc = collection @@ -568,8 +516,6 @@ void deleteDocument(ArangoDatabaseAsync db) throws ExecutionException, Interrupt @MethodSource("asyncDbs") void deleteDocuments(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); List keys = collection @@ -601,8 +547,6 @@ void deleteDocuments(ArangoDatabaseAsync db) throws ExecutionException, Interrup @MethodSource("asyncDbs") void documentExists(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)).get(); @@ -623,8 +567,6 @@ void documentExists(ArangoDatabaseAsync db) throws ExecutionException, Interrupt @MethodSource("asyncDbs") void count(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); Long initialCount = collection.count().get().getCount(); @@ -646,8 +588,6 @@ void count(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcepti @MethodSource("asyncDbs") void truncate(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); collection.insertDocument(new BaseDocument(), null).get(); @@ -675,8 +615,6 @@ void truncate(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExce @MethodSource("asyncDbs") void createCursor(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)).get(); @@ -704,8 +642,6 @@ void createCursor(ArangoDatabaseAsync db) throws ExecutionException, Interrupted @MethodSource("asyncDbs") void nextCursor(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)).get(); @@ -740,8 +676,6 @@ void nextCursor(ArangoDatabaseAsync db) throws ExecutionException, InterruptedEx @MethodSource("asyncDbs") void getStreamTransactions(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction(null).get(); StreamTransactionEntity tx2 = db.beginStreamTransaction(null).get(); @@ -762,8 +696,6 @@ void getStreamTransactions(ArangoDatabaseAsync db) throws ExecutionException, In @MethodSource("asyncDbs") void transactionAllowImplicitFalse(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().allowImplicit(false)).get(); @@ -789,7 +721,6 @@ void transactionAllowImplicitFalse(ArangoDatabaseAsync db) throws ExecutionExcep @MethodSource("asyncDbs") void transactionDirtyRead(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollectionAsync collection = db.collection(COLLECTION_NAME); DocumentCreateEntity doc = collection.insertDocument(new BaseDocument()).get(); diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsAsyncTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsAsyncTest.java index 94e3996df..88097903a 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsAsyncTest.java @@ -53,8 +53,6 @@ static void init() { @MethodSource("asyncDbs") void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)).get(); @@ -73,11 +71,8 @@ void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabaseAsync db) throw new DocumentCreateOptions().streamTransactionId(tx2.getId())).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); ArangoDBException e = (ArangoDBException) thrown; - - if (isAtLeastVersion(3, 8)) { - assertThat(e.getResponseCode()).isEqualTo(409); - assertThat(e.getErrorNum()).isEqualTo(1200); - } + assertThat(e.getResponseCode()).isEqualTo(409); + assertThat(e.getErrorNum()).isEqualTo(1200); db.abortStreamTransaction(tx1.getId()).get(); db.abortStreamTransaction(tx2.getId()).get(); @@ -87,8 +82,6 @@ void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabaseAsync db) throw @MethodSource("asyncDbs") void conflictOnInsertDocumentWithAlreadyCommittedTx(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)).get(); @@ -110,10 +103,8 @@ void conflictOnInsertDocumentWithAlreadyCommittedTx(ArangoDatabaseAsync db) thro new DocumentCreateOptions().streamTransactionId(tx2.getId())).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); ArangoDBException e = (ArangoDBException) thrown; - if (isAtLeastVersion(3, 8)) { - assertThat(e.getResponseCode()).isEqualTo(409); - assertThat(e.getErrorNum()).isEqualTo(1200); - } + assertThat(e.getResponseCode()).isEqualTo(409); + assertThat(e.getErrorNum()).isEqualTo(1200); db.abortStreamTransaction(tx2.getId()); } diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsTest.java index 71b4a01ed..00cd8a61f 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionConflictsTest.java @@ -52,8 +52,6 @@ static void init() { @MethodSource("dbs") void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)); @@ -72,11 +70,8 @@ void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabase db) { new DocumentCreateOptions().streamTransactionId(tx2.getId()))); assertThat(thrown).isInstanceOf(ArangoDBException.class); ArangoDBException e = (ArangoDBException) thrown; - - if (isAtLeastVersion(3, 8)) { - assertThat(e.getResponseCode()).isEqualTo(409); - assertThat(e.getErrorNum()).isEqualTo(1200); - } + assertThat(e.getResponseCode()).isEqualTo(409); + assertThat(e.getErrorNum()).isEqualTo(1200); db.abortStreamTransaction(tx1.getId()); db.abortStreamTransaction(tx2.getId()); @@ -86,8 +81,6 @@ void conflictOnInsertDocumentWithNotYetCommittedTx(ArangoDatabase db) { @MethodSource("dbs") void conflictOnInsertDocumentWithAlreadyCommittedTx(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)); @@ -109,10 +102,8 @@ void conflictOnInsertDocumentWithAlreadyCommittedTx(ArangoDatabase db) { new DocumentCreateOptions().streamTransactionId(tx2.getId()))); assertThat(thrown).isInstanceOf(ArangoDBException.class); ArangoDBException e = (ArangoDBException) thrown; - if (isAtLeastVersion(3, 8)) { - assertThat(e.getResponseCode()).isEqualTo(409); - assertThat(e.getErrorNum()).isEqualTo(1200); - } + assertThat(e.getResponseCode()).isEqualTo(409); + assertThat(e.getErrorNum()).isEqualTo(1200); db.abortStreamTransaction(tx2.getId()); } diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionGraphAsyncTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionGraphAsyncTest.java index b83f453ae..f7ed508d7 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionGraphAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionGraphAsyncTest.java @@ -83,8 +83,6 @@ private BaseEdgeDocument createEdgeValue(String streamTransactionId, ArangoGraph @MethodSource("asyncVertices") void getVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabaseAsync db = vertexCollection1.graph().db(); StreamTransactionEntity tx = db @@ -107,8 +105,6 @@ void getVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionEx @MethodSource("asyncVertices") void createVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabaseAsync db = vertexCollection1.graph().db(); StreamTransactionEntity tx = db.beginStreamTransaction( @@ -137,8 +133,6 @@ void createVertex(ArangoVertexCollectionAsync vertexCollection1) throws Executio @MethodSource("asyncVertices") void replaceVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -176,8 +170,6 @@ void replaceVertex(ArangoVertexCollectionAsync vertexCollection1) throws Executi @MethodSource("asyncVertices") void updateVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -215,8 +207,6 @@ void updateVertex(ArangoVertexCollectionAsync vertexCollection1) throws Executio @MethodSource("asyncVertices") void deleteVertex(ArangoVertexCollectionAsync vertexCollection1) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); VertexEntity createdDoc = vertexCollection1.insertVertex(new BaseDocument(), null).get(); @@ -247,8 +237,6 @@ void deleteVertex(ArangoVertexCollectionAsync vertexCollection1) throws Executio @MethodSource("asyncEdges") void getEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabaseAsync db = edgeCollection.graph().db(); StreamTransactionEntity tx = db @@ -271,8 +259,6 @@ void getEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException @MethodSource("asyncEdges") void createEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabaseAsync db = edgeCollection.graph().db(); StreamTransactionEntity tx = db.beginStreamTransaction( @@ -301,8 +287,6 @@ void createEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionExcept @MethodSource("asyncEdges") void replaceEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseEdgeDocument doc = createEdgeValue(null, edgeCollection.graph()); doc.addAttribute("test", "foo"); @@ -340,8 +324,6 @@ void replaceEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionExcep @MethodSource("asyncEdges") void updateEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseEdgeDocument doc = createEdgeValue(null, edgeCollection.graph()); doc.addAttribute("test", "foo"); @@ -378,8 +360,6 @@ void updateEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionExcept @MethodSource("asyncEdges") void deleteEdge(ArangoEdgeCollectionAsync edgeCollection) throws ExecutionException, InterruptedException { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); EdgeEntity createdDoc = edgeCollection.insertEdge(createEdgeValue(null, edgeCollection.graph()), null).get(); diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionGraphTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionGraphTest.java index d4337788a..a3bf6b47b 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionGraphTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionGraphTest.java @@ -82,8 +82,6 @@ private BaseEdgeDocument createEdgeValue(String streamTransactionId, ArangoGraph @MethodSource("vertices") void getVertex(ArangoVertexCollection vertexCollection1) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabase db = vertexCollection1.graph().db(); StreamTransactionEntity tx = db @@ -106,8 +104,6 @@ void getVertex(ArangoVertexCollection vertexCollection1) { @MethodSource("vertices") void createVertex(ArangoVertexCollection vertexCollection1) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabase db = vertexCollection1.graph().db(); StreamTransactionEntity tx = db.beginStreamTransaction( @@ -136,8 +132,6 @@ void createVertex(ArangoVertexCollection vertexCollection1) { @MethodSource("vertices") void replaceVertex(ArangoVertexCollection vertexCollection1) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -175,8 +169,6 @@ void replaceVertex(ArangoVertexCollection vertexCollection1) { @MethodSource("vertices") void updateVertex(ArangoVertexCollection vertexCollection1) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -214,8 +206,6 @@ void updateVertex(ArangoVertexCollection vertexCollection1) { @MethodSource("vertices") void deleteVertex(ArangoVertexCollection vertexCollection1) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); VertexEntity createdDoc = vertexCollection1.insertVertex(new BaseDocument(), null); @@ -246,8 +236,6 @@ void deleteVertex(ArangoVertexCollection vertexCollection1) { @MethodSource("edges") void getEdge(ArangoEdgeCollection edgeCollection) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabase db = edgeCollection.graph().db(); StreamTransactionEntity tx = db @@ -270,8 +258,6 @@ void getEdge(ArangoEdgeCollection edgeCollection) { @MethodSource("edges") void createEdge(ArangoEdgeCollection edgeCollection) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoDatabase db = edgeCollection.graph().db(); StreamTransactionEntity tx = db.beginStreamTransaction( @@ -300,8 +286,6 @@ void createEdge(ArangoEdgeCollection edgeCollection) { @MethodSource("edges") void replaceEdge(ArangoEdgeCollection edgeCollection) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseEdgeDocument doc = createEdgeValue(null, edgeCollection.graph()); doc.addAttribute("test", "foo"); @@ -339,8 +323,6 @@ void replaceEdge(ArangoEdgeCollection edgeCollection) { @MethodSource("edges") void updateEdge(ArangoEdgeCollection edgeCollection) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseEdgeDocument doc = createEdgeValue(null, edgeCollection.graph()); doc.addAttribute("test", "foo"); @@ -377,8 +359,6 @@ void updateEdge(ArangoEdgeCollection edgeCollection) { @MethodSource("edges") void deleteEdge(ArangoEdgeCollection edgeCollection) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); EdgeEntity createdDoc = edgeCollection.insertEdge(createEdgeValue(null, edgeCollection.graph()), null); diff --git a/test-functional/src/test/java/com/arangodb/StreamTransactionTest.java b/test-functional/src/test/java/com/arangodb/StreamTransactionTest.java index 826a6696f..dfc54ab04 100644 --- a/test-functional/src/test/java/com/arangodb/StreamTransactionTest.java +++ b/test-functional/src/test/java/com/arangodb/StreamTransactionTest.java @@ -51,8 +51,6 @@ static void init() { @MethodSource("dbs") void beginStreamTransaction(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction(null); assertThat(tx.getId()).isNotNull(); @@ -64,8 +62,6 @@ void beginStreamTransaction(ArangoDatabase db) { @MethodSource("dbs") void beginStreamTransactionWithNonExistingCollectionsShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.beginStreamTransaction(new StreamTransactionOptions().writeCollections("notExistingCollection"))); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -75,8 +71,6 @@ void beginStreamTransactionWithNonExistingCollectionsShouldThrow(ArangoDatabase @MethodSource("dbs") void abortStreamTransaction(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity begunTx = db.beginStreamTransaction(null); StreamTransactionEntity abortedTx = db.abortStreamTransaction(begunTx.getId()); @@ -90,8 +84,6 @@ void abortStreamTransaction(ArangoDatabase db) { @MethodSource("dbs") void abortStreamTransactionTwice(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity begunTx = db.beginStreamTransaction(null); db.abortStreamTransaction(begunTx.getId()); @@ -102,8 +94,6 @@ void abortStreamTransactionTwice(ArangoDatabase db) { @MethodSource("dbs") void abortStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.abortStreamTransaction("000000")); assertThat(thrown).isInstanceOf(ArangoDBException.class); } @@ -112,8 +102,6 @@ void abortStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatab @MethodSource("dbs") void abortStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.abortStreamTransaction("invalidTransactionId")); assertThat(thrown).isInstanceOf(ArangoDBException.class); } @@ -122,8 +110,6 @@ void abortStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase db @MethodSource("dbs") void abortCommittedStreamTransactionShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null); db.commitStreamTransaction(createdTx.getId()); @@ -135,8 +121,6 @@ void abortCommittedStreamTransactionShouldThrow(ArangoDatabase db) { @MethodSource("dbs") void getStreamTransaction(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null); StreamTransactionEntity gotTx = db.getStreamTransaction(createdTx.getId()); @@ -152,8 +136,6 @@ void getStreamTransaction(ArangoDatabase db) { @MethodSource("dbs") void getStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.getStreamTransaction("000000")); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -163,8 +145,6 @@ void getStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabas @MethodSource("dbs") void getStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.getStreamTransaction("invalidTransactionId")); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -174,8 +154,6 @@ void getStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase db) @MethodSource("dbs") void commitStreamTransaction(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null); StreamTransactionEntity committedTx = db.commitStreamTransaction(createdTx.getId()); @@ -189,8 +167,6 @@ void commitStreamTransaction(ArangoDatabase db) { @MethodSource("dbs") void commitStreamTransactionTwice(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null); db.commitStreamTransaction(createdTx.getId()); @@ -201,8 +177,6 @@ void commitStreamTransactionTwice(ArangoDatabase db) { @MethodSource("dbs") void commitStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.commitStreamTransaction("000000")); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -212,8 +186,6 @@ void commitStreamTransactionWhenTransactionIdDoesNotExistsShouldThrow(ArangoData @MethodSource("dbs") void commitStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); Throwable thrown = catchThrowable(() -> db.commitStreamTransaction("invalidTransactionId")); assertThat(thrown).isInstanceOf(ArangoDBException.class); @@ -223,8 +195,6 @@ void commitStreamTransactionWithInvalidTransactionIdShouldThrow(ArangoDatabase d @MethodSource("dbs") void commitAbortedStreamTransactionShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity createdTx = db.beginStreamTransaction(null); db.abortStreamTransaction(createdTx.getId()); @@ -236,8 +206,6 @@ void commitAbortedStreamTransactionShouldThrow(ArangoDatabase db) { @MethodSource("dbs") void getDocument(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)); @@ -258,8 +226,6 @@ void getDocument(ArangoDatabase db) { @MethodSource("dbs") void getDocumentWithNonExistingTransactionIdShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); @@ -272,8 +238,6 @@ void getDocumentWithNonExistingTransactionIdShouldThrow(ArangoDatabase db) { @MethodSource("dbs") void getDocumentWithInvalidTransactionIdShouldThrow(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); Throwable thrown = catchThrowable(() -> collection @@ -285,8 +249,6 @@ void getDocumentWithInvalidTransactionIdShouldThrow(ArangoDatabase db) { @MethodSource("dbs") void getDocuments(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)); @@ -313,8 +275,6 @@ void getDocuments(ArangoDatabase db) { @MethodSource("dbs") void insertDocument(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)); @@ -341,8 +301,6 @@ void insertDocument(ArangoDatabase db) { @MethodSource("dbs") void insertDocuments(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)); @@ -373,8 +331,6 @@ void insertDocuments(ArangoDatabase db) { @MethodSource("dbs") void replaceDocument(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -410,8 +366,6 @@ void replaceDocument(ArangoDatabase db) { @MethodSource("dbs") void replaceDocuments(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); List docs = IntStream.range(0, 3).mapToObj(it -> new BaseDocument()) .peek(doc -> doc.addAttribute("test", "foo")).collect(Collectors.toList()); @@ -457,8 +411,6 @@ void replaceDocuments(ArangoDatabase db) { @MethodSource("dbs") void updateDocument(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); BaseDocument doc = new BaseDocument(UUID.randomUUID().toString()); doc.addAttribute("test", "foo"); @@ -495,8 +447,6 @@ void updateDocument(ArangoDatabase db) { @MethodSource("dbs") void updateDocuments(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); List docs = IntStream.range(0, 3).mapToObj(it -> new BaseDocument()) .peek(doc -> doc.addAttribute("test", "foo")).collect(Collectors.toList()); @@ -542,8 +492,6 @@ void updateDocuments(ArangoDatabase db) { @MethodSource("dbs") void deleteDocument(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); DocumentCreateEntity createdDoc = collection @@ -573,8 +521,6 @@ void deleteDocument(ArangoDatabase db) { @MethodSource("dbs") void deleteDocuments(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); List keys = collection @@ -606,8 +552,6 @@ void deleteDocuments(ArangoDatabase db) { @MethodSource("dbs") void documentExists(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)); @@ -628,8 +572,6 @@ void documentExists(ArangoDatabase db) { @MethodSource("dbs") void count(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); Long initialCount = collection.count().getCount(); @@ -651,8 +593,6 @@ void count(ArangoDatabase db) { @MethodSource("dbs") void truncate(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); ArangoCollection collection = db.collection(COLLECTION_NAME); collection.insertDocument(new BaseDocument(), null); @@ -680,8 +620,6 @@ void truncate(ArangoDatabase db) { @MethodSource("dbs") void createCursor(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().readCollections(COLLECTION_NAME)); @@ -709,8 +647,6 @@ void createCursor(ArangoDatabase db) { @MethodSource("dbs") void nextCursor(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db.beginStreamTransaction( new StreamTransactionOptions().readCollections(COLLECTION_NAME).writeCollections(COLLECTION_NAME)); @@ -742,8 +678,6 @@ void nextCursor(ArangoDatabase db) { @MethodSource("dbs") void getStreamTransactions(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx1 = db.beginStreamTransaction(null); StreamTransactionEntity tx2 = db.beginStreamTransaction(null); @@ -764,8 +698,6 @@ void getStreamTransactions(ArangoDatabase db) { @MethodSource("dbs") void transactionAllowImplicitFalse(ArangoDatabase db) { assumeTrue(isSingleServer()); - assumeTrue(isAtLeastVersion(3, 5)); - assumeTrue(isStorageEngine(ArangoDBEngine.StorageEngineName.rocksdb)); StreamTransactionEntity tx = db .beginStreamTransaction(new StreamTransactionOptions().allowImplicit(false)); @@ -791,7 +723,6 @@ void transactionAllowImplicitFalse(ArangoDatabase db) { @MethodSource("dbs") void transactionDirtyRead(ArangoDatabase db) throws IOException { assumeTrue(isCluster()); - assumeTrue(isAtLeastVersion(3, 10)); ArangoCollection collection = db.collection(COLLECTION_NAME); DocumentCreateEntity doc = collection.insertDocument(new BaseDocument()); diff --git a/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java b/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java index 24d50c881..d18e46e45 100644 --- a/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java @@ -1,9 +1,8 @@ package com.arangodb; +import com.arangodb.util.ProtocolSource; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import java.util.concurrent.ExecutionException; @@ -12,11 +11,9 @@ class UserAgentAsyncTest extends BaseJunit5 { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void userAgentHeader(Protocol protocol) throws ExecutionException, InterruptedException { assumeTrue(supportsV8()); - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDBAsync adb = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) diff --git a/test-functional/src/test/java/com/arangodb/UserAgentTest.java b/test-functional/src/test/java/com/arangodb/UserAgentTest.java index c060dff91..c645681c0 100644 --- a/test-functional/src/test/java/com/arangodb/UserAgentTest.java +++ b/test-functional/src/test/java/com/arangodb/UserAgentTest.java @@ -1,16 +1,16 @@ package com.arangodb; +import com.arangodb.util.ProtocolSource; import com.fasterxml.jackson.databind.JsonNode; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; class UserAgentTest extends BaseJunit5 { - private static final String EXPECTED_VERSION = "7.25.0"; + private static final String EXPECTED_VERSION = "8.0.0-SNAPSHOT"; private static final boolean SHADED = Boolean.parseBoolean(System.getProperty("shaded")); @@ -25,10 +25,9 @@ void packageVersionIsShaded() { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void userAgentHeader(Protocol protocol) { assumeTrue(supportsV8()); - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); ArangoDB adb = new ArangoDB.Builder() .loadProperties(config) diff --git a/test-functional/src/test/java/com/arangodb/internal/HostHandlerTest.java b/test-functional/src/test/java/com/arangodb/internal/HostHandlerTest.java index 109a9eb5e..025d93b47 100644 --- a/test-functional/src/test/java/com/arangodb/internal/HostHandlerTest.java +++ b/test-functional/src/test/java/com/arangodb/internal/HostHandlerTest.java @@ -84,26 +84,26 @@ public void close() { @Test void fallbackHostHandlerSingleHost() { final HostHandler handler = new FallbackHostHandler(SINGLE_HOST); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); handler.fail(new RuntimeException()); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); } @Test void fallbackHostHandlerMultipleHosts() { final HostHandler handler = new FallbackHostHandler(MULTIPLE_HOSTS); for (int i = 0; i < 3; i++) { - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); handler.fail(new RuntimeException("HOST_0 failed")); - assertThat(handler.get(null, null)).isEqualTo(HOST_1); + assertThat(handler.get(null)).isEqualTo(HOST_1); handler.fail(new RuntimeException("HOST_1 failed")); - assertThat(handler.get(null, null)).isEqualTo(HOST_2); + assertThat(handler.get(null)).isEqualTo(HOST_2); handler.fail(new RuntimeException("HOST_2 failed")); if (i < 2) { - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); } else { try { - handler.get(null, null); + handler.get(null); fail(); } catch (ArangoDBException e) { assertThat(e.getCause()).isNotNull(); @@ -123,24 +123,24 @@ void fallbackHostHandlerMultipleHosts() { @Test void randomHostHandlerSingleHost() { final HostHandler handler = new RandomHostHandler(SINGLE_HOST, new FallbackHostHandler(SINGLE_HOST)); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); handler.fail(new RuntimeException()); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); } @Test void randomHostHandlerMultipleHosts() { final HostHandler handler = new RandomHostHandler(MULTIPLE_HOSTS, new FallbackHostHandler(MULTIPLE_HOSTS)); - final Host pick0 = handler.get(null, null); + final Host pick0 = handler.get(null); assertThat(pick0).isIn(HOST_0, HOST_1, HOST_2); handler.fail(new RuntimeException()); - final Host pick1 = handler.get(null, null); + final Host pick1 = handler.get(null); assertThat(pick1).isIn(HOST_0, HOST_1, HOST_2); handler.success(); - final Host pick3 = handler.get(null, null); + final Host pick3 = handler.get(null); assertThat(pick3) .isIn(HOST_0, HOST_1, HOST_2) .isEqualTo(pick1); @@ -149,25 +149,25 @@ void randomHostHandlerMultipleHosts() { @Test void roundRobinHostHandlerSingleHost() { final HostHandler handler = new RoundRobinHostHandler(SINGLE_HOST); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); handler.fail(new RuntimeException()); - assertThat(handler.get(null, null)).isEqualTo(HOST_0); + assertThat(handler.get(null)).isEqualTo(HOST_0); } @Test void roundRobinHostHandlerMultipleHosts() { final HostHandler handler = new RoundRobinHostHandler(MULTIPLE_HOSTS); - final Host pick0 = handler.get(null, null); + final Host pick0 = handler.get(null); assertThat(pick0).isIn(HOST_0, HOST_1, HOST_2); - final Host pick1 = handler.get(null, null); + final Host pick1 = handler.get(null); assertThat(pick1) .isIn(HOST_0, HOST_1, HOST_2) .isNotEqualTo(pick0); - final Host pick2 = handler.get(null, null); + final Host pick2 = handler.get(null); assertThat(pick2) .isIn(HOST_0, HOST_1, HOST_2) .isNotIn(pick0, pick1); - final Host pick4 = handler.get(null, null); + final Host pick4 = handler.get(null); assertThat(pick4).isEqualTo(pick0); } diff --git a/test-functional/src/test/java/com/arangodb/internal/velocystream/CommunicationTest.java b/test-functional/src/test/java/com/arangodb/internal/velocystream/CommunicationTest.java deleted file mode 100644 index 5219179fc..000000000 --- a/test-functional/src/test/java/com/arangodb/internal/velocystream/CommunicationTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.internal.velocystream; - -import com.arangodb.ArangoDB; -import com.arangodb.ArangoDatabase; -import com.arangodb.config.ConfigUtils; -import com.arangodb.entity.ArangoDBVersion; -import com.arangodb.util.SlowTest; -import org.junit.jupiter.api.Test; - -import java.util.Collection; -import java.util.Iterator; -import java.util.concurrent.ConcurrentLinkedQueue; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * @author Mark Vollmary - */ -class CommunicationTest { - - private static final String FAST = "fast"; - private static final String SLOW = "slow"; - - @Test - void chunkSizeSmall() { - final ArangoDB arangoDB = new ArangoDB.Builder() - .loadProperties(ConfigUtils.loadConfig()) - .chunkSize(20).build(); - final ArangoDBVersion version = arangoDB.getVersion(); - assertThat(version).isNotNull(); - } - - @SlowTest - @Test - void multiThread() throws Exception { - final ArangoDB arangoDB = new ArangoDB.Builder() - .loadProperties(ConfigUtils.loadConfig()) - .build(); - arangoDB.getUsers(); // authentication and active-failover connection redirect to master - - final Collection result = new ConcurrentLinkedQueue<>(); - final Thread fast = new Thread(() -> { - arangoDB.db().query("return sleep(0.1)", null, null, null); - result.add(FAST); - }); - final Thread slow = new Thread(() -> { - arangoDB.db().query("return sleep(0.5)", null, null, null); - result.add(SLOW); - }); - slow.start(); - fast.start(); - - slow.join(); - fast.join(); - - assertThat(result.size()).isEqualTo(2); - final Iterator iterator = result.iterator(); - assertThat(iterator.next()).isEqualTo(FAST); - assertThat(iterator.next()).isEqualTo(SLOW); - } - - @SlowTest - @Test - void multiThreadSameDatabases() throws Exception { - final ArangoDB arangoDB = new ArangoDB.Builder() - .loadProperties(ConfigUtils.loadConfig()) - .build(); - arangoDB.getUsers(); // authentication and active-failover connection redirect to master - - final ArangoDatabase db = arangoDB.db(); - - final Collection result = new ConcurrentLinkedQueue<>(); - final Thread t1 = new Thread(() -> { - db.query("return sleep(0.1)", null, null, null); - result.add("1"); - }); - final Thread t2 = new Thread(() -> { - db.query("return sleep(0.1)", null, null, null); - result.add("1"); - }); - t2.start(); - t1.start(); - t2.join(); - t1.join(); - assertThat(result.size()).isEqualTo(2); - } - - @Test - void defaultMaxConnection() { - final ArangoDB arangoDB = new ArangoDB.Builder() - .loadProperties(ConfigUtils.loadConfig()) - .maxConnections(null).build(); - final ArangoDBVersion version = arangoDB.getVersion(); - assertThat(version).isNotNull(); - } -} diff --git a/test-functional/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java b/test-functional/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java index 218ba79ae..2af8441b7 100644 --- a/test-functional/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java +++ b/test-functional/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java @@ -20,11 +20,9 @@ package com.arangodb.mapping.annotations; -import com.arangodb.ContentType; import com.arangodb.serde.ArangoSerde; import com.arangodb.serde.jackson.JacksonSerde; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.api.Test; import java.util.Map; @@ -35,10 +33,9 @@ */ class ArangoAnnotationsTest { - @ParameterizedTest - @EnumSource(ContentType.class) - void documentFieldAnnotations(ContentType contentType) { - ArangoSerde mapper = JacksonSerde.of(contentType); + @Test + void documentFieldAnnotations() { + ArangoSerde mapper = JacksonSerde.load(); AnnotatedEntity e = new AnnotatedEntity(); e.setId("Id"); diff --git a/test-functional/src/test/java/com/arangodb/serde/CustomSerdeAsyncTest.java b/test-functional/src/test/java/com/arangodb/serde/CustomSerdeAsyncTest.java index 0f305e97c..ec47e5385 100644 --- a/test-functional/src/test/java/com/arangodb/serde/CustomSerdeAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/serde/CustomSerdeAsyncTest.java @@ -64,7 +64,7 @@ class CustomSerdeAsyncTest { @BeforeAll static void init() throws ExecutionException, InterruptedException { - JacksonSerde serde = JacksonSerde.of(ContentType.JSON) + JacksonSerde serde = JacksonSerde.load() .configure((mapper) -> { mapper.configure(WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED, true); mapper.configure(USE_BIG_INTEGER_FOR_INTS, true); @@ -75,7 +75,7 @@ static void init() throws ExecutionException, InterruptedException { arangoDB = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) .serde(serde) - .protocol(Protocol.HTTP_JSON) + .protocol(Protocol.HTTP_1_1) .build() .async(); diff --git a/test-functional/src/test/java/com/arangodb/serde/CustomSerdeTest.java b/test-functional/src/test/java/com/arangodb/serde/CustomSerdeTest.java index 58a736f6f..a2657de56 100644 --- a/test-functional/src/test/java/com/arangodb/serde/CustomSerdeTest.java +++ b/test-functional/src/test/java/com/arangodb/serde/CustomSerdeTest.java @@ -63,7 +63,7 @@ class CustomSerdeTest { @BeforeAll static void init() { - JacksonSerde serde = JacksonSerde.of(ContentType.VPACK) + JacksonSerde serde = JacksonSerde.load() .configure((mapper) -> { mapper.configure(WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED, true); mapper.configure(USE_BIG_INTEGER_FOR_INTS, true); @@ -73,7 +73,7 @@ static void init() { }); arangoDB = new ArangoDB.Builder() .loadProperties(ConfigUtils.loadConfig()) - .protocol(Protocol.HTTP_VPACK) + .protocol(Protocol.HTTP_1_1) .serde(serde).build(); db = arangoDB.db("custom-serde-test"); diff --git a/test-functional/src/test/java/com/arangodb/serde/JacksonConfigurationTest.java b/test-functional/src/test/java/com/arangodb/serde/JacksonConfigurationTest.java index 1a0f82122..3b0606fd5 100644 --- a/test-functional/src/test/java/com/arangodb/serde/JacksonConfigurationTest.java +++ b/test-functional/src/test/java/com/arangodb/serde/JacksonConfigurationTest.java @@ -1,11 +1,9 @@ package com.arangodb.serde; -import com.arangodb.ContentType; import com.arangodb.internal.serde.InternalSerdeProvider; import com.arangodb.serde.jackson.JacksonSerde; import com.arangodb.util.SlowTest; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.api.Test; import java.util.UUID; @@ -14,10 +12,9 @@ public class JacksonConfigurationTest { @SlowTest - @ParameterizedTest - @EnumSource(ContentType.class) - void bigStringInternalSerde(ContentType type) { - ArangoSerde s = new InternalSerdeProvider(type).create(); + @Test + void bigStringInternalSerde() { + ArangoSerde s = new InternalSerdeProvider().create(); StringBuilder sb = new StringBuilder(); while (sb.length() < 40_000_000) { @@ -30,10 +27,9 @@ void bigStringInternalSerde(ContentType type) { } @SlowTest - @ParameterizedTest - @EnumSource(ContentType.class) - void bigStringUserSerde(ContentType type) { - ArangoSerde s = JacksonSerde.of(type); + @Test + void bigStringUserSerde() { + ArangoSerde s = JacksonSerde.load(); StringBuilder sb = new StringBuilder(); while (sb.length() < 40_000_000) { diff --git a/test-functional/src/test/java/com/arangodb/serde/SerdeTest.java b/test-functional/src/test/java/com/arangodb/serde/SerdeTest.java index fd98e5e37..d7848dd95 100644 --- a/test-functional/src/test/java/com/arangodb/serde/SerdeTest.java +++ b/test-functional/src/test/java/com/arangodb/serde/SerdeTest.java @@ -1,6 +1,5 @@ package com.arangodb.serde; -import com.arangodb.ContentType; import com.arangodb.entity.BaseDocument; import com.arangodb.internal.serde.InternalSerde; import com.arangodb.internal.serde.InternalSerdeProvider; @@ -10,8 +9,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import org.assertj.core.api.InstanceOfAssertFactories; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.api.Test; import java.util.*; @@ -20,10 +18,9 @@ class SerdeTest { - @ParameterizedTest - @EnumSource(ContentType.class) - void rawJsonSerde(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void rawJsonSerde() { + InternalSerde s = new InternalSerdeProvider().create(); ObjectNode node = JsonNodeFactory.instance.objectNode().put("foo", "bar"); RawJson raw = RawJson.of(SerdeUtils.INSTANCE.writeJson(node)); byte[] serialized = s.serialize(raw); @@ -31,10 +28,9 @@ void rawJsonSerde(ContentType type) { assertThat(deserialized).isEqualTo(raw); } - @ParameterizedTest - @EnumSource(ContentType.class) - void rawBytesSerde(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void rawBytesSerde() { + InternalSerde s = new InternalSerdeProvider().create(); ObjectNode node = JsonNodeFactory.instance.objectNode().put("foo", "bar"); RawBytes raw = RawBytes.of(s.serialize(node)); byte[] serialized = s.serializeUserData(raw); @@ -42,10 +38,9 @@ void rawBytesSerde(ContentType type) { assertThat(deserialized).isEqualTo(raw); } - @ParameterizedTest - @EnumSource(ContentType.class) - void deserializeBaseDocumentWithNestedProperties(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void deserializeBaseDocumentWithNestedProperties() { + InternalSerde s = new InternalSerdeProvider().create(); RawJson json = RawJson.of("{\"foo\":\"aaa\",\"properties\":{\"foo\":\"bbb\"}}"); BaseDocument deserialized = s.deserialize(s.serialize(json), BaseDocument.class); assertThat(deserialized.getAttribute("foo")).isEqualTo("aaa"); @@ -55,10 +50,9 @@ void deserializeBaseDocumentWithNestedProperties(ContentType type) { .containsEntry("foo", "bbb"); } - @ParameterizedTest - @EnumSource(ContentType.class) - void serializeBaseDocumentWithNestedProperties(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void serializeBaseDocumentWithNestedProperties() { + InternalSerde s = new InternalSerdeProvider().create(); BaseDocument doc = new BaseDocument(); doc.addAttribute("foo", "aaa"); doc.addAttribute("properties", Collections.singletonMap("foo", "bbb")); @@ -68,34 +62,30 @@ void serializeBaseDocumentWithNestedProperties(ContentType type) { assertThat(on.get("properties").get("foo").textValue()).isEqualTo("bbb"); } - @ParameterizedTest - @EnumSource(ContentType.class) - void deserializeNull(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void deserializeNull() { + InternalSerde s = new InternalSerdeProvider().create(); Void deser = s.deserialize((byte[]) null, Void.class); assertThat(deser).isNull(); } - @ParameterizedTest - @EnumSource(ContentType.class) - void deserializeNullUserSerde(ContentType type) { - ArangoSerde s = ArangoSerdeProvider.of(type).create(); + @Test + void deserializeNullUserSerde() { + ArangoSerde s = ArangoSerdeProvider.load().create(); Void deser = s.deserialize(null, Void.class); assertThat(deser).isNull(); } - @ParameterizedTest - @EnumSource(ContentType.class) - void deserializeEmpty(ContentType type) { - InternalSerde s = new InternalSerdeProvider(type).create(); + @Test + void deserializeEmpty() { + InternalSerde s = new InternalSerdeProvider().create(); Void deser = s.deserialize(new byte[0], Void.class); assertThat(deser).isNull(); } - @ParameterizedTest - @EnumSource(ContentType.class) - void deserializeEmptyUserSerde(ContentType type) { - ArangoSerde s = ArangoSerdeProvider.of(type).create(); + @Test + void deserializeEmptyUserSerde() { + ArangoSerde s = ArangoSerdeProvider.load().create(); Void deser = s.deserialize(new byte[0], Void.class); assertThat(deser).isNull(); } diff --git a/test-functional/src/test/java/com/arangodb/util/ProtocolSource.java b/test-functional/src/test/java/com/arangodb/util/ProtocolSource.java new file mode 100644 index 000000000..5701d5571 --- /dev/null +++ b/test-functional/src/test/java/com/arangodb/util/ProtocolSource.java @@ -0,0 +1,15 @@ +package com.arangodb.util; + +import com.arangodb.Protocol; +import org.junit.jupiter.params.provider.EnumSource; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@EnumSource(Protocol.class) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ProtocolSource { +} diff --git a/test-functional/src/test/resources/META-INF/native-image/native-image.properties b/test-functional/src/test/resources/META-INF/native-image/native-image.properties index 0f53a7a15..6ee473457 100644 --- a/test-functional/src/test/resources/META-INF/native-image/native-image.properties +++ b/test-functional/src/test/resources/META-INF/native-image/native-image.properties @@ -42,5 +42,7 @@ Args=\ io.netty.resolver.dns.DnsNameResolver,\ io.netty.resolver.HostsFileEntriesResolver,\ io.netty.resolver.dns.ResolvConf$ResolvConfLazy,\ - io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider,\ + io.netty.handler.ssl.ReferenceCountedOpenSslContext,\ + io.netty.handler.ssl.ReferenceCountedOpenSslClientContext,\ + io.netty.handler.ssl.ReferenceCountedOpenSslServerContext,\ io.vertx.core.buffer.impl.VertxByteBufAllocator diff --git a/test-non-functional/pom.xml b/test-non-functional/pom.xml index eef56d5a3..109921cf4 100644 --- a/test-non-functional/pom.xml +++ b/test-non-functional/pom.xml @@ -8,15 +8,15 @@ ../test-parent com.arangodb test-parent - 7.25.0 + 8.0.0-SNAPSHOT test-non-functional - 17 - 17 - 17 + 21 + 21 + 21 diff --git a/test-non-functional/src/test/java/CommunicationTest.java b/test-non-functional/src/test/java/CommunicationTest.java index 158a1b3d8..64888b242 100644 --- a/test-non-functional/src/test/java/CommunicationTest.java +++ b/test-non-functional/src/test/java/CommunicationTest.java @@ -1,9 +1,9 @@ import com.arangodb.*; import com.arangodb.config.ArangoConfigProperties; +import com.arangodb.serde.jackson.JacksonSerde; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; -import util.TestUtils; +import util.ProtocolSource; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -11,20 +11,17 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; public class CommunicationTest { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource @Timeout(5) void disconnectAsync(Protocol protocol) throws InterruptedException, ExecutionException { - assumeTrue(!Protocol.VST.equals(protocol)); - ArangoDBAsync arangoDB = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) .protocol(protocol) - .serde(TestUtils.createSerde(protocol)) + .serde(JacksonSerde.load()) .build() .async(); arangoDB.getVersion().get(); @@ -42,15 +39,13 @@ void disconnectAsync(Protocol protocol) throws InterruptedException, ExecutionEx } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource @Timeout(5) void disconnect(Protocol protocol) { - assumeTrue(!Protocol.VST.equals(protocol)); - ArangoDB arangoDB = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) .protocol(protocol) - .serde(TestUtils.createSerde(protocol)) + .serde(JacksonSerde.load()) .build(); arangoDB.getVersion(); diff --git a/test-non-functional/src/test/java/ConfigurationTest.java b/test-non-functional/src/test/java/ConfigurationTest.java index b004c9b38..a0ffe4961 100644 --- a/test-non-functional/src/test/java/ConfigurationTest.java +++ b/test-non-functional/src/test/java/ConfigurationTest.java @@ -1,5 +1,4 @@ import com.arangodb.ArangoDB; -import com.arangodb.ContentType; import com.arangodb.config.ArangoConfigProperties; import com.arangodb.entity.ArangoDBVersion; import com.arangodb.serde.jackson.JacksonSerde; @@ -15,7 +14,7 @@ public class ConfigurationTest { void fallbackHost() { final ArangoDB arangoDB = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) - .serde(JacksonSerde.of(ContentType.JSON)) + .serde(JacksonSerde.load()) .host("not-accessible", 8529) .host("172.28.0.1", 8529) .build(); @@ -27,7 +26,7 @@ void fallbackHost() { void loadPropertiesWithPrefix() { ArangoDB adb = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile("arangodb-with-prefix.properties", "adb")) - .serde(JacksonSerde.of(ContentType.JSON)) + .serde(JacksonSerde.load()) .build(); adb.getVersion(); adb.shutdown(); @@ -40,7 +39,7 @@ void loadConfigFromPropertiesWithPrefix() { props.setProperty("adb.password", "test"); ArangoDB adb = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromProperties(props, "adb")) - .serde(JacksonSerde.of(ContentType.JSON)) + .serde(JacksonSerde.load()) .build(); adb.getVersion(); adb.shutdown(); diff --git a/test-non-functional/src/test/java/arch/InternalsTest.java b/test-non-functional/src/test/java/arch/InternalsTest.java index e46d0ab29..3d56897b0 100644 --- a/test-non-functional/src/test/java/arch/InternalsTest.java +++ b/test-non-functional/src/test/java/arch/InternalsTest.java @@ -33,7 +33,6 @@ public class InternalsTest { not(JavaClass.Predicates.resideInAnyPackage( "..internal..", "com.arangodb.jackson..", - "com.arangodb.velocypack..", "com.arangodb.shaded..") ) ); diff --git a/test-non-functional/src/test/java/arch/SerdeArchTest.java b/test-non-functional/src/test/java/arch/SerdeArchTest.java index 9abf7c5f8..954d9c0c7 100644 --- a/test-non-functional/src/test/java/arch/SerdeArchTest.java +++ b/test-non-functional/src/test/java/arch/SerdeArchTest.java @@ -18,13 +18,6 @@ public class SerdeArchTest { .should().dependOnClassesThat() .resideInAPackage("com.arangodb.serde.jsonb.."); - @ArchTest - public static final ArchRule noDependencyOnJacksonDataformatVelocypack = noClasses().that() - .resideInAPackage("com.arangodb..").and() - .resideOutsideOfPackage("com.arangodb.jackson.dataformat.velocypack..").and() - .resideOutsideOfPackage("com.arangodb.serde.jackson..") - .should().dependOnClassesThat() - .resideInAPackage("com.arangodb.jackson.dataformat.velocypack.."); @ArchTest public static final ArchRule noDependencyOnJacksonSerde = noClasses().that() diff --git a/test-non-functional/src/test/java/arch/ShadedArchTest.java b/test-non-functional/src/test/java/arch/ShadedArchTest.java index b13c93a87..cc6e5318f 100644 --- a/test-non-functional/src/test/java/arch/ShadedArchTest.java +++ b/test-non-functional/src/test/java/arch/ShadedArchTest.java @@ -55,7 +55,6 @@ public void vertxRelocation() { public void jacksonRelocation() { noClasses().that() .resideInAPackage("com.arangodb..").and() - .resideOutsideOfPackage("com.arangodb.jackson.dataformat.velocypack..").and() .resideOutsideOfPackage("com.arangodb.serde.jackson..").and() .resideOutsideOfPackage("com.arangodb.serde.jackson3..") .should().dependOnClassesThat() @@ -68,7 +67,6 @@ public void noJacksonDependency() { noClasses().that() .resideInAPackage("com.arangodb..").and() .resideOutsideOfPackages( - "com.arangodb.jackson.dataformat.velocypack..", "com.arangodb.serde.jackson..", "com.arangodb.serde.jackson3.." ) @@ -77,14 +75,4 @@ public void noJacksonDependency() { .check(importedClasses); } - @Test - public void noJacksonDataformatVelocypackDependency() { - noClasses().that() - .resideInAPackage("com.arangodb..").and() - .resideOutsideOfPackage("com.arangodb.jackson.dataformat.velocypack..") - .should().dependOnClassesThat() - .resideInAPackage("com.arangodb.jackson.dataformat.velocypack..") - .check(importedClasses); - } - } diff --git a/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java b/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java index a3f5200a2..9fd0a4e7a 100644 --- a/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java +++ b/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java @@ -3,6 +3,7 @@ import com.arangodb.*; import com.arangodb.config.ArangoConfigProperties; import com.arangodb.internal.net.ConnectionPoolImpl; +import com.arangodb.serde.jackson.JacksonSerde; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -23,13 +24,10 @@ public class ConnectionLoadBalanceTest { public static Stream configs() { return Stream.of( - // FIXME: DE-1017 - // new Config(Protocol.VST, 1), - // new Config(Protocol.VST, 2), - new Config(Protocol.HTTP_JSON, 10), - new Config(Protocol.HTTP_JSON, 20), - new Config(Protocol.HTTP2_JSON, 1), - new Config(Protocol.HTTP2_JSON, 2) + new Config(Protocol.HTTP_1_1, 10), + new Config(Protocol.HTTP_1_1, 20), + new Config(Protocol.HTTP_2, 1), + new Config(Protocol.HTTP_2, 2) ).map(Arguments::of); } @@ -55,7 +53,7 @@ void doTestLoadBalance(Config cfg, int sleepCycles) throws InterruptedException ArangoDatabaseAsync db = new ArangoDB.Builder() .loadProperties(ArangoConfigProperties.fromFile()) .protocol(cfg.protocol) - .serde(TestUtils.createSerde(cfg.protocol)) + .serde(JacksonSerde.load()) .maxConnections(cfg.maxConnections) .build().async().db(); @@ -105,8 +103,8 @@ private record Config( ) { int maxStreams() { return switch (protocol) { - case HTTP_JSON, HTTP_VPACK -> ConnectionPoolImpl.HTTP1_SLOTS; - default -> ConnectionPoolImpl.HTTP2_SLOTS; + case HTTP_1_1 -> ConnectionPoolImpl.HTTP1_SLOTS; + case HTTP_2 -> ConnectionPoolImpl.HTTP2_SLOTS; }; } } diff --git a/test-non-functional/src/test/java/example/ExampleBase.java b/test-non-functional/src/test/java/example/ExampleBase.java index c4bb33763..ae1d12219 100644 --- a/test-non-functional/src/test/java/example/ExampleBase.java +++ b/test-non-functional/src/test/java/example/ExampleBase.java @@ -25,6 +25,7 @@ import com.arangodb.ArangoDatabase; import com.arangodb.Protocol; import com.arangodb.config.ArangoConfigProperties; +import com.arangodb.serde.jackson.JacksonSerde; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import util.TestUtils; @@ -45,7 +46,7 @@ static void setUp() { ArangoConfigProperties config = ArangoConfigProperties.fromFile(); arangoDB = new ArangoDB.Builder() .loadProperties(config) - .serde(TestUtils.createSerde(config.getProtocol().orElse(Protocol.HTTP2_JSON))) + .serde(JacksonSerde.load()) .build(); String dbName = DB_NAME; if (arangoDB.db(dbName).exists()) diff --git a/test-non-functional/src/test/java/example/graph/AQLActorsAndMoviesExampleTest.java b/test-non-functional/src/test/java/example/graph/AQLActorsAndMoviesExampleTest.java index b2be78c30..e1338806a 100644 --- a/test-non-functional/src/test/java/example/graph/AQLActorsAndMoviesExampleTest.java +++ b/test-non-functional/src/test/java/example/graph/AQLActorsAndMoviesExampleTest.java @@ -27,6 +27,7 @@ import com.arangodb.entity.CollectionType; import com.arangodb.entity.DocumentCreateEntity; import com.arangodb.model.CollectionCreateOptions; +import com.arangodb.serde.jackson.JacksonSerde; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.junit.jupiter.api.AfterAll; @@ -56,7 +57,7 @@ static void setUp() { ArangoConfigProperties config = ArangoConfigProperties.fromFile(); arangoDB = new ArangoDB.Builder() .loadProperties(config) - .serde(TestUtils.createSerde(config.getProtocol().orElse(Protocol.HTTP2_JSON))) + .serde(JacksonSerde.load()) .build(); if (arangoDB.db(TEST_DB).exists()) arangoDB.db(TEST_DB).drop(); diff --git a/test-non-functional/src/test/java/example/graph/BaseGraphTest.java b/test-non-functional/src/test/java/example/graph/BaseGraphTest.java index 134885b00..1bd39eab7 100644 --- a/test-non-functional/src/test/java/example/graph/BaseGraphTest.java +++ b/test-non-functional/src/test/java/example/graph/BaseGraphTest.java @@ -27,6 +27,7 @@ import com.arangodb.config.ArangoConfigProperties; import com.arangodb.entity.EdgeDefinition; import com.arangodb.entity.VertexEntity; +import com.arangodb.serde.jackson.JacksonSerde; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import util.TestUtils; @@ -52,7 +53,7 @@ static void init() { ArangoConfigProperties config = ArangoConfigProperties.fromFile(); arangoDB = new ArangoDB.Builder() .loadProperties(config) - .serde(TestUtils.createSerde(config.getProtocol().orElse(Protocol.HTTP2_JSON))) + .serde(JacksonSerde.load()) .build(); } if (arangoDB.db(TEST_DB).exists()) diff --git a/test-non-functional/src/test/java/mp/ArangoConfigPropertiesMPImpl.java b/test-non-functional/src/test/java/mp/ArangoConfigPropertiesMPImpl.java index cf38fd8ad..534aa34ec 100644 --- a/test-non-functional/src/test/java/mp/ArangoConfigPropertiesMPImpl.java +++ b/test-non-functional/src/test/java/mp/ArangoConfigPropertiesMPImpl.java @@ -28,13 +28,11 @@ public final class ArangoConfigPropertiesMPImpl implements ArangoConfigPropertie private Optional sslTrustStorePassword; private Optional sslTrustStoreType; private Optional verifyHost; - private Optional chunkSize; private Optional pipelining; private Optional connectionWindowSize; private Optional initialWindowSize; private Optional maxConnections; private Optional connectionTtl; - private Optional keepAliveInterval; private Optional acquireHostList; private Optional acquireHostListInterval; private Optional loadBalancingStrategy; @@ -114,11 +112,6 @@ public Optional getVerifyHost() { return verifyHost; } - @Override - public Optional getChunkSize() { - return chunkSize; - } - @Override public Optional getPipelining() { return pipelining; @@ -144,11 +137,6 @@ public Optional getConnectionTtl() { return connectionTtl; } - @Override - public Optional getKeepAliveInterval() { - return keepAliveInterval; - } - @Override public Optional getAcquireHostList() { return acquireHostList; @@ -193,12 +181,12 @@ public Optional getSerdeProviderClass() { public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; ArangoConfigPropertiesMPImpl that = (ArangoConfigPropertiesMPImpl) o; - return Objects.equals(hosts, that.hosts) && Objects.equals(protocol, that.protocol) && Objects.equals(user, that.user) && Objects.equals(password, that.password) && Objects.equals(jwt, that.jwt) && Objects.equals(timeout, that.timeout) && Objects.equals(useSsl, that.useSsl) && Objects.equals(sslCertValue, that.sslCertValue) && Objects.equals(sslAlgorithm, that.sslAlgorithm) && Objects.equals(sslProtocol, that.sslProtocol) && Objects.equals(sslTrustStorePath, that.sslTrustStorePath) && Objects.equals(sslTrustStorePassword, that.sslTrustStorePassword) && Objects.equals(sslTrustStoreType, that.sslTrustStoreType) && Objects.equals(verifyHost, that.verifyHost) && Objects.equals(chunkSize, that.chunkSize) && Objects.equals(pipelining, that.pipelining) && Objects.equals(connectionWindowSize, that.connectionWindowSize) && Objects.equals(initialWindowSize, that.initialWindowSize) && Objects.equals(maxConnections, that.maxConnections) && Objects.equals(connectionTtl, that.connectionTtl) && Objects.equals(keepAliveInterval, that.keepAliveInterval) && Objects.equals(acquireHostList, that.acquireHostList) && Objects.equals(acquireHostListInterval, that.acquireHostListInterval) && Objects.equals(loadBalancingStrategy, that.loadBalancingStrategy) && Objects.equals(responseQueueTimeSamples, that.responseQueueTimeSamples) && Objects.equals(compression, that.compression) && Objects.equals(compressionThreshold, that.compressionThreshold) && Objects.equals(compressionLevel, that.compressionLevel) && Objects.equals(serdeProviderClass, that.serdeProviderClass); + return Objects.equals(hosts, that.hosts) && Objects.equals(protocol, that.protocol) && Objects.equals(user, that.user) && Objects.equals(password, that.password) && Objects.equals(jwt, that.jwt) && Objects.equals(timeout, that.timeout) && Objects.equals(useSsl, that.useSsl) && Objects.equals(sslCertValue, that.sslCertValue) && Objects.equals(sslAlgorithm, that.sslAlgorithm) && Objects.equals(sslProtocol, that.sslProtocol) && Objects.equals(sslTrustStorePath, that.sslTrustStorePath) && Objects.equals(sslTrustStorePassword, that.sslTrustStorePassword) && Objects.equals(sslTrustStoreType, that.sslTrustStoreType) && Objects.equals(verifyHost, that.verifyHost) && Objects.equals(pipelining, that.pipelining) && Objects.equals(connectionWindowSize, that.connectionWindowSize) && Objects.equals(initialWindowSize, that.initialWindowSize) && Objects.equals(maxConnections, that.maxConnections) && Objects.equals(connectionTtl, that.connectionTtl) && Objects.equals(acquireHostList, that.acquireHostList) && Objects.equals(acquireHostListInterval, that.acquireHostListInterval) && Objects.equals(loadBalancingStrategy, that.loadBalancingStrategy) && Objects.equals(responseQueueTimeSamples, that.responseQueueTimeSamples) && Objects.equals(compression, that.compression) && Objects.equals(compressionThreshold, that.compressionThreshold) && Objects.equals(compressionLevel, that.compressionLevel) && Objects.equals(serdeProviderClass, that.serdeProviderClass); } @Override public int hashCode() { - return Objects.hash(hosts, protocol, user, password, jwt, timeout, useSsl, sslCertValue, sslAlgorithm, sslProtocol, sslTrustStorePath, sslTrustStorePassword, sslTrustStoreType, verifyHost, chunkSize, pipelining, connectionWindowSize, initialWindowSize, maxConnections, connectionTtl, keepAliveInterval, acquireHostList, acquireHostListInterval, loadBalancingStrategy, responseQueueTimeSamples, compression, compressionThreshold, compressionLevel, serdeProviderClass); + return Objects.hash(hosts, protocol, user, password, jwt, timeout, useSsl, sslCertValue, sslAlgorithm, sslProtocol, sslTrustStorePath, sslTrustStorePassword, sslTrustStoreType, verifyHost, pipelining, connectionWindowSize, initialWindowSize, maxConnections, connectionTtl, acquireHostList, acquireHostListInterval, loadBalancingStrategy, responseQueueTimeSamples, compression, compressionThreshold, compressionLevel, serdeProviderClass); } @Override @@ -218,13 +206,11 @@ public String toString() { ", sslTrustStorePassword=" + sslTrustStorePassword + ", sslTrustStoreType=" + sslTrustStoreType + ", verifyHost=" + verifyHost + - ", chunkSize=" + chunkSize + ", pipelining=" + pipelining + ", connectionWindowSize=" + connectionWindowSize + ", initialWindowSize=" + initialWindowSize + ", maxConnections=" + maxConnections + ", connectionTtl=" + connectionTtl + - ", keepAliveInterval=" + keepAliveInterval + ", acquireHostList=" + acquireHostList + ", acquireHostListInterval=" + acquireHostListInterval + ", loadBalancingStrategy=" + loadBalancingStrategy + diff --git a/test-non-functional/src/test/java/mp/ConfigMPDefaultsTest.java b/test-non-functional/src/test/java/mp/ConfigMPDefaultsTest.java index c84510765..a3fcc39c8 100644 --- a/test-non-functional/src/test/java/mp/ConfigMPDefaultsTest.java +++ b/test-non-functional/src/test/java/mp/ConfigMPDefaultsTest.java @@ -30,13 +30,11 @@ private void checkResult(ArangoConfigProperties config) { assertThat(config.getSslTrustStorePassword()).isEmpty(); assertThat(config.getSslTrustStoreType()).isEmpty(); assertThat(config.getVerifyHost()).isEmpty(); - assertThat(config.getChunkSize()).isEmpty(); assertThat(config.getPipelining()).isEmpty(); assertThat(config.getConnectionWindowSize()).isEmpty(); assertThat(config.getInitialWindowSize()).isEmpty(); assertThat(config.getMaxConnections()).isNotPresent(); assertThat(config.getConnectionTtl()).isNotPresent(); - assertThat(config.getKeepAliveInterval()).isNotPresent(); assertThat(config.getAcquireHostList()).isEmpty(); assertThat(config.getAcquireHostListInterval()).isEmpty(); assertThat(config.getLoadBalancingStrategy()).isEmpty(); diff --git a/test-non-functional/src/test/java/mp/ConfigMPTest.java b/test-non-functional/src/test/java/mp/ConfigMPTest.java index ea427f449..09106f354 100644 --- a/test-non-functional/src/test/java/mp/ConfigMPTest.java +++ b/test-non-functional/src/test/java/mp/ConfigMPTest.java @@ -15,7 +15,7 @@ class ConfigMPTest { private final HostDescription hostA = new HostDescription("aaa", 1111); private final HostDescription hostB = new HostDescription("bbb", 2222); - private final Protocol protocol = Protocol.HTTP_VPACK; + private final Protocol protocol = Protocol.HTTP_1_1; private final String user = "testUser"; private final String password = "testPassword"; private final String jwt = "testJwt"; @@ -28,13 +28,11 @@ class ConfigMPTest { private final String sslTrustStorePassword = "sslTrustStorePassword"; private final String sslTrustStoreType = "sslTrustStoreType"; private final Boolean verifyHost = false; - private final Integer vstChunkSize = 1234; private final Boolean pipelining = true; private final Integer connectionWindowSize = 987; private final Integer initialWindowSize = 876; private final Integer maxConnections = 123; private final Long connectionTtl = 12345L; - private final Integer keepAliveInterval = 123456; private final Boolean acquireHostList = true; private final Integer acquireHostListInterval = 1234567; private final LoadBalancingStrategy loadBalancingStrategy = LoadBalancingStrategy.ROUND_ROBIN; @@ -72,7 +70,6 @@ private void checkResult(ArangoConfigProperties config) { assertThat(config.getSslTrustStorePassword()).hasValue(sslTrustStorePassword); assertThat(config.getSslTrustStoreType()).hasValue(sslTrustStoreType); assertThat(config.getVerifyHost()).hasValue(verifyHost); - assertThat(config.getChunkSize()).hasValue(vstChunkSize); assertThat(config.getPipelining()).hasValue(pipelining); assertThat(config.getConnectionWindowSize()).hasValue(connectionWindowSize); assertThat(config.getInitialWindowSize()).hasValue(initialWindowSize); @@ -82,9 +79,6 @@ private void checkResult(ArangoConfigProperties config) { assertThat(config.getConnectionTtl()) .isPresent() .hasValue(connectionTtl); - assertThat(config.getKeepAliveInterval()) - .isPresent() - .hasValue(keepAliveInterval); assertThat(config.getAcquireHostList()).hasValue(acquireHostList); assertThat(config.getAcquireHostListInterval()).hasValue(acquireHostListInterval); assertThat(config.getLoadBalancingStrategy()).hasValue(loadBalancingStrategy); diff --git a/test-non-functional/src/test/java/mp/ConfigUtilsMP.java b/test-non-functional/src/test/java/mp/ConfigUtilsMP.java index 07277115f..5dc2bfce1 100644 --- a/test-non-functional/src/test/java/mp/ConfigUtilsMP.java +++ b/test-non-functional/src/test/java/mp/ConfigUtilsMP.java @@ -1,10 +1,14 @@ package mp; import com.arangodb.config.ArangoConfigProperties; -import io.smallrye.config.PropertiesConfigSourceLoader; +import io.smallrye.config.PropertiesConfigSource; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.URL; + public class ConfigUtilsMP { public static ArangoConfigProperties loadConfigMP() { @@ -16,11 +20,19 @@ public static ArangoConfigProperties loadConfigMP(final String location) { } public static ArangoConfigProperties loadConfigMP(final String location, final String prefix) { - SmallRyeConfig cfg = new SmallRyeConfigBuilder() - .withSources(PropertiesConfigSourceLoader.inClassPath(location, 0, ConfigUtilsMP.class.getClassLoader())) - .withMapping(ArangoConfigPropertiesMPImpl.class, prefix) - .build(); - return cfg.getConfigMapping(ArangoConfigPropertiesMPImpl.class, prefix); + URL url = ConfigUtilsMP.class.getClassLoader().getResource(location); + if (url == null) { + throw new IllegalStateException("Configuration file not found: " + location); + } + try { + SmallRyeConfig cfg = new SmallRyeConfigBuilder() + .withSources(new PropertiesConfigSource(url)) + .withMapping(ArangoConfigPropertiesMPImpl.class, prefix) + .build(); + return cfg.getConfigMapping(ArangoConfigPropertiesMPImpl.class, prefix); + } catch (IOException e) { + throw new UncheckedIOException(e); + } } } diff --git a/test-non-functional/src/test/java/perf/SimpleAsyncPerfTest.java b/test-non-functional/src/test/java/perf/SimpleAsyncPerfTest.java index 16cf43cfc..5a3cc4bca 100644 --- a/test-non-functional/src/test/java/perf/SimpleAsyncPerfTest.java +++ b/test-non-functional/src/test/java/perf/SimpleAsyncPerfTest.java @@ -25,7 +25,7 @@ import com.arangodb.Protocol; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import util.ProtocolSource; import java.util.Date; import java.util.concurrent.atomic.AtomicInteger; @@ -56,7 +56,7 @@ private void doGetVersion(ArangoDBAsync arangoDB) throws InterruptedException { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void getVersion(Protocol protocol) throws InterruptedException { ArangoDBAsync arangoDB = new ArangoDB.Builder() .host("172.28.0.1", 8529) diff --git a/test-non-functional/src/test/java/perf/SimpleSyncPerfTest.java b/test-non-functional/src/test/java/perf/SimpleSyncPerfTest.java index 4e18b71f4..4ceffd984 100644 --- a/test-non-functional/src/test/java/perf/SimpleSyncPerfTest.java +++ b/test-non-functional/src/test/java/perf/SimpleSyncPerfTest.java @@ -24,7 +24,7 @@ import com.arangodb.Protocol; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import util.ProtocolSource; import java.util.Date; @@ -42,7 +42,7 @@ private void doGetVersion(ArangoDB arangoDB) { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void getVersion(Protocol protocol) throws InterruptedException { ArangoDB arangoDB = new ArangoDB.Builder() .host("172.28.0.1", 8529) diff --git a/test-non-functional/src/test/java/perf/SyncBenchmarkTest.java b/test-non-functional/src/test/java/perf/SyncBenchmarkTest.java index cc7651c9b..b065ab657 100644 --- a/test-non-functional/src/test/java/perf/SyncBenchmarkTest.java +++ b/test-non-functional/src/test/java/perf/SyncBenchmarkTest.java @@ -6,7 +6,7 @@ import com.arangodb.internal.ArangoRequestParam; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import util.ProtocolSource; @Disabled public class SyncBenchmarkTest { @@ -14,7 +14,7 @@ public class SyncBenchmarkTest { private final int numberOfRequests = 1_000_000; @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void getVersion(Protocol protocol) { System.out.println("-----------------------------------------"); System.out.println("--- getVersion(): " + protocol); @@ -43,7 +43,7 @@ protected void shutdown() { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void getVersionWithDetails(Protocol protocol) { System.out.println("-----------------------------------------"); System.out.println("--- getVersion w/ details: " + protocol); diff --git a/test-non-functional/src/test/java/serde/InternalSerdeTest.java b/test-non-functional/src/test/java/serde/InternalSerdeTest.java index e6d2d5ac6..d425ee50f 100644 --- a/test-non-functional/src/test/java/serde/InternalSerdeTest.java +++ b/test-non-functional/src/test/java/serde/InternalSerdeTest.java @@ -1,38 +1,39 @@ package serde; import com.arangodb.ArangoDB; -import com.arangodb.ContentType; -import com.arangodb.Protocol; import com.arangodb.config.ArangoConfigProperties; import com.arangodb.internal.serde.InternalSerdeProvider; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.arangodb.util.RawJson; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.Map; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; class InternalSerdeTest { - static Stream adbByContentType() { - return Stream.of(ContentType.values()) - .map(ct -> new ArangoDB.Builder() - .loadProperties(ArangoConfigProperties.fromFile()) - .protocol(ContentType.VPACK.equals(ct) ? Protocol.HTTP2_VPACK : Protocol.HTTP2_JSON) - .serde(new InternalSerdeProvider(ct).create()) - .build()) - .map(Arguments::of); + private static ArangoDB adb; + + @BeforeAll + static void init() { + adb = new ArangoDB.Builder() + .loadProperties(ArangoConfigProperties.fromFile()) + .serde(new InternalSerdeProvider().create()) + .build(); + } + + @AfterAll + static void shutdown() { + adb.shutdown(); } - @ParameterizedTest - @MethodSource("adbByContentType") - void shadedJsonNode(ArangoDB adb) { + @Test + void shadedJsonNode() { // uses the internal serde JsonNode doc = JsonNodeFactory.instance .objectNode() @@ -44,9 +45,8 @@ void shadedJsonNode(ArangoDB adb) { assertThat(value.textValue()).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void map(ArangoDB adb) { + @Test + void map() { Map doc = Collections.singletonMap("foo", "bar"); Map res = adb.db().query("return @d", Map.class, Collections.singletonMap("d", doc)).next(); assertThat(res).hasSize(1); @@ -55,9 +55,8 @@ void map(ArangoDB adb) { assertThat(value).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void rawJson(ArangoDB adb) { + @Test + void rawJson() { RawJson doc = RawJson.of(""" {"foo":"bar"}"""); RawJson res = adb.db().query("return @d", RawJson.class, Collections.singletonMap("d", doc)).next(); @@ -66,9 +65,8 @@ void rawJson(ArangoDB adb) { assertThat(value.get()).isEqualTo("\"bar\""); } - @ParameterizedTest - @MethodSource("adbByContentType") - void person(ArangoDB adb) { + @Test + void person() { InternalSerdePerson doc = new InternalSerdePerson("key", "Jim", 22); InternalSerdePerson res = adb.db().query("return @d", InternalSerdePerson.class, Collections.singletonMap("d", doc)).next(); assertThat(res).isEqualTo(doc); diff --git a/test-non-functional/src/test/java/serde/Jackson3SerdeTest.java b/test-non-functional/src/test/java/serde/Jackson3SerdeTest.java index da645904d..0f9a3a383 100644 --- a/test-non-functional/src/test/java/serde/Jackson3SerdeTest.java +++ b/test-non-functional/src/test/java/serde/Jackson3SerdeTest.java @@ -6,29 +6,34 @@ import com.arangodb.util.RawJson; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.Map; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; class Jackson3SerdeTest { - static Stream adbByContentType() { - return Stream.of(new ArangoDB.Builder() - .loadProperties(ArangoConfigProperties.fromFile()) - .serdeProviderClass(JacksonJsonSerdeProvider.class) - .build()) - .map(Arguments::of); + private static ArangoDB adb; + + @BeforeAll + static void init() { + adb = new ArangoDB.Builder() + .loadProperties(ArangoConfigProperties.fromFile()) + .serdeProviderClass(JacksonJsonSerdeProvider.class) + .build(); + } + + @AfterAll + static void shutdown() { + adb.shutdown(); } - @ParameterizedTest - @MethodSource("adbByContentType") - void shadedJsonNode(ArangoDB adb) { + @Test + void shadedJsonNode() { // uses the internal serde JsonNode doc = JsonNodeFactory.instance .objectNode() @@ -40,9 +45,8 @@ void shadedJsonNode(ArangoDB adb) { assertThat(value.textValue()).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void jsonNode(ArangoDB adb) { + @Test + void jsonNode() { // uses the user serde JsonNode doc = JsonNodeFactory.instance .objectNode() @@ -54,9 +58,8 @@ void jsonNode(ArangoDB adb) { assertThat(value.textValue()).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void map(ArangoDB adb) { + @Test + void map() { Map doc = Collections.singletonMap("foo", "bar"); Map res = adb.db().query("return @d", Map.class, Collections.singletonMap("d", doc)).next(); assertThat(res).hasSize(1); @@ -65,9 +68,8 @@ void map(ArangoDB adb) { assertThat(value).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void rawJson(ArangoDB adb) { + @Test + void rawJson() { RawJson doc = RawJson.of(""" {"foo":"bar"}"""); RawJson res = adb.db().query("return @d", RawJson.class, Collections.singletonMap("d", doc)).next(); @@ -76,9 +78,8 @@ void rawJson(ArangoDB adb) { assertThat(value.get()).isEqualTo("\"bar\""); } - @ParameterizedTest - @MethodSource("adbByContentType") - void person(ArangoDB adb) { + @Test + void person() { Jackson3Person doc = new Jackson3Person("key", "Jim", 22); Jackson3Person res = adb.db().query("return @d", Jackson3Person.class, Collections.singletonMap("d", doc)).next(); assertThat(res).isEqualTo(doc); diff --git a/test-non-functional/src/test/java/serde/JacksonRequestContextTest.java b/test-non-functional/src/test/java/serde/JacksonRequestContextTest.java index 468467ff1..a610050db 100644 --- a/test-non-functional/src/test/java/serde/JacksonRequestContextTest.java +++ b/test-non-functional/src/test/java/serde/JacksonRequestContextTest.java @@ -58,7 +58,7 @@ class JacksonRequestContextTest { @BeforeAll static void init() { - JacksonSerde serde = JacksonSerde.of(ContentType.JSON) + JacksonSerde serde = JacksonSerde.load() .configure((mapper) -> { SimpleModule module = new SimpleModule("PersonModule"); module.addDeserializer(Person.class, new PersonDeserializer()); diff --git a/test-non-functional/src/test/java/serde/JacksonSerdeTest.java b/test-non-functional/src/test/java/serde/JacksonSerdeTest.java index 1a1a5db27..16ff150c0 100644 --- a/test-non-functional/src/test/java/serde/JacksonSerdeTest.java +++ b/test-non-functional/src/test/java/serde/JacksonSerdeTest.java @@ -1,38 +1,38 @@ package serde; import com.arangodb.ArangoDB; -import com.arangodb.ContentType; -import com.arangodb.Protocol; import com.arangodb.config.ArangoConfigProperties; import com.arangodb.serde.jackson.JacksonSerde; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.arangodb.util.RawJson; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.Map; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; class JacksonSerdeTest { + private static ArangoDB adb; - static Stream adbByContentType() { - return Stream.of(ContentType.values()) - .map(ct -> new ArangoDB.Builder() - .loadProperties(ArangoConfigProperties.fromFile()) - .protocol(ContentType.VPACK.equals(ct) ? Protocol.HTTP2_VPACK : Protocol.HTTP2_JSON) - .serde(JacksonSerde.of(ct)) - .build()) - .map(Arguments::of); + @BeforeAll + static void init() { + adb = new ArangoDB.Builder() + .loadProperties(ArangoConfigProperties.fromFile()) + .serde(JacksonSerde.load()) + .build(); } - @ParameterizedTest - @MethodSource("adbByContentType") - void shadedJsonNode(ArangoDB adb) { + @AfterAll + static void shutdown() { + adb.shutdown(); + } + + @Test + void shadedJsonNode() { // uses the internal serde JsonNode doc = JsonNodeFactory.instance .objectNode() @@ -44,9 +44,8 @@ void shadedJsonNode(ArangoDB adb) { assertThat(value.textValue()).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void jsonNode(ArangoDB adb) { + @Test + void jsonNode() { // uses the user serde com.fasterxml.jackson.databind.JsonNode doc = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance .objectNode() @@ -58,9 +57,8 @@ void jsonNode(ArangoDB adb) { assertThat(value.textValue()).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void map(ArangoDB adb) { + @Test + void map() { Map doc = Collections.singletonMap("foo", "bar"); Map res = adb.db().query("return @d", Map.class, Collections.singletonMap("d", doc)).next(); assertThat(res).hasSize(1); @@ -69,9 +67,8 @@ void map(ArangoDB adb) { assertThat(value).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void rawJson(ArangoDB adb) { + @Test + void rawJson() { RawJson doc = RawJson.of(""" {"foo":"bar"}"""); RawJson res = adb.db().query("return @d", RawJson.class, Collections.singletonMap("d", doc)).next(); @@ -80,9 +77,8 @@ void rawJson(ArangoDB adb) { assertThat(value.get()).isEqualTo("\"bar\""); } - @ParameterizedTest - @MethodSource("adbByContentType") - void person(ArangoDB adb) { + @Test + void person() { JacksonPerson doc = new JacksonPerson("key", "Jim", 22); JacksonPerson res = adb.db().query("return @d", JacksonPerson.class, Collections.singletonMap("d", doc)).next(); assertThat(res).isEqualTo(doc); diff --git a/test-non-functional/src/test/java/serde/JsonBSerdeTest.java b/test-non-functional/src/test/java/serde/JsonBSerdeTest.java index 7fdc03f7c..a945ba288 100644 --- a/test-non-functional/src/test/java/serde/JsonBSerdeTest.java +++ b/test-non-functional/src/test/java/serde/JsonBSerdeTest.java @@ -5,29 +5,34 @@ import com.arangodb.serde.jsonb.JsonbSerdeProvider; import com.arangodb.util.RawJson; import jakarta.json.*; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.Map; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; class JsonBSerdeTest { - static Stream adbByContentType() { - return Stream.of(new ArangoDB.Builder() - .loadProperties(ArangoConfigProperties.fromFile()) - .serde(new JsonbSerdeProvider().create()) - .build()) - .map(Arguments::of); + private static ArangoDB adb; + + @BeforeAll + static void init() { + adb = new ArangoDB.Builder() + .loadProperties(ArangoConfigProperties.fromFile()) + .serde(new JsonbSerdeProvider().create()) + .build(); + } + + @AfterAll + static void shutdown() { + adb.shutdown(); } - @ParameterizedTest - @MethodSource("adbByContentType") - void jsonNode(ArangoDB adb) { + @Test + void jsonNode() { JsonObject doc = Json.createObjectBuilder() .add("foo", "bar") .build(); @@ -41,9 +46,8 @@ void jsonNode(ArangoDB adb) { .isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void map(ArangoDB adb) { + @Test + void map() { Map doc = Collections.singletonMap("foo", "bar"); Map res = adb.db().query("return @d", Map.class, Collections.singletonMap("d", doc)).next(); assertThat(res).hasSize(1); @@ -52,9 +56,8 @@ void map(ArangoDB adb) { assertThat(value).isEqualTo("bar"); } - @ParameterizedTest - @MethodSource("adbByContentType") - void rawJson(ArangoDB adb) { + @Test + void rawJson() { RawJson doc = RawJson.of(""" {"foo":"bar"}"""); RawJson res = adb.db().query("return @d", RawJson.class, Collections.singletonMap("d", doc)).next(); @@ -63,9 +66,8 @@ void rawJson(ArangoDB adb) { assertThat(value.get()).isEqualTo("\"bar\""); } - @ParameterizedTest - @MethodSource("adbByContentType") - void person(ArangoDB adb) { + @Test + void person() { JsonBPerson doc = new JsonBPerson("key", "Jim", 22); JsonBPerson res = adb.db().query("return @d", JsonBPerson.class, Collections.singletonMap("d", doc)).next(); assertThat(res).isEqualTo(doc); diff --git a/test-non-functional/src/test/java/serde/SerdeConfigurationTest.java b/test-non-functional/src/test/java/serde/SerdeConfigurationTest.java index e899a2b78..5088b408a 100644 --- a/test-non-functional/src/test/java/serde/SerdeConfigurationTest.java +++ b/test-non-functional/src/test/java/serde/SerdeConfigurationTest.java @@ -5,7 +5,6 @@ import com.arangodb.serde.ArangoSerde; import com.arangodb.serde.jackson.internal.JacksonSerdeImpl; import com.arangodb.serde.jackson.json.JacksonJsonSerdeProvider; -import com.arangodb.serde.jackson.vpack.JacksonVPackSerdeProvider; import com.arangodb.serde.jsonb.JsonbSerde; import com.arangodb.serde.jsonb.JsonbSerdeProvider; import com.fasterxml.jackson.databind.ObjectMapper; @@ -28,19 +27,6 @@ public class SerdeConfigurationTest { } } - @Test - void vpackSerdeProvider() { - ArangoDB adb = new ArangoDB.Builder() - .host("foo", 1111) - .serdeProviderClass(JacksonVPackSerdeProvider.class) - .build(); - - ArangoSerde serde = adb.getSerde().getUserSerde(); - assertThat(serde).isInstanceOf(JacksonSerdeImpl.class); - - ObjectMapper mapper = (ObjectMapper) JACKSON_SERDE_IMPL_MAPPER.get(serde); - assertThat(mapper.getFactory().getFormatName()).isEqualTo("Velocypack"); - } @Test void jsonSerdeProvider() { diff --git a/test-non-functional/src/test/java/util/ProtocolSource.java b/test-non-functional/src/test/java/util/ProtocolSource.java new file mode 100644 index 000000000..08e4ac862 --- /dev/null +++ b/test-non-functional/src/test/java/util/ProtocolSource.java @@ -0,0 +1,15 @@ +package util; + +import com.arangodb.Protocol; +import org.junit.jupiter.params.provider.EnumSource; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@EnumSource(Protocol.class) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ProtocolSource { +} diff --git a/test-non-functional/src/test/java/util/TestUtils.java b/test-non-functional/src/test/java/util/TestUtils.java index 9a5dbc3b9..0162877bc 100644 --- a/test-non-functional/src/test/java/util/TestUtils.java +++ b/test-non-functional/src/test/java/util/TestUtils.java @@ -22,10 +22,6 @@ package util; -import com.arangodb.ContentType; -import com.arangodb.Protocol; -import com.arangodb.serde.ArangoSerde; -import com.arangodb.serde.jackson.JacksonSerde; import com.arangodb.util.UnicodeUtils; import java.util.ArrayList; @@ -44,13 +40,6 @@ public final class TestUtils { private TestUtils() { } - public static ArangoSerde createSerde(Protocol protocol) { - return switch (protocol) { - case VST, HTTP_VPACK, HTTP2_VPACK -> JacksonSerde.of(ContentType.VPACK); - case HTTP_JSON, HTTP2_JSON -> JacksonSerde.of(ContentType.JSON); - }; - } - /** * Parses {@param version} and checks whether it is greater or equal to <{@param otherMajor}, {@param otherMinor}, * {@param otherPatch}> comparing the corresponding version components in lexicographical order. diff --git a/test-non-functional/src/test/resources/arangodb-config-test.properties b/test-non-functional/src/test/resources/arangodb-config-test.properties index efb000f62..be2773ce9 100644 --- a/test-non-functional/src/test/resources/arangodb-config-test.properties +++ b/test-non-functional/src/test/resources/arangodb-config-test.properties @@ -1,5 +1,5 @@ adb.hosts=aaa:1111,bbb:2222 -adb.protocol=HTTP_VPACK +adb.protocol=HTTP_1_1 adb.user=testUser adb.password=testPassword adb.jwt=testJwt @@ -12,13 +12,11 @@ adb.sslTrustStorePath=sslTrustStorePath adb.sslTrustStorePassword=sslTrustStorePassword adb.sslTrustStoreType=sslTrustStoreType adb.verifyHost=false -adb.chunkSize=1234 adb.pipelining=true adb.connectionWindowSize=987 adb.initialWindowSize=876 adb.maxConnections=123 adb.connectionTtl=12345 -adb.keepAliveInterval=123456 adb.acquireHostList=true adb.acquireHostListInterval=1234567 adb.loadBalancingStrategy=ROUND_ROBIN diff --git a/test-parent/pom.xml b/test-parent/pom.xml index 7392eece7..8c8c4ceea 100644 --- a/test-parent/pom.xml +++ b/test-parent/pom.xml @@ -7,7 +7,7 @@ com.arangodb arangodb-java-driver-parent - 7.25.0 + 8.0.0-SNAPSHOT pom @@ -17,18 +17,13 @@ false 2.21.1 true - 17 - 17 + 21 + 21 src/test/java - - com.arangodb - jackson-serde-vpack - compile - org.slf4j slf4j-simple @@ -173,11 +168,6 @@ arangodb-java-driver compile - - com.arangodb - vst-protocol - compile - diff --git a/test-perf/pom.xml b/test-perf/pom.xml index f5e81909b..5be83fa3b 100644 --- a/test-perf/pom.xml +++ b/test-perf/pom.xml @@ -7,7 +7,7 @@ ../test-parent com.arangodb test-parent - 7.25.0 + 8.0.0-SNAPSHOT test-perf diff --git a/test-perf/src/main/java/com/arangodb/SerdeBench.java b/test-perf/src/main/java/com/arangodb/SerdeBench.java index 3577e96a0..1113495c1 100644 --- a/test-perf/src/main/java/com/arangodb/SerdeBench.java +++ b/test-perf/src/main/java/com/arangodb/SerdeBench.java @@ -7,7 +7,6 @@ import com.arangodb.internal.InternalResponse; import com.arangodb.internal.serde.InternalSerde; import com.arangodb.internal.serde.InternalSerdeProvider; -import com.arangodb.jackson.dataformat.velocypack.VPackMapper; import com.arangodb.util.RawBytes; import com.arangodb.util.RawJson; import com.fasterxml.jackson.databind.ObjectMapper; @@ -50,12 +49,7 @@ public class SerdeBench { public static class MyCol extends ArangoCollectionImpl { static ArangoDB jsonAdb = new ArangoDB.Builder() .host("127.0.0.1", 8529) - .protocol(Protocol.HTTP_JSON) - .build(); - - static ArangoDB vpackAdb = new ArangoDB.Builder() - .host("127.0.0.1", 8529) - .protocol(Protocol.HTTP_VPACK) + .protocol(Protocol.HTTP_1_1) .build(); private MyCol(ArangoDB adb) { @@ -66,10 +60,6 @@ public static MyCol ofJson() { return new MyCol(jsonAdb); } - public static MyCol ofVpack() { - return new MyCol(vpackAdb); - } - @Override public ArangoExecutor.ResponseDeserializer> getDocumentsResponseDeserializer(Class type) { return super.getDocumentsResponseDeserializer(type); @@ -78,33 +68,24 @@ public ArangoExecutor.ResponseDeserializer> getDocume @State(Scope.Benchmark) public static class Data { - public final byte[] vpack; public final byte[] json; public final RawBytes rawJsonBytes; - public final RawBytes rawVPackBytes; public final RawJson rawJson; public final MyCol jsonCol = MyCol.ofJson(); - public final MyCol vpackCol = MyCol.ofVpack(); public final InternalResponse jsonResp = new InternalResponse(); - public final InternalResponse vpackResp = new InternalResponse(); public Data() { ObjectMapper jsonMapper = new ObjectMapper(); - VPackMapper vpackMapper = new VPackMapper(); try { JsonNode jn = readFile("/api-docs.json", jsonMapper); json = jsonMapper.writeValueAsBytes(jn); - vpack = vpackMapper.writeValueAsBytes(jn); rawJsonBytes = RawBytes.of(json); - rawVPackBytes = RawBytes.of(vpack); rawJson = RawJson.of(jsonMapper.writeValueAsString(jsonMapper.readTree(json))); JsonNode docs = readFile("/multi-docs.json", jsonMapper); jsonResp.setResponseCode(200); jsonResp.setBody(jsonMapper.writeValueAsBytes(docs)); - vpackResp.setResponseCode(200); - vpackResp.setBody(vpackMapper.writeValueAsBytes(docs)); } catch (Exception e) { throw new RuntimeException(e); } @@ -152,31 +133,23 @@ public static void main(String[] args) throws RunnerException, IOException { @Benchmark public void rawJsonDeser(Data data, Blackhole bh) { - InternalSerde serde = new InternalSerdeProvider(ContentType.VPACK).create(); + InternalSerde serde = new InternalSerdeProvider().create(); bh.consume( - serde.deserialize(data.vpack, RawJson.class) + serde.deserialize(data.json, RawJson.class) ); } @Benchmark public void rawJsonSer(Data data, Blackhole bh) { - InternalSerde serde = new InternalSerdeProvider(ContentType.VPACK).create(); + InternalSerde serde = new InternalSerdeProvider().create(); bh.consume( serde.serialize(data.rawJson) ); } - @Benchmark - public void extractBytesVPack(Data data, Blackhole bh) { - InternalSerde serde = new InternalSerdeProvider(ContentType.VPACK).create(); - bh.consume( - serde.extract(data.vpack, "/definitions/put_api_simple_remove_by_example_opts") - ); - } - @Benchmark public void extractBytesJson(Data data, Blackhole bh) { - InternalSerde serde = new InternalSerdeProvider(ContentType.JSON).create(); + InternalSerde serde = new InternalSerdeProvider().create(); bh.consume( serde.extract(data.json, "/definitions/put_api_simple_remove_by_example_opts") ); @@ -189,11 +162,4 @@ public void deserializeDocsJson(Data data, Blackhole bh) { ); } - @Benchmark - public void deserializeDocsVPack(Data data, Blackhole bh) { - bh.consume( - data.vpackCol.getDocumentsResponseDeserializer(RawBytes.class).deserialize(data.vpackResp) - ); - } - } diff --git a/test-resilience/pom.xml b/test-resilience/pom.xml index 5656d8691..60368c0a1 100644 --- a/test-resilience/pom.xml +++ b/test-resilience/pom.xml @@ -6,7 +6,7 @@ ../test-parent com.arangodb test-parent - 7.25.0 + 8.0.0-SNAPSHOT 4.0.0 @@ -38,7 +38,7 @@ io.netty netty-bom - 4.1.125.Final + 4.2.10.Final pom import diff --git a/test-resilience/src/test/java/resilience/ClusterTest.java b/test-resilience/src/test/java/resilience/ClusterTest.java index d15bbbcf6..f8332637b 100644 --- a/test-resilience/src/test/java/resilience/ClusterTest.java +++ b/test-resilience/src/test/java/resilience/ClusterTest.java @@ -71,13 +71,9 @@ protected static ArangoDB.Builder dbBuilder() { return builder.password(PASSWORD); } - protected static Stream protocolProvider() { - return Stream.of(Protocol.values()) - .filter(p -> !p.equals(Protocol.VST) || isLessThanVersion(3, 12)); - } - protected static Stream builderProvider() { - return protocolProvider().map(p -> dbBuilder().protocol(p)); + return Stream.of(Protocol.values()) + .map(p -> dbBuilder().protocol(p)); } protected static Stream adbProvider() { diff --git a/test-resilience/src/test/java/resilience/MockTest.java b/test-resilience/src/test/java/resilience/MockTest.java index c75ecc27a..389f9dfaf 100644 --- a/test-resilience/src/test/java/resilience/MockTest.java +++ b/test-resilience/src/test/java/resilience/MockTest.java @@ -25,7 +25,7 @@ public MockTest() { void before() { mockServer = startClientAndServer(getEndpoint().getHost(), getEndpoint().getPort()); arangoDB = new ArangoDB.Builder() - .protocol(Protocol.HTTP_JSON) + .protocol(Protocol.HTTP_1_1) .password(PASSWORD) .host("127.0.0.1", mockServer.getPort()) .build(); diff --git a/test-resilience/src/test/java/resilience/SingleServerTest.java b/test-resilience/src/test/java/resilience/SingleServerTest.java index 852d0a013..68f18995c 100644 --- a/test-resilience/src/test/java/resilience/SingleServerTest.java +++ b/test-resilience/src/test/java/resilience/SingleServerTest.java @@ -58,13 +58,9 @@ protected static ArangoDB.Builder dbBuilder() { .password(PASSWORD); } - protected static Stream protocolProvider() { - return Stream.of(Protocol.values()) - .filter(p -> !p.equals(Protocol.VST) || isLessThanVersion(3, 12)); - } - protected static Stream builderProvider() { - return protocolProvider().map(p -> dbBuilder().protocol(p)); + return Stream.of(Protocol.values()) + .map(p -> dbBuilder().protocol(p)); } protected static Stream adbProvider() { diff --git a/test-resilience/src/test/java/resilience/compression/CompressionTest.java b/test-resilience/src/test/java/resilience/compression/CompressionTest.java index d33e345d0..49cb0b0c5 100644 --- a/test-resilience/src/test/java/resilience/compression/CompressionTest.java +++ b/test-resilience/src/test/java/resilience/compression/CompressionTest.java @@ -7,8 +7,8 @@ import com.arangodb.Protocol; import io.netty.handler.codec.http2.Http2FrameLogger; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; +import resilience.utils.ProtocolSource; import java.util.*; import java.util.stream.Collectors; @@ -27,26 +27,22 @@ class CompressionTest extends ClusterTest { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void gzip(Protocol protocol) { doTest(protocol, Compression.GZIP); } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void deflate(Protocol protocol) { doTest(protocol, Compression.DEFLATE); } void doTest(Protocol protocol, Compression compression) { - assumeTrue(isAtLeastVersion(3, 12)); - assumeTrue(protocol != Protocol.VST); - - assumeTrue(protocol != Protocol.HTTP_VPACK, "hex dumps logs"); // FIXME - assumeTrue(protocol != Protocol.HTTP_JSON, "hex dumps logs"); // FIXME + assumeTrue(protocol != Protocol.HTTP_1_1, "hex dumps logs"); // FIXME // FIXME: - // When using HTTP_VPACK or HTTP_JSON, the logs are hex dumps. + // When using HTTP_JSON, the logs are hex dumps. // Implement a way to check the content-encoding and accept-encoding headers from these logs. ArangoDB adb = dbBuilder() diff --git a/test-resilience/src/test/java/resilience/connection/AcquireHostListTest.java b/test-resilience/src/test/java/resilience/connection/AcquireHostListTest.java index be8d02d5f..a059f66be 100644 --- a/test-resilience/src/test/java/resilience/connection/AcquireHostListTest.java +++ b/test-resilience/src/test/java/resilience/connection/AcquireHostListTest.java @@ -5,9 +5,9 @@ import com.arangodb.entity.LoadBalancingStrategy; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; -import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; import resilience.Endpoint; +import resilience.utils.ProtocolSource; import java.util.HashSet; import java.util.Set; @@ -18,7 +18,7 @@ public class AcquireHostListTest extends ClusterTest { @ParameterizedTest(name = "{index}") - @MethodSource("protocolProvider") + @ProtocolSource void acquireHostList(Protocol protocol) { ArangoDB adb = new ArangoDB.Builder() .host("172.28.0.1", 8529) diff --git a/test-resilience/src/test/java/resilience/connection/ConnectionClusterTest.java b/test-resilience/src/test/java/resilience/connection/ConnectionClusterTest.java index 3748ea975..358bfe151 100644 --- a/test-resilience/src/test/java/resilience/connection/ConnectionClusterTest.java +++ b/test-resilience/src/test/java/resilience/connection/ConnectionClusterTest.java @@ -6,6 +6,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; +import resilience.utils.ProtocolSource; import java.net.ConnectException; import java.net.UnknownHostException; @@ -20,7 +21,7 @@ class ConnectionClusterTest extends ClusterTest { @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFail(Protocol protocol) { // FIXME: make this test faster and re-enable @@ -42,7 +43,7 @@ void nameResolutionFail(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFailAsync(Protocol protocol) { // FIXME: make this test faster and re-enable @@ -65,7 +66,7 @@ void nameResolutionFailAsync(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFailover(Protocol protocol) { // FIXME: make this test faster and re-enable @@ -86,7 +87,7 @@ void nameResolutionFailover(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFailoverAsync(Protocol protocol) throws ExecutionException, InterruptedException { // FIXME: make this test faster and re-enable diff --git a/test-resilience/src/test/java/resilience/connection/ConnectionTest.java b/test-resilience/src/test/java/resilience/connection/ConnectionTest.java index b64f1dd42..342a20b4f 100644 --- a/test-resilience/src/test/java/resilience/connection/ConnectionTest.java +++ b/test-resilience/src/test/java/resilience/connection/ConnectionTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import resilience.SingleServerTest; +import resilience.utils.ProtocolSource; import java.io.IOException; import java.net.ConnectException; @@ -14,7 +15,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Michele Rastelli @@ -22,7 +22,7 @@ class ConnectionTest extends SingleServerTest { @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFail(Protocol protocol) { // FIXME: make this test faster and re-enable @@ -44,7 +44,7 @@ void nameResolutionFail(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource @Disabled void nameResolutionFailAsync(Protocol protocol) { // FIXME: make this test faster and re-enable @@ -98,7 +98,7 @@ void connectionFailAsync(ArangoDBAsync arangoDB) { } @ParameterizedTest(name = "{index}") - @MethodSource("protocolProvider") + @ProtocolSource void authFail(Protocol protocol) { ArangoDB adb = new ArangoDB.Builder() .host(getEndpoint().getHost(), getEndpoint().getPort()) @@ -114,7 +114,7 @@ void authFail(Protocol protocol) { } @ParameterizedTest(name = "{index}") - @MethodSource("protocolProvider") + @ProtocolSource void authFailAsync(Protocol protocol) { ArangoDBAsync adb = new ArangoDB.Builder() .host(getEndpoint().getHost(), getEndpoint().getPort()) @@ -151,9 +151,8 @@ void connCloseAsync(ArangoDBAsync adb) { } @ParameterizedTest(name = "{index}") - @MethodSource("protocolProvider") + @ProtocolSource void connReset(Protocol protocol) throws IOException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST), "DE-776"); // FIXME ArangoDB adb = new ArangoDB.Builder() .host(getEndpoint().getHost(), getEndpoint().getPort()) .protocol(protocol) @@ -171,9 +170,8 @@ void connReset(Protocol protocol) throws IOException, InterruptedException { } @ParameterizedTest(name = "{index}") - @MethodSource("protocolProvider") + @ProtocolSource void connResetAsync(Protocol protocol) throws IOException, InterruptedException { - assumeTrue(!protocol.equals(Protocol.VST), "DE-776"); // FIXME ArangoDBAsync adb = new ArangoDB.Builder() .host(getEndpoint().getHost(), getEndpoint().getPort()) .protocol(protocol) diff --git a/test-resilience/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java b/test-resilience/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java index 1efb0305d..47cbe74ae 100644 --- a/test-resilience/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java +++ b/test-resilience/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java @@ -13,7 +13,6 @@ import java.io.IOException; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; @@ -112,11 +111,6 @@ void retryGETAsync(ArangoDBAsync arangoDB) throws IOException, InterruptedExcept @ParameterizedTest(name = "{index}") @MethodSource("arangoProvider") void retryPOST(ArangoDB arangoDB) throws IOException, InterruptedException { - // create VST connections - for (int i = 0; i < getEndpoints().size(); i++) { - arangoDB.getVersion(); - } - // slow down the driver connection Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); Thread.sleep(100); @@ -137,12 +131,7 @@ void retryPOST(ArangoDB arangoDB) throws IOException, InterruptedException { @ParameterizedTest(name = "{index}") @MethodSource("asyncArangoProvider") - void retryPOSTAsync(ArangoDBAsync arangoDB) throws IOException, InterruptedException, ExecutionException { - // create VST connections - for (int i = 0; i < getEndpoints().size(); i++) { - arangoDB.getVersion().get(); - } - + void retryPOSTAsync(ArangoDBAsync arangoDB) throws IOException, InterruptedException { // slow down the driver connection Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); Thread.sleep(100); diff --git a/test-resilience/src/test/java/resilience/logging/RequestLoggingTest.java b/test-resilience/src/test/java/resilience/logging/RequestLoggingTest.java index ce5d33386..5b0ba1589 100644 --- a/test-resilience/src/test/java/resilience/logging/RequestLoggingTest.java +++ b/test-resilience/src/test/java/resilience/logging/RequestLoggingTest.java @@ -8,8 +8,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.SingleServerTest; +import resilience.utils.ProtocolSource; import java.util.Collections; import java.util.Map; @@ -24,7 +24,7 @@ public RequestLoggingTest() { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void requestLogging(Protocol protocol) { ArangoDB adb = new ArangoDB.Builder() .host("172.28.0.1", 8529) diff --git a/test-resilience/src/test/java/resilience/protocol/ProtocolTest.java b/test-resilience/src/test/java/resilience/protocol/ProtocolTest.java index a242b76a9..91ac05e5d 100644 --- a/test-resilience/src/test/java/resilience/protocol/ProtocolTest.java +++ b/test-resilience/src/test/java/resilience/protocol/ProtocolTest.java @@ -3,7 +3,6 @@ import ch.qos.logback.classic.Level; import com.arangodb.ArangoDB; import com.arangodb.Protocol; -import com.arangodb.vst.internal.VstConnection; import io.netty.handler.codec.http2.Http2FrameLogger; import io.netty.handler.logging.LoggingHandler; import org.junit.jupiter.api.*; @@ -18,13 +17,11 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assumptions.assumeTrue; public class ProtocolTest extends TestUtils { private static final Map, Level> logLevels = new HashMap<>(); static { - logLevels.put(VstConnection.class, Level.DEBUG); logLevels.put(LoggingHandler.class, Level.DEBUG); logLevels.put(Http2FrameLogger.class, Level.DEBUG); } @@ -47,16 +44,14 @@ void shutdown() { static Stream args() { return Stream.of( - Arguments.of(Protocol.VST, "VstConnection"), - Arguments.of(Protocol.HTTP_JSON, "LoggingHandler"), - Arguments.of(Protocol.HTTP2_JSON, "Http2FrameLogger") + Arguments.of(Protocol.HTTP_1_1, "LoggingHandler"), + Arguments.of(Protocol.HTTP_2, "Http2FrameLogger") ); } @ParameterizedTest @MethodSource("args") void shouldUseConfiguredProtocol(Protocol p, String expectedLog) { - assumeTrue(!p.equals(Protocol.VST) || isLessThanVersion(3, 12)); ArangoDB adb = new ArangoDB.Builder() .host("172.28.0.1", 8529) .password("test") diff --git a/test-resilience/src/test/java/resilience/retry/RetryClusterTest.java b/test-resilience/src/test/java/resilience/retry/RetryClusterTest.java index d2f44eba2..0953550dc 100644 --- a/test-resilience/src/test/java/resilience/retry/RetryClusterTest.java +++ b/test-resilience/src/test/java/resilience/retry/RetryClusterTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; +import resilience.utils.ProtocolSource; import java.io.IOException; import java.net.ConnectException; @@ -15,7 +16,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Michele Rastelli @@ -124,9 +124,8 @@ void unreachableHostFailoverAsync(ArangoDBAsync arangoDB) throws ExecutionExcept @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void retryGetOnClosedConnection(Protocol protocol) throws IOException, InterruptedException { - assumeTrue(protocol != Protocol.VST); ArangoDB arangoDB = dbBuilder() .protocol(protocol) .build(); @@ -150,9 +149,8 @@ void retryGetOnClosedConnection(Protocol protocol) throws IOException, Interrupt } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void retryGetOnClosedConnectionAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { - assumeTrue(protocol != Protocol.VST); ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) .build() @@ -183,7 +181,7 @@ void retryGetOnClosedConnectionAsync(Protocol protocol) throws IOException, Inte * the subsequent requests should fail over to a different coordinator and be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, InterruptedException { ArangoDB arangoDB = dbBuilder() .protocol(protocol) @@ -199,9 +197,7 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class)); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); - if (protocol != Protocol.VST) { - assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); - } + assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); arangoDB.db().query("return null", Void.class); @@ -216,7 +212,7 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter * the subsequent requests should fail over to a different coordinator and be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) @@ -233,9 +229,7 @@ void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); - if (protocol != Protocol.VST) { - assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); - } + assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); arangoDB.db().query("return null", Void.class).get(); diff --git a/test-resilience/src/test/java/resilience/retry/RetryTest.java b/test-resilience/src/test/java/resilience/retry/RetryTest.java index 81875c4aa..cf68cdafe 100644 --- a/test-resilience/src/test/java/resilience/retry/RetryTest.java +++ b/test-resilience/src/test/java/resilience/retry/RetryTest.java @@ -8,6 +8,7 @@ import eu.rekawek.toxiproxy.model.toxic.Latency; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import resilience.utils.ProtocolSource; import java.io.IOException; import java.net.ConnectException; @@ -16,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Michele Rastelli @@ -97,7 +97,7 @@ void unreachableHostAsync(ArangoDBAsync arangoDB) throws ExecutionException, Int * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void connectionTimeout(Protocol protocol) throws IOException, InterruptedException { ArangoDB arangoDB = dbBuilder() .timeout(500) @@ -131,7 +131,7 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .timeout(500) @@ -170,9 +170,8 @@ void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedEx * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void retryGetOnClosedConnection(Protocol protocol) throws IOException, InterruptedException { - assumeTrue(protocol != Protocol.VST); ArangoDB arangoDB = dbBuilder() .protocol(protocol) .build(); @@ -212,9 +211,8 @@ void retryGetOnClosedConnection(Protocol protocol) throws IOException, Interrupt * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void retryGetOnClosedConnectionAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { - assumeTrue(protocol != Protocol.VST); ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) .build() @@ -251,7 +249,7 @@ void retryGetOnClosedConnectionAsync(Protocol protocol) throws IOException, Inte * once restored: - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, InterruptedException { ArangoDB arangoDB = dbBuilder() .protocol(protocol) @@ -267,9 +265,7 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class)); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); - if (protocol != Protocol.VST) { - assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); - } + assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); toxic.remove(); getEndpoint().enable(); @@ -284,7 +280,7 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter * once restored: - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) @@ -301,9 +297,7 @@ void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class).get()).getCause(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); - if (protocol != Protocol.VST) { - assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); - } + assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class); toxic.remove(); getEndpoint().enable(); diff --git a/test-resilience/src/test/java/resilience/shutdown/ShutdownClusterTest.java b/test-resilience/src/test/java/resilience/shutdown/ShutdownClusterTest.java index 0ff83e7c6..70b0c7dc8 100644 --- a/test-resilience/src/test/java/resilience/shutdown/ShutdownClusterTest.java +++ b/test-resilience/src/test/java/resilience/shutdown/ShutdownClusterTest.java @@ -6,8 +6,8 @@ import com.arangodb.Protocol; import io.vertx.core.http.HttpClosedException; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; +import resilience.utils.ProtocolSource; import java.io.IOException; import java.util.concurrent.ExecutionException; @@ -17,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Michele Rastelli @@ -25,7 +24,7 @@ class ShutdownClusterTest extends ClusterTest { @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdown(Protocol protocol) throws InterruptedException { ArangoDB arangoDB = dbBuilder() .protocol(protocol) @@ -40,7 +39,7 @@ void shutdown(Protocol protocol) throws InterruptedException { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) @@ -56,9 +55,8 @@ void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionExce } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownWithPendingRequests(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); ArangoDB arangoDB = dbBuilder() .protocol(protocol) .build(); @@ -73,9 +71,8 @@ void shutdownWithPendingRequests(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownWithPendingRequestsAsync(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) .build() diff --git a/test-resilience/src/test/java/resilience/shutdown/ShutdownTest.java b/test-resilience/src/test/java/resilience/shutdown/ShutdownTest.java index 4132f6036..7135dd8af 100644 --- a/test-resilience/src/test/java/resilience/shutdown/ShutdownTest.java +++ b/test-resilience/src/test/java/resilience/shutdown/ShutdownTest.java @@ -6,8 +6,8 @@ import com.arangodb.Protocol; import io.vertx.core.http.HttpClosedException; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.SingleServerTest; +import resilience.utils.ProtocolSource; import java.io.IOException; import java.util.concurrent.ExecutionException; @@ -17,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * @author Michele Rastelli @@ -25,7 +24,7 @@ class ShutdownTest extends SingleServerTest { @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdown(Protocol protocol) throws InterruptedException { ArangoDB arangoDB = dbBuilder() .protocol(protocol) @@ -40,7 +39,7 @@ void shutdown(Protocol protocol) throws InterruptedException { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) @@ -56,9 +55,8 @@ void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionExce } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownWithPendingRequests(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); ArangoDB arangoDB = dbBuilder() .protocol(protocol) .build(); @@ -73,9 +71,8 @@ void shutdownWithPendingRequests(Protocol protocol) { } @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void shutdownWithPendingRequestsAsync(Protocol protocol) { - assumeTrue(protocol != Protocol.VST); ArangoDBAsync arangoDB = dbBuilder() .protocol(protocol) .build() diff --git a/test-resilience/src/test/java/resilience/timeout/TimeoutClusterTest.java b/test-resilience/src/test/java/resilience/timeout/TimeoutClusterTest.java index fa80f1364..fd1eeed72 100644 --- a/test-resilience/src/test/java/resilience/timeout/TimeoutClusterTest.java +++ b/test-resilience/src/test/java/resilience/timeout/TimeoutClusterTest.java @@ -2,8 +2,8 @@ import com.arangodb.*; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; +import resilience.utils.ProtocolSource; import java.util.Collections; import java.util.Map; @@ -27,7 +27,7 @@ class TimeoutClusterTest extends ClusterTest { * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void requestTimeout(Protocol protocol) throws InterruptedException { ArangoDB arangoDB = dbBuilder() .timeout(500) @@ -68,7 +68,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException { * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .timeout(500) diff --git a/test-resilience/src/test/java/resilience/timeout/TimeoutTest.java b/test-resilience/src/test/java/resilience/timeout/TimeoutTest.java index 00f0f6aab..75ab8a363 100644 --- a/test-resilience/src/test/java/resilience/timeout/TimeoutTest.java +++ b/test-resilience/src/test/java/resilience/timeout/TimeoutTest.java @@ -2,8 +2,8 @@ import com.arangodb.*; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; import resilience.SingleServerTest; +import resilience.utils.ProtocolSource; import java.util.Collections; import java.util.Map; @@ -27,7 +27,7 @@ class TimeoutTest extends SingleServerTest { * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void requestTimeout(Protocol protocol) throws InterruptedException { ArangoDB arangoDB = dbBuilder() .timeout(500) @@ -68,7 +68,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException { * - the subsequent requests should be successful */ @ParameterizedTest - @MethodSource("protocolProvider") + @ProtocolSource void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException { ArangoDBAsync arangoDB = dbBuilder() .timeout(500) diff --git a/test-resilience/src/test/java/resilience/ttl/TtlTest.java b/test-resilience/src/test/java/resilience/ttl/TtlTest.java index 17853836a..e3cfe689d 100644 --- a/test-resilience/src/test/java/resilience/ttl/TtlTest.java +++ b/test-resilience/src/test/java/resilience/ttl/TtlTest.java @@ -32,8 +32,8 @@ class TtlTest extends SingleServerTest { static Stream args() { return Stream.of( - Arguments.of(Protocol.HTTP_JSON, "UNREGISTERED"), - Arguments.of(Protocol.HTTP2_JSON, "OUTBOUND GO_AWAY") + Arguments.of(Protocol.HTTP_1_1, "UNREGISTERED"), + Arguments.of(Protocol.HTTP_2, "OUTBOUND GO_AWAY") ); } diff --git a/test-resilience/src/test/java/resilience/utils/ProtocolSource.java b/test-resilience/src/test/java/resilience/utils/ProtocolSource.java new file mode 100644 index 000000000..d3ed26a86 --- /dev/null +++ b/test-resilience/src/test/java/resilience/utils/ProtocolSource.java @@ -0,0 +1,15 @@ +package resilience.utils; + +import com.arangodb.Protocol; +import org.junit.jupiter.params.provider.EnumSource; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@EnumSource(Protocol.class) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ProtocolSource { +} diff --git a/test-resilience/src/test/java/resilience/vstKeepAlive/VstKeepAliveCloseTest.java b/test-resilience/src/test/java/resilience/vstKeepAlive/VstKeepAliveCloseTest.java deleted file mode 100644 index c38309a12..000000000 --- a/test-resilience/src/test/java/resilience/vstKeepAlive/VstKeepAliveCloseTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package resilience.vstKeepAlive; - -import ch.qos.logback.classic.Level; -import com.arangodb.ArangoDB; -import com.arangodb.Protocol; -import resilience.SingleServerTest; -import eu.rekawek.toxiproxy.model.ToxicDirection; -import eu.rekawek.toxiproxy.model.toxic.Latency; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Timeout; - -import java.io.IOException; -import java.time.Duration; -import java.util.concurrent.ExecutionException; - -import static org.awaitility.Awaitility.await; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - -/** - * @author Michele Rastelli - */ -class VstKeepAliveCloseTest extends SingleServerTest { - - private ArangoDB arangoDB; - - @BeforeEach - void init() { - assumeTrue(isLessThanVersion(3, 12)); - arangoDB = dbBuilder() - .protocol(Protocol.VST) - .timeout(1000) - .keepAliveInterval(1) - .build(); - } - - @AfterEach - void shutDown() { - if (arangoDB != null) { - arangoDB.shutdown(); - } - } - - /** - * after 3 consecutive VST keepAlive failures: - * - log ERROR Connection unresponsive - * - reconnect on next request - */ - @Test - @Timeout(10) - void keepAliveCloseAndReconnect() throws IOException, InterruptedException { - arangoDB.getVersion(); - Latency toxic = getEndpoint().getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); - await() - .timeout(Duration.ofSeconds(3)) - .until(() -> logs.getLogs() - .filter(e -> e.getLevel().equals(Level.ERROR)) - .filter(e -> e.getFormattedMessage() != null) - .anyMatch(e -> e.getFormattedMessage().contains("Connection unresponsive!"))); - toxic.setLatency(0); - toxic.remove(); - Thread.sleep(100); - arangoDB.getVersion(); - } - - /** - * after 3 consecutive VST keepAlive failures: - * - log ERROR Connection unresponsive - * - reconnect on next request - */ - @Test - @Timeout(10) - void keepAliveCloseAndReconnectAsync() throws IOException, ExecutionException, InterruptedException { - arangoDB.async().getVersion().get(); - Latency toxic = getEndpoint().getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); - await() - .timeout(Duration.ofSeconds(3)) - .until(() -> logs.getLogs() - .filter(e -> e.getLevel().equals(Level.ERROR)) - .filter(e -> e.getFormattedMessage() != null) - .anyMatch(e -> e.getFormattedMessage().contains("Connection unresponsive!"))); - toxic.setLatency(0); - toxic.remove(); - Thread.sleep(100); - arangoDB.async().getVersion().get(); - } - -} diff --git a/tutorial/Tutorial.md b/tutorial/Tutorial.md index fccf40d45..934c5b800 100644 --- a/tutorial/Tutorial.md +++ b/tutorial/Tutorial.md @@ -367,7 +367,6 @@ Maven coordinates: `com.arangodb:arangodb-java-driver-shaded`. It bundles and relocates the following packages: - `com.fasterxml.jackson` -- `com.arangodb.jackson.dataformat.velocypack` - `io.vertx` - `io.netty` @@ -391,7 +390,7 @@ in future releases without notice, thus breaking client applications relying on it to serialize or deserialize user-data. It is therefore recommended also in this case either: - using the default user-data serde `JacksonSerde` - (from packages `com.arangodb:jackson-serde-json` or `com.arangodb:jackson-serde-vpack`), or + (from package `com.arangodb:jackson-serde-json`), or - providing a custom user-data serde implementation via `ArangoDB.Builder.serde(ArangoSerde)`. ## Support for extended naming constraints diff --git a/tutorial/gradle/build.gradle b/tutorial/gradle/build.gradle index 847710b8d..40d314933 100644 --- a/tutorial/gradle/build.gradle +++ b/tutorial/gradle/build.gradle @@ -12,7 +12,7 @@ repositories { } dependencies { - implementation 'com.arangodb:arangodb-java-driver:7.25.0' + implementation 'com.arangodb:arangodb-java-driver:8.0.0-SNAPSHOT' } ext { diff --git a/tutorial/maven/pom.xml b/tutorial/maven/pom.xml index cf0cd3173..25edcd91e 100644 --- a/tutorial/maven/pom.xml +++ b/tutorial/maven/pom.xml @@ -9,9 +9,9 @@ 1.0-SNAPSHOT - 17 - 17 - 17 + 21 + 21 + 21 UTF-8 @@ -19,7 +19,7 @@ com.arangodb arangodb-java-driver - 7.25.0 + 8.0.0-SNAPSHOT diff --git a/vst-protocol/pom.xml b/vst-protocol/pom.xml deleted file mode 100644 index 266b0a881..000000000 --- a/vst-protocol/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - com.arangodb - arangodb-java-driver-parent - 7.25.0 - - - vst-protocol - vst-protocol - VST Protocol module for ArangoDB Java Driver - - - com.arangodb.vst - - - - - com.arangodb - core - provided - - - com.arangodb - velocypack - compile - - - - \ No newline at end of file diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstCommunication.java b/vst-protocol/src/main/java/com/arangodb/vst/VstCommunication.java deleted file mode 100644 index c9150f5e1..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstCommunication.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst; - -import com.arangodb.ArangoDBException; -import com.arangodb.arch.UnstableApi; -import com.arangodb.internal.InternalRequest; -import com.arangodb.internal.InternalResponse; -import com.arangodb.internal.config.ArangoConfig; -import com.arangodb.internal.net.Communication; -import com.arangodb.internal.net.Connection; -import com.arangodb.internal.net.HostHandler; -import com.arangodb.internal.util.ResponseUtils; -import com.arangodb.vst.internal.AuthenticationRequest; -import com.arangodb.vst.internal.JwtAuthenticationRequest; -import com.arangodb.vst.internal.VstConnectionAsync; - -import java.io.IOException; -import java.util.concurrent.ExecutionException; - -/** - * @author Mark Vollmary - */ -@UnstableApi -public final class VstCommunication extends Communication { - private static final String ENCRYPTION_PLAIN = "plain"; - private static final String ENCRYPTION_JWT = "jwt"; - - private final String user; - private final String password; - private volatile String jwt; - - public VstCommunication(@UnstableApi final ArangoConfig config, @UnstableApi final HostHandler hostHandler) { - super(config, hostHandler); - user = config.getUser(); - password = config.getPassword(); - jwt = config.getJwt(); - } - - @Override - protected void connect(@UnstableApi Connection conn) throws IOException { - VstConnectionAsync connection = (VstConnectionAsync) conn; - if (!connection.isOpen()) { - connection.open(); - if (jwt != null || user != null) { - tryAuthenticate(connection); - } - } - } - - private void tryAuthenticate(final VstConnectionAsync connection) throws IOException { - try { - authenticate(connection); - } catch (final ArangoDBException authException) { - connection.close(); - throw authException; - } - } - - private void authenticate(final VstConnectionAsync connection) throws IOException { - InternalRequest authRequest; - if (jwt != null) { - authRequest = new JwtAuthenticationRequest(jwt, ENCRYPTION_JWT); - } else { - authRequest = new AuthenticationRequest(user, password != null ? password : "", ENCRYPTION_PLAIN); - } - - InternalResponse response; - try { - response = connection.executeAsync(authRequest).get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw ArangoDBException.of(e); - } catch (ExecutionException e) { - throw new IOException(e.getCause()); - } - checkError(response); - } - - - private void checkError(final InternalResponse response) { - ArangoDBException e = ResponseUtils.translateError(serde, response); - if (e != null) throw e; - } - - public void setJwt(String jwt) { - this.jwt = jwt; - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstConnectionFactoryAsync.java b/vst-protocol/src/main/java/com/arangodb/vst/VstConnectionFactoryAsync.java deleted file mode 100644 index 1db7852a0..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstConnectionFactoryAsync.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2018 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst; - -import com.arangodb.arch.UnstableApi; -import com.arangodb.config.HostDescription; -import com.arangodb.internal.config.ArangoConfig; -import com.arangodb.internal.net.Connection; -import com.arangodb.internal.net.ConnectionFactory; -import com.arangodb.internal.net.ConnectionPool; -import com.arangodb.vst.internal.VstConnectionAsync; - -/** - * @author Mark Vollmary - */ -@UnstableApi -public class VstConnectionFactoryAsync implements ConnectionFactory { - - @Override - @UnstableApi - public Connection create(@UnstableApi final ArangoConfig config, final HostDescription host, @UnstableApi final ConnectionPool pool) { - return new VstConnectionAsync(config, host, pool); - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstModule.java b/vst-protocol/src/main/java/com/arangodb/vst/VstModule.java deleted file mode 100644 index 255a041fd..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstModule.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.arangodb.vst; - -import com.arangodb.vst.internal.AuthenticationRequest; -import com.arangodb.vst.internal.JwtAuthenticationRequest; -import com.fasterxml.jackson.databind.Module; -import com.fasterxml.jackson.databind.module.SimpleModule; - -import java.util.function.Supplier; - -enum VstModule implements Supplier { - INSTANCE; - - private final SimpleModule module; - - VstModule() { - module = new SimpleModule(); - module.addSerializer(AuthenticationRequest.class, VstSerializers.AUTHENTICATION_REQUEST); - module.addSerializer(JwtAuthenticationRequest.class, VstSerializers.JWT_AUTHENTICATION_REQUEST); - } - - @Override - public Module get() { - return module; - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstProtocol.java b/vst-protocol/src/main/java/com/arangodb/vst/VstProtocol.java deleted file mode 100644 index 7d840a8ab..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstProtocol.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst; - -import com.arangodb.ArangoDBException; -import com.arangodb.arch.UnstableApi; -import com.arangodb.internal.InternalRequest; -import com.arangodb.internal.InternalResponse; -import com.arangodb.internal.net.CommunicationProtocol; -import com.arangodb.internal.net.HostHandle; - -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * @author Mark Vollmary - */ -@UnstableApi -public class VstProtocol implements CommunicationProtocol { - - private final VstCommunication communication; - private final ExecutorService outgoingExecutor = Executors.newCachedThreadPool(); - - public VstProtocol(final VstCommunication communication) { - super(); - this.communication = communication; - } - - @Override - @UnstableApi - public CompletableFuture executeAsync(@UnstableApi InternalRequest request, @UnstableApi HostHandle hostHandle) { - if (outgoingExecutor.isShutdown()) { - CompletableFuture cf = new CompletableFuture<>(); - cf.completeExceptionally(new ArangoDBException("VstProtocol already closed!")); - return cf; - } - return CompletableFuture.completedFuture(null) - .thenComposeAsync(__ -> communication.executeAsync(request, hostHandle), outgoingExecutor); - } - - @Override - public void setJwt(String jwt) { - communication.setJwt(jwt); - } - - @Override - public void close() throws IOException { - outgoingExecutor.shutdown(); - communication.close(); - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstProtocolProvider.java b/vst-protocol/src/main/java/com/arangodb/vst/VstProtocolProvider.java deleted file mode 100644 index 274cd0284..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstProtocolProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.arangodb.vst; - -import com.arangodb.Protocol; -import com.arangodb.arch.UnstableApi; -import com.arangodb.internal.config.ArangoConfig; -import com.arangodb.internal.net.CommunicationProtocol; -import com.arangodb.internal.net.ConnectionFactory; -import com.arangodb.internal.net.HostHandler; -import com.arangodb.internal.net.ProtocolProvider; -import com.fasterxml.jackson.databind.Module; - -@UnstableApi -public class VstProtocolProvider implements ProtocolProvider { - @Override - public boolean supportsProtocol(Protocol protocol) { - return Protocol.VST.equals(protocol); - } - - @Override - @UnstableApi - public ConnectionFactory createConnectionFactory() { - return new VstConnectionFactoryAsync(); - } - - @Override - @UnstableApi - public CommunicationProtocol createProtocol(@UnstableApi ArangoConfig config, @UnstableApi HostHandler hostHandler) { - return new VstProtocol(new VstCommunication(config, hostHandler)); - } - - @Override - public Module protocolModule() { - return VstModule.INSTANCE.get(); - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/VstSerializers.java b/vst-protocol/src/main/java/com/arangodb/vst/VstSerializers.java deleted file mode 100644 index 2ba762a52..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/VstSerializers.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.arangodb.vst; - -import com.arangodb.arch.UnstableApi; -import com.arangodb.vst.internal.AuthenticationRequest; -import com.arangodb.vst.internal.JwtAuthenticationRequest; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import java.io.IOException; - -public final class VstSerializers { - - static final JsonSerializer AUTHENTICATION_REQUEST = - new JsonSerializer() { - @Override - public void serialize(@UnstableApi AuthenticationRequest value, JsonGenerator gen, SerializerProvider serializers) throws IOException { - gen.writeStartArray(); - gen.writeNumber(value.getVersion()); - gen.writeNumber(value.getType()); - gen.writeString(value.getEncryption()); - gen.writeString(value.getUser()); - gen.writeString(value.getPassword()); - gen.writeEndArray(); - } - }; - static final JsonSerializer JWT_AUTHENTICATION_REQUEST = - new JsonSerializer() { - @Override - public void serialize(@UnstableApi JwtAuthenticationRequest value, JsonGenerator gen, - SerializerProvider serializers) throws IOException { - gen.writeStartArray(); - gen.writeNumber(value.getVersion()); - gen.writeNumber(value.getType()); - gen.writeString(value.getEncryption()); - gen.writeString(value.getToken()); - gen.writeEndArray(); - } - }; - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/AuthenticationRequest.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/AuthenticationRequest.java deleted file mode 100644 index 8a0e11288..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/AuthenticationRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import com.arangodb.arch.UsedInApi; -import com.arangodb.internal.InternalRequest; - -/** - * @author Mark Vollmary - */ -@UsedInApi -public class AuthenticationRequest extends InternalRequest { - - private final String user; - private final String password; - private final String encryption;// "plain" - - public AuthenticationRequest(final String user, final String password, final String encryption) { - super(null, null, null); - this.user = user; - this.password = password; - this.encryption = encryption; - setType(1000); - } - - public String getUser() { - return user; - } - - public String getPassword() { - return password; - } - - public String getEncryption() { - return encryption; - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/Chunk.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/Chunk.java deleted file mode 100644 index 93e2d7848..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/Chunk.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -/** - * @author Mark Vollmary - */ -public class Chunk { - - private final long messageId; - private final long messageLength; - private final int chunkX; - private final int contentOffset; - private final int contentLength; - - public Chunk(final long messageId, final int chunkX, final long messageLength, final int contentOffset, - final int contentLength) { - this.messageId = messageId; - this.chunkX = chunkX; - this.messageLength = messageLength; - this.contentOffset = contentOffset; - this.contentLength = contentLength; - } - - public Chunk(final long messageId, final int chunkIndex, final int numberOfChunks, final long messageLength, - final int contentOffset, final int contentLength) { - this(messageId, chunkX(chunkIndex, numberOfChunks), messageLength, contentOffset, contentLength); - } - - private static int chunkX(final int chunkIndex, final int numberOfChunks) { - int chunkX; - if (numberOfChunks == 1) { - chunkX = 3;// last byte: 0000 0011 - } else if (chunkIndex == 0) { - chunkX = (numberOfChunks << 1) + 1; - } else { - chunkX = chunkIndex << 1; - } - return chunkX; - } - - public long getMessageId() { - return messageId; - } - - public long getMessageLength() { - return messageLength; - } - - public boolean isFirstChunk() { - return 1 == (chunkX & 0x1); - } - - public int getChunk() { - return chunkX >> 1; - } - - public int getChunkX() { - return chunkX; - } - - public int getContentOffset() { - return contentOffset; - } - - public int getContentLength() { - return contentLength; - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/ChunkStore.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/ChunkStore.java deleted file mode 100644 index a945ec79d..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/ChunkStore.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import java.nio.BufferUnderflowException; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Mark Vollmary - */ -public class ChunkStore { - - private final MessageStore messageStore; - private final Map data; - - public ChunkStore(final MessageStore messageStore) { - super(); - this.messageStore = messageStore; - data = new HashMap<>(); - } - - public ByteBuffer storeChunk(final Chunk chunk) throws BufferUnderflowException, IndexOutOfBoundsException { - final long messageId = chunk.getMessageId(); - ByteBuffer chunkBuffer = data.get(messageId); - if (chunkBuffer == null) { - if (!chunk.isFirstChunk()) { - messageStore.cancel(messageId); - return null; - } - final int length = (int) (chunk.getMessageLength() > 0 ? chunk.getMessageLength() - : chunk.getContentLength()); - chunkBuffer = ByteBuffer.allocate(length); - data.put(messageId, chunkBuffer); - } - return chunkBuffer; - } - - public void checkCompleteness(final long messageId) { - checkCompleteness(messageId, data.get(messageId)); - } - - private void checkCompleteness(final long messageId, final ByteBuffer chunkBuffer) - throws BufferUnderflowException, IndexOutOfBoundsException { - if (chunkBuffer.position() == chunkBuffer.limit()) { - messageStore.consume(new Message(messageId, chunkBuffer.array())); - data.remove(messageId); - } - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/JwtAuthenticationRequest.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/JwtAuthenticationRequest.java deleted file mode 100644 index 726057c16..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/JwtAuthenticationRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.arangodb.vst.internal; - -import com.arangodb.arch.UsedInApi; -import com.arangodb.internal.InternalRequest; - -@UsedInApi -public class JwtAuthenticationRequest extends InternalRequest { - - private final String token; - private final String encryption; // "jwt" - - public JwtAuthenticationRequest(final String token, final String encryption) { - super(null, null, null); - this.token = token; - this.encryption = encryption; - setType(1000); - } - - public String getToken() { - return token; - } - - public String getEncryption() { - return encryption; - } - -} \ No newline at end of file diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/Message.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/Message.java deleted file mode 100644 index 7b673fb68..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/Message.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import com.arangodb.velocypack.VPackSlice; - -import java.nio.BufferUnderflowException; - -/** - * @author Mark Vollmary - */ -public class Message { - - private final long id; - private final VPackSlice head; - private final VPackSlice body; - - public Message(final long id, final byte[] chunkBuffer) throws BufferUnderflowException, IndexOutOfBoundsException { - super(); - this.id = id; - head = new VPackSlice(chunkBuffer); - final int headSize = head.getByteSize(); - if (chunkBuffer.length > headSize) { - body = new VPackSlice(chunkBuffer, headSize); - } else { - body = null; - } - } - - public Message(final long id, final byte[] head, final byte[] body) { - super(); - this.id = id; - this.head = new VPackSlice(head); - this.body = body != null ? new VPackSlice(body) : null; - } - - public long getId() { - return id; - } - - public VPackSlice getHead() { - return head; - } - - public VPackSlice getBody() { - return body; - } - -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/MessageStore.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/MessageStore.java deleted file mode 100644 index 1d8d6effb..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/MessageStore.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import com.arangodb.ArangoDBException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.FutureTask; - -/** - * @author Mark Vollmary - */ -public class MessageStore { - - private static final Logger LOGGER = LoggerFactory.getLogger(MessageStore.class); - - private final Map> task; - private final Map response; - private final Map error; - - public MessageStore() { - super(); - task = new ConcurrentHashMap<>(); - response = new ConcurrentHashMap<>(); - error = new ConcurrentHashMap<>(); - } - - public void storeMessage(final long messageId, final FutureTask future) { - task.put(messageId, future); - } - - public void consume(final Message message) { - final FutureTask future = task.remove(message.getId()); - if (future != null) { - response.put(message.getId(), message); - future.run(); - } - } - - public Message get(final long messageId) { - final Message result = response.remove(messageId); - if (result == null) { - final Exception e = error.remove(messageId); - if (e != null) { - throw ArangoDBException.of(e); - } - } - return result; - } - - public void cancel(final long messageId) { - final FutureTask future = task.remove(messageId); - if (future != null) { - LOGGER.error("Cancel Message unexpected (id={}).", messageId); - future.cancel(true); - } - } - - public synchronized void clear(final Exception e) { - if (!task.isEmpty()) { - LOGGER.error(e.getMessage(), e); - } - for (final Entry> entry : task.entrySet()) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("Exceptionally complete Message (id=%s).", entry.getKey())); - } - error.put(entry.getKey(), e); - entry.getValue().run(); - } - task.clear(); - } - - public boolean isEmpty() { - return task.isEmpty(); - } -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnection.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnection.java deleted file mode 100644 index 870051fa6..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnection.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import com.arangodb.ArangoDBException; -import com.arangodb.config.HostDescription; -import com.arangodb.internal.ArangoDefaults; -import com.arangodb.internal.config.ArangoConfig; -import com.arangodb.internal.net.Connection; -import com.arangodb.internal.net.ConnectionPool; -import com.arangodb.velocypack.VPackBuilder; -import com.arangodb.velocypack.VPackSlice; -import com.arangodb.velocypack.ValueType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.SocketFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import java.io.BufferedOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.Map; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author Mark Vollmary - */ -public abstract class VstConnection implements Connection { - private static final Logger LOGGER = LoggerFactory.getLogger(VstConnection.class); - private static final AtomicInteger THREAD_COUNT = new AtomicInteger(); - private static final byte[] PROTOCOL_HEADER = "VST/1.0\r\n\r\n".getBytes(); - protected final MessageStore messageStore = new MessageStore(); - protected final Integer timeout; - private final AtomicLong keepAliveId = new AtomicLong(); - private final Long ttl; - private final Integer keepAliveInterval; - private final Boolean useSsl; - private final SSLContext sslContext; - private final HostDescription host; - private final Map sendTimestamps = new ConcurrentHashMap<>(); - private final String connectionName; - private final ConnectionPool pool; - private final byte[] keepAliveRequest = new VPackBuilder() - .add(ValueType.ARRAY) - .add(1) - .add(1) - .add("_system") - .add(1) - .add("/_admin/server/availability") - .add(ValueType.OBJECT) - .close() - .add(ValueType.OBJECT) - .close() - .close() - .slice() - .toByteArray(); - private ExecutorService executor; - private ScheduledExecutorService keepAliveScheduler; - private int keepAliveFailCounter = 0; - private Socket socket; - private OutputStream outputStream; - private InputStream inputStream; - - protected VstConnection(final ArangoConfig config, final HostDescription host, final ConnectionPool pool) { - super(); - timeout = config.getTimeout(); - ttl = config.getConnectionTtl(); - keepAliveInterval = config.getKeepAliveInterval(); - useSsl = config.getUseSsl(); - sslContext = config.getSslContext(); - this.host = host; - this.pool = pool; - - connectionName = "connection_" + System.currentTimeMillis() + "_" + Math.random(); - LOGGER.debug("[" + connectionName + "]: Connection created"); - } - - protected T sendKeepAlive() { - long id = keepAliveId.decrementAndGet(); - Message message = new Message(id, keepAliveRequest, null); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Send keepalive probe (id=%s, head=%s, body=%s)", connectionName, - message.getId(), message.getHead(), - message.getBody() != null ? message.getBody() : "{}")); - } - return write(message, Collections.singleton(new Chunk( - id, 0, 1, -1, - 0, keepAliveRequest.length - ))); - } - - public abstract T write(final Message message, final Collection chunks); - - protected abstract void doKeepAlive(); - - private void keepAlive() { - try { - doKeepAlive(); - keepAliveFailCounter = 0; - } catch (Exception e) { - LOGGER.error("Got exception while performing keepAlive request:", e); - keepAliveFailCounter++; - if (keepAliveFailCounter >= 3) { - LOGGER.error("KeepAlive request failed consecutively for 3 times, closing connection now..."); - messageStore.clear(new IOException("Connection unresponsive!")); - close(); - } - } - } - - public boolean isOpen() { - return socket != null && socket.isConnected() && !socket.isClosed(); - } - - public synchronized void open() throws IOException { - if (isOpen()) { - return; - } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Open connection to %s", connectionName, host)); - } - if (Boolean.TRUE.equals(useSsl)) { - socket = sslContext.getSocketFactory().createSocket(); - } else { - socket = SocketFactory.getDefault().createSocket(); - } - socket.connect(new InetSocketAddress(host.getHost(), host.getPort()), timeout); - socket.setKeepAlive(true); - socket.setTcpNoDelay(true); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Connected to %s", connectionName, socket)); - } - - outputStream = new BufferedOutputStream(socket.getOutputStream()); - inputStream = socket.getInputStream(); - - if (Boolean.TRUE.equals(useSsl)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Start Handshake on %s", connectionName, socket)); - } - ((SSLSocket) socket).startHandshake(); - } - sendProtocolHeader(); - - executor = Executors.newSingleThreadExecutor(r -> { - Thread t = Executors.defaultThreadFactory().newThread(r); - t.setDaemon(true); - t.setName("adb-vst-" + THREAD_COUNT.getAndIncrement()); - return t; - }); - executor.submit((Callable) () -> { - LOGGER.debug("[" + connectionName + "]: Start Callable"); - - final long openTime = new Date().getTime(); - final Long ttlTime = ttl != null && ttl > 0 ? openTime + ttl : null; - final ChunkStore chunkStore = new ChunkStore(messageStore); - while (true) { - if (ttlTime != null && new Date().getTime() > ttlTime && messageStore.isEmpty()) { - close(); - break; - } - if (!isOpen()) { - messageStore.clear(new IOException("The socket is closed.")); - close(); - break; - } - try { - final Chunk chunk = readChunk(); - final ByteBuffer chunkBuffer = chunkStore.storeChunk(chunk); - if (chunkBuffer != null) { - final byte[] buf = new byte[chunk.getContentLength()]; - readBytesIntoBuffer(buf, 0, buf.length); - chunkBuffer.put(buf); - chunkStore.checkCompleteness(chunk.getMessageId()); - } - } catch (final Exception e) { - messageStore.clear(e); - close(); - break; - } - } - - LOGGER.debug("[" + connectionName + "]: Stop Callable"); - - return null; - }); - - if (keepAliveInterval != null) { - keepAliveScheduler = Executors.newScheduledThreadPool(1); - keepAliveScheduler.scheduleAtFixedRate(this::keepAlive, 0, keepAliveInterval, TimeUnit.SECONDS); - } - - } - - @Override - public synchronized void close() { - if (keepAliveScheduler != null) { - keepAliveScheduler.shutdown(); - } - messageStore.clear(new IOException("Connection closed")); - if (executor != null && !executor.isShutdown()) { - executor.shutdown(); - } - if (socket != null && !socket.isClosed()) { - try { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Close connection %s", connectionName, socket)); - } - socket.close(); - } catch (final IOException e) { - throw ArangoDBException.of(e); - } - } - } - - @Override - public void release() { - pool.release(this); - } - - private synchronized void sendProtocolHeader() throws IOException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Send velocystream protocol header to %s", connectionName, socket)); - } - outputStream.write(PROTOCOL_HEADER); - outputStream.flush(); - } - - protected synchronized void writeIntern(final Message message, final Collection chunks) { - for (final Chunk chunk : chunks) { - try { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Send chunk %s:%s from message %s", connectionName, - chunk.getChunk(), - chunk.isFirstChunk() ? 1 : 0, chunk.getMessageId())); - sendTimestamps.put(chunk.getMessageId(), System.currentTimeMillis()); - } - writeChunkHead(chunk); - final int contentOffset = chunk.getContentOffset(); - final int contentLength = chunk.getContentLength(); - final VPackSlice head = message.getHead(); - final int headLength = head.getByteSize(); - int written = 0; - if (contentOffset < headLength) { - written = Math.min(contentLength, headLength - contentOffset); - outputStream.write(head.getBuffer(), contentOffset, written); - } - if (written < contentLength) { - final VPackSlice body = message.getBody(); - outputStream.write(body.getBuffer(), contentOffset + written - headLength, contentLength - written); - } - outputStream.flush(); - } catch (final IOException e) { - LOGGER.error("Error on Connection " + connectionName); - throw ArangoDBException.of(e); - } - } - } - - private synchronized void writeChunkHead(final Chunk chunk) throws IOException { - final long messageLength = chunk.getMessageLength(); - final int headLength = messageLength > -1L ? ArangoDefaults.CHUNK_MAX_HEADER_SIZE - : ArangoDefaults.CHUNK_MIN_HEADER_SIZE; - final int length = chunk.getContentLength() + headLength; - final ByteBuffer buffer = ByteBuffer.allocate(headLength).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(length); - buffer.putInt(chunk.getChunkX()); - buffer.putLong(chunk.getMessageId()); - if (messageLength > -1L) { - buffer.putLong(messageLength); - } - outputStream.write(buffer.array()); - } - - protected Chunk readChunk() throws IOException { - final ByteBuffer chunkHeadBuffer = readBytes(ArangoDefaults.CHUNK_MIN_HEADER_SIZE); - final int length = chunkHeadBuffer.getInt(); - final int chunkX = chunkHeadBuffer.getInt(); - final long messageId = chunkHeadBuffer.getLong(); - final long messageLength; - final int contentLength; - if ((1 == (chunkX & 0x1)) && ((chunkX >> 1) > 1)) { - messageLength = readBytes(ArangoDefaults.LONG_BYTES).getLong(); - contentLength = length - ArangoDefaults.CHUNK_MAX_HEADER_SIZE; - } else { - messageLength = -1L; - contentLength = length - ArangoDefaults.CHUNK_MIN_HEADER_SIZE; - } - final Chunk chunk = new Chunk(messageId, chunkX, messageLength, 0, contentLength); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("[%s]: Received chunk %s:%s from message %s", connectionName, chunk.getChunk() - , chunk.isFirstChunk() ? 1 : 0, chunk.getMessageId())); - LOGGER.debug("[" + connectionName + "]: Responsetime for Message " + chunk.getMessageId() + " is " + (System.currentTimeMillis() - sendTimestamps.get(chunk.getMessageId()))); - } - - return chunk; - } - - private ByteBuffer readBytes(final int len) throws IOException { - final byte[] buf = new byte[len]; - readBytesIntoBuffer(buf, 0, len); - return ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN); - } - - protected void readBytesIntoBuffer(final byte[] buf, final int off, final int len) throws IOException { - for (int readed = 0; readed < len; ) { - final int read = inputStream.read(buf, off + readed, len - readed); - if (read == -1) { - throw new IOException("Reached the end of the stream."); - } else { - readed += read; - } - } - } - - @Override - public void setJwt(String jwt) { - // no-op: VST connections send jwt token only at initialization time - } -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnectionAsync.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnectionAsync.java deleted file mode 100644 index 5b128340e..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/VstConnectionAsync.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.vst.internal; - -import com.arangodb.PackageVersion; -import com.arangodb.config.HostDescription; -import com.arangodb.internal.InternalRequest; -import com.arangodb.internal.InternalResponse; -import com.arangodb.internal.config.ArangoConfig; -import com.arangodb.internal.net.ConnectionPool; -import com.arangodb.internal.serde.InternalSerde; -import com.arangodb.velocypack.VPackSlice; -import com.arangodb.velocypack.exception.VPackParserException; -import com.arangodb.vst.internal.utils.CompletableFutureUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author Mark Vollmary - */ -public class VstConnectionAsync extends VstConnection> { - private final static Logger LOGGER = LoggerFactory.getLogger(VstConnectionAsync.class); - private static final AtomicLong mId = new AtomicLong(0L); - private static final String X_ARANGO_DRIVER = "JavaDriver/" + PackageVersion.VERSION + " (JVM/" + System.getProperty("java.specification.version") + ")"; - private final Integer chunkSize; - private final InternalSerde serde; - - - public VstConnectionAsync(final ArangoConfig config, final HostDescription host, final ConnectionPool pool) { - super(config, host, pool); - chunkSize = config.getChunkSize(); - serde = config.getInternalSerde(); - } - - @Override - public synchronized CompletableFuture write(final Message message, final Collection chunks) { - final CompletableFuture future = new CompletableFuture<>(); - final FutureTask task = new FutureTask<>(() -> { - try { - future.complete(messageStore.get(message.getId())); - } catch (final Exception e) { - future.completeExceptionally(e); - } - return null; - }); - messageStore.storeMessage(message.getId(), task); - super.writeIntern(message, chunks); - if (timeout == null || timeout == 0L) { - return future; - } else { - return CompletableFutureUtils.orTimeout(future, timeout, TimeUnit.MILLISECONDS); - } - } - - @Override - protected void doKeepAlive() { - sendKeepAlive().join(); - } - - @Override - public CompletableFuture executeAsync(final InternalRequest request) { - // TODO: refactor using Future composition - final CompletableFuture rfuture = new CompletableFuture<>(); - try { - final Message message = createMessage(request); - send(message).whenComplete((m, ex) -> { - if (m != null) { - final InternalResponse response; - try { - response = createResponse(m); - } catch (final Exception e) { - rfuture.completeExceptionally(e); - return; - } - rfuture.complete(response); - } else { - Throwable e = ex instanceof CompletionException ? ex.getCause() : ex; - rfuture.completeExceptionally(e); - } - }); - } catch (Exception e) { - LOGGER.error(e.getMessage(), e); - rfuture.completeExceptionally(e); - } - return rfuture; - } - - private Message createMessage(final InternalRequest request) throws VPackParserException { - request.putHeaderParam("accept", "application/x-velocypack"); - request.putHeaderParam("content-type", "application/x-velocypack"); - request.putHeaderParam("x-arango-driver", X_ARANGO_DRIVER); - final long id = mId.incrementAndGet(); - return new Message(id, serde.serialize(request), request.getBody()); - } - - private CompletableFuture send(final Message message) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("Send Message (id=%s, head=%s, body=%s)", - message.getId(), - serde.toJsonString(message.getHead().toByteArray()), - message.getBody() != null ? serde.toJsonString(message.getBody().toByteArray()) : "{}")); - } - return write(message, buildChunks(message)); - } - - private Collection buildChunks(final Message message) { - final Collection chunks = new ArrayList<>(); - final VPackSlice head = message.getHead(); - int size = head.getByteSize(); - final VPackSlice body = message.getBody(); - if (body != null) { - size += body.getByteSize(); - } - final int n = size / chunkSize; - final int numberOfChunks = (size % chunkSize != 0) ? (n + 1) : n; - int off = 0; - for (int i = 0; size > 0; i++) { - final int len = Math.min(chunkSize, size); - final long messageLength = (i == 0 && numberOfChunks > 1) ? size : -1L; - final Chunk chunk = new Chunk(message.getId(), i, numberOfChunks, messageLength, off, len); - size -= len; - off += len; - chunks.add(chunk); - } - return chunks; - } - - private InternalResponse createResponse(final Message message) throws VPackParserException { - InternalResponse response = serde.deserialize(message.getHead().toByteArray(), InternalResponse.class); - if (message.getBody() != null) { - response.setBody(message.getBody().toByteArray()); - } - return response; - } -} diff --git a/vst-protocol/src/main/java/com/arangodb/vst/internal/utils/CompletableFutureUtils.java b/vst-protocol/src/main/java/com/arangodb/vst/internal/utils/CompletableFutureUtils.java deleted file mode 100644 index 2321ac5aa..000000000 --- a/vst-protocol/src/main/java/com/arangodb/vst/internal/utils/CompletableFutureUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.arangodb.vst.internal.utils; - -import java.util.concurrent.*; - -public class CompletableFutureUtils { - - private CompletableFutureUtils() { - } - - private static final ScheduledExecutorService timeoutScheduler = Executors.newSingleThreadScheduledExecutor(r -> { - Thread t = Executors.defaultThreadFactory().newThread(r); - t.setDaemon(true); - return t; - } - ); - - public static CompletableFuture orTimeout(CompletableFuture completableFuture, long timeout, TimeUnit unit) { - ScheduledFuture timeoutTask = timeoutScheduler.schedule(() -> - completableFuture.completeExceptionally(new TimeoutException()), timeout, unit); - completableFuture.whenComplete((v, e) -> timeoutTask.cancel(false)); - return completableFuture; - } - -} diff --git a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/native-image.properties b/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/native-image.properties deleted file mode 100644 index f6d4bf39a..000000000 --- a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/native-image.properties +++ /dev/null @@ -1,3 +0,0 @@ -Args=\ --H:ResourceConfigurationResources=${.}/resource-config-spi.json \ --H:ReflectionConfigurationResources=${.}/reflect-config-spi.json diff --git a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/reflect-config-spi.json b/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/reflect-config-spi.json deleted file mode 100644 index 57c85201e..000000000 --- a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/reflect-config-spi.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "name": "com.arangodb.vst.VstProtocolProvider", - "methods": [ - { - "name": "", - "parameterTypes": [] - } - ] - } -] diff --git a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/resource-config-spi.json b/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/resource-config-spi.json deleted file mode 100644 index 9037d85e5..000000000 --- a/vst-protocol/src/main/resources/META-INF/native-image/com.arangodb/vst-protocol/resource-config-spi.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "resources": { - "includes": [ - { - "pattern": "META-INF/services/com.arangodb.internal.net.ProtocolProvider" - } - ] - }, - "bundles": [] -} diff --git a/vst-protocol/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider b/vst-protocol/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider deleted file mode 100644 index 6d11ca0c7..000000000 --- a/vst-protocol/src/main/resources/META-INF/services/com.arangodb.internal.net.ProtocolProvider +++ /dev/null @@ -1 +0,0 @@ -com.arangodb.vst.VstProtocolProvider