Search in sources :

Example 1 with ResourcePath

use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.

the class FieldResourcePostTest method onNonRelationRequestShouldDenyIt.

@Test
public void onNonRelationRequestShouldDenyIt() {
    // GIVEN
    JsonPath jsonPath = new ResourcePath("tasks");
    ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
    FieldResourcePost sut = new FieldResourcePost(resourceRegistry, PROPERTIES_PROVIDER, typeParser, objectMapper, documentMapper, modificationFilters);
    // WHEN
    boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
    // THEN
    assertThat(result).isFalse();
}
Also used : ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) ResourceRegistry(io.crnk.core.engine.registry.ResourceRegistry) JsonPath(io.crnk.core.engine.internal.dispatcher.path.JsonPath) FieldResourcePost(io.crnk.core.engine.internal.dispatcher.controller.FieldResourcePost) BaseControllerTest(io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest) Test(org.junit.Test)

Example 2 with ResourcePath

use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.

the class ResourcePatchTest method onNoBodyResourceShouldThrowException.

@Test
public void onNoBodyResourceShouldThrowException() throws Exception {
    // GIVEN
    ResourcePost sut = new ResourcePost(resourceRegistry, PROPERTIES_PROVIDER, typeParser, objectMapper, documentMapper, modificationFilters);
    // THEN
    expectedException.expect(RuntimeException.class);
    // WHEN
    sut.handle(new ResourcePath("fridges"), emptyProjectQuery, null, null);
}
Also used : ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) ResourcePost(io.crnk.core.engine.internal.dispatcher.controller.ResourcePost) BaseControllerTest(io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest) Test(org.junit.Test)

Example 3 with ResourcePath

use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.

the class FieldResourceGetTest method onNonRelationRequestShouldDenyIt.

@Test
public void onNonRelationRequestShouldDenyIt() {
    // GIVEN
    JsonPath jsonPath = new ResourcePath("tasks");
    ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
    FieldResourceGet sut = new FieldResourceGet(resourceRegistry, typeParser, documentMapper);
    // WHEN
    boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
    // THEN
    assertThat(result).isFalse();
}
Also used : ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) FieldResourceGet(io.crnk.core.engine.internal.dispatcher.controller.FieldResourceGet) ResourceRegistry(io.crnk.core.engine.registry.ResourceRegistry) JsonPath(io.crnk.core.engine.internal.dispatcher.path.JsonPath) BaseControllerTest(io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest) Test(org.junit.Test)

Example 4 with ResourcePath

use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.

the class FieldResourceGetTest method onRelationshipRequestShouldDenyIt.

@Test
public void onRelationshipRequestShouldDenyIt() {
    // GIVEN
    JsonPath jsonPath = new ResourcePath("tasks/1/relationships/project");
    ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
    FieldResourceGet sut = new FieldResourceGet(resourceRegistry, typeParser, documentMapper);
    // WHEN
    boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
    // THEN
    assertThat(result).isFalse();
}
Also used : ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) FieldResourceGet(io.crnk.core.engine.internal.dispatcher.controller.FieldResourceGet) ResourceRegistry(io.crnk.core.engine.registry.ResourceRegistry) JsonPath(io.crnk.core.engine.internal.dispatcher.path.JsonPath) BaseControllerTest(io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest) Test(org.junit.Test)

Example 5 with ResourcePath

use of io.crnk.core.engine.internal.dispatcher.path.ResourcePath in project crnk-framework by crnk-project.

the class RelationshipsResourcePatchTest method onNonRelationRequestShouldDenyIt.

@Test
public void onNonRelationRequestShouldDenyIt() {
    // GIVEN
    JsonPath jsonPath = new ResourcePath("tasks");
    ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
    RelationshipsResourcePatch sut = new RelationshipsResourcePatch(resourceRegistry, typeParser, modificationFilters);
    // WHEN
    boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE);
    // THEN
    assertThat(result).isFalse();
}
Also used : ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) RelationshipsResourcePatch(io.crnk.core.engine.internal.dispatcher.controller.RelationshipsResourcePatch) ResourceRegistry(io.crnk.core.engine.registry.ResourceRegistry) JsonPath(io.crnk.core.engine.internal.dispatcher.path.JsonPath) BaseControllerTest(io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest) Test(org.junit.Test)

Aggregations

ResourcePath (io.crnk.core.engine.internal.dispatcher.path.ResourcePath)15 Test (org.junit.Test)15 BaseControllerTest (io.crnk.core.engine.internal.dispatcher.controller.BaseControllerTest)14 JsonPath (io.crnk.core.engine.internal.dispatcher.path.JsonPath)10 ResourceRegistry (io.crnk.core.engine.registry.ResourceRegistry)10 ResourcePost (io.crnk.core.engine.internal.dispatcher.controller.ResourcePost)4 FieldResourceGet (io.crnk.core.engine.internal.dispatcher.controller.FieldResourceGet)2 FieldResourcePost (io.crnk.core.engine.internal.dispatcher.controller.FieldResourcePost)2 RelationshipsResourceGet (io.crnk.core.engine.internal.dispatcher.controller.RelationshipsResourceGet)2 Document (io.crnk.core.engine.document.Document)1 Resource (io.crnk.core.engine.document.Resource)1 ResourceFilterDirectory (io.crnk.core.engine.filter.ResourceFilterDirectory)1 ResourceModificationFilter (io.crnk.core.engine.filter.ResourceModificationFilter)1 ControllerRegistry (io.crnk.core.engine.internal.dispatcher.ControllerRegistry)1 ControllerRegistryBuilder (io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder)1 RelationshipsResourceDelete (io.crnk.core.engine.internal.dispatcher.controller.RelationshipsResourceDelete)1 RelationshipsResourcePatch (io.crnk.core.engine.internal.dispatcher.controller.RelationshipsResourcePatch)1 RelationshipsResourcePost (io.crnk.core.engine.internal.dispatcher.controller.RelationshipsResourcePost)1 ResourceDelete (io.crnk.core.engine.internal.dispatcher.controller.ResourceDelete)1 PropertiesProvider (io.crnk.core.engine.properties.PropertiesProvider)1