use of com.yahoo.processing.Request in project vespa by vespa-engine.
the class JDiscContainerProcessingTest method requireThatBasicProcessingWorks.
@Test
public void requireThatBasicProcessingWorks() {
try (JDisc container = getContainerWithRot13()) {
Processing processing = container.processing();
Request req = new Request();
req.properties().set("title", "Good day!");
Response response = processing.process(ComponentSpecification.fromString("foo"), req);
assertThat(response.data().get(0).toString(), equalTo("Tbbq qnl!"));
}
}
use of com.yahoo.processing.Request in project vespa by vespa-engine.
the class AsynchronousSectionedRendererTest method createDataList.
public StringDataList createDataList() {
Request request = new Request();
StringDataList dataList = new StringDataList(request);
dataList.add(new StringDataItem(request, "l1"));
StringDataList secondLevel = new StringDataList(request);
secondLevel.add(new StringDataItem(request, "l11"));
secondLevel.add(new StringDataItem(request, "l12"));
dataList.add(secondLevel);
return dataList;
}
use of com.yahoo.processing.Request in project vespa by vespa-engine.
the class AsynchronousSectionedRendererTest method testEmptyProcessingRendering.
@Test
public void testEmptyProcessingRendering() throws IOException, InterruptedException {
Request request = new Request();
DataList dataList = ArrayDataList.create(request);
assertThat(render(dataList), equalTo("{\"datalist\":[" + "]}"));
}
use of com.yahoo.processing.Request in project vespa by vespa-engine.
the class AbstractProcessingHandler method handle.
@Override
@SuppressWarnings("unchecked")
public HttpResponse handle(HttpRequest request, ContentChannel channel) {
com.yahoo.processing.Request processingRequest = new com.yahoo.processing.Request();
populate("", request.propertyMap(), processingRequest.properties());
populate("context", request.getJDiscRequest().context(), processingRequest.properties());
processingRequest.properties().set(Request.JDISC_REQUEST, request);
FreezeListener freezeListener = new FreezeListener(processingRequest, renderers, defaultRenderer, channel, renderingExecutor);
processingRequest.properties().set(freezeListenerKey, freezeListener);
Chain<COMPONENT> chain = chainRegistry.getComponent(resolveChainId(processingRequest.properties()));
if (chain == null)
throw new IllegalArgumentException("Chain '" + processingRequest.properties().get("chain") + "' not found");
Execution execution = createExecution(chain, processingRequest);
freezeListener.setExecution(execution);
Response processingResponse = execution.process(processingRequest);
return freezeListener.getHttpResponse(processingResponse);
}
use of com.yahoo.processing.Request in project vespa by vespa-engine.
the class MockUserDatabaseClientTest method createRequest.
/**
* Creates a request which has an underlying jdisc request, which is needed to make the outgoing request
*/
private Request createRequest() {
com.yahoo.jdisc.http.HttpRequest jdiscRequest = HttpRequest.newServerRequest(driver, URI.create("http://localhost/"));
com.yahoo.container.jdisc.HttpRequest containerRequest = new com.yahoo.container.jdisc.HttpRequest(jdiscRequest, new ByteArrayInputStream(new byte[0]));
Request request = new Request();
request.properties().set("jdisc.request", containerRequest);
request.properties().set("timeout", 1000);
return request;
}
Aggregations