Search in sources :

Example 51 with ResourceInformation

use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.

the class DefaultResourceInformationProviderTest method shouldHaveGetterBooleanWithGetPrefix.

@Test
public void shouldHaveGetterBooleanWithGetPrefix() throws Exception {
    ResourceInformation resourceInformation = resourceInformationProvider.build(Task.class);
    assertThat(containsFieldWithName(resourceInformation, "deleted")).isTrue();
    assertThat(containsFieldWithName(resourceInformation, "tDeleted")).isFalse();
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Test(org.junit.Test)

Example 52 with ResourceInformation

use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.

the class DefaultResourceInformationProviderTest method shouldNotIncludeIgnoredInterfaceMethod.

@Test
public void shouldNotIncludeIgnoredInterfaceMethod() throws Exception {
    ResourceInformation resourceInformation = resourceInformationProvider.build(JsonIgnoreMethodImpl.class);
    assertThat(resourceInformation.findFieldByName("ignoredMember")).isNull();
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Test(org.junit.Test)

Example 53 with ResourceInformation

use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.

the class DefaultResourceInformationProviderTest method checkWriteOnlyAttributesCurrentlyNotSupported.

@Test
public void checkWriteOnlyAttributesCurrentlyNotSupported() throws Exception {
    ResourceInformation resourceInformation = resourceInformationProvider.build(WriteOnlyAttributeResource.class);
    Assert.assertNull(resourceInformation.findAttributeFieldByName("attribute"));
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Test(org.junit.Test)

Example 54 with ResourceInformation

use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.

the class DefaultResourceInformationProviderTest method shouldIgnoreStaticAttributes.

@Test
public void shouldIgnoreStaticAttributes() throws Exception {
    ResourceInformation resourceInformation = resourceInformationProvider.build(IgnoredStaticAttributeResource.class);
    Assert.assertNull(resourceInformation.findFieldByName("attribute"));
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Test(org.junit.Test)

Example 55 with ResourceInformation

use of io.crnk.core.engine.information.resource.ResourceInformation in project crnk-framework by crnk-project.

the class DefaultResourceInformationProviderTest method shouldHaveNoneForDefaultLookupBehavior.

@Test
public void shouldHaveNoneForDefaultLookupBehavior() throws Exception {
    ResourceInformation resourceInformation = resourceInformationProvider.build(JsonResourceWithDefaultLookupBehaviorRelationship.class);
    assertThat(resourceInformation.getRelationshipFields()).extracting("lookupIncludeBehavior").contains(LookupIncludeBehavior.NONE);
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Test(org.junit.Test)

Aggregations

ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)167 Test (org.junit.Test)79 ResourceField (io.crnk.core.engine.information.resource.ResourceField)76 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)60 QuerySpec (io.crnk.core.queryspec.QuerySpec)16 Resource (io.crnk.core.engine.document.Resource)15 ResourceRegistry (io.crnk.core.engine.registry.ResourceRegistry)15 QueryAdapter (io.crnk.core.engine.query.QueryAdapter)9 Task (io.crnk.core.mock.models.Task)9 JsonApiResponse (io.crnk.core.repository.response.JsonApiResponse)9 HashSet (java.util.HashSet)9 Collection (java.util.Collection)8 Relationship (io.crnk.core.engine.document.Relationship)7 HttpMethod (io.crnk.core.engine.http.HttpMethod)7 ResourceRepositoryAdapter (io.crnk.core.engine.internal.repository.ResourceRepositoryAdapter)7 QuerySpecAdapter (io.crnk.core.queryspec.internal.QuerySpecAdapter)7 OffsetLimitPagingBehavior (io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior)7 DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)7 Set (java.util.Set)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6