Search in sources :

Example 6 with CrnkClient

use of io.crnk.client.CrnkClient in project crnk-framework by crnk-project.

the class ClientStubBaseTest method setup.

@Before
public void setup() {
    client = new CrnkClient("http://x");
    SimpleModule module = new SimpleModule("test");
    module.addExceptionMapper(new CheckedExceptionMapper());
    client.addModule(module);
    urlBuilder = Mockito.mock(JsonApiUrlBuilder.class);
    stub = new ClientStubBase(client, urlBuilder, Task.class);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.test.mock.models.Task) JsonApiUrlBuilder(io.crnk.core.engine.internal.utils.JsonApiUrlBuilder) SimpleModule(io.crnk.core.module.SimpleModule) Before(org.junit.Before)

Example 7 with CrnkClient

use of io.crnk.client.CrnkClient in project crnk-framework by crnk-project.

the class AbstractValidationTest method setup.

@Before
public void setup() {
    client = new CrnkClient(getBaseUri().toString());
    client.addModule(ValidationModule.newInstance());
    taskRepo = client.getQueryParamsRepository(Task.class);
    projectRepo = client.getQueryParamsRepository(Project.class);
    relRepo = client.getQueryParamsRepository(Task.class, Project.class);
    TaskRepository.map.clear();
    client.getHttpAdapter().setReceiveTimeout(1000000, TimeUnit.MILLISECONDS);
}
Also used : Project(io.crnk.validation.mock.models.Project) CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.validation.mock.models.Task) Before(org.junit.Before)

Example 8 with CrnkClient

use of io.crnk.client.CrnkClient in project crnk-framework by crnk-project.

the class SleuthModuleTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    RestTemplateAdapter httpAdapter = new RestTemplateAdapter();
    client = new CrnkClient(getBaseUri().toString());
    client.setHttpAdapter(httpAdapter);
    taskRepo = client.getRepositoryForType(Task.class);
    projectRepo = client.getRepositoryForType(Project.class);
    TaskRepository.clear();
    ProjectRepository.clear();
    httpAdapter.setReceiveTimeout(10000, TimeUnit.SECONDS);
}
Also used : Project(io.crnk.test.mock.models.Project) CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.test.mock.models.Task) RestTemplateAdapter(io.crnk.spring.client.RestTemplateAdapter) Before(org.junit.Before)

Example 9 with CrnkClient

use of io.crnk.client.CrnkClient in project crnk-framework by crnk-project.

the class RestTemplateClientTest method setupClient.

@Before
public void setupClient() {
    client = new CrnkClient("http://127.0.0.1:" + port + "/api");
    client.findModules();
    RestTemplateAdapter adapter = RestTemplateAdapter.newInstance();
    adapter.setReceiveTimeout(30000, TimeUnit.MILLISECONDS);
    listener = Mockito.mock(RestTemplateAdapterListener.class);
    adapter.addListener(listener);
    adapter.addListener(new RestTemplateAdapterListenerBase());
    adapter.getImplementation().setRequestFactory(new OkHttp3ClientHttpRequestFactory());
    client.setHttpAdapter(adapter);
    scheduleRepo = client.getRepositoryForType(Schedule.class);
    taskRepo = client.getRepositoryForType(Task.class);
    projectRepo = client.getRepositoryForType(Project.class);
    relRepo = client.getRepositoryForType(Task.class, Project.class);
    scheduleTaskRepo = client.getRepositoryForType(Schedule.class, Task.class);
    taskScheduleRepo = client.getRepositoryForType(Task.class, Schedule.class);
    TestModule.clear();
}
Also used : OkHttp3ClientHttpRequestFactory(org.springframework.http.client.OkHttp3ClientHttpRequestFactory) Project(io.crnk.test.mock.models.Project) CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.test.mock.models.Task) Schedule(io.crnk.test.mock.models.Schedule) Before(org.junit.Before)

Example 10 with CrnkClient

use of io.crnk.client.CrnkClient in project crnk-framework by crnk-project.

the class ClientModuleFactoryTest method shouldDiscoverModules.

@Test
public void shouldDiscoverModules() {
    CrnkClient client = new CrnkClient("http://something");
    client.findModules();
    List<Module> modules = client.getModuleRegistry().getModules();
    Assert.assertEquals(3, modules.size());
    Assert.assertEquals(ClientModule.class, modules.get(0).getClass());
    Assert.assertEquals(JacksonModule.class, modules.get(1).getClass());
    Assert.assertEquals(ClientTestModule.class, modules.get(2).getClass());
}
Also used : CrnkClient(io.crnk.client.CrnkClient) JacksonModule(io.crnk.core.engine.internal.jackson.JacksonModule) Module(io.crnk.core.module.Module) Test(org.junit.Test)

Aggregations

CrnkClient (io.crnk.client.CrnkClient)15 Before (org.junit.Before)11 Task (io.crnk.test.mock.models.Task)3 ClientDocumentMapper (io.crnk.client.internal.ClientDocumentMapper)2 JacksonModule (io.crnk.core.engine.internal.jackson.JacksonModule)2 Module (io.crnk.core.module.Module)2 MetaModule (io.crnk.meta.MetaModule)2 ResourceMetaProvider (io.crnk.meta.provider.resource.ResourceMetaProvider)2 Project (io.crnk.test.mock.models.Project)2 Schedule (io.crnk.test.mock.models.Schedule)2 Test (org.junit.Test)2 Tracing (brave.Tracing)1 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)1 ApproveForm (io.crnk.activiti.example.model.ApproveForm)1 ApproveTask (io.crnk.activiti.example.model.ApproveTask)1 ScheduleApprovalProcessInstance (io.crnk.activiti.example.model.ScheduleApprovalProcessInstance)1 HttpAdapter (io.crnk.client.http.HttpAdapter)1 Document (io.crnk.core.engine.document.Document)1 DocumentMapper (io.crnk.core.engine.internal.document.mapper.DocumentMapper)1 JsonApiUrlBuilder (io.crnk.core.engine.internal.utils.JsonApiUrlBuilder)1