use of org.ovirt.engine.sdk4.Error in project ovirt-engine-sdk-java by oVirt.
the class VmsServiceTest method testFaultReaderWithAction.
/**
* When the server returns an fault instead of an action it
* raises an error containing the information of the fault.
*/
@Test
public void testFaultReaderWithAction() {
boolean raised = false;
VmService vmService = vmsService.vmService("456");
try {
vmService.start().send();
} catch (Error e) {
assertTrue(e.getMessage().contains("myreason"));
raised = true;
}
assertTrue(raised);
}
use of org.ovirt.engine.sdk4.Error in project openflowplugin by opendaylight.
the class StackedSegment method completeEntry.
private static boolean completeEntry(final OutboundQueueEntry entry, final OfHeader response) {
if (response instanceof Error) {
final Error err = (Error) response;
LOG.debug("Device-reported request XID {} failed {}:{}", response.getXid(), err.getTypeString(), err.getCodeString());
entry.fail(new DeviceRequestFailedException("Device-side failure", err));
return true;
}
return entry.complete(response);
}
use of org.ovirt.engine.sdk4.Error in project openflowplugin by opendaylight.
the class DeviceContextImplTest method testProcessReply.
@Test
public void testProcessReply() {
final Error mockedError = mock(Error.class);
deviceContext.processReply(mockedError);
verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE));
final OfHeader mockedOfHeader = mock(OfHeader.class);
deviceContext.processReply(mockedOfHeader);
verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS));
}
use of org.ovirt.engine.sdk4.Error in project kie-wb-common by kiegroup.
the class EventDefinitionReaderTest method testErrorRefOfWithValue.
@Test
public void testErrorRefOfWithValue() {
Error error = mock(Error.class);
when(error.getErrorCode()).thenReturn(SOME_VALUE);
testErrorRef(error, SOME_VALUE);
}
use of org.ovirt.engine.sdk4.Error in project kie-wb-common by kiegroup.
the class EventPropertyWriter method addError.
public void addError(ErrorRef errorRef) {
Error error = bpmn2.createError();
ErrorEventDefinition errorEventDefinition = bpmn2.createErrorEventDefinition();
addEventDefinition(errorEventDefinition);
String errorCode = errorRef.getValue();
String errorId;
if (StringUtils.nonEmpty(errorCode)) {
error.setErrorCode(errorCode);
CustomAttribute.errorName.of(errorEventDefinition).set(errorCode);
errorId = errorCode;
} else {
errorId = UUID.uuid();
}
error.setId(errorId);
errorEventDefinition.setErrorRef(error);
addRootElement(error);
}
Aggregations