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);
}
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);
}
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);
}
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();
}
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());
}
Aggregations