use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class HostResourceTest method returns_200_on_success.
@Test
public void returns_200_on_success() {
HostResource hostResource = new HostResource(alwaysAllowOrchestrator, uriInfo);
final String hostName = "hostname";
UpdateHostResponse response = hostResource.suspend(hostName);
assertThat(response.hostname()).isEqualTo(hostName);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class HostResource method webExceptionWithDenialReason.
private static WebApplicationException webExceptionWithDenialReason(String operationDescription, HostName hostName, HostStateChangeDeniedException e) {
HostStateChangeDenialReason hostStateChangeDenialReason = new HostStateChangeDenialReason(e.getConstraintName(), operationDescription + " failed: " + e.getMessage());
UpdateHostResponse response = new UpdateHostResponse(hostName.s(), hostStateChangeDenialReason);
return new WebApplicationException(hostStateChangeDenialReason.toString(), e, Response.status(Response.Status.CONFLICT).entity(response).type(MediaType.APPLICATION_JSON_TYPE).build());
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class OrchestratorImplTest method testResumeCall.
@Test
public void testResumeCall() {
when(configServerApi.delete(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended", UpdateHostResponse.class)).thenReturn(new UpdateHostResponse(hostName, null));
orchestrator.resume(hostName);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class OrchestratorImplTest method testSuspendCallWithFailureReason.
@Test(expected = OrchestratorException.class)
public void testSuspendCallWithFailureReason() {
when(configServerApi.put(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended", Optional.empty(), UpdateHostResponse.class)).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "fail")));
orchestrator.suspend(hostName);
}
use of com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse in project vespa by vespa-engine.
the class OrchestratorImplTest method testSuspendCall.
@Test
public void testSuspendCall() {
when(configServerApi.put(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName + "/suspended", Optional.empty(), UpdateHostResponse.class)).thenReturn(new UpdateHostResponse(hostName, null));
orchestrator.suspend(hostName);
}
Aggregations