project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.txt"), new ByteArrayInputStream(
"hello, world".getBytes()));
// verify that file is created
final RepositoryAccessor repo = new RepositoryAccessor(config);
Poller poller = new Poller();
poller.pollUntil(new Callable<Void>() {
@Override
public Void call() throws HttpException, IOException {
repo.assertGetIsSuccessful("test/hello.txt", "hello, world");
return null;
}
}, nullValue(Void.class));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.txt"), new ByteArrayInputStream(
"goodbye, world".getBytes()));
// verify that file is updated
poller.pollUntil(new Callable<Void>() {
@Override
public Void call() throws HttpException, IOException {
repo.assertGetIsSuccessful("test/hello.txt", "goodbye, world");
return null;
}
}, nullValue(Void.class));
project.deleteMember(Path.fromPortableString("jcr_root/test/hello.txt"));
// verify that file is deleted
poller.pollUntil(new Callable<Void>() {
@Override
public Void call() throws HttpException, IOException {
repo.assertGetReturns404("test/hello.txt");
return null;
}