Search in sources :

Example 31 with Error

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);
}
Also used : VmService(org.ovirt.engine.sdk4.services.VmService) Test(org.junit.Test)

Example 32 with Error

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);
}
Also used : Error(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error) DeviceRequestFailedException(org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException)

Example 33 with Error

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));
}
Also used : OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) Error(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error) Test(org.junit.Test)

Example 34 with Error

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);
}
Also used : Error(org.eclipse.bpmn2.Error) Test(org.junit.Test)

Example 35 with Error

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);
}
Also used : ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) Error(org.eclipse.bpmn2.Error)

Aggregations

Error (org.eclipse.bpmn2.Error)11 Error (org.ovirt.engine.sdk4.Error)11 RootElement (org.eclipse.bpmn2.RootElement)8 Test (org.junit.Test)8 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)7 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)7 Escalation (org.eclipse.bpmn2.Escalation)6 Process (org.eclipse.bpmn2.Process)6 Signal (org.eclipse.bpmn2.Signal)6 SubProcess (org.eclipse.bpmn2.SubProcess)6 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 Entry (java.util.Map.Entry)5 Error (org.bytedeco.javacpp.FlyCapture2.Error)5 IOException (java.io.IOException)4 Iterator (java.util.Iterator)4 Activity (org.eclipse.bpmn2.Activity)4 CallActivity (org.eclipse.bpmn2.CallActivity)4 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)4 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)4