Search in sources :

Example 1 with PatchHostRequest

use of com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest in project vespa by vespa-engine.

the class HostResourceTest method patch_works.

@Test
public void patch_works() throws OrchestrationException {
    Orchestrator orchestrator = mock(Orchestrator.class);
    HostResource hostResource = new HostResource(orchestrator, uriInfo);
    String hostNameString = "hostname";
    PatchHostRequest request = new PatchHostRequest();
    request.state = "NO_REMARKS";
    PatchHostResponse response = hostResource.patch(hostNameString, request);
    assertEquals(response.description, "ok");
    verify(orchestrator, times(1)).setNodeStatus(new HostName(hostNameString), HostStatus.NO_REMARKS);
}
Also used : PatchHostResponse(com.yahoo.vespa.orchestrator.restapi.wire.PatchHostResponse) PatchHostRequest(com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest) Orchestrator(com.yahoo.vespa.orchestrator.Orchestrator) HostName(com.yahoo.vespa.applicationmodel.HostName) Test(org.junit.Test)

Example 2 with PatchHostRequest

use of com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest in project vespa by vespa-engine.

the class HostResourceTest method patch_state_may_throw_bad_request.

@Test(expected = BadRequestException.class)
public void patch_state_may_throw_bad_request() {
    Orchestrator orchestrator = mock(Orchestrator.class);
    HostResource hostResource = new HostResource(orchestrator, uriInfo);
    String hostNameString = "hostname";
    PatchHostRequest request = new PatchHostRequest();
    request.state = "bad state";
    hostResource.patch(hostNameString, request);
}
Also used : PatchHostRequest(com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest) Orchestrator(com.yahoo.vespa.orchestrator.Orchestrator) Test(org.junit.Test)

Example 3 with PatchHostRequest

use of com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest in project vespa by vespa-engine.

the class HostResourceTest method patch_handles_exception_in_orchestrator.

@Test(expected = InternalServerErrorException.class)
public void patch_handles_exception_in_orchestrator() throws OrchestrationException {
    Orchestrator orchestrator = mock(Orchestrator.class);
    HostResource hostResource = new HostResource(orchestrator, uriInfo);
    String hostNameString = "hostname";
    PatchHostRequest request = new PatchHostRequest();
    request.state = "NO_REMARKS";
    doThrow(new OrchestrationException("error")).when(orchestrator).setNodeStatus(new HostName(hostNameString), HostStatus.NO_REMARKS);
    hostResource.patch(hostNameString, request);
}
Also used : OrchestrationException(com.yahoo.vespa.orchestrator.OrchestrationException) PatchHostRequest(com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest) Orchestrator(com.yahoo.vespa.orchestrator.Orchestrator) HostName(com.yahoo.vespa.applicationmodel.HostName) Test(org.junit.Test)

Aggregations

Orchestrator (com.yahoo.vespa.orchestrator.Orchestrator)3 PatchHostRequest (com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest)3 Test (org.junit.Test)3 HostName (com.yahoo.vespa.applicationmodel.HostName)2 OrchestrationException (com.yahoo.vespa.orchestrator.OrchestrationException)1 PatchHostResponse (com.yahoo.vespa.orchestrator.restapi.wire.PatchHostResponse)1