def get_reproduction_by_instance_id(instance_id):
    result = HttpClient.get(
        f"{settings.COREAPI_URL}:{settings.COREAPI_PORT}/core/reproduction?filter=byInstance&instance={instance_id}"
    )

    if not result.has_error and result.data:
        return result.data[0]
def get_operation_instance_by_instance_id_and_event(instance_id, event_name):
    result = HttpClient.get(
        f"{settings.COREAPI_URL}:{settings.COREAPI_PORT}/core/operationInstance?filter=byInstanceIdEventName&processInstanceId={instance_id}&eventName={event_name}"
    )

    if not result.has_error and result.data:
        return result.data[0]
def get_process_instance_by_instance_id(instance_id):
    result = HttpClient.get(
        f"{settings.COREAPI_URL}:{settings.COREAPI_PORT}/core/processInstance?filter=byId&id={instance_id}"
    )

    if not result.has_error and result.data:
        return result.data[0]
def first_commit(instance_id):
    """ return first commit from instance id  """
    result = HttpClient.get(
        f"{settings.PROCESS_MEMORY_URL}:{settings.PROCESS_MEMORY_PORT}/{instance_id}/first?app_origin=executor"
    )
    if len(result.data) > 0:
        return result.data[0]
    return None
def get_operation_by_event_and_version(event, version):
    """ Retrieves the operation subscribed to an event.
    """
    result = HttpClient.get(
        f"{settings.COREAPI_URL}:{settings.COREAPI_PORT}/core/operation?filter=byEventAndVersion&event={event.name}&version={version}"
    )

    if not result.has_error and result.data:
        return result.data[0]
Exemple #6
0
    def test_get_method_invokes_requests(self):
        # mock
        VERBS.GET = mock.MagicMock()
        uri = 'http://app.uri.com'

        # act
        result = HttpClient.get(uri)

        # assert
        VERBS.GET.assert_called_with(uri)
def commit(id, data):
    result = HttpClient.post(
        f"{settings.PROCESS_MEMORY_URL}:{settings.PROCESS_MEMORY_PORT}/{id}/commit?app_origin=executor",
        data)
    return not result.has_error
def clone(from_instance_id, to_instance_id):
    """ clone process memory with instance id """
    result = HttpClient.post(
        f"{settings.PROCESS_MEMORY_URL}:{settings.PROCESS_MEMORY_PORT}/{from_instance_id}/{to_instance_id}/clone?app_origin=executor"
    )
    return not result.has_error
def create_memory(process, event):
    result = HttpClient.post(
        f"{settings.PROCESS_MEMORY_URL}:{settings.PROCESS_MEMORY_PORT}/{process['id']}/create?app_origin=executor",
        {"event": event.__dict__})

    return not result.has_error
def create_memory(process_instance_id, event):
    result = HttpClient.post(
        f"{settings.PROCESS_MEMORY_URL}:{settings.PROCESS_MEMORY_PORT}/{process_instance_id}",
        {"event": event})

    return not result.has_error
def persist(data):
    return HttpClient.post(
        f"{settings.COREAPI_URL}:{settings.COREAPI_PORT}/core/persist",
        data=data)
def emit_event(event):
    result = HttpClient.put(
        f"{settings.EVENT_MANAGER_URL}:{settings.EVENT_MANAGER_PORT}/sendevent",
        event)
    return not result.has_error