use of org.ovirt.engine.api.model.Fault in project ovirt-engine by oVirt.
the class BackendStorageDomainImagesResourceTest method verifyFault.
@Override
protected void verifyFault(WebApplicationException wae, String reason, Throwable t) {
assertEquals(BAD_REQUEST, wae.getResponse().getStatus());
assertTrue(wae.getResponse().getEntity() instanceof Fault);
Fault fault = (Fault) wae.getResponse().getEntity();
assertEquals(reason, fault.getReason());
assertNotNull(fault.getDetail());
assertTrue("expected detail to include: " + t.getMessage(), fault.getDetail().contains(t.getMessage()));
}
use of org.ovirt.engine.api.model.Fault in project ovirt-engine by oVirt.
the class BackendTemplateDisksResourceTest method testListFailure.
@Override
@Test
public void testListFailure() throws Exception {
UriInfo uriInfo = setUpUriExpectations(null);
setUpEntityQueryExpectations(1, FAILURE);
collection.setUriInfo(uriInfo);
try {
getCollection();
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
assertTrue(wae.getResponse().getEntity() instanceof Fault);
assertEquals(mockl10n(FAILURE), ((Fault) wae.getResponse().getEntity()).getDetail());
}
}
use of org.ovirt.engine.api.model.Fault in project ovirt-engine by oVirt.
the class NetworkAttachmentMapper method fault.
private static Fault fault(String reason, String detail) {
Fault fault = new Fault();
fault.setReason(reason);
fault.setDetail(detail);
return fault;
}
use of org.ovirt.engine.api.model.Fault in project ovirt-engine by oVirt.
the class CreationMapper method map.
@Mapping(from = List.class, to = Creation.class)
public static Creation map(List<AsyncTaskStatus> entity, Creation template) {
Creation model = template != null ? template : new Creation();
CreationStatus asyncStatus = null;
for (AsyncTaskStatus task : entity) {
asyncStatus = AsyncTaskMapper.map(task, asyncStatus);
}
model.setStatus(asyncStatus.value());
if (asyncStatus == CreationStatus.FAILED) {
model.setFault(new Fault());
for (AsyncTaskStatus task : entity) {
if (task.getException() != null) {
model.getFault().setDetail(task.getException().toString());
break;
}
}
}
return model;
}
use of org.ovirt.engine.api.model.Fault in project ovirt-engine by oVirt.
the class ActionMapper method map.
@Mapping(from = List.class, to = Action.class)
public static Action map(List<AsyncTaskStatus> entity, Action template) {
Action model = template != null ? template : new Action();
CreationStatus asyncStatus = null;
for (AsyncTaskStatus task : entity) {
asyncStatus = AsyncTaskMapper.map(task, asyncStatus);
}
model.setStatus(asyncStatus.value());
if (asyncStatus == CreationStatus.FAILED) {
model.setFault(new Fault());
for (AsyncTaskStatus task : entity) {
if (task.getException() != null) {
model.getFault().setDetail(task.getException().toString());
break;
}
}
}
return model;
}
Aggregations