Examples of DelegateExecution


Examples of org.activiti.engine.delegate.DelegateExecution

        super.tearDown();
    }

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

        final ImmutableSet<Rule> ingressRules = ImmutableSet.of(
            Rule.builder().anySource().icmp().createRule(),
            Rule.builder().anySource().port(22).tcp().createRule(),
            Rule.builder().anySource().port(53).udp().createRule()
        );

        final Network network = Network.builder().ingress(ingressRules).createNetwork();

        Pool pool = mock(Pool.class);

        when(pool.getProvider()).thenReturn(provider);
        when(pool.getNetwork()).thenReturn(network);

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

        activity.execute(execution);
        assertSecurityGroupExistsWithRules(SECURITY_GROUP_NAME, ingressRules);

        /* If any permissions is removed it should converge on a second run */
 
View Full Code Here

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.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 */
 
View Full Code Here

Examples of org.activiti.engine.delegate.DelegateExecution

        AmazonEC2 client = mock(AmazonEC2.class);

        ProviderClientCache clientCache = mock(ProviderClientCache.class);
        when(clientCache.get(Matchers.<Provider>any())).thenReturn(client);

        DelegateExecution execution = mock(DelegateExecution.class);
        List<String> instanceIds = Lists.newArrayList("i-123", "i-456");
        when(execution.getVariable(ProcessVariables.INSTANCE_IDS)).thenReturn(instanceIds);

        when(client.describeInstances(Matchers.<DescribeInstancesRequest>any()))
            .thenReturn(new DescribeInstancesResult()
                .withReservations(new Reservation().withInstances(
                    new Instance().withInstanceId("i-123").withPublicDnsName("i1.amazonaws.com")
View Full Code Here

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

Examples of org.activiti.engine.delegate.DelegateExecution

        super.tearDown();
    }

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

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

        client.createSecurityGroup(new CreateSecurityGroupRequest()
            .withGroupName(SECURITY_GROUP_NAME).withDescription("Just for test"));

        activity.execute(execution);
View Full Code Here

Examples of org.activiti.engine.delegate.DelegateExecution

            "1", mockProcessInstance(/* ended= */ false)));
        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
    }

    private RuntimeService runTest(List<String> processIds, Map<String, ProcessInstance> processMap) throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(processIds);

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

        RuntimeService runtimeService = mockRuntimeService(processMap, "invalid");
View Full Code Here

Examples of org.activiti.engine.delegate.DelegateExecution

        super.tearDown();
    }

    @Test
    public void testDeleteSecurityGroup() throws Exception {
        DelegateExecution execution = mock(DelegateExecution.class);
        final Network network = Network.builder().createNetwork();

        Pool pool = mock(Pool.class);

        when(pool.getProvider()).thenReturn(provider);
        when(pool.getNetwork()).thenReturn(network);

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

        SecurityGroups.createSecurityGroup(context.getApi(), SECURITY_GROUP_NAME);

        activity.execute(execution);
View Full Code Here

Examples of org.activiti.engine.delegate.DelegateExecution

        }
    }

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

        when(pool.getProvider()).thenReturn(provider);
        when(pool.getNetwork()).thenReturn(network);

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

        activity.execute(execution);
        assertSecurityGroupExistsWithRules(SecurityGroups.getByName(
            context.getApi(), SECURITY_GROUP_NAME), ingressRules);
    }
View Full Code Here

Examples of org.activiti.engine.delegate.DelegateExecution

            context.getApi(), SECURITY_GROUP_NAME), ingressRules);
    }

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

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

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

        // create the SecurityGroup with an extra Network Rule, then call the activity
        when(pool.getNetwork()).thenReturn(network.toBuilder().addRules(
            Rule.builder().anySource().tcp().port(80).createRule()).createNetwork());
View Full Code Here

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.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
TOP
Copyright © 2018 www.massapi.com. 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.