Search in sources :

Example 6 with RemoveDeploymentGroupResponse

use of com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse in project helios by spotify.

the class DeploymentGroupRemoveCommandTest method testRemoveDeploymentGroupRemovedJson.

@Test
public void testRemoveDeploymentGroupRemovedJson() throws Exception {
    when(client.removeDeploymentGroup(GROUP_NAME)).thenReturn(immediateFuture(new RemoveDeploymentGroupResponse(Status.REMOVED)));
    final int ret = command.run(options, client, out, true, null);
    final String output = baos.toString();
    verify(client).removeDeploymentGroup(GROUP_NAME);
    assertEquals(0, ret);
    final RemoveDeploymentGroupResponse res = Json.read(output, new TypeReference<RemoveDeploymentGroupResponse>() {
    });
    assertEquals(new RemoveDeploymentGroupResponse(Status.REMOVED), res);
}
Also used : RemoveDeploymentGroupResponse(com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse) Test(org.junit.Test)

Example 7 with RemoveDeploymentGroupResponse

use of com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse in project helios by spotify.

the class DeploymentGroupResourceTest method testRemoveNonExistingDeploymentGroup.

@Test
public void testRemoveNonExistingDeploymentGroup() throws Exception {
    doThrow(new DeploymentGroupDoesNotExistException("")).when(model).removeDeploymentGroup(anyString());
    final Response response = resource.removeDeploymentGroup("foo");
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    assertEquals(new RemoveDeploymentGroupResponse(RemoveDeploymentGroupResponse.Status.DEPLOYMENT_GROUP_NOT_FOUND), response.getEntity());
}
Also used : RemoveDeploymentGroupResponse(com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse) RollingUpdateResponse(com.spotify.helios.common.protocol.RollingUpdateResponse) CreateDeploymentGroupResponse(com.spotify.helios.common.protocol.CreateDeploymentGroupResponse) Response(javax.ws.rs.core.Response) DeploymentGroupDoesNotExistException(com.spotify.helios.master.DeploymentGroupDoesNotExistException) RemoveDeploymentGroupResponse(com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse) Test(org.junit.Test)

Aggregations

RemoveDeploymentGroupResponse (com.spotify.helios.common.protocol.RemoveDeploymentGroupResponse)7 Test (org.junit.Test)6 CreateDeploymentGroupResponse (com.spotify.helios.common.protocol.CreateDeploymentGroupResponse)2 RollingUpdateResponse (com.spotify.helios.common.protocol.RollingUpdateResponse)2 Response (javax.ws.rs.core.Response)2 HeliosClient (com.spotify.helios.client.HeliosClient)1 JobId (com.spotify.helios.common.descriptors.JobId)1 DeploymentGroupDoesNotExistException (com.spotify.helios.master.DeploymentGroupDoesNotExistException)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1