Added support of the PersistTo, ReplicateTo and DurabilityLevel via @Document annotation. (#1649)

Closes #1486
This commit is contained in:
Tigran Babloyan
2023-01-25 01:05:52 +04:00
committed by GitHub
parent 0e76118dbc
commit 6326317971
20 changed files with 477 additions and 98 deletions

View File

@@ -43,21 +43,8 @@ import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.data.couchbase.core.ExecutableFindByIdOperation.ExecutableFindById;
import org.springframework.data.couchbase.core.ExecutableRemoveByIdOperation.ExecutableRemoveById;
import org.springframework.data.couchbase.core.ExecutableReplaceByIdOperation.ExecutableReplaceById;
import org.springframework.data.couchbase.core.support.OneAndAllEntity;
import org.springframework.data.couchbase.core.support.OneAndAllId;
import org.springframework.data.couchbase.core.support.WithDurability;
import org.springframework.data.couchbase.core.support.WithExpiry;
import org.springframework.data.couchbase.domain.Address;
import org.springframework.data.couchbase.domain.Config;
import org.springframework.data.couchbase.domain.NaiveAuditorAware;
import org.springframework.data.couchbase.domain.PersonValue;
import org.springframework.data.couchbase.domain.Submission;
import org.springframework.data.couchbase.domain.User;
import org.springframework.data.couchbase.domain.UserAnnotated;
import org.springframework.data.couchbase.domain.UserAnnotated2;
import org.springframework.data.couchbase.domain.UserAnnotated3;
import org.springframework.data.couchbase.domain.UserAnnotatedTouchOnRead;
import org.springframework.data.couchbase.domain.UserSubmission;
import org.springframework.data.couchbase.core.support.*;
import org.springframework.data.couchbase.domain.*;
import org.springframework.data.couchbase.util.ClusterType;
import org.springframework.data.couchbase.util.IgnoreWhen;
import org.springframework.data.couchbase.util.JavaIntegrationTests;
@@ -74,6 +61,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
*
* @author Michael Nitschinger
* @author Michael Reiche
* @author Tigran Babloyan
*/
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
@SpringJUnitConfig(Config.class)
@@ -275,49 +263,58 @@ class CouchbaseTemplateKeyValueIntegrationTests extends JavaIntegrationTests {
@Test
void withDurability()
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
Class<?> clazz = User.class; // for now, just User.class. There is no Durability annotation.
// insert, replace, upsert
for (OneAndAllEntity<User> operator : new OneAndAllEntity[] { couchbaseTemplate.insertById(clazz),
couchbaseTemplate.replaceById(clazz), couchbaseTemplate.upsertById(clazz) }) {
// create an entity of type clazz
Constructor<?> cons = clazz.getConstructor(String.class, String.class, String.class);
User user = (User) cons.newInstance("" + operator.getClass().getSimpleName() + "_" + clazz.getSimpleName(),
"firstname", "lastname");
for (Class<?> clazz : new Class[] { User.class, UserAnnotatedDurability.class, UserAnnotatedPersistTo.class, UserAnnotatedReplicateTo.class }) {
// insert, replace, upsert
for (OneAndAllEntity<User> operator : new OneAndAllEntity[]{couchbaseTemplate.insertById(clazz),
couchbaseTemplate.replaceById(clazz), couchbaseTemplate.upsertById(clazz)}) {
// create an entity of type clazz
Constructor<?> cons = clazz.getConstructor(String.class, String.class, String.class);
User user = (User) cons.newInstance("" + operator.getClass().getSimpleName() + "_" + clazz.getSimpleName(),
"firstname", "lastname");
if (clazz.equals(User.class)) { // User.java doesn't have an durability annotation
operator = (OneAndAllEntity) ((WithDurability<User>) operator).withDurability(PersistTo.ACTIVE,
ReplicateTo.NONE);
}
// if replace, we need to insert a document to replace
if (operator instanceof ExecutableReplaceById) {
couchbaseTemplate.insertById(User.class).one(user);
}
// call to insert/replace/update
User returned = null;
// occasionally gives "reactor.core.Exceptions$OverflowException: Could not emit value due to lack of requests"
for (int i = 1; i != 5; i++) {
try {
returned = (User) operator.one(user);
break;
} catch (Exception ofe) {
System.out.println("" + i + " caught: " + ofe);
couchbaseTemplate.removeByQuery(User.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).all();
if (i == 4) {
throw ofe;
}
sleepSecs(1);
if (clazz.equals(User.class)) { // User.java doesn't have an durability annotation
operator = (OneAndAllEntity<User>) ((WithDurability<User>) operator).withDurability(PersistTo.ACTIVE,
ReplicateTo.NONE);
} else if (clazz.equals(UserAnnotatedReplicateTo.class)){ // override the replica count from the annotation with no replica
operator = (OneAndAllEntity<User>) ((WithDurability<User>) operator).withDurability(PersistTo.NONE,
ReplicateTo.NONE);
}
}
assertEquals(user, returned);
User found = couchbaseTemplate.findById(User.class).one(user.getId());
assertEquals(user, found);
if (operator instanceof ExecutableReplaceById) {
couchbaseTemplate.removeById().withDurability(PersistTo.ACTIVE, ReplicateTo.NONE).one(user.getId());
User removed = (User) couchbaseTemplate.findById(user.getClass()).one(user.getId());
assertNull(removed, "found should have been null as document should be removed");
// if replace, we need to insert a document to replace
if (operator instanceof ExecutableReplaceById) {
couchbaseTemplate.insertById(User.class).one(user);
}
// call to insert/replace/update
User returned = null;
// occasionally gives "reactor.core.Exceptions$OverflowException: Could not emit value due to lack of requests"
for (int i = 1; i != 5; i++) {
try {
returned = (User) operator.one(user);
break;
} catch (Exception ofe) {
System.out.println("" + i + " caught: " + ofe);
couchbaseTemplate.removeByQuery(User.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).all();
if (i == 4) {
throw ofe;
}
sleepSecs(1);
}
}
assertEquals(user, returned);
User found = couchbaseTemplate.findById(User.class).one(user.getId());
assertEquals(user, found);
if (operator instanceof ExecutableReplaceById) {
if (clazz.equals(UserAnnotatedReplicateTo.class)){ // override the replica count from the annotation with no replica
couchbaseTemplate.removeById(clazz).withDurability(PersistTo.ACTIVE,
ReplicateTo.NONE).one(user.getId());
} else {
couchbaseTemplate.removeById(clazz).one(user.getId());
}
User removed = (User) couchbaseTemplate.findById(user.getClass()).one(user.getId());
assertNull(removed, "found should have been null as document should be removed");
}
}
}
@@ -474,6 +471,56 @@ class CouchbaseTemplateKeyValueIntegrationTests extends JavaIntegrationTests {
couchbaseTemplate.removeById(User.class).one(user.getId());
}
@Test
void insertByIdWithAnnotatedDurability() {
UserAnnotatedPersistTo user = new UserAnnotatedPersistTo(UUID.randomUUID().toString(), "firstname", "lastname");
UserAnnotatedPersistTo inserted = null;
// occasionally gives "reactor.core.Exceptions$OverflowException: Could not emit value due to lack of requests"
for (int i = 1; i != 5; i++) {
try {
inserted = couchbaseTemplate.insertById(UserAnnotatedPersistTo.class)
.one(user);
break;
} catch (Exception ofe) {
System.out.println("" + i + " caught: " + ofe);
couchbaseTemplate.removeByQuery(UserAnnotatedPersistTo.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).all();
if (i == 4) {
throw ofe;
}
sleepSecs(1);
}
}
assertEquals(user, inserted);
assertThrows(DuplicateKeyException.class, () -> couchbaseTemplate.insertById(UserAnnotatedPersistTo.class).one(user));
couchbaseTemplate.removeById(UserAnnotatedPersistTo.class).one(user.getId());
}
@Test
void insertByIdWithAnnotatedDurability2() {
UserAnnotatedDurability user = new UserAnnotatedDurability(UUID.randomUUID().toString(), "firstname", "lastname");
UserAnnotatedDurability inserted = null;
// occasionally gives "reactor.core.Exceptions$OverflowException: Could not emit value due to lack of requests"
for (int i = 1; i != 5; i++) {
try {
inserted = couchbaseTemplate.insertById(UserAnnotatedDurability.class)
.one(user);
break;
} catch (Exception ofe) {
System.out.println("" + i + " caught: " + ofe);
couchbaseTemplate.removeByQuery(UserAnnotatedDurability.class).withConsistency(QueryScanConsistency.REQUEST_PLUS).all();
if (i == 4) {
throw ofe;
}
sleepSecs(1);
}
}
assertEquals(user, inserted);
assertThrows(DuplicateKeyException.class, () -> couchbaseTemplate.insertById(UserAnnotatedDurability.class).one(user));
couchbaseTemplate.removeById(UserAnnotatedDurability.class).one(user.getId());
}
@Test
void existsById() {
String id = UUID.randomUUID().toString();

View File

@@ -48,13 +48,7 @@ import org.springframework.data.couchbase.core.support.OneAndAllEntityReactive;
import org.springframework.data.couchbase.core.support.OneAndAllIdReactive;
import org.springframework.data.couchbase.core.support.WithDurability;
import org.springframework.data.couchbase.core.support.WithExpiry;
import org.springframework.data.couchbase.domain.Config;
import org.springframework.data.couchbase.domain.PersonValue;
import org.springframework.data.couchbase.domain.ReactiveNaiveAuditorAware;
import org.springframework.data.couchbase.domain.User;
import org.springframework.data.couchbase.domain.UserAnnotated;
import org.springframework.data.couchbase.domain.UserAnnotated2;
import org.springframework.data.couchbase.domain.UserAnnotated3;
import org.springframework.data.couchbase.domain.*;
import org.springframework.data.couchbase.util.ClusterType;
import org.springframework.data.couchbase.util.IgnoreWhen;
import org.springframework.data.couchbase.util.JavaIntegrationTests;
@@ -68,6 +62,7 @@ import com.couchbase.client.java.kv.ReplicateTo;
*
* @author Michael Nitschinger
* @author Michael Reiche
* @author Tigran Babloyan
*/
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
@SpringJUnitConfig(Config.class)
@@ -158,36 +153,44 @@ class ReactiveCouchbaseTemplateKeyValueIntegrationTests extends JavaIntegrationT
@Test
void withDurability()
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
Class<?> clazz = User.class; // for now, just User.class. There is no Durability annotation.
// insert, replace, upsert
for (OneAndAllEntityReactive<User> operator : new OneAndAllEntityReactive[] {
reactiveCouchbaseTemplate.insertById(clazz), reactiveCouchbaseTemplate.replaceById(clazz),
reactiveCouchbaseTemplate.upsertById(clazz) }) {
// create an entity of type clazz
Constructor<?> cons = clazz.getConstructor(String.class, String.class, String.class);
User user = (User) cons.newInstance("" + operator.getClass().getSimpleName() + "_" + clazz.getSimpleName(),
"firstname", "lastname");
for (Class<?> clazz : new Class[] { User.class, UserAnnotatedDurability.class, UserAnnotatedPersistTo.class, UserAnnotatedReplicateTo.class }) {
// insert, replace, upsert
for (OneAndAllEntityReactive<User> operator : new OneAndAllEntityReactive[]{
reactiveCouchbaseTemplate.insertById(clazz), reactiveCouchbaseTemplate.replaceById(clazz),
reactiveCouchbaseTemplate.upsertById(clazz)}) {
// create an entity of type clazz
Constructor<?> cons = clazz.getConstructor(String.class, String.class, String.class);
User user = (User) cons.newInstance("" + operator.getClass().getSimpleName() + "_" + clazz.getSimpleName(),
"firstname", "lastname");
if (clazz.equals(User.class)) { // User.java doesn't have an durability annotation
operator = (OneAndAllEntityReactive<User>) ((WithDurability<User>) operator).withDurability(PersistTo.ACTIVE,
ReplicateTo.NONE);
}
if (clazz.equals(User.class)) { // User.java doesn't have an durability annotation
operator = (OneAndAllEntityReactive<User>) ((WithDurability<User>) operator).withDurability(PersistTo.ACTIVE,
ReplicateTo.NONE);
} else if (clazz.equals(UserAnnotatedReplicateTo.class)){ // override the replica count from the annotation with no replica
operator = (OneAndAllEntityReactive<User>) ((WithDurability<User>) operator).withDurability(PersistTo.NONE,
ReplicateTo.NONE);
}
// if replace, we need to insert a document to replace
if (operator instanceof ReactiveReplaceById) {
reactiveCouchbaseTemplate.insertById(User.class).one(user).block();
}
// call to insert/replace/update
User returned = operator.one(user).block();
assertEquals(user, returned);
User found = reactiveCouchbaseTemplate.findById(User.class).one(user.getId()).block();
assertEquals(user, found);
// if replace, we need to insert a document to replace
if (operator instanceof ReactiveReplaceById) {
reactiveCouchbaseTemplate.insertById(User.class).one(user).block();
}
// call to insert/replace/update
User returned = operator.one(user).block();
assertEquals(user, returned);
User found = reactiveCouchbaseTemplate.findById(User.class).one(user.getId()).block();
assertEquals(user, found);
if (operator instanceof ReactiveReplaceByIdOperation.ReactiveReplaceById) {
reactiveCouchbaseTemplate.removeById().withDurability(PersistTo.ACTIVE, ReplicateTo.NONE).one(user.getId())
.block();
User removed = (User) reactiveCouchbaseTemplate.findById(user.getClass()).one(user.getId()).block();
assertNull(removed, "found should have been null as document should be removed");
if (operator instanceof ReactiveReplaceByIdOperation.ReactiveReplaceById) {
if (clazz.equals(UserAnnotatedReplicateTo.class)){ // override the replica count from the annotation with no replica
reactiveCouchbaseTemplate.removeById(clazz).withDurability(PersistTo.NONE,
ReplicateTo.NONE).one(user.getId()).block();
} else {
reactiveCouchbaseTemplate.removeById(clazz).one(user.getId()).block();
}
User removed = reactiveCouchbaseTemplate.findById(user.getClass()).one(user.getId()).block();
assertNull(removed, "found should have been null as document should be removed");
}
}
}
@@ -330,6 +333,24 @@ class ReactiveCouchbaseTemplateKeyValueIntegrationTests extends JavaIntegrationT
assertThrows(DuplicateKeyException.class, () -> reactiveCouchbaseTemplate.insertById(User.class).one(user).block());
}
@Test
void insertByIdWithAnnotatedDurability() {
UserAnnotatedPersistTo user = new UserAnnotatedPersistTo(UUID.randomUUID().toString(), "firstname", "lastname");
UserAnnotatedPersistTo inserted = reactiveCouchbaseTemplate.insertById(UserAnnotatedPersistTo.class)
.one(user).block();
assertEquals(user, inserted);
assertThrows(DuplicateKeyException.class, () -> reactiveCouchbaseTemplate.insertById(User.class).one(user).block());
}
@Test
void insertByIdWithAnnotatedDurability2() {
UserAnnotatedDurability user = new UserAnnotatedDurability(UUID.randomUUID().toString(), "firstname", "lastname");
UserAnnotatedDurability inserted = reactiveCouchbaseTemplate.insertById(UserAnnotatedDurability.class)
.one(user).block();
assertEquals(user, inserted);
assertThrows(DuplicateKeyException.class, () -> reactiveCouchbaseTemplate.insertById(User.class).one(user).block());
}
@Test
void existsById() {
String id = UUID.randomUUID().toString();

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2012-2023 the original author or authors
*
* 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
*
* https://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.
*/
package org.springframework.data.couchbase.domain;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.ReplicateTo;
import org.springframework.data.couchbase.core.mapping.Document;
import java.util.UUID;
/**
* Person entity for tests.
*
* @author Tigran Babloyan
*/
@Document(persistTo = PersistTo.ONE, replicateTo = ReplicateTo.ONE)
public class PersonWithDurability extends Person {
public PersonWithDurability() {
setId(UUID.randomUUID());
setMiddlename("Nick");
}
public PersonWithDurability(String firstname, String lastname) {
this();
setFirstname(firstname);
setLastname(lastname);
isNew(true);
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2012-2023 the original author or authors
*
* 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
*
* https://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.
*/
package org.springframework.data.couchbase.domain;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.ReplicateTo;
import org.springframework.data.couchbase.core.mapping.Document;
import java.util.UUID;
/**
* Person entity for tests.
*
* @author Tigran Babloyan
*/
@Document(durabilityLevel = DurabilityLevel.MAJORITY)
public class PersonWithDurability2 extends Person {
public PersonWithDurability2() {
setId(UUID.randomUUID());
setMiddlename("Nick");
}
public PersonWithDurability2(String firstname, String lastname) {
this();
setFirstname(firstname);
setLastname(lastname);
isNew(true);
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2020-2023 the original author or authors
*
* 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
*
* https://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.
*/
package org.springframework.data.couchbase.domain;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import org.springframework.data.couchbase.core.mapping.Document;
import java.io.Serializable;
/**
* Annotated User entity for tests
*
* @author Tigran Babloyan
*/
@Document(durabilityLevel = DurabilityLevel.MAJORITY)
public class UserAnnotatedDurability extends User implements Serializable {
public UserAnnotatedDurability(String id, String firstname, String lastname) {
super(id, firstname, lastname);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2020-2023 the original author or authors
*
* 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
*
* https://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.
*/
package org.springframework.data.couchbase.domain;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.ReplicateTo;
import org.springframework.data.couchbase.core.mapping.Document;
import java.io.Serializable;
/**
* Annotated User entity for tests
*
* @author Tigran Babloyan
*/
@Document(persistTo = PersistTo.ACTIVE)
public class UserAnnotatedPersistTo extends User implements Serializable {
public UserAnnotatedPersistTo(String id, String firstname, String lastname) {
super(id, firstname, lastname);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2020-2023 the original author or authors
*
* 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
*
* https://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.
*/
package org.springframework.data.couchbase.domain;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.java.kv.ReplicateTo;
import org.springframework.data.couchbase.core.mapping.Document;
import java.io.Serializable;
/**
* Annotated User entity for tests
*
* @author Tigran Babloyan
*/
@Document(replicateTo = ReplicateTo.ONE)
public class UserAnnotatedReplicateTo extends User implements Serializable {
public UserAnnotatedReplicateTo(String id, String firstname, String lastname) {
super(id, firstname, lastname);
}
}

View File

@@ -31,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.couchbase.CouchbaseClientFactory;
import org.springframework.data.couchbase.core.CouchbaseOperations;
import org.springframework.data.couchbase.domain.Person;
import org.springframework.data.couchbase.domain.PersonWithDurability;
import org.springframework.data.couchbase.domain.PersonWithDurability2;
import org.springframework.data.couchbase.transaction.error.TransactionSystemUnambiguousException;
import org.springframework.data.couchbase.util.Capabilities;
import org.springframework.data.couchbase.util.ClusterType;
@@ -54,6 +56,7 @@ import com.couchbase.client.java.kv.ReplicateTo;
*
* @author Graham Pople
* @author Michael Reiche
* @author Tigran Babloyan
*/
@IgnoreWhen(missesCapabilities = Capabilities.QUERY, clusterTypes = ClusterType.MOCKED)
@SpringJUnitConfig(classes = { TransactionsConfig.class,
@@ -96,6 +99,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using insertById() with Durability set via annotations in a transaction is rejected at runtime")
@Test
public void insertWithDurabilityAnnotated() {
test((ops) -> {
ops.insertById(PersonWithDurability.class).one(new PersonWithDurability("Walter", "White"));
});
}
@DisplayName("Using insertById().withExpiry in a transaction is rejected at runtime")
@Test
public void insertWithExpiry() {
@@ -112,6 +123,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using insertById with Durability set via annotations in a transaction is rejected at runtime")
@Test
public void insertWithDurabilityAnnotated2() {
test((ops) -> {
ops.insertById(PersonWithDurability2.class).one(new PersonWithDurability2("Walter", "White"));
});
}
@DisplayName("Using insertById().withOptions in a transaction is rejected at runtime")
@Test
public void insertWithOptions() {
@@ -128,6 +147,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using replaceById() with Durability set via annotations in a transaction is rejected at runtime")
@Test
public void replaceWithAnnotatedDurability() {
test((ops) -> {
ops.replaceById(PersonWithDurability.class).one(new PersonWithDurability("Walter", "White"));
});
}
@DisplayName("Using replaceById().withExpiry in a transaction is rejected at runtime")
@Test
public void replaceWithExpiry() {
@@ -144,6 +171,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using replaceById() with Durability set via annotations in a transaction is rejected at runtime")
@Test
public void replaceWithAnnotatedDurability2() {
test((ops) -> {
ops.replaceById(PersonWithDurability2.class).one(new PersonWithDurability2("Walter", "White"));
});
}
@DisplayName("Using replaceById().withOptions in a transaction is rejected at runtime")
@Test
public void replaceWithOptions() {
@@ -160,6 +195,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using removeById() with Durability set via annotations in a transaction is rejected at runtime")
@Test
public void removeWithAnnotatedDurability() {
test((ops) -> {
ops.removeById(PersonWithDurability.class).oneEntity(new PersonWithDurability("Walter", "White"));
});
}
@DisplayName("Using removeById().withDurability(durabilityLevel) in a transaction is rejected at runtime")
@Test
public void removeWithDurability2() {
@@ -168,6 +211,14 @@ public class CouchbaseTransactionalUnsettableParametersIntegrationTests extends
});
}
@DisplayName("Using removeById().withDurability(durabilityLevel) in a transaction is rejected at runtime")
@Test
public void removeWithAnnotatedDurability2() {
test((ops) -> {
ops.removeById(PersonWithDurability2.class).oneEntity(new PersonWithDurability2("Walter", "White"));
});
}
@DisplayName("Using removeById().withOptions in a transaction is rejected at runtime")
@Test
public void removeWithOptions() {