use of io.crnk.operations.client.OperationsClient in project crnk-framework by crnk-project.
the class OperationsExceptionTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
operationsClient = new OperationsClient(client);
}
use of io.crnk.operations.client.OperationsClient in project crnk-framework by crnk-project.
the class OperationsPostTest method testMultiplePost.
@Test
public void testMultiplePost() {
ResourceRepositoryV2<PersonEntity, UUID> personRepo = client.getRepositoryForType(PersonEntity.class);
PersonEntity person1 = newPerson("1");
PersonEntity person2 = newPerson("2");
MovieEntity movie = newMovie("test");
movie.setDirectors(new HashSet<>(Arrays.asList(person1, person2)));
// tag::client[]
OperationsClient operationsClient = new OperationsClient(client);
OperationsCall call = operationsClient.createCall();
call.add(HttpMethod.POST, movie);
call.add(HttpMethod.POST, person1);
call.add(HttpMethod.POST, person2);
call.execute();
// end::client[]
QuerySpec querySpec = new QuerySpec(PersonEntity.class);
ResourceList<PersonEntity> persons = personRepo.findAll(querySpec);
Assert.assertEquals(2, persons.size());
querySpec = new QuerySpec(MovieEntity.class);
querySpec.includeRelation(Arrays.asList("directors"));
ResourceList<MovieEntity> movies = movieRepo.findAll(querySpec);
Assert.assertEquals(1, movies.size());
movie = movies.get(0);
Assert.assertEquals(2, movie.getDirectors().size());
}
use of io.crnk.operations.client.OperationsClient in project crnk-framework by crnk-project.
the class OperationsDeleteRelationTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
movieRepo = client.getRepositoryForType(MovieEntity.class);
operationsClient = new OperationsClient(client);
}
use of io.crnk.operations.client.OperationsClient in project crnk-framework by crnk-project.
the class OperationsSingleEntityTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
movieRepo = client.getRepositoryForType(MovieEntity.class);
operationsClient = new OperationsClient(client);
}
Aggregations