Search in sources :

Example 21 with CrnkBoot

use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.

the class DefaultQueryParamsSerializerTest method testPort.

@Test
public void testPort() {
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider("https://127.0.0.1:1234"));
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
    boot.boot();
    resourceRegistry = boot.getResourceRegistry();
    urlBuilder = new JsonApiUrlBuilder(boot.getResourceRegistry());
    check("https://127.0.0.1:1234/tasks", null, new QueryParams());
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) JsonApiUrlBuilder(io.crnk.core.engine.internal.utils.JsonApiUrlBuilder) Test(org.junit.Test)

Example 22 with CrnkBoot

use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.

the class DefaultQuerySpecSerializerTest method testHttpsSchema.

@Test
public void testHttpsSchema() {
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider("https://127.0.0.1"));
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery(String.format("%s,io.crnk.core.queryspec.pagingspec", MockConstants.TEST_MODELS_PACKAGE)));
    boot.boot();
    urlBuilder = new JsonApiUrlBuilder(boot.getResourceRegistry());
    check("https://127.0.0.1/tasks", null, new QuerySpec(Task.class));
}
Also used : Task(io.crnk.core.mock.models.Task) CrnkBoot(io.crnk.core.boot.CrnkBoot) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) JsonApiUrlBuilder(io.crnk.core.engine.internal.utils.JsonApiUrlBuilder) Test(org.junit.Test)

Example 23 with CrnkBoot

use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.

the class DefaultQuerySpecSerializerTest method testPort.

@Test
public void testPort() {
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider("https://127.0.0.1:1234"));
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery(String.format("%s,io.crnk.core.queryspec.pagingspec", MockConstants.TEST_MODELS_PACKAGE)));
    boot.boot();
    urlBuilder = new JsonApiUrlBuilder(boot.getResourceRegistry());
    check("https://127.0.0.1:1234/tasks", null, new QuerySpec(Task.class));
}
Also used : Task(io.crnk.core.mock.models.Task) CrnkBoot(io.crnk.core.boot.CrnkBoot) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) JsonApiUrlBuilder(io.crnk.core.engine.internal.utils.JsonApiUrlBuilder) Test(org.junit.Test)

Example 24 with CrnkBoot

use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.

the class ClientDocumentMapperTest method setup.

@Before
public void setup() {
    boot = new CrnkBoot();
    boot.addModule(new TestModule());
    boot.boot();
    NullPropertiesProvider properties = new NullPropertiesProvider();
    documentMapper = new ClientDocumentMapper(boot.getModuleRegistry(), boot.getObjectMapper(), properties);
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) NullPropertiesProvider(io.crnk.core.engine.properties.NullPropertiesProvider) TestModule(io.crnk.test.mock.TestModule) Before(org.junit.Before)

Example 25 with CrnkBoot

use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.

the class AbstractDocumentMapperTest method setup.

@Before
public void setup() {
    MockRepositoryUtil.clear();
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery(String.format("%s,io.crnk.core.queryspec.pagingspec", MockConstants.TEST_MODELS_PACKAGE)));
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
    boot.setPropertiesProvider(getPropertiesProvider());
    boot.boot();
    objectMapper = boot.getObjectMapper();
    moduleRegistry = boot.getModuleRegistry();
    mapper = boot.getDocumentMapper();
    resourceRegistry = boot.getResourceRegistry();
    resourceFilterDirectory = boot.getModuleRegistry().getContext().getResourceFilterDirectory();
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) Before(org.junit.Before)

Aggregations

CrnkBoot (io.crnk.core.boot.CrnkBoot)54 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)34 Before (org.junit.Before)34 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)28 Test (org.junit.Test)11 TestModule (io.crnk.test.mock.TestModule)9 SimpleModule (io.crnk.core.module.SimpleModule)7 JsonApiUrlBuilder (io.crnk.core.engine.internal.utils.JsonApiUrlBuilder)6 ResourceMetaProvider (io.crnk.meta.provider.resource.ResourceMetaProvider)6 MetaModule (io.crnk.meta.MetaModule)5 NullPropertiesProvider (io.crnk.core.engine.properties.NullPropertiesProvider)4 PropertiesProvider (io.crnk.core.engine.properties.PropertiesProvider)4 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)4 Task (io.crnk.core.mock.models.Task)4 TaskRepository (io.crnk.core.mock.repository.TaskRepository)4 QuerySpec (io.crnk.core.queryspec.QuerySpec)4 QuerySpecAdapter (io.crnk.core.queryspec.internal.QuerySpecAdapter)4 JaxrsModule (io.crnk.rs.internal.JaxrsModule)4 JsonApiExceptionMapper (io.crnk.core.engine.error.JsonApiExceptionMapper)3 HttpRequestContextProvider (io.crnk.core.engine.http.HttpRequestContextProvider)3