Package org.activiti.engine.delegate

Examples of org.activiti.engine.delegate.DelegateExecution


            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();

        DelegateExecution execution = mock(DelegateExecution.class);
        Pool pool = mock(Pool.class);

        when(pool.getProvider()).thenReturn(provider);
        when(pool.getAdminAccess()).thenReturn(adminAccess);

        when(execution.getProcessBusinessKey()).thenReturn(BUSINESS_KEY);
        when(execution.getVariable(CoreProcessVariables.POOL)).thenReturn(pool);

        activity.execute(execution);
        assertKeyPairWasImportedAsExpected();

        /* the second call should just re-import the key */
 
View Full Code Here


    private static final String BUSINESS_KEY = UUID.randomUUID().toString();

    @Test
    public void testSpawnSampleProcessForLocalhost() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        Pool pool = mock(Pool.class, withSettings().serializable());
        Software software = mock(Software.class, withSettings().serializable());
        when(software.isCachedImage()).thenReturn(false);
        when(pool.getSoftware()).thenReturn(software);
        when(execution.getVariable(eq(CoreProcessVariables.POOL))).thenReturn(pool);
        when(execution.getVariable(eq(CoreProcessVariables.POOL_BUSINESS_KEY))).thenReturn(BUSINESS_KEY);

        List<Machine> machines = Lists.newArrayList(
            Machine.builder().localhost().createMachine(),
            Machine.builder().localhost().externalId("local-2").createMachine()
        );
        when(execution.getVariable(eq(CoreProcessVariables.MACHINES))).thenReturn(machines);

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
View Full Code Here

    private static final String RESULT = "result";

    @Test
    public void testWithRandomOpenPort() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);

        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
            .thenReturn(Machine.builder().localhost().createMachine());

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);
View Full Code Here

        }
    }

    @Test
    public void testWithRandomClosedPort() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);

        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
            .thenReturn(Machine.builder().localhost().createMachine());

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);
View Full Code Here

    private static final String RESULT = "result";

    @Test
    public void testWithAListOfEndedProcesses() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
View Full Code Here

        assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
    }

    @Test
    public void testWithOneEndedAndOneStillRunning() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
View Full Code Here

    /**
     * We consider an invalid process instance ID as ended by default
     */
    @Test
    public void testWithOneInvalidProcessId() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "invalid"));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
View Full Code Here

public class AssigneeOverwriteFromVariable implements TaskListener {

  @SuppressWarnings("unchecked")
  public void notify(DelegateTask delegateTask) {
    // get mapping table from variable
    DelegateExecution execution = delegateTask.getExecution();
    Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable");
   
    // get assignee from process
    String assigneeFromProcessDefinition = delegateTask.getAssignee();
   
    // overwrite assignee if there is an entry in the mapping table
View Full Code Here

            .username("admin")
            .publicKey(getResourceAsString("keys/test.pub"))
            .privateKey(getResourceAsString("keys/test"))
            .createAdminAccess();

        DelegateExecution execution = mock(DelegateExecution.class);
        Pool pool = mock(Pool.class);

        when(pool.getAdminAccess()).thenReturn(adminAccess);
        when(pool.getProvider()).thenReturn(provider);

        when(execution.getProcessBusinessKey()).thenReturn(BUSINESS_KEY);
        when(execution.getVariable(CoreProcessVariables.POOL)).thenReturn(pool);

        activity.execute(execution);
        assertKeyNotFound(KEYPAIR_NAME);
        /* the second call should just do nothing */
        activity.execute(execution);
View Full Code Here

            .username("admin")
            .publicKey(getResourceAsString("keys/test.pub"))
            .privateKey(getResourceAsString("keys/test"))
            .createAdminAccess();

        DelegateExecution execution = mock(DelegateExecution.class);
        Pool pool = mock(Pool.class);

        when(pool.getProvider()).thenReturn(provider);
        when(pool.getAdminAccess()).thenReturn(adminAccess);

        when(execution.getProcessBusinessKey()).thenReturn(BUSINESS_KEY);
        when(execution.getVariable(CoreProcessVariables.POOL)).thenReturn(pool);

        activity.execute(execution);
        assertKeyPairWasImportedAsExpected();

        /* the second call should just re-import the key */
 
View Full Code Here

TOP

Related Classes of org.activiti.engine.delegate.DelegateExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.