Example usage for org.springframework.http HttpStatus OK

List of usage examples for org.springframework.http HttpStatus OK

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus OK.

Prototype

HttpStatus OK

To view the source code for org.springframework.http HttpStatus OK.

Click Source Link

Document

200 OK .

Usage

From source file:com.company.eleave.leave.rest.TestLeaveTypeController.java

@Test
public void testGetAll() {
    //given/*from ww w .j av a 2 s.c o m*/
    Mockito.when(leaveTypeServiceMock.getAll())
            .thenReturn(Lists.newArrayList(new LeaveType(), new LeaveType()));

    //when
    ResponseEntity<List<LeaveTypeDTO>> result = testedObject.getAll();

    //then
    Assert.assertEquals(HttpStatus.OK, result.getStatusCode());
    Assert.assertEquals(2, result.getBody().size());
}

From source file:com.trafficfine.controller.TrafficFineController.java

/**
 * //from   ww  w.  ja  va 2s. c  o m
 * @param initialDate
 * @param finalDate
 * @return
 */
@RequestMapping(value = "/api/infracao/busca", method = RequestMethod.GET)
public ResponseEntity<List<Infraction>> listAllTrafficFine(
        @RequestParam(value = "dataInicial") @DateTimeFormat(pattern = "dd/MM/yy") Date dataInicial,
        @RequestParam(value = "dataFinal") @DateTimeFormat(pattern = "dd/MM/yy") Date dataFinal) {
    List<Infraction> infractions = this.trafficFineService.findByRange(dataInicial, dataFinal);
    if (infractions.isEmpty()) {
        return new ResponseEntity<List<Infraction>>(HttpStatus.NO_CONTENT);
    }
    return new ResponseEntity<List<Infraction>>(infractions, HttpStatus.OK);
}

From source file:com.consol.citrus.samples.bakery.ReportSummaryIT.java

@CitrusTest
public void getHtmlReport() {
    echo("Receive Html report");

    http().client(reportingClient).send().get("/reporting");

    http().client(reportingClient).receive().response(HttpStatus.OK).messageType("xhtml").payload(
            "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"org/w3/xhtml/xhtml1-strict.dtd\">\n"
                    + "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + "<head>\n" + "<title></title>\n"
                    + "</head>\n" + "<body>\n" + "<h1>Camel bakery reporting</h1>\n"
                    + "<p>Today we have produced following goods:</p>\n" + "<ul>\n"
                    + "<li>@startsWith('chocolate:')@</li>\n" + "<li>@startsWith('caramel:')@</li>\n"
                    + "<li>@startsWith('blueberry:')@</li>\n" + "</ul>"
                    + "<p><a href=\"reporting/orders\">Show orders</a></p>" + "</body>" + "</html>")
            .build();//from ww w . j  a va  2  s  . co m
}

From source file:com.consol.citrus.samples.todolist.TodoListLoadTestIT.java

@Parameters({ "designer" })
@CitrusTest/*from  w  w w.  j av  a  2  s . com*/
public void testListTodos(@Optional @CitrusResource TestDesigner designer) {
    designer.http().client(todoClient).send().get("/todolist").accept("text/html");

    designer.http().client(todoClient).receive().response(HttpStatus.OK);
}

From source file:com.opensearchserver.hadse.RootController.java

@RequestMapping(method = RequestMethod.GET, value = "/")
@ResponseBody/*ww w .  j av a 2s .  co m*/
public HttpEntity<RootResponse> home() {

    return new ResponseEntity<RootResponse>(new RootResponse(), HttpStatus.OK);
}

From source file:sample.tomcat.jndi.SampleTomcatJndiApplicationTests.java

@Test
public void testDirect() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate()
            .getForEntity("http://localhost:" + this.port + "/direct", String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertThat(entity.getBody(), containsString(BasicDataSource.class.getName()));
}

From source file:com.ar.dev.tierra.api.controller.DetalleTransferenciaController.java

@RequestMapping(value = "/trans", method = RequestMethod.GET)
public ResponseEntity<?> getByTransferencia(@RequestParam("idTransferencia") int idTransferencia) {
    List<DetalleTransferencia> list = facadeService.getDetalleTransferenciaDAO()
            .getByTransferencia(idTransferencia);
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from www.j  ava2 s  . com*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.consol.citrus.samples.bakery.ProcessOrdersIT.java

@CitrusTest
public void processOrderWithReporting() {
    variable("orderId", Functions.randomNumber(10L, null));

    send(factoryOrderEndpoint)/*from www.  j a v a2s . c  o m*/
            .payload("<order><type>chocolate</type><id>${orderId}</id><amount>1</amount></order>");

    http().server(reportingServer).receive().put("/report/services/reporting").header("id", "${orderId}")
            .header("name", "chocolate").header("amount", "1").timeout(10000L);

    http().server(reportingServer).respond(HttpStatus.OK);
}

From source file:hello.TodoController.java

@RequestMapping(method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<Iterable<Todo>> list() {
    HttpHeaders headers = new HttpHeaders();
    headers.add("Accept-Patch", "application/json-patch+json");
    return new ResponseEntity<Iterable<Todo>>(repository.findAll(), headers, HttpStatus.OK);
}

From source file:com.consol.citrus.demo.devoxx.ProcessOrdersIT.java

@CitrusTest
public void processOrderWithReporting() {
    variable("orderId", Functions.randomNumber(10L));

    send(factoryOrderEndpoint).payload(/*  w  ww.  j av a 2s. c  om*/
            "<order>" + "<type>chocolate</type>" + "<id>${orderId}</id>" + "<amount>1</amount>" + "</order>");

    http().server(reportingServer).put("/report/services/reporting").header("id", "${orderId}")
            .header("name", "chocolate").header("amount", "1").timeout(10000L);

    http().server(reportingServer).respond(HttpStatus.OK);
}