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);
}
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);
}
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);
}
Aggregations