diff --git a/CHANGELOG.md b/CHANGELOG.md index ae32068d..4c783386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,101 +3,134 @@ ## [Unreleased] ### API changes + - Add "mode" option for crud select operation ([#107](https://github.com/tarantool/cartridge-java/issues/107)) +- Change using of proxy client parameters (mode, rollback_on_error, stop_on_error) with enum classes([#419](https://github.com/tarantool/cartridge-java/issues/419)) ### Bugfixes + - Fix Instant converter to parse 8 bytes datetime ([#408](https://github.com/tarantool/cartridge-java/issues/408)) ## [0.12.1] - 2023-08-04 ### Bugfixes -- Fix losing address connections in discovery if restart happens faster than discovery task ([#404](https://github.com/tarantool/cartridge-java/issues/404)) + +- Fix losing address connections in discovery if restart happens faster than discovery + task ([#404](https://github.com/tarantool/cartridge-java/issues/404)) - Add toString in tarantool proxy entities ([#406](https://github.com/tarantool/cartridge-java/issues/406)) ## [0.12.0] - 2023-06-09 ### Internal and API changes + - **[breaking change]** Split `call*` client API methods into calls with Tuple result as a return type -and calls with generic Object as a return type ([#123](https://github.com/tarantool/cartridge-springdata/issues/123)) + and calls with generic Object as a return type ([#123](https://github.com/tarantool/cartridge-springdata/issues/123)) - Add buildSingleValueResultMapper() in mapper builder for generic call result mappers. -That will simplify the support for auto object converter in SpringData module. + That will simplify the support for auto object converter in SpringData module. ### Bugfixes + - Support both string and integer values in index fields metadata ## [0.11.2] - 2023-05-04 ### Bugfixes + - Fix lack of closing when greeting fails ([#379](https://github.com/tarantool/cartridge-java/pull/379)) - Get rid of double executor in retrying ([#382](https://github.com/tarantool/cartridge-java/pull/382)) ## [0.11.1] - 2023-04-24 ### Bugfixes + - Fix hasMetadata logic ## [0.11.0] - 2023-04-12 ### Internal and API changes + - Remove config request timeout as default parameter in crud client - Add hasMetadata in TarantoolTuple - Add "can convert value" check to TupleResultConverter - Support Datetime type ([#214](https://github.com/tarantool/cartridge-java/pull/214)) ### Bugfixes -- Add details for the case of space metadata fetching failure ([#200](https://github.com/tarantool/cartridge-java/issues/200)) + +- Add details for the case of space metadata fetching + failure ([#200](https://github.com/tarantool/cartridge-java/issues/200)) - Close public access to TarantoolResult*Impl ([#326](https://github.com/tarantool/cartridge-java/issues/326)) -- Add deep copy instead of shallow copy in default message pack mapper ([#166](https://github.com/tarantool/cartridge-java/issues/166)) +- Add deep copy instead of shallow copy in default message pack + mapper ([#166](https://github.com/tarantool/cartridge-java/issues/166)) ### Refactor + - Split retrying into more detailed modules ([#341](https://github.com/tarantool/cartridge-java/issues/341)) ### Features + - Add a factory builder for constructing mapper hierarchies ## [0.10.1] - 2023-01-13 ### Internal and API changes -- Add ability to pass retrying executor in client builder ([#339](https://github.com/tarantool/cartridge-java/issues/339)) + +- Add ability to pass retrying executor in client + builder ([#339](https://github.com/tarantool/cartridge-java/issues/339)) - Do not use sync calls instead of async in retrying ([#299](https://github.com/tarantool/cartridge-java/pull/299)) ## [0.10.0] - 2022-12-29 ### Features -- Add `fields` option to ProxySpace for controlling the result tuple fields ([#236](https://github.com/tarantool/cartridge-java/pull/236)) + +- Add `fields` option to ProxySpace for controlling the result tuple + fields ([#236](https://github.com/tarantool/cartridge-java/pull/236)) - Parse metadata from crud response ([#272](https://github.com/tarantool/cartridge-java/pull/272)) ### Bugfixes + - Add parsing of the batch operation errors ([#334](https://github.com/tarantool/cartridge-java/issues/334)) ### Internal and API changes + - Move metadata parsing to separate converters ([#325](https://github.com/tarantool/cartridge-java/pull/325)) - Add simple to use TarantoolTupleResultMapper factory ([#321](https://github.com/tarantool/cartridge-java/pull/321)) - Use netty part dependencies instead of netty-all ([#295](https://github.com/tarantool/cartridge-java/issues/295)) - Refactor mappers and split `TarantoolResultConverter` ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `TarantoolResultConverter` was removed, use `DefaultArrayValueToTarantoolResultConverter` or `DefaultMapValueToTarantoolTupleResultConverter` instead ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `ConverterWrapper` was moved to converters package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `*MapperFactory` classes were moved to separate package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `TarantoolTupleMultiResult` was renamed to `MultiValueTarantoolTupleResult` ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `TarantoolTupleSingleResult` was renamed to `SingleValueTarantoolTupleResult` ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `*MapperFactory` methods were renamed ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** `*DefaultConverter` converters moved into `mappers.converters.value.defaults` package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) -- **[breaking change]** All converters from `mappers.converters.value.custom` moved into `mappers.converters.value` package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `TarantoolResultConverter` was removed, use `DefaultArrayValueToTarantoolResultConverter` + or `DefaultMapValueToTarantoolTupleResultConverter` + instead ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `ConverterWrapper` was moved to converters + package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `*MapperFactory` classes were moved to separate + package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `TarantoolTupleMultiResult` was renamed + to `MultiValueTarantoolTupleResult` ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `TarantoolTupleSingleResult` was renamed + to `SingleValueTarantoolTupleResult` ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `*MapperFactory` methods were + renamed ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** `*DefaultConverter` converters moved into `mappers.converters.value.defaults` + package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) +- **[breaking change]** All converters from `mappers.converters.value.custom` moved into `mappers.converters.value` + package ([#301](https://github.com/tarantool/cartridge-java/pull/301)) - Return back the `jmh-generator-annprocess` dependency ## [0.9.2] - 2022-11-15 ### Features + - Adding default mapper for long arrays ([#290](https://github.com/tarantool/cartridge-java/pull/290)) ### Internal and API changes + - Add dependency management ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump testcontainers-java-tarantool to 0.5.3 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump slf4j-api to 2.0.3 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump jackson-databind to 2.14.0 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump jackson-annotations to 2.14.0 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump org.testcontainers:junit-jupiter to 1.17.4 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) -- Add junit class ordering according the order before junit-jupiter 5.8.0 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) +- Add junit class ordering according the order before junit-jupiter + 5.8.0 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Bump logback-classic to 1.3.4 ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Remove org.junit.jupiter:junit-jupiter ([#296](https://github.com/tarantool/cartridge-java/pull/296)) - Remove jmh-generator-annprocess ([#296](https://github.com/tarantool/cartridge-java/pull/296)) @@ -105,97 +138,117 @@ That will simplify the support for auto object converter in SpringData module. ## [0.9.1] - 2022-10-13 ### Features + - Enable Short to Integer converters ([#282](https://github.com/tarantool/cartridge-java/issues/282)) ### Internal and API changes + - Changed TarantoolNullField class to singleton ([#195](https://github.com/tarantool/cartridge-java/pull/275)) - Bump netty to 4.1.78 ([#280](https://github.com/tarantool/cartridge-java/issues/280)) ### Security + - Bump jackson-databind to 2.14.1-rc1 ([#284](https://github.com/tarantool/cartridge-java/pull/284)) ## [0.9.0] - 2022-10-03 ### Features + - Added options parameter to Tarantool Space API ([#266](https://github.com/tarantool/cartridge-java/pull/266)) - Added bucket id parameter to Tarantool Space API ([#270](https://github.com/tarantool/cartridge-java/pull/270)) -- Added support for insert_many and replace_many CRUD operations ([#259](https://github.com/tarantool/cartridge-java/issues/259)) +- Added support for insert_many and replace_many CRUD + operations ([#259](https://github.com/tarantool/cartridge-java/issues/259)) ## [0.8.2] - 2022-09-16 ### Features -- Added client EventLoopThreadsNumber property for control netty work threads ([#253](https://github.com/tarantool/cartridge-java/pull/253)) + +- Added client EventLoopThreadsNumber property for control netty work + threads ([#253](https://github.com/tarantool/cartridge-java/pull/253)) ### Misc + - Removed code duplication in *ProxyOperations builders ([#256](https://github.com/tarantool/cartridge-java/issues/256)) -- Refactor CRUDOperationOptions to a hierarchy of classes ([#258](https://github.com/tarantool/cartridge-java/issues/258)) +- Refactor CRUDOperationOptions to a hierarchy of + classes ([#258](https://github.com/tarantool/cartridge-java/issues/258)) ## [0.8.1] - 2022-08-18 ### Features + - Added StringValueToByteArray converter ([#230](https://github.com/tarantool/cartridge-java/issues/230)) - Added IPROTO constants to align code more with Tarantool ## [0.8.0] - 2022-05-20 ### Features -- **[breaking change]** Use ValueType for registering ValueConverters ([#213](https://github.com/tarantool/cartridge-java/issues/213)) -- Removed reflection in value converters search for performance ([#178](https://github.com/tarantool/cartridge-java/issues/178)) -- Added objects converters for ArrayList and HashMap for increasing performance ([#207](https://github.com/tarantool/cartridge-java/issues/207)) + +- **[breaking change]** Use ValueType for registering + ValueConverters ([#213](https://github.com/tarantool/cartridge-java/issues/213)) +- Removed reflection in value converters search for + performance ([#178](https://github.com/tarantool/cartridge-java/issues/178)) +- Added objects converters for ArrayList and HashMap for increasing + performance ([#207](https://github.com/tarantool/cartridge-java/issues/207)) - Fixed converting performance with targetType ([#212](https://github.com/tarantool/cartridge-java/issues/212)) - Added microbenchmark tests - Added support for SSl/TLS ([#180](https://github.com/tarantool/cartridge-java/issues/180)) - Added support for IPv6 ([#199](https://github.com/tarantool/cartridge-java/issues/199)) ### Bugfixes + - Fixed TarantoolClientConfig.Builder - Fixed incorrect fieldNumber in the index metadata ([#203](https://github.com/tarantool/cartridge-java/issues/203)) ## [0.7.2] - 2022-04-06 ### Bugfixes - - Fix CVE-2020-36518: jackson-databind bump to 2.12.6 - - Fix CVE-2021-43797: bump netty-all to 4.1.75.Final - - Fix NPE in AbstractTarantoolConnectionManager when AddressProvider returns null + +- Fix CVE-2020-36518: jackson-databind bump to 2.12.6 +- Fix CVE-2021-43797: bump netty-all to 4.1.75.Final +- Fix NPE in AbstractTarantoolConnectionManager when AddressProvider returns null ## [0.7.1] - 2022-04-06 ### Features - - Added new error: TarantoolAccessDeniedException + +- Added new error: TarantoolAccessDeniedException ### Bugfixes - - Fixed stackoverflow on comparing two null fields #150 - - Fixed overwriting endpoint by TarantoolClusterDiscoveryConfig.Builder.withEndpoint() #173 - - Fixed closing connections to nodes not returned by address provider #77 - - Fixed NPE in RetryingTarantoolClient #184 +- Fixed stackoverflow on comparing two null fields #150 +- Fixed overwriting endpoint by TarantoolClusterDiscoveryConfig.Builder.withEndpoint() #173 +- Fixed closing connections to nodes not returned by address provider #77 +- Fixed NPE in RetryingTarantoolClient #184 -## [0.7.0] - 2022-02-21 +## [0.7.0] - 2022-02-21 ### Features - - Added refresh() method in connection manager to reestablish lacking connections - - Predefined discovery addressProviders now call refresh() when addresses change - - Added new exception type TarantoolNoSuchProcedureException which is useful in retry policies (for example - to handle errors caused by not initialized instance states) - - **Breaking change** error checking callbacks in retry policies now have Predicate type - - Added method to client builder for easy messagepack mapper configuration - - Added method to client builder which allows to use user defined TarantoolClientConfig + +- Added refresh() method in connection manager to reestablish lacking connections +- Predefined discovery addressProviders now call refresh() when addresses change +- Added new exception type TarantoolNoSuchProcedureException which is useful in retry policies (for example + to handle errors caused by not initialized instance states) +- **Breaking change** error checking callbacks in retry policies now have Predicate type +- Added method to client builder for easy messagepack mapper configuration +- Added method to client builder which allows to use user defined TarantoolClientConfig ### Bugfixes - - Concurrency issue in connection manager which caused connection creation over defined limit - + +- Concurrency issue in connection manager which caused connection creation over defined limit + ## [Older] ### Features - - Full support for Tarantool field types available in 1.10 and new field types introduced in 2.x: UUID, decimal, double - - Customizable mapping between the protocol primitives (MsgPack) into POJOs - - Default TarantoolTuple object with field access API - - Seamless working with standalone and Cartridge cluster Tarantool instances. +- Full support for Tarantool field types available in 1.10 and new field types introduced in 2.x: UUID, decimal, double +- Customizable mapping between the protocol primitives (MsgPack) into POJOs +- Default TarantoolTuple object with field access API +- Seamless working with standalone and Cartridge cluster Tarantool instances. Cluster support is available via a proxy using the customizable API functions exposed on Tarantool router. - - Built-in support for CRUD API (https://github.com/tarantool/crud) - - Schema fetching support for built-in spaces formats and DDL metadata (https://github.com/tarantool/ddl) - - Built-in examples for external server nodes discovery with HTTP or binary discovery endpoints - - Customizable request retry policies for reliable communication - - Automatic reconnects on connection failure + +- Built-in support for CRUD API (https://github.com/tarantool/crud) +- Schema fetching support for built-in spaces formats and DDL metadata (https://github.com/tarantool/ddl) +- Built-in examples for external server nodes discovery with HTTP or binary discovery endpoints +- Customizable request retry policies for reliable communication +- Automatic reconnects on connection failure diff --git a/src/main/java/io/tarantool/driver/api/space/options/InsertManyOptions.java b/src/main/java/io/tarantool/driver/api/space/options/InsertManyOptions.java index 908c55c2..3207a9aa 100644 --- a/src/main/java/io/tarantool/driver/api/space/options/InsertManyOptions.java +++ b/src/main/java/io/tarantool/driver/api/space/options/InsertManyOptions.java @@ -1,20 +1,11 @@ package io.tarantool.driver.api.space.options; -import java.util.Optional; - /** * Marker interface for space insert_many operation options * * @author Alexey Kuzin */ public interface InsertManyOptions> - extends OperationWithTimeoutOptions, OperationWithFieldsOptions, OperationWithRollbackOnErrorOptions { - - /** - * Return whether the operation should be interrupted if any tuple insertion - * was unsuccesful. - * - * @return true, if the operation should stop on error - */ - Optional getStopOnError(); + extends OperationWithTimeoutOptions, OperationWithFieldsOptions, OperationWithRollbackOnErrorOptions, + OperationWithStopOnErrorOptions { } diff --git a/src/main/java/io/tarantool/driver/api/space/options/OperationWithStopOnErrorOptions.java b/src/main/java/io/tarantool/driver/api/space/options/OperationWithStopOnErrorOptions.java new file mode 100644 index 00000000..1b5e2cd2 --- /dev/null +++ b/src/main/java/io/tarantool/driver/api/space/options/OperationWithStopOnErrorOptions.java @@ -0,0 +1,36 @@ +package io.tarantool.driver.api.space.options; + +import io.tarantool.driver.api.space.options.enums.crud.StopOnError; + +import java.util.Optional; + +/** + * Base interface for all operation options that may have a configurable stop_on_error. + * + * @author Belonogov Nikolay + */ +public interface OperationWithStopOnErrorOptions> + extends Options, Self { + + /** + * Specifies whether to not try to insert more tuples into the space if any tuple insert + * operation is unsuccesful. Default value is true. + * + * @param stopOnError should stop batch on error + * @return this options instance + */ + default T withStopOnError(StopOnError stopOnError) { + addOption(StopOnError.NAME, stopOnError.value()); + return self(); + } + + /** + * Return whether the operation should be interrupted if any tuple replace + * was unsuccesful. + * + * @return true, if the operation should stop on error + */ + default Optional getStopOnError() { + return getOption(StopOnError.NAME, Boolean.class); + } +} diff --git a/src/main/java/io/tarantool/driver/api/space/options/ReplaceManyOptions.java b/src/main/java/io/tarantool/driver/api/space/options/ReplaceManyOptions.java index 898b4d79..8e857f39 100644 --- a/src/main/java/io/tarantool/driver/api/space/options/ReplaceManyOptions.java +++ b/src/main/java/io/tarantool/driver/api/space/options/ReplaceManyOptions.java @@ -1,20 +1,11 @@ package io.tarantool.driver.api.space.options; -import java.util.Optional; - /** * Marker interface for space replace_many operation options * * @author Alexey Kuzin */ public interface ReplaceManyOptions> - extends OperationWithTimeoutOptions, OperationWithFieldsOptions, OperationWithRollbackOnErrorOptions { - - /** - * Return whether the operation should be interrupted if any tuple replace - * was unsuccesful. - * - * @return true, if the operation should stop on error - */ - Optional getStopOnError(); + extends OperationWithTimeoutOptions, OperationWithFieldsOptions, OperationWithRollbackOnErrorOptions, + OperationWithStopOnErrorOptions { } diff --git a/src/main/java/io/tarantool/driver/api/space/options/enums/crud/StopOnError.java b/src/main/java/io/tarantool/driver/api/space/options/enums/crud/StopOnError.java new file mode 100644 index 00000000..03492c91 --- /dev/null +++ b/src/main/java/io/tarantool/driver/api/space/options/enums/crud/StopOnError.java @@ -0,0 +1,30 @@ +package io.tarantool.driver.api.space.options.enums.crud; + +/** + * Enum represents the CRUD predefined stop_on_error option values. + * + * @author Belonogov Nikolay. + * @see tarantool/crud. + */ +public enum StopOnError { + + TRUE(true), + + FALSE(false); + + public static final String NAME = "stop_on_error"; + private final boolean value; + + StopOnError(boolean value) { + this.value = value; + } + + public boolean value() { + return this.value; + } + + @Override + public String toString() { + return Boolean.toString(this.value); + } +} diff --git a/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyInsertManyOptions.java b/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyInsertManyOptions.java index 2474c631..4de91cea 100644 --- a/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyInsertManyOptions.java +++ b/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyInsertManyOptions.java @@ -3,8 +3,6 @@ import io.tarantool.driver.api.space.options.BaseOptions; import io.tarantool.driver.api.space.options.InsertManyOptions; -import java.util.Optional; - /** * Represent options for insert_many cluster proxy operation * @@ -13,8 +11,6 @@ public final class ProxyInsertManyOptions extends BaseOptions implements InsertManyOptions { - public static final String STOP_ON_ERROR = "stop_on_error"; - private ProxyInsertManyOptions() { } @@ -27,25 +23,8 @@ public static ProxyInsertManyOptions create() { return new ProxyInsertManyOptions(); } - /** - * Specifies whether to not try to insert more tuples into the space if any tuple insert - * operation is unsuccesful. Default value is true. - * - * @param stopOnError should stop batch on error - * @return this options instance - */ - public ProxyInsertManyOptions withStopOnError(boolean stopOnError) { - addOption(STOP_ON_ERROR, stopOnError); - return self(); - } - @Override public ProxyInsertManyOptions self() { return this; } - - @Override - public Optional getStopOnError() { - return getOption(STOP_ON_ERROR, Boolean.class); - } } diff --git a/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyReplaceManyOptions.java b/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyReplaceManyOptions.java index 748cdc6c..9c7898fe 100644 --- a/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyReplaceManyOptions.java +++ b/src/main/java/io/tarantool/driver/api/space/options/proxy/ProxyReplaceManyOptions.java @@ -3,8 +3,6 @@ import io.tarantool.driver.api.space.options.BaseOptions; import io.tarantool.driver.api.space.options.ReplaceManyOptions; -import java.util.Optional; - /** * Represent options for replace_many cluster proxy operation * @@ -13,8 +11,6 @@ public final class ProxyReplaceManyOptions extends BaseOptions implements ReplaceManyOptions { - public static final String STOP_ON_ERROR = "stop_on_error"; - private ProxyReplaceManyOptions() { } @@ -27,25 +23,8 @@ public static ProxyReplaceManyOptions create() { return new ProxyReplaceManyOptions(); } - /** - * Specifies whether to not try to replace more tuples into the space if any tuple replace - * operation is unsuccesful. Default value is true. - * - * @param stopOnError should stop batch on error - * @return this options instance - */ - public ProxyReplaceManyOptions withStopOnError(boolean stopOnError) { - addOption(STOP_ON_ERROR, stopOnError); - return self(); - } - @Override public ProxyReplaceManyOptions self() { return this; } - - @Override - public Optional getStopOnError() { - return getOption(STOP_ON_ERROR, Boolean.class); - } } diff --git a/src/main/java/io/tarantool/driver/core/space/ProxyTarantoolSpace.java b/src/main/java/io/tarantool/driver/core/space/ProxyTarantoolSpace.java index d55deaf1..4e2fd060 100644 --- a/src/main/java/io/tarantool/driver/core/space/ProxyTarantoolSpace.java +++ b/src/main/java/io/tarantool/driver/core/space/ProxyTarantoolSpace.java @@ -17,6 +17,7 @@ import io.tarantool.driver.api.space.options.UpdateOptions; import io.tarantool.driver.api.space.options.UpsertOptions; import io.tarantool.driver.api.space.options.enums.crud.RollbackOnError; +import io.tarantool.driver.api.space.options.enums.crud.StopOnError; import io.tarantool.driver.api.space.options.proxy.ProxyDeleteOptions; import io.tarantool.driver.api.space.options.proxy.ProxyInsertManyOptions; import io.tarantool.driver.api.space.options.proxy.ProxyInsertOptions; @@ -144,7 +145,7 @@ private CompletableFuture insert( @Override public CompletableFuture insertMany(Collection tuples) { return insertMany(tuples, rowsMetadataTupleResultMapper(), ProxyInsertManyOptions.create() - .withStopOnError(true) + .withStopOnError(StopOnError.TRUE) .withRollbackOnError(RollbackOnError.TRUE) ); } @@ -210,7 +211,7 @@ private CompletableFuture replace( @Override public CompletableFuture replaceMany(Collection tuples) throws TarantoolClientException { return replaceMany(tuples, rowsMetadataTupleResultMapper(), ProxyReplaceManyOptions.create() - .withStopOnError(true) + .withStopOnError(StopOnError.TRUE) .withRollbackOnError(RollbackOnError.TRUE) ); } diff --git a/src/test/java/io/tarantool/driver/core/proxy/ProxyOperationBuildersTest.java b/src/test/java/io/tarantool/driver/core/proxy/ProxyOperationBuildersTest.java index 6fb850b2..beb20653 100644 --- a/src/test/java/io/tarantool/driver/core/proxy/ProxyOperationBuildersTest.java +++ b/src/test/java/io/tarantool/driver/core/proxy/ProxyOperationBuildersTest.java @@ -5,6 +5,7 @@ import io.tarantool.driver.api.conditions.Conditions; import io.tarantool.driver.api.space.options.enums.crud.Mode; import io.tarantool.driver.api.space.options.enums.crud.RollbackOnError; +import io.tarantool.driver.api.space.options.enums.crud.StopOnError; import io.tarantool.driver.api.space.options.proxy.ProxyDeleteOptions; import io.tarantool.driver.api.space.options.proxy.ProxyInsertManyOptions; import io.tarantool.driver.api.space.options.proxy.ProxyInsertOptions; @@ -124,7 +125,7 @@ public void insertManyOperationBuilderTest() { .withOptions(ProxyInsertManyOptions.create() .withTimeout(client.getConfig().getRequestTimeout()) .withRollbackOnError(RollbackOnError.TRUE) - .withStopOnError(false) + .withStopOnError(StopOnError.FALSE) ) .build(); @@ -184,7 +185,7 @@ public void replaceManyOperationBuilderTest() { .withOptions(ProxyReplaceManyOptions.create() .withTimeout(client.getConfig().getRequestTimeout()) .withRollbackOnError(RollbackOnError.TRUE) - .withStopOnError(false) + .withStopOnError(StopOnError.FALSE) ) .build(); diff --git a/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceInsertManyOptionsIT.java b/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceInsertManyOptionsIT.java index 39862a69..929fb5fb 100644 --- a/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceInsertManyOptionsIT.java +++ b/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceInsertManyOptionsIT.java @@ -7,6 +7,7 @@ import io.tarantool.driver.api.space.TarantoolSpaceOperations; import io.tarantool.driver.api.space.options.InsertManyOptions; import io.tarantool.driver.api.space.options.enums.crud.RollbackOnError; +import io.tarantool.driver.api.space.options.enums.crud.StopOnError; import io.tarantool.driver.api.space.options.proxy.ProxyInsertManyOptions; import io.tarantool.driver.api.tuple.DefaultTarantoolTupleFactory; import io.tarantool.driver.api.tuple.TarantoolTuple; @@ -36,16 +37,14 @@ */ public class ProxySpaceInsertManyOptionsIT extends SharedCartridgeContainer { - private static TarantoolClient> client; private static final DefaultMessagePackMapperFactory mapperFactory = DefaultMessagePackMapperFactory.getInstance(); private static final TarantoolTupleFactory tupleFactory = new DefaultTarantoolTupleFactory(mapperFactory.defaultComplexTypesMapper()); - - public static String USER_NAME; - public static String PASSWORD; - private static final String TEST_SPACE_NAME = "test__profile"; private static final String PK_FIELD_NAME = "profile_id"; + public static String USER_NAME; + public static String PASSWORD; + private static TarantoolClient> client; @BeforeAll public static void setUp() throws Exception { @@ -67,15 +66,15 @@ private static void initClient() { client = new ProxyTarantoolTupleClient(clusterClient); } + private static void truncateSpace(String spaceName) { + client.space(spaceName).truncate().join(); + } + @BeforeEach public void truncateSpace() { truncateSpace(TEST_SPACE_NAME); } - private static void truncateSpace(String spaceName) { - client.space(spaceName).truncate().join(); - } - @Test public void withStopOnError_withRollbackOnError() throws ExecutionException, InterruptedException { TarantoolSpaceOperations> profileSpace = @@ -102,7 +101,7 @@ public void withStopOnError_withRollbackOnError() throws ExecutionException, Int tarantoolTuples, ProxyInsertManyOptions.create() .withRollbackOnError(RollbackOnError.FALSE) - .withStopOnError(false) + .withStopOnError(StopOnError.FALSE) ).get(); crudInsertManyOpts = client.eval("return crud_insert_many_opts").get(); assertEquals(false, ((HashMap) crudInsertManyOpts.get(0)).get("rollback_on_error")); diff --git a/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceReplaceManyOptionsIT.java b/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceReplaceManyOptionsIT.java index c04a5956..e4d64618 100644 --- a/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceReplaceManyOptionsIT.java +++ b/src/test/java/io/tarantool/driver/integration/proxy/options/ProxySpaceReplaceManyOptionsIT.java @@ -6,6 +6,7 @@ import io.tarantool.driver.api.space.TarantoolSpaceOperations; import io.tarantool.driver.api.space.options.ReplaceManyOptions; import io.tarantool.driver.api.space.options.enums.crud.RollbackOnError; +import io.tarantool.driver.api.space.options.enums.crud.StopOnError; import io.tarantool.driver.api.space.options.proxy.ProxyReplaceManyOptions; import io.tarantool.driver.api.tuple.DefaultTarantoolTupleFactory; import io.tarantool.driver.api.tuple.TarantoolTuple; @@ -94,7 +95,7 @@ public void withStopOnError_withRollbackOnError() throws ExecutionException, Int tarantoolTuples, ProxyReplaceManyOptions.create() .withRollbackOnError(RollbackOnError.FALSE) - .withStopOnError(false) + .withStopOnError(StopOnError.FALSE) ).get(); crudReplaceManyOpts = client.eval("return crud_replace_many_opts").get(); assertEquals(false, ((HashMap) crudReplaceManyOpts.get(0)).get("rollback_on_error"));