Search in sources :

Example 1 with Connector

use of org.activiti.api.process.runtime.connector.Connector in project Activiti by Activiti.

the class DefaultServiceTaskBehaviorTest method hasConnectorBeanShouldReturnTrueIfABeanOfConnectorTypeIsFound.

@Test
public void hasConnectorBeanShouldReturnTrueIfABeanOfConnectorTypeIsFound() {
    // given
    String connectorName = "connector";
    DelegateExecution execution = ConnectorRuntimeApiTestHelper.buildExecution(connectorName);
    given(context.containsBean(connectorName)).willReturn(true);
    given(context.getBean(connectorName)).willReturn(mock(Connector.class));
    // when
    boolean hasConnectorBean = behavior.hasConnectorBean(execution);
    // then
    assertThat(hasConnectorBean).isTrue();
}
Also used : Connector(org.activiti.api.process.runtime.connector.Connector) DelegateExecution(org.activiti.engine.delegate.DelegateExecution) Test(org.junit.jupiter.api.Test)

Example 2 with Connector

use of org.activiti.api.process.runtime.connector.Connector in project Activiti by Activiti.

the class DefaultServiceTaskBehavior method execute.

/**
 * We have two different implementation strategy that can be executed
 * in according if we have a connector action definition match or not.
 */
@Override
public void execute(DelegateExecution execution) {
    Connector connector = getConnector(getImplementation(execution));
    IntegrationContext integrationContext = connector.apply(integrationContextBuilder.from(execution));
    execution.setVariables(outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(execution), integrationContext.getOutBoundVariables()));
    leave(execution);
}
Also used : Connector(org.activiti.api.process.runtime.connector.Connector) IntegrationContext(org.activiti.api.process.model.IntegrationContext)

Aggregations

Connector (org.activiti.api.process.runtime.connector.Connector)2 IntegrationContext (org.activiti.api.process.model.IntegrationContext)1 DelegateExecution (org.activiti.engine.delegate.DelegateExecution)1 Test (org.junit.jupiter.api.Test)1