Search in sources :

Example 1 with SearchRequest

use of webpiecesxxxxxpackage.json.SearchRequest in project webpieces by deanhiller.

the class TestLesson8JsonHttp2 method testSynchronousController.

/**
 * Testing a synchronous controller may be easier especially if there is no remote communication.
 */
@Test
public void testSynchronousController() {
    SearchRequest req = new SearchRequest();
    req.setQuery("my query");
    SearchResponse resp = search(req);
    Assert.assertEquals("match1", resp.getMatches().get(0));
    // check metrics are wired correctly here as well
    RequiredSearch result = metrics.get("testCounter");
    Counter counter = result.counter();
    Assert.assertEquals(1.0, counter.count(), 0.1);
}
Also used : SearchRequest(webpiecesxxxxxpackage.json.SearchRequest) Counter(io.micrometer.core.instrument.Counter) RequiredSearch(io.micrometer.core.instrument.search.RequiredSearch) SearchResponse(webpiecesxxxxxpackage.json.SearchResponse) AbstractHttp2Test(org.webpieces.webserver.test.http2.AbstractHttp2Test) Test(org.junit.Test)

Example 2 with SearchRequest

use of webpiecesxxxxxpackage.json.SearchRequest in project webpieces by deanhiller.

the class Requests method createSearchRequest.

public static SearchRequest createSearchRequest() {
    SearchRequest req = new SearchRequest();
    req.setQuery("my query");
    return req;
}
Also used : SearchRequest(webpiecesxxxxxpackage.json.SearchRequest)

Aggregations

SearchRequest (webpiecesxxxxxpackage.json.SearchRequest)2 Counter (io.micrometer.core.instrument.Counter)1 RequiredSearch (io.micrometer.core.instrument.search.RequiredSearch)1 Test (org.junit.Test)1 AbstractHttp2Test (org.webpieces.webserver.test.http2.AbstractHttp2Test)1 SearchResponse (webpiecesxxxxxpackage.json.SearchResponse)1