use of org.openstack4j.openstack.image.v2.domain.GlanceTask in project cloudbreak by hortonworks.
the class OpenStackImageImageImporterTest method testImportNoStatus.
@Test(expected = CloudConnectorException.class)
public void testImportNoStatus() {
try {
GlanceTask task = Mockito.mock(GlanceTask.class);
when(task.getStatus()).thenReturn(null);
when(task.getMessage()).thenReturn("USEFUL ERRROR MESSAGE");
when(taskService.create(any())).thenReturn(task);
underTest.importImage(osClient, "myimage");
} catch (CloudConnectorException e) {
Assert.assertEquals("Import of myimage did not return any status, message: USEFUL ERRROR MESSAGE", e.getMessage());
throw e;
}
}
use of org.openstack4j.openstack.image.v2.domain.GlanceTask in project cloudbreak by hortonworks.
the class OpenStackImageImageImporterTest method testImportFailure.
@Test(expected = CloudConnectorException.class)
public void testImportFailure() {
try {
GlanceTask task = Mockito.mock(GlanceTask.class);
when(task.getStatus()).thenReturn(Task.TaskStatus.FAILURE);
when(task.getMessage()).thenReturn("USEFUL ERRROR MESSAGE");
when(taskService.create(any())).thenReturn(task);
underTest.importImage(osClient, "myimage");
} catch (CloudConnectorException e) {
Assert.assertEquals("Import of myimage failed with status: FAILURE, message: USEFUL ERRROR MESSAGE", e.getMessage());
throw e;
}
}
use of org.openstack4j.openstack.image.v2.domain.GlanceTask in project cloudbreak by hortonworks.
the class OpenStackImageImageImporterTest method testImportSuccess.
@Test
public void testImportSuccess() {
GlanceTask task = Mockito.mock(GlanceTask.class);
when(task.getStatus()).thenReturn(Task.TaskStatus.SUCCESS);
when(taskService.create(any())).thenReturn(task);
underTest.importImage(osClient, "myimage");
}
Aggregations