diff --git a/src/main/java/com/arangodb/ArangoDB.java b/src/main/java/com/arangodb/ArangoDB.java index d429754b3..f58064a08 100644 --- a/src/main/java/com/arangodb/ArangoDB.java +++ b/src/main/java/com/arangodb/ArangoDB.java @@ -27,11 +27,7 @@ import com.arangodb.internal.InternalArangoDBBuilder; import com.arangodb.internal.http.HttpCommunication; import com.arangodb.internal.http.HttpConnectionFactory; -import com.arangodb.internal.net.ConnectionFactory; -import com.arangodb.internal.net.Host; -import com.arangodb.internal.net.HostHandle; -import com.arangodb.internal.net.HostHandler; -import com.arangodb.internal.net.HostResolver; +import com.arangodb.internal.net.*; import com.arangodb.internal.util.ArangoDeserializerImpl; import com.arangodb.internal.util.ArangoSerializationFactory; import com.arangodb.internal.util.ArangoSerializerImpl; @@ -42,19 +38,12 @@ import com.arangodb.model.LogOptions; import com.arangodb.model.UserCreateOptions; import com.arangodb.model.UserUpdateOptions; -import com.arangodb.util.*; +import com.arangodb.util.ArangoCursorInitializer; +import com.arangodb.util.ArangoDeserializer; +import com.arangodb.util.ArangoSerialization; +import com.arangodb.util.ArangoSerializer; import com.arangodb.velocypack.VPack; -import com.arangodb.velocypack.VPackAnnotationFieldFilter; -import com.arangodb.velocypack.VPackAnnotationFieldNaming; -import com.arangodb.velocypack.VPackDeserializer; -import com.arangodb.velocypack.VPackInstanceCreator; -import com.arangodb.velocypack.VPackJsonDeserializer; -import com.arangodb.velocypack.VPackJsonSerializer; -import com.arangodb.velocypack.VPackModule; import com.arangodb.velocypack.VPackParser; -import com.arangodb.velocypack.VPackParserModule; -import com.arangodb.velocypack.VPackSerializer; -import com.arangodb.velocypack.ValueType; import com.arangodb.velocystream.Request; import com.arangodb.velocystream.Response; import org.apache.http.client.HttpRequestRetryHandler; @@ -64,7 +53,6 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import java.io.InputStream; -import java.lang.annotation.Annotation; import java.util.Collection; import java.util.Locale; import java.util.Properties; @@ -339,321 +327,6 @@ public Builder responseQueueTimeSamples(final Integer responseQueueTimeSamples) return this; } - /** - * Register a custom {@link VPackSerializer} for a specific type to be used within the internal serialization - * process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param serializer serializer to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerSerializer(final Class clazz, final VPackSerializer serializer) { - vpackBuilder.registerSerializer(clazz, serializer); - return this; - } - - /** - * Register a special serializer for a member class which can only be identified by its enclosing class. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type of the enclosing class - * @param serializer serializer to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerEnclosingSerializer(final Class clazz, final VPackSerializer serializer) { - vpackBuilder.registerEnclosingSerializer(clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackDeserializer} for a specific type to be used within the internal serialization - * process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerDeserializer(final Class clazz, final VPackDeserializer deserializer) { - vpackBuilder.registerDeserializer(clazz, deserializer); - return this; - } - - /** - * Register a custom {@link VPackInstanceCreator} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the instance creator should be registered for - * @param creator - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerInstanceCreator(final Class clazz, final VPackInstanceCreator creator) { - vpackBuilder.registerInstanceCreator(clazz, creator); - return this; - } - - /** - * Register a custom {@link VPackJsonDeserializer} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonDeserializer(final ValueType type, final VPackJsonDeserializer deserializer) { - vpackParserBuilder.registerDeserializer(type, deserializer); - return this; - } - - /** - * Register a custom {@link VPackJsonDeserializer} for a specific type and attribute name to be used within the - * internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param attribute - * @param type the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonDeserializer( - final String attribute, - final ValueType type, - final VPackJsonDeserializer deserializer) { - vpackParserBuilder.registerDeserializer(attribute, type, deserializer); - return this; - } - - /** - * Register a custom {@link VPackJsonSerializer} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param serializer - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonSerializer(final Class clazz, final VPackJsonSerializer serializer) { - vpackParserBuilder.registerSerializer(clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackJsonSerializer} for a specific type and attribute name to be used within the - * internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param attribute - * @param clazz the type the serializer should be registered for - * @param serializer - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonSerializer( - final String attribute, - final Class clazz, - final VPackJsonSerializer serializer) { - vpackParserBuilder.registerSerializer(attribute, clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackAnnotationFieldFilter} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param fieldFilter - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder annotationFieldFilter( - final Class type, - final VPackAnnotationFieldFilter fieldFilter) { - vpackBuilder.annotationFieldFilter(type, fieldFilter); - return this; - } - - /** - * Register a custom {@link VPackAnnotationFieldNaming} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param fieldNaming - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see
Reference Documentation - */ - @Deprecated - public Builder annotationFieldNaming( - final Class type, - final VPackAnnotationFieldNaming fieldNaming) { - vpackBuilder.annotationFieldNaming(type, fieldNaming); - return this; - } - - /** - * Register a {@link VPackModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param module module to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see
Reference Documentation - */ - @Deprecated - public Builder registerModule(final VPackModule module) { - vpackBuilder.registerModule(module); - return this; - } - - /** - * Register a list of {@link VPackModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param modules modules to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerModules(final VPackModule... modules) { - vpackBuilder.registerModules(modules); - return this; - } - - /** - * Register a {@link VPackParserModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param module module to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonModule(final VPackParserModule module) { - vpackParserBuilder.registerModule(module); - return this; - } - - /** - * Register a list of {@link VPackParserModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param modules modules to register - * @return {@link ArangoDB.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonModules(final VPackParserModule... modules) { - vpackParserBuilder.registerModules(modules); - return this; - } - - /** - * Replace the built-in serializer with the given serializer. - *

- *
- * ATTENTION!: Use at your own risk - * - * @param serializer custom serializer - * @return {@link ArangoDB.Builder} - * @deprecated use {@link #serializer(ArangoSerialization)} instead - */ - @Deprecated - public Builder setSerializer(final ArangoSerializer serializer) { - serializer(serializer); - return this; - } - - /** - * Replace the built-in deserializer with the given deserializer. - *

- *
- * ATTENTION!: Use at your own risk - * - * @param deserializer custom deserializer - * @return {@link ArangoDB.Builder} - * @deprecated use {@link #serializer(ArangoSerialization)} instead - */ - @Deprecated - public Builder setDeserializer(final ArangoDeserializer deserializer) { - deserializer(deserializer); - return this; - } - /** * Replace the built-in serializer/deserializer with the given one. *

@@ -746,18 +419,6 @@ public synchronized ArangoDB build() { */ ArangoDatabase db(); - /** - * Returns a {@code ArangoDatabase} instance for the given database name. - * - * @param name Name of the database - * @return database handler - * @deprecated Use {@link #db(DbName)} instead - */ - @Deprecated - default ArangoDatabase db(String name) { - return db(DbName.of(name)); - } - /** * Returns a {@code ArangoDatabase} instance for the given database name. * @@ -771,21 +432,6 @@ default ArangoDatabase db(String name) { */ ArangoMetrics metrics(); - /** - * Creates a new database with the given name. - * - * @param name Name of the database to create - * @return true if the database was created successfully. - * @throws ArangoDBException - * @see API - * Documentation - * @deprecated Use {@link #createDatabase(DbName)} instead - */ - @Deprecated - default Boolean createDatabase(String name) throws ArangoDBException { - return createDatabase(DbName.of(name)); - } - /** * Creates a new database with the given name. * diff --git a/src/main/java/com/arangodb/ArangoDatabase.java b/src/main/java/com/arangodb/ArangoDatabase.java index d9d2a8eff..24146626c 100644 --- a/src/main/java/com/arangodb/ArangoDatabase.java +++ b/src/main/java/com/arangodb/ArangoDatabase.java @@ -21,7 +21,6 @@ package com.arangodb; import com.arangodb.entity.*; -import com.arangodb.entity.arangosearch.AnalyzerEntity; import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer; import com.arangodb.model.*; import com.arangodb.model.arangosearch.AnalyzerDeleteOptions; @@ -48,17 +47,6 @@ public interface ArangoDatabase extends ArangoSerializationAccessor { */ ArangoDB arango(); - /** - * Returns the name of the database - * - * @return database name - * @deprecated Use {@link #dbName()} instead - */ - @Deprecated - default String name() { - return dbName().get(); - } - /** * Returns the name of the database * @@ -719,19 +707,6 @@ GraphEntity createGraph(String name, Collection edgeDefinitions, */ ViewEntity createArangoSearch(String name, ArangoSearchCreateOptions options) throws ArangoDBException; - /** - * Creates an Analyzer - * - * @param options AnalyzerEntity - * @return the created Analyzer - * @throws ArangoDBException - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#createSearchAnalyzer(SearchAnalyzer)}} - */ - @Deprecated - AnalyzerEntity createAnalyzer(AnalyzerEntity options) throws ArangoDBException; - /** * Creates an Analyzer * @@ -743,19 +718,6 @@ GraphEntity createGraph(String name, Collection edgeDefinitions, */ SearchAnalyzer createSearchAnalyzer(SearchAnalyzer analyzer) throws ArangoDBException; - /** - * Gets information about an Analyzer - * - * @param name of the Analyzer without database prefix - * @return information about an Analyzer - * @throws ArangoDBException - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#getSearchAnalyzer(String)}} - */ - @Deprecated - AnalyzerEntity getAnalyzer(String name) throws ArangoDBException; - /** * Gets information about an Analyzer * @@ -767,18 +729,6 @@ GraphEntity createGraph(String name, Collection edgeDefinitions, */ SearchAnalyzer getSearchAnalyzer(String name) throws ArangoDBException; - /** - * Retrieves all analyzers definitions. - * - * @return collection of all analyzers definitions - * @throws ArangoDBException - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#getSearchAnalyzers()} - */ - @Deprecated - Collection getAnalyzers() throws ArangoDBException; - /** * Retrieves all analyzers definitions. * @@ -789,31 +739,6 @@ GraphEntity createGraph(String name, Collection edgeDefinitions, */ Collection getSearchAnalyzers() throws ArangoDBException; - /** - * Deletes an Analyzer - * - * @param name of the Analyzer without database prefix - * @throws ArangoDBException - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#deleteSearchAnalyzer(String)}}} - */ - @Deprecated - void deleteAnalyzer(String name) throws ArangoDBException; - - /** - * Deletes an Analyzer - * - * @param name of the Analyzer without database prefix - * @param options AnalyzerDeleteOptions - * @throws ArangoDBException - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#deleteSearchAnalyzer(String, AnalyzerDeleteOptions)}}} - */ - @Deprecated - void deleteAnalyzer(String name, AnalyzerDeleteOptions options) throws ArangoDBException; - /** * Deletes an Analyzer * diff --git a/src/main/java/com/arangodb/ArangoIterable.java b/src/main/java/com/arangodb/ArangoIterable.java index 40ab262bc..b0848c292 100644 --- a/src/main/java/com/arangodb/ArangoIterable.java +++ b/src/main/java/com/arangodb/ArangoIterable.java @@ -20,7 +20,6 @@ package com.arangodb; -import java.util.Collection; import java.util.stream.Stream; /** @@ -33,101 +32,4 @@ public interface ArangoIterable extends Iterable { Stream stream(); - /** - * Performs the given action for each element of the {@code ArangoIterable} - * - * @param action - * a action to perform on the elements - * @deprecated Use {@link #forEach(java.util.function.Consumer)} instead. - */ - @Deprecated - void foreach(Consumer action); - - /** - * Returns a {@code ArangoIterable} consisting of the results of applying the given function to the elements of this - * {@code ArangoIterable}. - * - * @param mapper - * a function to apply to each element - * @return the new {@code ArangoIterable} - * - * @deprecated Use {@link #stream()} and {@link Stream#map(java.util.function.Function)} instead. - */ - @Deprecated - ArangoIterable map(Function mapper); - - /** - * Returns a {@code ArangoIterable} consisting of the elements of this {@code ArangoIterable} that match the given - * predicate. - * - * @param predicate - * a predicate to apply to each element to determine if it should be included - * @return the new {@code ArangoIterable} - * - * @deprecated Use {@link #stream()} and {@link Stream#filter(java.util.function.Predicate)} instead. - */ - @Deprecated - ArangoIterable filter(Predicate predicate); - - /** - * Returns the first element or {@code null} if no element exists. - * - * @return first element or {@code null} - * @deprecated Use {@link #stream()} and {@link Stream#findFirst()} instead. - */ - @Deprecated - T first(); - - /** - * Returns the count of elements of this {@code ArangoIterable}. - * - * @return the count of elements - * @deprecated Use {@link #stream()} and {@link Stream#count()} instead. - */ - @Deprecated - long count(); - - /** - * Returns whether any elements of this {@code ArangoIterable} match the provided predicate. - * - * @param predicate a predicate to apply to elements of this {@code ArangoIterable} - * @return {@code true} if any elements of the {@code ArangoIterable} match the provided predicate, otherwise - * {@code false} - * @deprecated Use {@link #stream()} and {@link Stream#anyMatch(java.util.function.Predicate)} instead. - */ - @Deprecated - boolean anyMatch(Predicate predicate); - - /** - * Returns whether all elements of this {@code ArangoIterable} match the provided predicate. - * - * @param predicate a predicate to apply to elements of this {@code ArangoIterable} - * @return {@code true} if all elements of the {@code ArangoIterable} match the provided predicate, otherwise - * {@code false} - * @deprecated Use {@link #stream()} and {@link Stream#allMatch(java.util.function.Predicate)} instead. - */ - @Deprecated - boolean allMatch(Predicate predicate); - - /** - * Returns whether no elements of this {@code ArangoIterable} match the provided predicate. - * - * @param predicate a predicate to apply to elements of this {@code ArangoIterable} - * @return {@code true} if no elements of the {@code ArangoIterable} match the provided predicate, otherwise - * {@code false} - * @deprecated Use {@link #stream()} and {@link Stream#noneMatch(java.util.function.Predicate)} instead. - */ - @Deprecated - boolean noneMatch(Predicate predicate); - - /** - * Iterates over all elements of this {@code ArangoIterable} and adds each to the given target. - * - * @param target the collection to insert into - * @return the filled target - * @deprecated Use {@link #stream()} and {@link Stream#collect} instead. - */ - @Deprecated - > R collectInto(R target); - } diff --git a/src/main/java/com/arangodb/Consumer.java b/src/main/java/com/arangodb/Consumer.java deleted file mode 100644 index 3edbe3c4e..000000000 --- a/src/main/java/com/arangodb/Consumer.java +++ /dev/null @@ -1,38 +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; - -/** - * @param the type of the input to the operation - * @author Mark Vollmary - * @deprecated Use {@link java.util.function.Consumer} instead. - */ -@Deprecated -public interface Consumer { - - /** - * Performs this operation on the given argument. - * - * @param t the input argument - */ - void accept(T t); - -} diff --git a/src/main/java/com/arangodb/Predicate.java b/src/main/java/com/arangodb/Predicate.java deleted file mode 100644 index 4c7257862..000000000 --- a/src/main/java/com/arangodb/Predicate.java +++ /dev/null @@ -1,39 +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; - -/** - * @param the type of the input to the predicate - * @author Mark Vollmary - * @deprecated Use {@link java.util.function.Predicate} instead. - */ -@Deprecated -public interface Predicate { - - /** - * Evaluates this predicate on the given argument. - * - * @param t the input argument - * @return {@code true} if the input argument matches the predicate, otherwise {@code false} - */ - boolean test(T t); - -} diff --git a/src/main/java/com/arangodb/async/ArangoDBAsync.java b/src/main/java/com/arangodb/async/ArangoDBAsync.java index f809f78d8..8b3b0b75d 100644 --- a/src/main/java/com/arangodb/async/ArangoDBAsync.java +++ b/src/main/java/com/arangodb/async/ArangoDBAsync.java @@ -52,7 +52,6 @@ import javax.net.ssl.SSLContext; import java.io.InputStream; -import java.lang.annotation.Annotation; import java.util.Collection; import java.util.concurrent.CompletableFuture; @@ -89,18 +88,6 @@ public interface ArangoDBAsync extends ArangoSerializationAccessor { */ ArangoDatabaseAsync db(); - /** - * Returns a handler of the database by the given name - * - * @param name Name of the database - * @return database handler - * @deprecated Use {@link #db(DbName)} instead - */ - @Deprecated - default ArangoDatabaseAsync db(final String name) { - return db(DbName.of(name)); - } - /** * Returns a handler of the database by the given name * @@ -114,20 +101,6 @@ default ArangoDatabaseAsync db(final String name) { */ ArangoMetrics metrics(); - /** - * Creates a new database - * - * @param name Has to contain a valid database name - * @return true if the database was created successfully. - * @see API - * Documentation - * @deprecated Use {@link #createDatabase(DbName)} instead - */ - @Deprecated - default CompletableFuture createDatabase(final String name) { - return createDatabase(DbName.of(name)); - } - /** * Creates a new database * @@ -515,321 +488,6 @@ public Builder loadBalancingStrategy(final LoadBalancingStrategy loadBalancingSt return this; } - /** - * Register a custom {@link VPackSerializer} for a specific type to be used within the internal serialization - * process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param serializer serializer to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerSerializer(final Class clazz, final VPackSerializer serializer) { - vpackBuilder.registerSerializer(clazz, serializer); - return this; - } - - /** - * Register a special serializer for a member class which can only be identified by its enclosing class. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type of the enclosing class - * @param serializer serializer to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerEnclosingSerializer(final Class clazz, final VPackSerializer serializer) { - vpackBuilder.registerEnclosingSerializer(clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackDeserializer} for a specific type to be used within the internal serialization - * process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerDeserializer(final Class clazz, final VPackDeserializer deserializer) { - vpackBuilder.registerDeserializer(clazz, deserializer); - return this; - } - - /** - * Register a custom {@link VPackInstanceCreator} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the instance creator should be registered for - * @param creator - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerInstanceCreator(final Class clazz, final VPackInstanceCreator creator) { - vpackBuilder.registerInstanceCreator(clazz, creator); - return this; - } - - /** - * Register a custom {@link VPackJsonDeserializer} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonDeserializer(final ValueType type, final VPackJsonDeserializer deserializer) { - vpackParserBuilder.registerDeserializer(type, deserializer); - return this; - } - - /** - * Register a custom {@link VPackJsonDeserializer} for a specific type and attribute name to be used within the - * internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param attribute - * @param type the type the serializer should be registered for - * @param deserializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonDeserializer( - final String attribute, - final ValueType type, - final VPackJsonDeserializer deserializer) { - vpackParserBuilder.registerDeserializer(attribute, type, deserializer); - return this; - } - - /** - * Register a custom {@link VPackJsonSerializer} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param clazz the type the serializer should be registered for - * @param serializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonSerializer(final Class clazz, final VPackJsonSerializer serializer) { - vpackParserBuilder.registerSerializer(clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackJsonSerializer} for a specific type and attribute name to be used within the - * internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param attribute - * @param clazz the type the serializer should be registered for - * @param serializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonSerializer( - final String attribute, - final Class clazz, - final VPackJsonSerializer serializer) { - vpackParserBuilder.registerSerializer(attribute, clazz, serializer); - return this; - } - - /** - * Register a custom {@link VPackAnnotationFieldFilter} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param fieldFilter - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see Reference Documentation - */ - @Deprecated - public Builder annotationFieldFilter( - final Class type, - final VPackAnnotationFieldFilter fieldFilter) { - vpackBuilder.annotationFieldFilter(type, fieldFilter); - return this; - } - - /** - * Register a custom {@link VPackAnnotationFieldNaming} for a specific type to be used within the internal - * serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param type the type the serializer should be registered for - * @param fieldNaming - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom serializers and deserializers by implementing {@link com.fasterxml.jackson.databind.JsonSerializer} and {@link com.fasterxml.jackson.databind.JsonDeserializer}. - * @see
Reference Documentation - */ - @Deprecated - public Builder annotationFieldNaming( - final Class type, - final VPackAnnotationFieldNaming fieldNaming) { - vpackBuilder.annotationFieldNaming(type, fieldNaming); - return this; - } - - /** - * Register a {@link VPackModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param module module to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see
Reference Documentation - */ - @Deprecated - public Builder registerModule(final VPackModule module) { - vpackBuilder.registerModule(module); - return this; - } - - /** - * Register a list of {@link VPackModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param modules modules to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerModules(final VPackModule... modules) { - vpackBuilder.registerModules(modules); - return this; - } - - /** - * Register a {@link VPackParserModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param module module to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonModule(final VPackParserModule module) { - vpackParserBuilder.registerModule(module); - return this; - } - - /** - * Register a list of {@link VPackParserModule} to be used within the internal serialization process. - * - *

- * Attention:can not be used together with {@link #serializer(ArangoSerialization)} - *

- * - * @param modules modules to register - * @return {@link ArangoDBAsync.Builder} - * @deprecated Use {@link com.arangodb.mapping.ArangoJack} instead and register custom modules. - * @see Reference Documentation - */ - @Deprecated - public Builder registerJsonModules(final VPackParserModule... modules) { - vpackParserBuilder.registerModules(modules); - return this; - } - - /** - * Replace the built-in serializer with the given serializer. - *

- *
- * ATTENTION!: Use at your own risk - * - * @param serializer custom serializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated use {@link #serializer(ArangoSerialization)} instead - */ - @Deprecated - public Builder setSerializer(final ArangoSerializer serializer) { - serializer(serializer); - return this; - } - - /** - * Replace the built-in deserializer with the given deserializer. - *

- *
- * ATTENTION!: Use at your own risk - * - * @param deserializer custom deserializer - * @return {@link ArangoDBAsync.Builder} - * @deprecated use {@link #serializer(ArangoSerialization)} instead - */ - @Deprecated - public Builder setDeserializer(final ArangoDeserializer deserializer) { - deserializer(deserializer); - return this; - } - /** * Replace the built-in serializer/deserializer with the given one. *

diff --git a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java index d5d391fbe..d3ed12c32 100644 --- a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java +++ b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java @@ -24,7 +24,6 @@ import com.arangodb.ArangoSerializationAccessor; import com.arangodb.DbName; import com.arangodb.entity.*; -import com.arangodb.entity.arangosearch.AnalyzerEntity; import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer; import com.arangodb.model.*; import com.arangodb.model.arangosearch.AnalyzerDeleteOptions; @@ -51,17 +50,6 @@ public interface ArangoDatabaseAsync extends ArangoSerializationAccessor { */ ArangoDBAsync arango(); - /** - * Returns the name of the database - * - * @return database name - * @deprecated Use {@link #dbName()} instead - */ - @Deprecated - default String name() { - return dbName().get(); - } - /** * Returns the name of the database * @@ -695,18 +683,6 @@ CompletableFuture getDocument(final String id, final Class type, final */ CompletableFuture createArangoSearch(String name, ArangoSearchCreateOptions options); - /** - * Creates an Analyzer - * - * @param options AnalyzerEntity - * @return the created Analyzer - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#createSearchAnalyzer(SearchAnalyzer)}} - */ - @Deprecated - CompletableFuture createAnalyzer(AnalyzerEntity options); - /** * Creates an Analyzer * @@ -718,18 +694,6 @@ CompletableFuture getDocument(final String id, final Class type, final */ CompletableFuture createSearchAnalyzer(SearchAnalyzer analyzer); - /** - * Gets information about an Analyzer - * - * @param name of the Analyzer without database prefix - * @return information about an Analyzer - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#getSearchAnalyzer(String)}} - */ - @Deprecated - CompletableFuture getAnalyzer(String name); - /** * Gets information about an Analyzer * @@ -741,17 +705,6 @@ CompletableFuture getDocument(final String id, final Class type, final */ CompletableFuture getSearchAnalyzer(String name); - /** - * Retrieves all analyzers definitions. - * - * @return collection of all analyzers definitions - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#getSearchAnalyzers()} - */ - @Deprecated - CompletableFuture> getAnalyzers(); - /** * Retrieves all analyzers definitions. * @@ -762,29 +715,6 @@ CompletableFuture getDocument(final String id, final Class type, final */ CompletableFuture> getSearchAnalyzers(); - /** - * Deletes an Analyzer - * - * @param name of the Analyzer without database prefix - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#deleteSearchAnalyzer(String)}}} - */ - @Deprecated - CompletableFuture deleteAnalyzer(String name); - - /** - * Deletes an Analyzer - * - * @param name of the Analyzer without database prefix - * @param options AnalyzerDeleteOptions - * @see API Documentation - * @since ArangoDB 3.5.0 - * @deprecated use {@link this#deleteSearchAnalyzer(String, AnalyzerDeleteOptions)}}} - */ - @Deprecated - CompletableFuture deleteAnalyzer(String name, AnalyzerDeleteOptions options); - /** * Deletes an Analyzer * diff --git a/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java index 1ff2ede2e..224d80d7c 100644 --- a/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java +++ b/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java @@ -30,7 +30,6 @@ import com.arangodb.async.ArangoSearchAsync; import com.arangodb.async.ArangoViewAsync; import com.arangodb.entity.*; -import com.arangodb.entity.arangosearch.AnalyzerEntity; import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer; import com.arangodb.internal.ArangoCursorExecute; import com.arangodb.internal.ArangoErrors; @@ -450,55 +449,29 @@ public CompletableFuture createArangoSearch(final String name, final return executor.execute(createArangoSearchRequest(name, options), ViewEntity.class); } - @Override - public CompletableFuture createAnalyzer(AnalyzerEntity options) { - return executor.execute(createAnalyzerRequest(options), AnalyzerEntity.class); - } - @Override public CompletableFuture createSearchAnalyzer(SearchAnalyzer analyzer) { return executor.execute(createAnalyzerRequest(analyzer), SearchAnalyzer.class); } - @Override - public CompletableFuture getAnalyzer(String name) { - return executor.execute(getAnalyzerRequest(name), AnalyzerEntity.class); - } - @Override public CompletableFuture getSearchAnalyzer(String name) { return executor.execute(getAnalyzerRequest(name), SearchAnalyzer.class); } - @Override - public CompletableFuture> getAnalyzers() { - return executor.execute(getAnalyzersRequest(), getAnalyzersResponseDeserializer()); - } - @Override public CompletableFuture> getSearchAnalyzers() { return executor.execute(getAnalyzersRequest(), getSearchAnalyzersResponseDeserializer()); } - @Override - public CompletableFuture deleteAnalyzer(String name) { - return executor.execute(deleteAnalyzerRequest(name, null), Void.class); - } - - @Override - public CompletableFuture deleteAnalyzer(String name, AnalyzerDeleteOptions options) { - return executor.execute(deleteAnalyzerRequest(name, options), Void.class); - } - @Override public CompletableFuture deleteSearchAnalyzer(String name) { - return deleteAnalyzer(name); + return deleteSearchAnalyzer(name, null); } @Override public CompletableFuture deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options) { - return deleteAnalyzer(name, options); + return executor.execute(deleteAnalyzerRequest(name, options), Void.class); } - } diff --git a/src/main/java/com/arangodb/entity/DocumentField.java b/src/main/java/com/arangodb/entity/DocumentField.java deleted file mode 100644 index 23341da94..000000000 --- a/src/main/java/com/arangodb/entity/DocumentField.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.entity; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @author Mark Vollmary - * @deprecated Use {@link Id}, {@link Key}, {@link Rev}, {@link From} or {@link To} instead. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD}) -@Deprecated -public @interface DocumentField { - - @Deprecated - enum Type { - - /** - * @deprecated Use {@link Id} instead. - */ - @Deprecated - ID("_id"), - - /** - * @deprecated Use {@link Key} instead. - */ - @Deprecated - KEY("_key"), - - /** - * @deprecated Use {@link Rev} instead. - */ - @Deprecated - REV("_rev"), - - /** - * @deprecated Use {@link From} instead. - */ - @Deprecated - FROM("_from"), - - /** - * @deprecated Use {@link To} instead. - */ - @Deprecated - TO("_to"); - - private final String serializeName; - - Type(final String serializeName) { - this.serializeName = serializeName; - } - - public String getSerializeName() { - return serializeName; - } - } - - Type value(); - -} diff --git a/src/main/java/com/arangodb/entity/arangosearch/AnalyzerEntity.java b/src/main/java/com/arangodb/entity/arangosearch/AnalyzerEntity.java deleted file mode 100644 index 5b5e5c019..000000000 --- a/src/main/java/com/arangodb/entity/arangosearch/AnalyzerEntity.java +++ /dev/null @@ -1,75 +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.entity.arangosearch; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * @author Michele Rastelli - * @deprecated use typed analyzers {@link com.arangodb.entity.arangosearch.analyzer} - */ -@Deprecated -public class AnalyzerEntity { - - private Collection features; - private AnalyzerType type; - private String name; - private Map properties; - - public AnalyzerEntity() { - } - - public Set getFeatures() { - return features != null ? new HashSet<>(features) : null; - } - - public void setFeatures(Set features) { - this.features = features; - } - - public AnalyzerType getType() { - return type; - } - - public void setType(AnalyzerType type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - -} diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java index a82374b31..8b094e709 100644 --- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java +++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java @@ -57,15 +57,6 @@ public StopwordsAnalyzerProperties() { private final List stopwords; private final boolean hex; - /** - * @return list of hex-encoded strings that describe the tokens to be discarded. - * @deprecated use {@link #getStopwordsAsHexList()} instead - */ - @Deprecated - public List getStopwords() { - return getStopwordsAsHexList(); - } - /** * @return list of verbatim strings that describe the tokens to be discarded. */ diff --git a/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java b/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java index cebbe794b..e73fa0fa0 100644 --- a/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java +++ b/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java @@ -22,7 +22,6 @@ import com.arangodb.*; import com.arangodb.entity.*; -import com.arangodb.entity.arangosearch.AnalyzerEntity; import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer; import com.arangodb.internal.cursor.ArangoCursorImpl; import com.arangodb.internal.net.HostHandle; @@ -416,54 +415,29 @@ public ViewEntity createArangoSearch(final String name, final ArangoSearchCreate return executor.execute(createArangoSearchRequest(name, options), ViewEntity.class); } - @Override - public AnalyzerEntity createAnalyzer(AnalyzerEntity options) throws ArangoDBException { - return executor.execute(createAnalyzerRequest(options), AnalyzerEntity.class); - } - @Override public SearchAnalyzer createSearchAnalyzer(SearchAnalyzer analyzer) throws ArangoDBException { return executor.execute(createAnalyzerRequest(analyzer), SearchAnalyzer.class); } - @Override - public AnalyzerEntity getAnalyzer(String name) throws ArangoDBException { - return executor.execute(getAnalyzerRequest(name), AnalyzerEntity.class); - } - @Override public SearchAnalyzer getSearchAnalyzer(String name) throws ArangoDBException { return executor.execute(getAnalyzerRequest(name), SearchAnalyzer.class); } - @Override - public Collection getAnalyzers() throws ArangoDBException { - return executor.execute(getAnalyzersRequest(), getAnalyzersResponseDeserializer()); - } - @Override public Collection getSearchAnalyzers() throws ArangoDBException { return executor.execute(getAnalyzersRequest(), getSearchAnalyzersResponseDeserializer()); } - @Override - public void deleteAnalyzer(String name) throws ArangoDBException { - executor.execute(deleteAnalyzerRequest(name, null), Void.class); - } - - @Override - public void deleteAnalyzer(String name, AnalyzerDeleteOptions options) throws ArangoDBException { - executor.execute(deleteAnalyzerRequest(name, options), Void.class); - } - @Override public void deleteSearchAnalyzer(String name) throws ArangoDBException { - deleteAnalyzer(name); + deleteSearchAnalyzer(name, null); } @Override public void deleteSearchAnalyzer(String name, AnalyzerDeleteOptions options) throws ArangoDBException { - deleteAnalyzer(name, options); + executor.execute(deleteAnalyzerRequest(name, options), Void.class); } } diff --git a/src/main/java/com/arangodb/internal/DocumentCache.java b/src/main/java/com/arangodb/internal/DocumentCache.java index e548be08f..63254a6be 100644 --- a/src/main/java/com/arangodb/internal/DocumentCache.java +++ b/src/main/java/com/arangodb/internal/DocumentCache.java @@ -94,9 +94,7 @@ private void findAnnotation( if (annotation != null && !field.isSynthetic() && !Modifier.isStatic(field.getModifiers()) && String.class.isAssignableFrom(field.getType())) { String value = null; - if (annotation instanceof DocumentField) { - value = ((DocumentField) annotation).value().getSerializeName(); - } else if (annotation instanceof Id) { + if (annotation instanceof Id) { value = DocumentFields.ID; } else if (annotation instanceof Key) { value = DocumentFields.KEY; diff --git a/src/main/java/com/arangodb/internal/InternalArangoDatabase.java b/src/main/java/com/arangodb/internal/InternalArangoDatabase.java index 71a3f0099..879f30987 100644 --- a/src/main/java/com/arangodb/internal/InternalArangoDatabase.java +++ b/src/main/java/com/arangodb/internal/InternalArangoDatabase.java @@ -22,7 +22,6 @@ import com.arangodb.DbName; import com.arangodb.entity.*; -import com.arangodb.entity.arangosearch.AnalyzerEntity; import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer; import com.arangodb.internal.ArangoExecutor.ResponseDeserializer; import com.arangodb.internal.util.ArangoSerializationFactory; @@ -432,14 +431,6 @@ protected Request getAnalyzersRequest() { return request(dbName, RequestType.GET, InternalArangoView.PATH_API_ANALYZER); } - protected ResponseDeserializer> getAnalyzersResponseDeserializer() { - return response -> { - final VPackSlice result = response.getBody().get(ArangoResponseField.RESULT); - return util().deserialize(result, new Type>() { - }.getType()); - }; - } - protected ResponseDeserializer> getSearchAnalyzersResponseDeserializer() { return response -> { final VPackSlice result = response.getBody().get(ArangoResponseField.RESULT); @@ -448,11 +439,6 @@ protected ResponseDeserializer> getSearchAnalyzersRes }; } - protected Request createAnalyzerRequest(final AnalyzerEntity options) { - return request(dbName, RequestType.POST, InternalArangoView.PATH_API_ANALYZER) - .setBody(util().serialize(options)); - } - protected Request createAnalyzerRequest(final SearchAnalyzer options) { return request(dbName, RequestType.POST, InternalArangoView.PATH_API_ANALYZER) .setBody(util().serialize(options)); diff --git a/src/main/java/com/arangodb/internal/cursor/AbstractArangoIterable.java b/src/main/java/com/arangodb/internal/cursor/AbstractArangoIterable.java index 93ede0a1b..958446e67 100644 --- a/src/main/java/com/arangodb/internal/cursor/AbstractArangoIterable.java +++ b/src/main/java/com/arangodb/internal/cursor/AbstractArangoIterable.java @@ -21,12 +21,7 @@ package com.arangodb.internal.cursor; import com.arangodb.ArangoIterable; -import com.arangodb.ArangoIterator; -import com.arangodb.Function; -import com.arangodb.Predicate; -import java.util.Collection; -import java.util.Iterator; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -40,73 +35,4 @@ public Stream stream() { return StreamSupport.stream(spliterator(), false); } - @Override - public ArangoIterable map(final Function mapper) { - return new ArangoMappingIterable<>(this, mapper); - } - - @Override - public ArangoIterable filter(final Predicate predicate) { - return new ArangoFilterIterable<>(this, predicate); - } - - @Override - public T first() { - final ArangoIterator iterator = iterator(); - return iterator.hasNext() ? iterator.next() : null; - } - - @Override - public long count() { - long count = 0L; - for (final Iterator iterator = iterator(); iterator.hasNext(); iterator.next()) { - count++; - } - return count; - } - - @Override - public boolean anyMatch(final Predicate predicate) { - boolean match = false; - for (final T t : this) { - if (predicate.test(t)) { - match = true; - break; - } - } - return match; - } - - @Override - public boolean allMatch(final Predicate predicate) { - boolean match = false; - for (final T t : this) { - match = predicate.test(t); - if (!match) { - break; - } - } - return match; - } - - @Override - public boolean noneMatch(final Predicate predicate) { - boolean match = false; - for (final T t : this) { - match = !predicate.test(t); - if (!match) { - break; - } - } - return match; - } - - @Override - public > R collectInto(final R target) { - for (final T t : this) { - target.add(t); - } - return target; - } - } diff --git a/src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java b/src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java index 228989657..1de76a083 100644 --- a/src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java +++ b/src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java @@ -22,7 +22,6 @@ import com.arangodb.ArangoCursor; import com.arangodb.ArangoIterator; -import com.arangodb.Consumer; import com.arangodb.entity.CursorEntity; import com.arangodb.entity.CursorEntity.Extras; import com.arangodb.entity.CursorEntity.Stats; @@ -130,11 +129,4 @@ public ArangoIterator iterator() { return iterator; } - @Override - public void foreach(final Consumer action) { - while (hasNext()) { - action.accept(next()); - } - } - } diff --git a/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterable.java b/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterable.java deleted file mode 100644 index bb0ff1054..000000000 --- a/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterable.java +++ /dev/null @@ -1,57 +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.cursor; - -import com.arangodb.ArangoIterable; -import com.arangodb.ArangoIterator; -import com.arangodb.Consumer; -import com.arangodb.Predicate; - -/** - * @author Mark Vollmary - */ -@Deprecated -public class ArangoFilterIterable extends AbstractArangoIterable implements ArangoIterable { - - private final ArangoIterable iterable; - private final Predicate predicate; - - protected ArangoFilterIterable(final ArangoIterable iterable, final Predicate predicate) { - super(); - this.iterable = iterable; - this.predicate = predicate; - } - - @Override - public ArangoIterator iterator() { - return new ArangoFilterIterator<>(iterable.iterator(), predicate); - } - - @Override - public void foreach(final Consumer action) { - for (final T t : iterable) { - if (predicate.test(t)) { - action.accept(t); - } - } - } - -} diff --git a/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterator.java b/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterator.java deleted file mode 100644 index 7c65f9d22..000000000 --- a/src/main/java/com/arangodb/internal/cursor/ArangoFilterIterator.java +++ /dev/null @@ -1,73 +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.cursor; - -import com.arangodb.ArangoIterator; -import com.arangodb.Predicate; - -import java.util.NoSuchElementException; - -/** - * @author Mark Vollmary - */ -public class ArangoFilterIterator implements ArangoIterator { - - private final ArangoIterator iterator; - private final Predicate predicate; - private T next; - - protected ArangoFilterIterator(final ArangoIterator iterator, final Predicate predicate) { - super(); - this.iterator = iterator; - this.predicate = predicate; - next = null; - } - - @Override - public boolean hasNext() { - if (next != null) { - return true; - } - while (iterator.hasNext()) { - next = iterator.next(); - if (predicate.test(next)) { - return true; - } - } - next = null; - return false; - } - - @Override - public T next() { - if (next == null && !hasNext()) { - throw new NoSuchElementException(); - } - final T tmp = next; - next = null; - return tmp; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } -} diff --git a/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterable.java b/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterable.java deleted file mode 100644 index c1b818c2b..000000000 --- a/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterable.java +++ /dev/null @@ -1,55 +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.cursor; - -import com.arangodb.ArangoIterable; -import com.arangodb.ArangoIterator; -import com.arangodb.Consumer; -import com.arangodb.Function; - -/** - * @author Mark Vollmary - */ -@Deprecated -public class ArangoMappingIterable extends AbstractArangoIterable implements ArangoIterable { - - private final ArangoIterable iterable; - private final Function mapper; - - protected ArangoMappingIterable(final ArangoIterable iterable, final Function mapper) { - super(); - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public ArangoIterator iterator() { - return new ArangoMappingIterator<>(iterable.iterator(), mapper); - } - - @Override - public void foreach(final Consumer action) { - for (final R t : iterable) { - action.accept(mapper.apply(t)); - } - } - -} diff --git a/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterator.java b/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterator.java deleted file mode 100644 index e3594a1cc..000000000 --- a/src/main/java/com/arangodb/internal/cursor/ArangoMappingIterator.java +++ /dev/null @@ -1,55 +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.cursor; - -import com.arangodb.ArangoIterator; -import com.arangodb.Function; - -/** - * @author Mark Vollmary - */ -public class ArangoMappingIterator implements ArangoIterator { - - private final ArangoIterator iterator; - private final Function mapper; - - public ArangoMappingIterator(final ArangoIterator iterator, final Function mapper) { - super(); - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public T next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - -} diff --git a/src/main/java/com/arangodb/internal/mapping/ArangoAnnotationIntrospector.java b/src/main/java/com/arangodb/internal/mapping/ArangoAnnotationIntrospector.java index 33dab6a91..6f80f1e01 100644 --- a/src/main/java/com/arangodb/internal/mapping/ArangoAnnotationIntrospector.java +++ b/src/main/java/com/arangodb/internal/mapping/ArangoAnnotationIntrospector.java @@ -21,7 +21,6 @@ package com.arangodb.internal.mapping; -import com.arangodb.entity.DocumentField; import com.arangodb.velocypack.annotations.Expose; import com.arangodb.velocypack.annotations.SerializedName; import com.fasterxml.jackson.annotation.JsonProperty; @@ -116,11 +115,6 @@ private PropertyName findPropertyName(Annotated a) { return null; } - final DocumentField documentField = a.getAnnotation(DocumentField.class); - if (documentField != null) { - return PropertyName.construct(documentField.value().getSerializeName()); - } - final SerializedName serializedName = a.getAnnotation(SerializedName.class); if (serializedName != null) { return PropertyName.construct(serializedName.value()); diff --git a/src/main/java/com/arangodb/internal/velocypack/VPackDriverModule.java b/src/main/java/com/arangodb/internal/velocypack/VPackDriverModule.java index 46a18784b..ca86c5946 100644 --- a/src/main/java/com/arangodb/internal/velocypack/VPackDriverModule.java +++ b/src/main/java/com/arangodb/internal/velocypack/VPackDriverModule.java @@ -51,9 +51,7 @@ public class VPackDriverModule implements VPackModule, VPackParserModule { public > void setup(final C context) { context.fieldNamingStrategy(field -> { for (Annotation annotation : field.getAnnotations()) { - if(annotation instanceof DocumentField) { - return ((DocumentField) annotation).value().getSerializeName(); - } else if (annotation instanceof Id) { + if (annotation instanceof Id) { return DocumentFields.ID; } else if (annotation instanceof Key) { return DocumentFields.KEY; diff --git a/src/main/java/com/arangodb/model/CollectionCreateOptions.java b/src/main/java/com/arangodb/model/CollectionCreateOptions.java index 4e69ea8f9..e4c425aa0 100644 --- a/src/main/java/com/arangodb/model/CollectionCreateOptions.java +++ b/src/main/java/com/arangodb/model/CollectionCreateOptions.java @@ -271,14 +271,4 @@ public CollectionCreateOptions schema(final CollectionSchema schema) { return this; } - /** - * @since ArangoDB 3.7 - * @deprecated Use {@link #schema(CollectionSchema)} instead. - */ - @Deprecated - public CollectionCreateOptions setSchema(final CollectionSchema schema) { - this.schema = schema; - return this; - } - } diff --git a/src/main/java/com/arangodb/model/DBCreateOptions.java b/src/main/java/com/arangodb/model/DBCreateOptions.java index 23708bb18..1c9d6ed07 100644 --- a/src/main/java/com/arangodb/model/DBCreateOptions.java +++ b/src/main/java/com/arangodb/model/DBCreateOptions.java @@ -58,16 +58,6 @@ public String getName() { return name; } - /** - * @param name Has to contain a valid database name - * @return options - * @deprecated Use {@link #name(DbName)} instead. - */ - @Deprecated - public DBCreateOptions name(final String name) { - return name(DbName.of(name)); - } - /** * @param dbName database name * @return options diff --git a/src/main/java/com/arangodb/velocystream/Request.java b/src/main/java/com/arangodb/velocystream/Request.java index c57e22a81..cfa9eead7 100644 --- a/src/main/java/com/arangodb/velocystream/Request.java +++ b/src/main/java/com/arangodb/velocystream/Request.java @@ -42,14 +42,6 @@ public class Request { @Expose(serialize = false) private VPackSlice body; - /** - * @deprecated Use {@link #Request(DbName, RequestType, String)} instead - */ - @Deprecated - public Request(final String database, final RequestType requestType, final String path) { - this(DbName.of(database), requestType, path); - } - public Request(final DbName dbName, final RequestType requestType, final String path) { super(); this.dbName = dbName; @@ -78,14 +70,6 @@ public Request setType(final int type) { return this; } - /** - * @deprecated Use {@link #getDbName()} instead - */ - @Deprecated - public String getDatabase() { - return getDbName().get(); - } - public DbName getDbName() { return dbName; } diff --git a/src/test/java/com/arangodb/ArangoCursorTest.java b/src/test/java/com/arangodb/ArangoCursorTest.java index 2872451bf..41d9d5d99 100644 --- a/src/test/java/com/arangodb/ArangoCursorTest.java +++ b/src/test/java/com/arangodb/ArangoCursorTest.java @@ -43,22 +43,12 @@ static void init() { initDB(); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void first(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final VPackSlice first = cursor.first(); - assertThat(first).isNotNull(); - assertThat(first.isInteger()).isTrue(); - assertThat(first.getAsLong()).isZero(); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void firstStream(ArangoDatabase db) { final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); final Optional first = cursor.stream().findFirst(); - assertThat(first.isPresent()).isTrue(); + assertThat(first).isPresent(); assertThat(first.get().isInteger()).isTrue(); assertThat(first.get().getAsLong()).isZero(); } @@ -66,21 +56,10 @@ void firstStream(ArangoDatabase db) { @ParameterizedTest(name = "{index}") @MethodSource("dbs") void next(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", new AqlQueryOptions().batchSize(5), VPackSlice.class); - while (cursor.hasNext()) { cursor.next(); } - - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterCount(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final long count = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).count(); - assertThat(count).isEqualTo(50L); } @ParameterizedTest(name = "{index}") @@ -91,71 +70,14 @@ void mapFilterCountStream(ArangoDatabase db) { assertThat(count).isEqualTo(50L); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapMapFilterCount(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final long count = cursor.map(VPackSlice::getAsLong).map(t -> t * 10).filter(t -> t < 500).count(); - assertThat(count).isEqualTo(50L); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapMapFilterFilterCount(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final long count = cursor.map(VPackSlice::getAsLong).map(t -> t * 10).filter(t -> t < 500).filter(t -> t < 250).count(); - assertThat(count).isEqualTo(25L); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterNext(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final long count = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).iterator().next(); - assertThat(count).isZero(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterFirst(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final long count = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).first(); - assertThat(count).isZero(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterCollectIntoList(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final List target = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).collectInto(new ArrayList<>()); - assertThat(target).isNotNull(); - assertThat(target).hasSize(50); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterCollectIntoSet(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final Set target = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).collectInto(new HashSet<>()); - assertThat(target).isNotNull(); - assertThat(target).hasSize(50); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void mapFilterCollectIntoSetStream(ArangoDatabase db) { final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); final Set target = cursor.stream().map(VPackSlice::getAsLong).filter(t -> t < 50).collect(Collectors.toSet()); - assertThat(target).isNotNull(); - assertThat(target).hasSize(50); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void foreach(ArangoDatabase db) { - final AtomicLong i = new AtomicLong(0L); - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - cursor.foreach(t -> assertThat(t.getAsLong()).isEqualTo(i.getAndIncrement())); + assertThat(target) + .isNotNull() + .hasSize(50); } @ParameterizedTest(name = "{index}") @@ -166,14 +88,6 @@ void forEach(ArangoDatabase db) { cursor.forEach(t -> assertThat(t.getAsLong()).isEqualTo(i.getAndIncrement())); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapForeach(ArangoDatabase db) { - final AtomicLong i = new AtomicLong(0L); - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - cursor.map(VPackSlice::getAsLong).foreach(t -> assertThat(t).isEqualTo(i.getAndIncrement())); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void mapForeachStream(ArangoDatabase db) { @@ -182,14 +96,6 @@ void mapForeachStream(ArangoDatabase db) { cursor.stream().map(VPackSlice::getAsLong).forEach(t -> assertThat(t).isEqualTo(i.getAndIncrement())); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterForeach(ArangoDatabase db) { - final AtomicLong i = new AtomicLong(0L); - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).foreach(t -> assertThat(t).isEqualTo(i.getAndIncrement())); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void mapFilterForEachStream(ArangoDatabase db) { @@ -198,14 +104,6 @@ void mapFilterForEachStream(ArangoDatabase db) { cursor.stream().map(VPackSlice::getAsLong).filter(t -> t < 50).forEach(t -> assertThat(t).isEqualTo(i.getAndIncrement())); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void anyMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.anyMatch(t -> t.getAsLong() == 50L); - assertThat(match).isTrue(); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void anyMatchStream(ArangoDatabase db) { @@ -214,30 +112,6 @@ void anyMatchStream(ArangoDatabase db) { assertThat(match).isTrue(); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapAnyMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).anyMatch(t -> t == 50L); - assertThat(match).isTrue(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterAnyMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).anyMatch(t -> t == 25L); - assertThat(match).isTrue(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void noneMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.noneMatch(t -> t.getAsLong() == 100L); - assertThat(match).isTrue(); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void noneMatchStream(ArangoDatabase db) { @@ -246,30 +120,6 @@ void noneMatchStream(ArangoDatabase db) { assertThat(match).isTrue(); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapNoneMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).noneMatch(t -> t == 100L); - assertThat(match).isTrue(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterNoneMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).noneMatch(t -> t == 50L); - assertThat(match).isTrue(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void allMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.allMatch(t -> t.getAsLong() < 100L); - assertThat(match).isTrue(); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void allMatchStream(ArangoDatabase db) { @@ -278,19 +128,4 @@ void allMatchStream(ArangoDatabase db) { assertThat(match).isTrue(); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapAllMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).allMatch(t -> t < 100); - assertThat(match).isTrue(); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void mapFilterAllMatch(ArangoDatabase db) { - final ArangoCursor cursor = db.query("FOR i IN 0..99 RETURN i", VPackSlice.class); - final boolean match = cursor.map(VPackSlice::getAsLong).filter(t -> t < 50).allMatch(t -> t < 50); - assertThat(match).isTrue(); - } } diff --git a/src/test/java/com/arangodb/ArangoSearchTest.java b/src/test/java/com/arangodb/ArangoSearchTest.java index 173c0a47e..cfbf8a477 100644 --- a/src/test/java/com/arangodb/ArangoSearchTest.java +++ b/src/test/java/com/arangodb/ArangoSearchTest.java @@ -253,45 +253,6 @@ void replaceProperties(ArangoDatabase db) { assertThat(link.getFields().iterator().next().getName()).isEqualTo("value"); } - private void createGetAndDeleteAnalyzer(ArangoDatabase db, AnalyzerEntity options) { - - String fullyQualifiedName = db.dbName().get() + "::" + options.getName(); - - // createAnalyzer - AnalyzerEntity createdAnalyzer = db.createAnalyzer(options); - - assertThat(createdAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(createdAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(createdAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(createdAnalyzer.getProperties(), options.getProperties()); - - // getAnalyzer - AnalyzerEntity gotAnalyzer = db.getAnalyzer(options.getName()); - assertThat(gotAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(gotAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(gotAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(gotAnalyzer.getProperties(), options.getProperties()); - - // getAnalyzers - @SuppressWarnings("OptionalGetWithoutIsPresent") - AnalyzerEntity foundAnalyzer = db.getAnalyzers().stream().filter(it -> it.getName().equals(fullyQualifiedName)) - .findFirst().get(); - - assertThat(foundAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(foundAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(foundAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(foundAnalyzer.getProperties(), options.getProperties()); - - AnalyzerDeleteOptions deleteOptions = new AnalyzerDeleteOptions(); - deleteOptions.setForce(true); - - // deleteAnalyzer - db.deleteAnalyzer(options.getName(), deleteOptions); - - Throwable thrown = catchThrowable(() -> db.getAnalyzer(options.getName())); - assertThat(thrown).isInstanceOf(ArangoDBException.class); - } - private void createGetAndDeleteTypedAnalyzer(ArangoDatabase db, SearchAnalyzer analyzer) { String fullyQualifiedName = db.dbName().get() + "::" + analyzer.getName(); @@ -317,7 +278,7 @@ private void createGetAndDeleteTypedAnalyzer(ArangoDatabase db, SearchAnalyzer a db.deleteSearchAnalyzer(analyzer.getName(), deleteOptions); - Throwable thrown = catchThrowable(() -> db.getAnalyzer(analyzer.getName())); + Throwable thrown = catchThrowable(() -> db.getSearchAnalyzer(analyzer.getName())); assertThat(thrown).isInstanceOf(ArangoDBException.class); ArangoDBException e = (ArangoDBException) thrown; assertThat(e.getResponseCode()).isEqualTo(404); @@ -325,42 +286,6 @@ private void createGetAndDeleteTypedAnalyzer(ArangoDatabase db, SearchAnalyzer a } @SuppressWarnings("unchecked") - private void compareProperties(Map actualProperties, Map expectedProperties) { - expectedProperties.forEach((key, expectedValue) -> { - Object actualValue = actualProperties.get(key); - if (expectedValue instanceof Map) { - assertThat(actualValue).isNotNull(); - assertThat(actualValue).isInstanceOf(Map.class); - compareProperties((Map) actualValue, (Map) expectedValue); - } else if (expectedValue instanceof Number) { - assertThat(Double.valueOf(actualValue.toString())).isEqualTo(Double.valueOf(expectedValue.toString())); - } else { - assertThat(actualValue).isEqualTo(expectedValue); - } - }); - } - - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void identityAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.identity); - options.setProperties(Collections.emptyMap()); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void identityAnalyzerTyped(ArangoDatabase db) { @@ -380,27 +305,6 @@ void identityAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, analyzer); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void delimiterAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.delimiter); - options.setProperties(Collections.singletonMap("delimiter", "-")); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void delimiterAnalyzerTyped(ArangoDatabase db) { @@ -424,27 +328,6 @@ void delimiterAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, analyzer); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void stemAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.stem); - options.setProperties(Collections.singletonMap("locale", "ru")); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void stemAnalyzerTyped(ArangoDatabase db) { @@ -468,32 +351,6 @@ void stemAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, options); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void normAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("locale", "ru"); - properties.put("case", "lower"); - properties.put("accent", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.norm); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void normAnalyzerTyped(ArangoDatabase db) { @@ -519,32 +376,6 @@ void normAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, options); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void ngramAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("max", 6L); - properties.put("min", 3L); - properties.put("preserveOriginal", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.ngram); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void ngramAnalyzerTyped(ArangoDatabase db) { @@ -571,35 +402,6 @@ void ngramAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, analyzer); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void enhancedNgramAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 6)); - - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("max", 6L); - properties.put("min", 3L); - properties.put("preserveOriginal", true); - properties.put("startMarker", "^"); - properties.put("endMarker", "^"); - properties.put("streamType", "utf8"); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.ngram); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void enhancedNgramAnalyzerTyped(ArangoDatabase db) { @@ -628,34 +430,6 @@ void enhancedNgramAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, analyzer); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void textAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + rnd(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("locale", "ru"); - properties.put("case", "lower"); - properties.put("stopwords", Collections.emptyList()); - properties.put("accent", true); - properties.put("stemming", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.text); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void textAnalyzerTyped(ArangoDatabase db) { @@ -683,40 +457,6 @@ void textAnalyzerTyped(ArangoDatabase db) { createGetAndDeleteTypedAnalyzer(db, analyzer); } - @ParameterizedTest(name = "{index}") - @MethodSource("dbs") - void enhancedTextAnalyzer(ArangoDatabase db) { - assumeTrue(isAtLeastVersion(3, 6)); - - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map edgeNgram = new HashMap<>(); - edgeNgram.put("min", 2L); - edgeNgram.put("max", 100000L); - edgeNgram.put("preserveOriginal", true); - - Map properties = new HashMap<>(); - properties.put("locale", "ru"); - properties.put("case", "lower"); - properties.put("stopwords", Collections.emptyList()); - properties.put("accent", true); - properties.put("stemming", true); - properties.put("edgeNgram", edgeNgram); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.text); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(db, options); - } - @ParameterizedTest(name = "{index}") @MethodSource("dbs") void enhancedTextAnalyzerTyped(ArangoDatabase db) { diff --git a/src/test/java/com/arangodb/async/ArangoSearchTest.java b/src/test/java/com/arangodb/async/ArangoSearchTest.java index 47c183b54..5cf5aedfe 100644 --- a/src/test/java/com/arangodb/async/ArangoSearchTest.java +++ b/src/test/java/com/arangodb/async/ArangoSearchTest.java @@ -251,7 +251,7 @@ private void createGetAndDeleteTypedAnalyzer(SearchAnalyzer analyzer) throws Exe db.deleteSearchAnalyzer(analyzer.getName(), deleteOptions).get(); try { - db.getAnalyzer(analyzer.getName()).get(); + db.getSearchAnalyzer(analyzer.getName()).get(); fail("deleted analyzer should not be found!"); } catch (ExecutionException e) { assertThat(e.getCause()).isInstanceOf(ArangoDBException.class); @@ -261,84 +261,6 @@ private void createGetAndDeleteTypedAnalyzer(SearchAnalyzer analyzer) throws Exe } - private void createGetAndDeleteAnalyzer(AnalyzerEntity options) throws ExecutionException, InterruptedException { - - String fullyQualifiedName = db.dbName().get() + "::" + options.getName(); - - // createAnalyzer - AnalyzerEntity createdAnalyzer = db.createAnalyzer(options).get(); - - assertThat(createdAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(createdAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(createdAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(createdAnalyzer.getProperties(), options.getProperties()); - - // getAnalyzer - AnalyzerEntity gotAnalyzer = db.getAnalyzer(options.getName()).get(); - assertThat(gotAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(gotAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(gotAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(gotAnalyzer.getProperties(), options.getProperties()); - - // getAnalyzers - @SuppressWarnings("OptionalGetWithoutIsPresent") - AnalyzerEntity foundAnalyzer = db.getAnalyzers().get().stream().filter(it -> it.getName().equals(fullyQualifiedName)) - .findFirst().get(); - - assertThat(foundAnalyzer.getName()).isEqualTo(fullyQualifiedName); - assertThat(foundAnalyzer.getType()).isEqualTo(options.getType()); - assertThat(foundAnalyzer.getFeatures()).isEqualTo(options.getFeatures()); - compareProperties(foundAnalyzer.getProperties(), options.getProperties()); - - AnalyzerDeleteOptions deleteOptions = new AnalyzerDeleteOptions(); - deleteOptions.setForce(true); - - // deleteAnalyzer - db.deleteAnalyzer(options.getName(), deleteOptions).get(); - - try { - db.getAnalyzer(options.getName()).get(); - fail(); - } catch (ExecutionException e) { - assertThat(e.getCause()).isInstanceOf(ArangoDBException.class); - assertThat(((ArangoDBException) e.getCause()).getResponseCode()).isEqualTo(404); - } - } - - private void compareProperties(Map actualProperties, Map expectedProperties) { - expectedProperties.forEach((key, expectedValue) -> { - Object actualValue = actualProperties.get(key); - if (expectedValue instanceof Map) { - assertThat(actualValue).isNotNull(); - assertThat(actualValue).isInstanceOf(Map.class); - compareProperties((Map) actualValue, (Map) expectedValue); - } else if (expectedValue instanceof Number) { - assertThat(Double.valueOf(actualValue.toString())).isEqualTo(Double.valueOf(expectedValue.toString())); - } else { - assertThat(actualValue).isEqualTo(expectedValue); - } - }); - } - - @Test - void identityAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.identity); - options.setProperties(Collections.emptyMap()); - - createGetAndDeleteAnalyzer(options); - } - @Test void identityAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); @@ -357,25 +279,6 @@ void identityAnalyzerTyped() throws ExecutionException, InterruptedException { createGetAndDeleteTypedAnalyzer(analyzer); } - @Test - void delimiterAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.delimiter); - options.setProperties(Collections.singletonMap("delimiter", "-")); - - createGetAndDeleteAnalyzer(options); - } - @Test void delimiterAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); @@ -398,25 +301,6 @@ void delimiterAnalyzerTyped() throws ExecutionException, InterruptedException { createGetAndDeleteTypedAnalyzer(analyzer); } - @Test - void stemAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.stem); - options.setProperties(Collections.singletonMap("locale", "ru")); - - createGetAndDeleteAnalyzer(options); - } - @Test void stemAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); @@ -439,30 +323,6 @@ void stemAnalyzerTyped() throws ExecutionException, InterruptedException { createGetAndDeleteTypedAnalyzer(options); } - @Test - void normAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("locale", "ru"); - properties.put("case", "lower"); - properties.put("accent", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.norm); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(options); - } - @Test void normAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); @@ -487,31 +347,6 @@ void normAnalyzerTyped() throws ExecutionException, InterruptedException { createGetAndDeleteTypedAnalyzer(options); } - @Test - void ngramAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("max", 6L); - properties.put("min", 3L); - properties.put("preserveOriginal", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.ngram); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(options); - } - @Test void ngramAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); @@ -537,33 +372,6 @@ void ngramAnalyzerTyped() throws ExecutionException, InterruptedException { createGetAndDeleteTypedAnalyzer(analyzer); } - @Test - void textAnalyzer() throws ExecutionException, InterruptedException { - assumeTrue(isAtLeastVersion(3, 5)); - - String name = "test-" + UUID.randomUUID(); - - Set features = new HashSet<>(); - features.add(AnalyzerFeature.frequency); - features.add(AnalyzerFeature.norm); - features.add(AnalyzerFeature.position); - - Map properties = new HashMap<>(); - properties.put("locale", "ru"); - properties.put("case", "lower"); - properties.put("stopwords", Collections.emptyList()); - properties.put("accent", true); - properties.put("stemming", true); - - AnalyzerEntity options = new AnalyzerEntity(); - options.setFeatures(features); - options.setName(name); - options.setType(AnalyzerType.text); - options.setProperties(properties); - - createGetAndDeleteAnalyzer(options); - } - @Test void textAnalyzerTyped() throws ExecutionException, InterruptedException { assumeTrue(isAtLeastVersion(3, 5)); diff --git a/src/test/java/com/arangodb/example/ExampleBase.java b/src/test/java/com/arangodb/example/ExampleBase.java index c378c789c..b4bd582e6 100644 --- a/src/test/java/com/arangodb/example/ExampleBase.java +++ b/src/test/java/com/arangodb/example/ExampleBase.java @@ -23,6 +23,7 @@ import com.arangodb.ArangoCollection; import com.arangodb.ArangoDB; import com.arangodb.ArangoDatabase; +import com.arangodb.DbName; import com.arangodb.mapping.ArangoJack; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -42,10 +43,11 @@ public class ExampleBase { @BeforeAll static void setUp() { arangoDB = new ArangoDB.Builder().serializer(new ArangoJack()).build(); - if (arangoDB.db(DB_NAME).exists()) - arangoDB.db(DB_NAME).drop(); - arangoDB.createDatabase(DB_NAME); - db = arangoDB.db(DB_NAME); + DbName dbName = DbName.of(DB_NAME); + if (arangoDB.db(dbName).exists()) + arangoDB.db(dbName).drop(); + arangoDB.createDatabase(dbName); + db = arangoDB.db(dbName); db.createCollection(COLLECTION_NAME); collection = db.collection(COLLECTION_NAME); } diff --git a/src/test/java/com/arangodb/example/FirstProject.java b/src/test/java/com/arangodb/example/FirstProject.java index db14e3741..63bcf034e 100644 --- a/src/test/java/com/arangodb/example/FirstProject.java +++ b/src/test/java/com/arangodb/example/FirstProject.java @@ -1,9 +1,6 @@ package com.arangodb.example; -import com.arangodb.ArangoCollection; -import com.arangodb.ArangoCursor; -import com.arangodb.ArangoDB; -import com.arangodb.ArangoDBException; +import com.arangodb.*; import com.arangodb.entity.BaseDocument; import com.arangodb.entity.CollectionEntity; import com.arangodb.mapping.ArangoJack; @@ -18,7 +15,7 @@ public static void main(final String[] args) { final ArangoDB arangoDB = new ArangoDB.Builder().user("root").serializer(new ArangoJack()).build(); // create database - final String dbName = "mydb"; + final DbName dbName = DbName.of("mydb"); try { arangoDB.createDatabase(dbName); System.out.println("Database created: " + dbName); diff --git a/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java b/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java index 63c1b87ae..0aa1ace84 100644 --- a/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java +++ b/src/test/java/com/arangodb/mapping/annotations/ArangoAnnotationsTest.java @@ -36,30 +36,6 @@ class ArangoAnnotationsTest { private final ArangoJack mapper = new ArangoJack(); - @Test - void documentField() { - DocumentFieldEntity e = new DocumentFieldEntity(); - e.setId("Id"); - e.setKey("Key"); - e.setRev("Rev"); - e.setFrom("From"); - e.setTo("To"); - - VPackSlice slice = mapper.serialize(e); - System.out.println(slice); - Map deserialized = mapper.deserialize(slice, Object.class); - assertThat(deserialized) - .containsEntry("_id", e.getId()) - .containsEntry("_key", e.getKey()) - .containsEntry("_rev", e.getRev()) - .containsEntry("_from", e.getFrom()) - .containsEntry("_to", e.getTo()) - .hasSize(5); - - DocumentFieldEntity deserializedEntity = mapper.deserialize(slice, DocumentFieldEntity.class); - assertThat(deserializedEntity).isEqualTo(e); - } - @Test void documentFieldAnnotations() { AnnotatedEntity e = new AnnotatedEntity(); diff --git a/src/test/java/com/arangodb/mapping/annotations/DocumentFieldEntity.java b/src/test/java/com/arangodb/mapping/annotations/DocumentFieldEntity.java deleted file mode 100644 index 20241673f..000000000 --- a/src/test/java/com/arangodb/mapping/annotations/DocumentFieldEntity.java +++ /dev/null @@ -1,112 +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.mapping.annotations; - -import com.arangodb.entity.DocumentField; - -import java.util.Objects; - -/** - * @author Michele Rastelli - */ -public class DocumentFieldEntity { - - @DocumentField(DocumentField.Type.ID) - private String id; - - @DocumentField(DocumentField.Type.KEY) - private String key; - - @DocumentField(DocumentField.Type.REV) - private String rev; - - @DocumentField(DocumentField.Type.FROM) - private String from; - - @DocumentField(DocumentField.Type.TO) - private String to; - - public DocumentFieldEntity() { - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getRev() { - return rev; - } - - public void setRev(String rev) { - this.rev = rev; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getTo() { - return to; - } - - public void setTo(String to) { - this.to = to; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - DocumentFieldEntity that = (DocumentFieldEntity) o; - return Objects.equals(id, that.id) && Objects.equals(key, that.key) && Objects.equals(rev, that.rev) && Objects - .equals(from, that.from) && Objects.equals(to, that.to); - } - - @Override - public int hashCode() { - return Objects.hash(id, key, rev, from, to); - } - - @Override - public String toString() { - return "AnnotatedEntity{" + "idField='" + id + '\'' + ", keyField='" + key + '\'' + ", revField='" + rev + '\'' - + ", fromField='" + from + '\'' + ", toField='" + to + '\'' + '}'; - } - -}