use of org.qi4j.library.rest.client.api.ContextResourceClient in project qi4j-sdk by Qi4j.
the class ContextResourceClientFactoryTest method testQueryListAndCommandProgressive.
@Test
public void testQueryListAndCommandProgressive() {
//START SNIPPET: query-list-and-command-progressive
crc.onResource(new ResultHandler<Resource>() {
@Override
public HandlerCommand handleResult(Resource result, ContextResourceClient client) {
return query("commandwithvalue").onSuccess(new ResultHandler<Links>() {
@Override
public HandlerCommand handleResult(Links result, ContextResourceClient client) {
Link link = LinksUtil.withId("right", result);
return command(link).onSuccess(new ResponseHandler() {
@Override
public HandlerCommand handleResponse(Response response, ContextResourceClient client) {
System.out.println("Done");
return null;
}
});
}
});
}
});
crc.start();
//END SNIPPET: query-list-and-command-progressive
}
use of org.qi4j.library.rest.client.api.ContextResourceClient in project qi4j-sdk by Qi4j.
the class ContinuousIntegrationTest method testRunBuild.
@Test
public void testRunBuild() {
//START SNIPPET: query-list-and-command
crc.onResource(new ResultHandler<Resource>() {
@Override
public HandlerCommand handleResult(Resource result, ContextResourceClient client) {
return query("runbuild");
}
}).onQuery("runbuild", new ResultHandler<Links>() {
@Override
public HandlerCommand handleResult(Links result, ContextResourceClient client) {
Link link = LinksUtil.withId("any", result);
return command(link);
}
}).onCommand("runbuild", new ResponseHandler() {
@Override
public HandlerCommand handleResponse(Response response, ContextResourceClient client) {
System.out.println("Done");
return null;
}
});
crc.start();
//END SNIPPET: query-list-and-command
}
Aggregations