use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldRemoveFromMap.
// #1007
@Test
void shouldRemoveFromMap() {
Update update = updateMapper.getMappedObject(Update.empty().removeFrom("map").value("foo"), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("map = map - {'foo'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldRemoveFromList.
// DATACASS-343
@Test
void shouldRemoveFromList() {
Update update = updateMapper.getMappedObject(Update.empty().remove("list", currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("list = list - ['Euro']");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldReplaceUdtMap.
// DATACASS-487
@Test
void shouldReplaceUdtMap() {
Manufacturer manufacturer = new Manufacturer("foobar");
Map<Manufacturer, Currency> map = Collections.singletonMap(manufacturer, currencyEUR);
Update update = Update.empty().set("manufacturers", map);
Update mappedUpdate = updateMapper.getMappedObject(update, persistentEntity);
assertThat(mappedUpdate.getUpdateOperations()).hasSize(1);
assertThat(mappedUpdate).hasToString("manufacturers = {{name:'foobar'}:'Euro'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateSetAtUdtKeyUpdate.
// DATACASS-487
@Test
void shouldCreateSetAtUdtKeyUpdate() {
Manufacturer manufacturer = new Manufacturer("foobar");
Update update = updateMapper.getMappedObject(Update.empty().set("manufacturers").atKey(manufacturer).to(currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("manufacturers[{name:'foobar'}] = 'Euro'");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldAppendAllToList.
// DATACASS-343
@Test
void shouldAppendAllToList() {
Update update = updateMapper.getMappedObject(Update.empty().addTo("list").appendAll("foo", currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("list = list + ['foo','Euro']");
}
Aggregations