diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b3bc3a01..55a9c3aa5 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: @@ -528,9 +522,7 @@ workflows: tags: only: /^v.*/ branches: - only: - - main - - next + ignore: /.*/ - test: name: test-native-ssl=<>-<> matrix: @@ -549,9 +541,7 @@ workflows: tags: only: /^v.*/ branches: - only: - - main - - next + ignore: /.*/ - test-shaded: name: test-native-shaded-ssl=<>-<> matrix: diff --git a/README.md b/README.md index 488d198e4..c2062f26a 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,4 @@ The official [ArangoDB](https://www.arangodb.com/) Java Driver. - [Examples](test-non-functional/src/test/java/example) - [Documentation and Tutorial](https://docs.arango.ai/ecosystem/drivers/java/) - [JavaDoc](https://www.javadoc.io/doc/com.arangodb/arangodb-java-driver/latest/index.html) + diff --git a/core/src/main/java/com/arangodb/ArangoDB.java b/core/src/main/java/com/arangodb/ArangoDB.java index 8ccf1668f..12f000db2 100644 --- a/core/src/main/java/com/arangodb/ArangoDB.java +++ b/core/src/main/java/com/arangodb/ArangoDB.java @@ -70,8 +70,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 */ @@ -612,17 +611,6 @@ public Builder verifyHost(final Boolean verifyHost) { return this; } - /** - * 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}). * @@ -664,7 +652,6 @@ 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
@@ -692,25 +679,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 +705,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} @@ -896,8 +867,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/Protocol.java b/core/src/main/java/com/arangodb/Protocol.java index 1ca4bb4ea..02f01eaf1 100644 --- a/core/src/main/java/com/arangodb/Protocol.java +++ b/core/src/main/java/com/arangodb/Protocol.java @@ -25,13 +25,6 @@ */ public enum Protocol { - /** - * VelocyStream - * - * @see VelocyStream specification - */ - VST, - /** * HTTP 1.1 with JSON body */ 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/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/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/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/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/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/ArangoDefaults.java b/core/src/main/java/com/arangodb/internal/ArangoDefaults.java index d61fea5b6..1b8b375c1 100644 --- a/core/src/main/java/com/arangodb/internal/ArangoDefaults.java +++ b/core/src/main/java/com/arangodb/internal/ArangoDefaults.java @@ -35,12 +35,6 @@ 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; @@ -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/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..841d61028 100644 --- a/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java +++ b/core/src/main/java/com/arangodb/internal/config/ArangoConfig.java @@ -46,13 +46,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 +90,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 +212,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,9 +246,6 @@ 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: defaultMaxConnections = ArangoDefaults.MAX_CONNECTIONS_HTTP_DEFAULT; @@ -282,9 +265,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 +272,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; } 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/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/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 index 453cc2a0f..531f924c7 100644 --- a/core/src/main/java/com/arangodb/internal/serde/ContentTypeFactory.java +++ b/core/src/main/java/com/arangodb/internal/serde/ContentTypeFactory.java @@ -12,7 +12,6 @@ public static ContentType of(Protocol protocol) { case HTTP_JSON: case HTTP2_JSON: return ContentType.JSON; - case VST: case HTTP_VPACK: case HTTP2_VPACK: return ContentType.VPACK; 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/AqlQueryOptions.java b/core/src/main/java/com/arangodb/model/AqlQueryOptions.java index e0266269b..1033343c6 100644 --- a/core/src/main/java/com/arangodb/model/AqlQueryOptions.java +++ b/core/src/main/java/com/arangodb/model/AqlQueryOptions.java @@ -524,7 +524,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) { @@ -850,7 +850,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 +894,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/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/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/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/arangosearch/ArangoSearchCreateOptions.java b/core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java index 1361f9c9d..319e38aeb 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; diff --git a/dev-README.md b/dev-README.md index 0eaaa61f0..e57e56d06 100644 --- a/dev-README.md +++ b/dev-README.md @@ -30,7 +30,6 @@ Reports: - [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 befdb725d..d1800c4df 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 @@ -112,9 +112,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/pom.xml b/pom.xml index e94991392..eab28b6f9 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,6 @@ jackson-serde-vpack jsonb-serde http-protocol - vst-protocol pom @@ -302,11 +301,6 @@ http-protocol ${project.version} - - com.arangodb - vst-protocol - ${project.version} - com.arangodb jackson-serde-json diff --git a/shaded/pom.xml b/shaded/pom.xml index 0a3f6cee5..825edbf2a 100644 --- a/shaded/pom.xml +++ b/shaded/pom.xml @@ -30,11 +30,6 @@ http-protocol compile - - com.arangodb - vst-protocol - compile - com.arangodb jackson-dataformat-velocypack @@ -113,14 +108,6 @@ META-INF/** - - com.arangodb:vst-protocol - - META-INF/MANIFEST.MF - META-INF/services/** - META-INF/maven/** - - com.arangodb:http-protocol 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/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/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..637fcfa83 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); @@ -2034,7 +1945,6 @@ void createAndGetVectorIndex(ArangoCollectionAsync collection) throws ExecutionE @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(); @@ -2056,7 +1966,6 @@ void createZKDIndex(ArangoCollectionAsync collection) throws ExecutionException, @ParameterizedTest @MethodSource("asyncCols") void createZKDIndexWithOptions(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 9)); collection.truncate().get(); String name = "ZKDIndex-" + rnd(); @@ -2084,7 +1993,6 @@ void createZKDIndexWithOptions(ArangoCollectionAsync collection) throws Executio @ParameterizedTest @MethodSource("asyncCols") void createMDIndex(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate().get(); String f1 = "field-" + rnd(); @@ -2106,7 +2014,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 +2047,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 +2082,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 +2102,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 +2122,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 +2139,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); @@ -2272,8 +2172,6 @@ void createFulltextIndex(ArangoCollectionAsync collection) throws ExecutionExcep @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); @@ -2295,7 +2193,6 @@ void createFulltextIndexWithOptions(ArangoCollectionAsync collection) throws Exe @ParameterizedTest @MethodSource("asyncCols") void createTtlIndexWithoutOptions(ArangoCollectionAsync collection) { - assumeTrue(isAtLeastVersion(3, 5)); final Collection fields = new ArrayList<>(); fields.add("a"); @@ -2310,8 +2207,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 +2353,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 +3334,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 +3346,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 +3388,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..f89695efa 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); @@ -2087,7 +1995,6 @@ void createAndGetVectorIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createZKDIndex(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 9)); collection.truncate(); String f1 = "field-" + rnd(); String f2 = "field-" + rnd(); @@ -2109,7 +2016,6 @@ void createZKDIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createZKDIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 9)); collection.truncate(); String name = "ZKDIndex-" + rnd(); @@ -2137,7 +2043,6 @@ void createZKDIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createMDIndex(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String f1 = "field-" + rnd(); @@ -2159,7 +2064,6 @@ void createMDIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createMDIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String name = "MDIndex-" + rnd(); @@ -2193,7 +2097,6 @@ void createMDIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createMDPrefixedIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 12)); collection.truncate(); String name = "MDPrefixedIndex-" + rnd(); @@ -2229,7 +2132,6 @@ void createMDPrefixedIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexEstimates(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2250,7 +2152,6 @@ void indexEstimates(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void indexEstimatesFalse(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 8)); assumeTrue(isSingleServer()); String name = "persistentIndex-" + rnd(); @@ -2271,8 +2172,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 +2189,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); @@ -2325,8 +2222,6 @@ void createFulltextIndex(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createFulltextIndexWithOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "fulltextIndex-" + rnd(); final FulltextIndexOptions options = new FulltextIndexOptions(); options.name(name); @@ -2348,7 +2243,6 @@ void createFulltextIndexWithOptions(ArangoCollection collection) { @ParameterizedTest @MethodSource("cols") void createTtlIndexWithoutOptions(ArangoCollection collection) { - assumeTrue(isAtLeastVersion(3, 5)); final Collection fields = new ArrayList<>(); fields.add("a"); @@ -2363,8 +2257,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 +2430,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 +3488,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..4037e8da0 100644 --- a/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java +++ b/test-functional/src/test/java/com/arangodb/ArangoConfigTest.java @@ -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 f62fa2679..70586f8db 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,16 +423,13 @@ 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 @MethodSource("arangos") void executeJS(ArangoDB arangoDB) { - assumeTrue(isAtLeastVersion(3, 11)); Request request = Request.builder() .db(ArangoRequestParam.SYSTEM) .method(Request.Method.POST) @@ -456,7 +443,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()); @@ -465,7 +451,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) @@ -475,7 +460,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) @@ -485,7 +469,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)); @@ -497,7 +480,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(); @@ -508,7 +490,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(); @@ -521,7 +502,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()); @@ -530,7 +510,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() @@ -545,7 +524,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() @@ -560,7 +538,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); } @@ -568,7 +545,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); @@ -583,7 +559,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); @@ -603,7 +578,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); @@ -622,7 +596,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); @@ -637,7 +610,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); @@ -655,7 +627,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) { @@ -774,27 +745,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 67af254ea..ab007b7e6 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"); @@ -1342,9 +1319,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 +1373,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(); @@ -1424,11 +1397,7 @@ void createGetDeleteAqlFunction(ArangoDatabaseAsync db) throws ExecutionExceptio } 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(); - } + assertThat(deleteCount).isEqualTo(1); final Collection aqlFunctions = db.getAqlFunctions(null).get(); assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); } @@ -1448,12 +1417,7 @@ void createGetDeleteAqlFunctionWithNamespace(ArangoDatabaseAsync db) throws Exec } 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(); - } + assertThat(deleteCount).isEqualTo(2); final Collection aqlFunctions = db.getAqlFunctions(null).get(); assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); } @@ -1470,9 +1434,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(); @@ -1628,7 +1590,6 @@ void transactionInsertJson(ArangoDatabaseAsync db) throws ExecutionException, In @ParameterizedTest @MethodSource("asyncDbs") void transactionExclusiveWrite(ArangoDatabaseAsync db) throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 4)); String key = "key-" + rnd(); final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") .exclusiveCollections(CNAME1); @@ -1680,7 +1641,7 @@ 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(); @@ -1690,8 +1651,6 @@ void getInfo(ArangoDatabaseAsync db) throws ExecutionException, InterruptedExcep @ParameterizedTest @MethodSource("asyncDbs") void shouldIncludeExceptionMessage(ArangoDatabaseAsync db) { - assumeTrue(isAtLeastVersion(3, 4)); - final String exceptionMessage = "My error context"; final String action = "function (params) {" + "throw '" + exceptionMessage + "';" + "}"; Throwable thrown = catchThrowable(() -> db.transaction(action, Void.class, null).get()).getCause(); diff --git a/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java b/test-functional/src/test/java/com/arangodb/ArangoDatabaseTest.java index 3763aacbf..330e1cc97 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(); @@ -1467,9 +1442,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 +1502,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(); @@ -1554,12 +1525,7 @@ void createGetDeleteAqlFunction(ArangoDatabase db) { 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(); - } + assertThat(deleteCount).isEqualTo(1); final Collection aqlFunctions = db.getAqlFunctions(null); assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); } @@ -1579,12 +1545,7 @@ void createGetDeleteAqlFunctionWithNamespace(ArangoDatabase db) { } 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(); - } + assertThat(deleteCount).isEqualTo(2); final Collection aqlFunctions = db.getAqlFunctions(null); assertThat(aqlFunctions).hasSize(aqlFunctionsInitial.size()); } @@ -1601,9 +1562,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())); @@ -1759,7 +1718,6 @@ void transactionInsertJson(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void transactionExclusiveWrite(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); String key = "key-" + rnd(); final TransactionOptions options = new TransactionOptions().params("{\"_key\":\"" + key + "\"}") .exclusiveCollections(CNAME1); @@ -1811,7 +1769,7 @@ 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(); @@ -1821,8 +1779,6 @@ void getInfo(ArangoDatabase db) { @ParameterizedTest @MethodSource("dbs") void shouldIncludeExceptionMessage(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 4)); - final String exceptionMessage = "My error context"; final String action = "function (params) {" + "throw '" + exceptionMessage + "';" + "}"; try { 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..301fe8be8 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,7 +267,6 @@ 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(); @@ -315,7 +299,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 +338,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 +356,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 +426,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 +443,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 +464,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 +485,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 +506,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 +529,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 +553,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 +579,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 +604,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 +634,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 +647,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 +676,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 +740,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 +770,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 +794,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 +821,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 +848,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 +875,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 +895,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 +916,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 +938,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 +958,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 +985,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 +1012,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<>(); diff --git a/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java b/test-functional/src/test/java/com/arangodb/ArangoSearchTest.java index 1f14c1a7b..2ce23dddd 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,7 +273,6 @@ 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()); @@ -321,7 +305,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 +344,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 +362,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 +432,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 +449,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 +470,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 +491,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 +512,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 +535,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 +559,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 +585,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 +610,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 +640,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 +654,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 +683,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 +746,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 +776,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 +800,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 +827,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 +854,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 +881,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 +901,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 +922,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 +944,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 +964,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 +991,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 +1018,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<>(); 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 d5c491361..5ad685204 100644 --- a/test-functional/src/test/java/com/arangodb/BaseJunit5.java +++ b/test-functional/src/test/java/com/arangodb/BaseJunit5.java @@ -34,7 +34,6 @@ public class BaseJunit5 { private static final ServerRole role = adb.getRole(); 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) @@ -206,10 +205,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; } @@ -218,8 +213,4 @@ public static boolean isCluster() { return role == ServerRole.COORDINATOR; } - public static boolean isEnterprise() { - return version.getLicense() == License.ENTERPRISE; - } - } diff --git a/test-functional/src/test/java/com/arangodb/CompressionTest.java b/test-functional/src/test/java/com/arangodb/CompressionTest.java index fa81c5bef..812dee6cd 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,21 +20,18 @@ class CompressionTest extends BaseJunit5 { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void gzip(Protocol protocol) { doTest(protocol, Compression.GZIP); } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void deflate(Protocol protocol) { 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..a647d34e3 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()) @@ -158,16 +156,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 +174,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 +192,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..2831bfeb4 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()) @@ -157,16 +155,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 +173,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 +191,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..e2171a7ab 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,10 +16,8 @@ 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); diff --git a/test-functional/src/test/java/com/arangodb/ParallelTest.java b/test-functional/src/test/java/com/arangodb/ParallelTest.java index 00bf1eaba..6e1143866 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,10 +18,8 @@ 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); 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 a1059b86c..2b66e9fbb 100644 --- a/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java +++ b/test-functional/src/test/java/com/arangodb/UserAgentAsyncTest.java @@ -1,21 +1,17 @@ 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; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assumptions.assumeTrue; class UserAgentAsyncTest extends BaseJunit5 { @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void userAgentHeader(Protocol protocol) throws ExecutionException, InterruptedException { - 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 7261367ea..235c05c33 100644 --- a/test-functional/src/test/java/com/arangodb/UserAgentTest.java +++ b/test-functional/src/test/java/com/arangodb/UserAgentTest.java @@ -1,12 +1,11 @@ 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 { @@ -25,10 +24,8 @@ void packageVersionIsShaded() { } @ParameterizedTest - @EnumSource(Protocol.class) + @ProtocolSource void userAgentHeader(Protocol protocol) { - assumeTrue(!protocol.equals(Protocol.VST) || BaseJunit5.isLessThanVersion(3, 12)); - ArangoDB adb = new ArangoDB.Builder() .loadProperties(config) .protocol(protocol) 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/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-non-functional/pom.xml b/test-non-functional/pom.xml index 03450dbd4..9954e4e12 100644 --- a/test-non-functional/pom.xml +++ b/test-non-functional/pom.xml @@ -14,9 +14,9 @@ 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..472c4ec0f 100644 --- a/test-non-functional/src/test/java/CommunicationTest.java +++ b/test-non-functional/src/test/java/CommunicationTest.java @@ -2,7 +2,7 @@ import com.arangodb.config.ArangoConfigProperties; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import util.ProtocolSource; import util.TestUtils; import java.io.IOException; @@ -11,16 +11,13 @@ 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) @@ -42,11 +39,9 @@ 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) diff --git a/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java b/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java index a3f5200a2..ff7a74a60 100644 --- a/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java +++ b/test-non-functional/src/test/java/concurrency/ConnectionLoadBalanceTest.java @@ -23,9 +23,6 @@ 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), 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..afdde2324 100644 --- a/test-non-functional/src/test/java/mp/ConfigMPTest.java +++ b/test-non-functional/src/test/java/mp/ConfigMPTest.java @@ -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/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..f1bc8ceed 100644 --- a/test-non-functional/src/test/java/util/TestUtils.java +++ b/test-non-functional/src/test/java/util/TestUtils.java @@ -46,7 +46,7 @@ private TestUtils() { public static ArangoSerde createSerde(Protocol protocol) { return switch (protocol) { - case VST, HTTP_VPACK, HTTP2_VPACK -> JacksonSerde.of(ContentType.VPACK); + case HTTP_VPACK, HTTP2_VPACK -> JacksonSerde.of(ContentType.VPACK); case HTTP_JSON, HTTP2_JSON -> JacksonSerde.of(ContentType.JSON); }; } 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..387d70c6d 100644 --- a/test-non-functional/src/test/resources/arangodb-config-test.properties +++ b/test-non-functional/src/test/resources/arangodb-config-test.properties @@ -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 2f29e2301..b401b46a9 100644 --- a/test-parent/pom.xml +++ b/test-parent/pom.xml @@ -17,8 +17,8 @@ false 2.20.0 true - 17 - 17 + 21 + 21 src/test/java @@ -173,11 +173,6 @@ arangodb-java-driver compile - - com.arangodb - vst-protocol - compile - 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/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..7c5a721aa 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,21 +27,18 @@ 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 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..174c925fd 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,7 +44,6 @@ 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") ); @@ -56,7 +52,6 @@ static Stream args() { @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/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/maven/pom.xml b/tutorial/maven/pom.xml index cf0cd3173..1c38b2158 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 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