Search in sources :

Example 1 with CrnkClient

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

the class SecurityModuleIntTest method setup.

@Before
public void setup() {
    identityManager.clear();
    client = new CrnkClient(getBaseUri().toString());
    client.addModule(SecurityModule.newClientModule());
    client.setPushAlways(false);
    client.getHttpAdapter().setReceiveTimeout(1000000, TimeUnit.MILLISECONDS);
    taskRepo = client.getRepositoryForType(Task.class);
    projectRepo = client.getRepositoryForType(Project.class);
    relRepo = client.getRepositoryForType(Task.class, Project.class);
    setBasicAuthentication(client, "doe", "doePass");
    TaskRepository.clear();
    ProjectRepository.clear();
}
Also used : Project(io.crnk.security.model.Project) CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.security.model.Task) Before(org.junit.Before)

Example 2 with CrnkClient

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

the class BaseTest method before.

@Before
public final void before() {
    RestAssured.port = port;
    loadJsonApiSchema();
    client = new CrnkClient("http://localhost:" + port + "/api");
    client.addModule(ValidationModule.newInstance());
    client.addModule(JpaModule.newClientModule());
}
Also used : CrnkClient(io.crnk.client.CrnkClient) Before(org.junit.Before)

Example 3 with CrnkClient

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

the class AbstractJpaJerseyTest method setup.

@Before
public void setup() {
    client = new CrnkClient(getBaseUri().toString());
    client.setPushAlways(false);
    JpaModule module = JpaModule.newClientModule();
    setupModule(module, false);
    client.addModule(module);
    MetaModule clientMetaModule = MetaModule.create();
    clientMetaModule.addMetaProvider(new ResourceMetaProvider());
    client.addModule(clientMetaModule);
    metaModule.getLookup().initialize();
    setNetworkTimeout(client, 10000, TimeUnit.SECONDS);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) MetaModule(io.crnk.meta.MetaModule) Before(org.junit.Before)

Example 4 with CrnkClient

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

the class ClientModuleFactoryTest method shouldDiscoverObjectLinkModules.

@Test
public void shouldDiscoverObjectLinkModules() {
    CrnkClient client = new CrnkClient("http://something", CrnkClient.ClientType.OBJECT_LINKS);
    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)

Example 5 with CrnkClient

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

the class ApprovalIntTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    client = new CrnkClient(getBaseUri().toString());
    client.getObjectMapper().registerModule(new JavaTimeModule());
    HttpAdapter httpAdapter = client.getHttpAdapter();
    httpAdapter.setReceiveTimeout(10000, TimeUnit.SECONDS);
    scheduleRepo = client.getRepositoryForInterface(ScheduleRepository.class);
    approvalRepo = client.getRepositoryForType(ScheduleApprovalProcessInstance.class);
    processTaskRepo = client.getRepositoryForType(ScheduleApprovalProcessInstance.class, ApproveTask.class);
    taskRepo = client.getRepositoryForType(ApproveTask.class);
    approvalRelRepo = client.getRepositoryForType(Schedule.class, ScheduleApprovalProcessInstance.class);
    formRepo = client.getRepositoryForType(ApproveForm.class);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) HttpAdapter(io.crnk.client.http.HttpAdapter) JavaTimeModule(com.fasterxml.jackson.datatype.jsr310.JavaTimeModule) Schedule(io.crnk.test.mock.models.Schedule) ScheduleRepository(io.crnk.test.mock.repository.ScheduleRepository) ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) ApproveForm(io.crnk.activiti.example.model.ApproveForm) ApproveTask(io.crnk.activiti.example.model.ApproveTask) Before(org.junit.Before)

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