use of org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension in project spring-data-jdbc by spring-projects.
the class PersistentPropertyPathExtensionUnitTests method equalsWorks.
// GH--1164
@Test
void equalsWorks() {
PersistentPropertyPathExtension root1 = extPath(entity);
PersistentPropertyPathExtension root2 = extPath(entity);
PersistentPropertyPathExtension path1 = extPath("withId");
PersistentPropertyPathExtension path2 = extPath("withId");
assertSoftly(softly -> {
softly.assertThat(root1).describedAs("root is equal to self").isEqualTo(root1);
softly.assertThat(root2).describedAs("root is equal to identical root").isEqualTo(root1);
softly.assertThat(path1).describedAs("path is equal to self").isEqualTo(path1);
softly.assertThat(path2).describedAs("path is equal to identical path").isEqualTo(path1);
softly.assertThat(path1).describedAs("path is not equal to other path").isNotEqualTo(extPath("entityId"));
softly.assertThat(root1).describedAs("root is not equal to path").isNotEqualTo(path1);
softly.assertThat(path1).describedAs("path is not equal to root").isNotEqualTo(root1);
});
}
use of org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension in project spring-data-jdbc by spring-projects.
the class BasicJdbcPersistentPropertyUnitTests method detectsKeyColumnOverrideNameFromMappedCollectionAnnotation.
// DATAJDBC-331
@Test
public void detectsKeyColumnOverrideNameFromMappedCollectionAnnotation() {
RelationalPersistentProperty listProperty = //
context.getRequiredPersistentEntity(//
WithCollections.class).getRequiredPersistentProperty("overrideList");
PersistentPropertyPathExtension path = getPersistentPropertyPath(WithCollections.class, "overrideList");
assertThat(listProperty.getKeyColumn()).isEqualTo(quoted("override_key"));
assertThat(listProperty.getReverseColumnName(path)).isEqualTo(quoted("override_id"));
}
use of org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension in project spring-data-jdbc by spring-projects.
the class BasicJdbcPersistentPropertyUnitTests method detectsAnnotatedColumnAndKeyName.
// DATAJDBC-218
@Test
public void detectsAnnotatedColumnAndKeyName() {
String propertyName = "someList";
RelationalPersistentProperty listProperty = entity.getRequiredPersistentProperty(propertyName);
PersistentPropertyPathExtension path = getPersistentPropertyPath(DummyEntity.class, propertyName);
assertThat(listProperty.getReverseColumnName(path)).isEqualTo(quoted("dummy_column_name"));
assertThat(listProperty.getKeyColumn()).isEqualTo(quoted("dummy_key_column_name"));
}
use of org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension in project spring-data-jdbc by spring-projects.
the class BasicJdbcPersistentPropertyUnitTests method detectsReverseColumnNameFromColumnAnnotation.
// DATAJDBC-331
@Test
public void detectsReverseColumnNameFromColumnAnnotation() {
String propertyName = "someList";
RelationalPersistentProperty listProperty = //
context.getRequiredPersistentEntity(//
WithCollections.class).getRequiredPersistentProperty(propertyName);
PersistentPropertyPathExtension path = getPersistentPropertyPath(DummyEntity.class, propertyName);
assertThat(listProperty.getKeyColumn()).isEqualTo(quoted("WITH_COLLECTIONS_KEY"));
assertThat(listProperty.getReverseColumnName(path)).isEqualTo(quoted("some_value"));
}
use of org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension in project spring-data-jdbc by spring-projects.
the class JdbcIdentifierBuilderUnitTests method qualifiersForMaps.
// DATAJDBC-326
@Test
public void qualifiersForMaps() {
PersistentPropertyPathExtension path = getPath("children");
Identifier identifier = //
JdbcIdentifierBuilder.forBackReferences(converter, path, //
"parent-eins").withQualifier(path, //
"map-key-eins").build();
//
assertThat(identifier.getParts()).extracting("name", "value", //
"targetType").containsExactlyInAnyOrder(//
tuple(quoted("DUMMY_ENTITY"), "parent-eins", UUID.class), //
tuple(quoted("DUMMY_ENTITY_KEY"), "map-key-eins", String.class));
}
Aggregations