use of com.blazebit.persistence.view.metamodel.ViewMetamodel in project blaze-persistence by Blazebit.
the class ViewMetamodelTest method testNoMappingNonConflictingMapping.
@Test
public void testNoMappingNonConflictingMapping() {
ViewMetamodel metamodel = build(NoMappingNonConflictingDoc.class).getMetamodel();
MappingAttribute<?, ?> mappingAttribute = (MappingAttribute<?, ?>) metamodel.view(NoMappingNonConflictingDoc.class).getAttribute("name");
assertEquals("COALESCE(name, '')", mappingAttribute.getMapping());
}
use of com.blazebit.persistence.view.metamodel.ViewMetamodel in project blaze-persistence by Blazebit.
the class ViewMetamodelTest method testImplicitAbstractClassMethodPreferredOverInterfaceMethod.
@Test
public void testImplicitAbstractClassMethodPreferredOverInterfaceMethod() {
ViewMetamodel metamodel = build(ImplicitAbstractClassMethodPreferredOverInterfaceMethod.class).getMetamodel();
MethodAttribute<?, ?> methodAttribute = metamodel.view(ImplicitAbstractClassMethodPreferredOverInterfaceMethod.class).getAttribute("name");
assertEquals(ImplicitAbstractClassMethodPreferredOverInterfaceMethodAbstractClass.class, methodAttribute.getJavaMethod().getDeclaringClass());
}
use of com.blazebit.persistence.view.metamodel.ViewMetamodel in project blaze-persistence by Blazebit.
the class ViewMetamodelTest method testMappingParameterClassView.
@Test
public void testMappingParameterClassView() throws Exception {
ViewMetamodel viewMetamodel = getViewMetamodel();
ViewType<?> viewType = viewMetamodel.view(DocumentViewAbstractClass.class);
MethodAttribute<?, ?> attribute = viewType.getAttribute("contactPersonNumber2");
assertNotNull(attribute);
assertEquals("contactPersonNumber2", attribute.getName());
assertFalse(attribute.isSubquery());
assertEquals("contactPersonNumber", ((MappingAttribute<?, ?>) attribute).getMapping());
assertFalse(attribute.isCollection());
assertTrue(((SingularAttribute<?, ?>) attribute).isQueryParameter());
assertEquals(Integer.class, attribute.getJavaType());
assertEquals(DocumentViewInterface.class.getMethod("getContactPersonNumber2"), attribute.getJavaMethod());
assertEquals(viewType, attribute.getDeclaringType());
}
use of com.blazebit.persistence.view.metamodel.ViewMetamodel in project blaze-persistence by Blazebit.
the class ViewMetamodelTest method testMappingParameterInterfaceView.
@Test
public void testMappingParameterInterfaceView() throws Exception {
ViewMetamodel viewMetamodel = getViewMetamodel();
ViewType<?> viewType = viewMetamodel.view(DocumentViewInterface.class);
MethodAttribute<?, ?> attribute = viewType.getAttribute("contactPersonNumber2");
assertNotNull(attribute);
assertEquals("contactPersonNumber2", attribute.getName());
assertFalse(attribute.isSubquery());
assertEquals("contactPersonNumber", ((MappingAttribute<?, ?>) attribute).getMapping());
assertFalse(attribute.isCollection());
assertTrue(((SingularAttribute<?, ?>) attribute).isQueryParameter());
assertEquals(Integer.class, attribute.getJavaType());
assertEquals(DocumentViewInterface.class.getMethod("getContactPersonNumber2"), attribute.getJavaMethod());
assertEquals(viewType, attribute.getDeclaringType());
}
use of com.blazebit.persistence.view.metamodel.ViewMetamodel in project blaze-persistence by Blazebit.
the class ViewMetamodelTest method testMappingAttributesInterfaceView.
@Test
public void testMappingAttributesInterfaceView() {
ViewMetamodel viewMetamodel = getViewMetamodel();
Set<MethodAttribute<? super DocumentViewInterface, ?>> attributes = viewMetamodel.view(DocumentViewInterface.class).getAttributes();
assertEquals(6, attributes.size());
}
Aggregations