use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldIgnoreCustomGetNamedMethods.
@Test
public void shouldIgnoreCustomGetNamedMethods() {
ResourceInformation resourceInformation = resourceInformationProvider.build(JsonApiRelationTypeCustomGetMethod.class);
assertNull(resourceInformation.getRelationshipFields().get(0).getIdType());
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldOverrideGlobalLookupBehavior.
@Test
public void shouldOverrideGlobalLookupBehavior() throws Exception {
ResourceInformationProvider resourceInformationProviderWithProperty = getResourceInformationProviderWithProperty(CrnkProperties.INCLUDE_AUTOMATICALLY_OVERWRITE, "true");
ResourceInformation resourceInformation = resourceInformationProviderWithProperty.build(JsonResourceWithOverrideLookupBehaviorRelationship.class);
// Global says automatically always, but relationship says only when null.
// Relationship annotation should win in this case.
assertThat(resourceInformation.getRelationshipFields()).extracting("lookupIncludeBehavior").contains(LookupIncludeBehavior.AUTOMATICALLY_WHEN_NULL);
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldHaveIdFieldInfoForValidResource.
@Test
public void shouldHaveIdFieldInfoForValidResource() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
assertThat(resourceInformation.getIdField().getUnderlyingName()).isNotNull().isEqualTo("id");
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldRecognizeJsonAPIRelationTypeWithDefaults.
@Test
public void shouldRecognizeJsonAPIRelationTypeWithDefaults() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(JsonApiRelationType.class);
assertThat(resourceInformation.getRelationshipFields()).isNotEmpty().hasSize(2).extracting("type").contains(Future.class).contains(Collection.class);
assertThat(resourceInformation.getRelationshipFields()).extracting("serializeType").contains(SerializeType.LAZY, SerializeType.LAZY);
assertThat(resourceInformation.getRelationshipFields()).extracting("lookupIncludeBehavior").contains(LookupIncludeBehavior.NONE, LookupIncludeBehavior.NONE);
assertThat(resourceInformation.getRelationshipFields()).extracting("resourceFieldType").contains(ResourceFieldType.RELATIONSHIP, ResourceFieldType.RELATIONSHIP);
}
use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.
the class DefaultResourceInformationProviderTest method shouldThrowExceptionOnMultipleMetaInformationFields.
@Test
public void shouldThrowExceptionOnMultipleMetaInformationFields() throws Exception {
ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
assertThat(resourceInformation.getMetaField().getUnderlyingName()).isEqualTo("metaInformation");
}
Aggregations