use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldRemoveFromSet.
// DATACASS-770
@Test
void shouldRemoveFromSet() {
Update update = updateMapper.getMappedObject(Update.empty().remove("set", currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = set_col - {'Euro'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateDecrementUpdate.
// DATACASS-343
@Test
void shouldCreateDecrementUpdate() {
Update update = updateMapper.getMappedObject(Update.empty().decrement("number"), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("number = number - 1");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldMapTime.
// DATACASS-302, DATACASS-694
@Test
void shouldMapTime() {
Update update = this.updateMapper.getMappedObject(Update.empty().set("localTime", LocalTime.of(1, 2, 3)), this.persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update.toString()).startsWith("localtime = '01:02:03.");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateSetAtUdtIndexUpdate.
// DATACASS-829
@Test
void shouldCreateSetAtUdtIndexUpdate() {
Update update = updateMapper.getMappedObject(Update.empty().set("manufacturerList").atIndex(10).to(new Manufacturer("foo")), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("manufacturerlist[10] = {name:'foo'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldAddUdtToMap.
// DATACASS-487
@Test
void shouldAddUdtToMap() {
Manufacturer manufacturer = new Manufacturer("foobar");
Update update = Update.empty().addTo("manufacturers").entry(manufacturer, currencyEUR);
Update mappedUpdate = updateMapper.getMappedObject(update, persistentEntity);
assertThat(mappedUpdate.getUpdateOperations()).hasSize(1);
assertThat(mappedUpdate).hasToString("manufacturers = manufacturers + {{name:'foobar'}:'Euro'}");
}
Aggregations