Package org.apache.provisionr.test

Examples of org.apache.provisionr.test.ProcessVariablesCollector


                        .withPublicIpAddress("1.2.3.4").withPrivateDnsName("i1.internal").withPrivateIpAddress("10.1.2.3"),
                    new Instance().withInstanceId("i-456").withPublicDnsName("i2.amazonaws.com")
                        .withPublicIpAddress("5.6.7.8").withPrivateDnsName("i2.internal").withPrivateIpAddress("10.4.5.6")
                )));

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

        AmazonActivity activity = new PublishListOfMachines(clientCache);
        activity.execute(client, null /* not used */, execution);

        @SuppressWarnings("unchecked")
        List<Machine> machines = (List<Machine>) collector.getVariable(CoreProcessVariables.MACHINES);

        assertThat(machines).hasSize(2);
        assertThat(machines.get(0).getPublicDnsName()).isEqualTo("i1.amazonaws.com");
    }
View Full Code Here


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

    @Test
    public void testRunSpotInstances() throws Exception {
        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        activity.execute(execution);

        @SuppressWarnings("unchecked")
        ArgumentCaptor<List<String>> argument = (ArgumentCaptor<List<String>>)
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();

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

    @Override
    public void setUp() throws Exception {
        super.setUp();

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

    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");

        JavaDelegate delegate = new KillMachineSetUpProcesses(runtimeService, PROCESS_IDS);
        delegate.execute(execution);
View Full Code Here

        when(execution.getVariable(CoreProcessVariables.POOL)).thenReturn(pool);
        when(execution.getProcessBusinessKey()).thenReturn(BUSINESS_KEY);
        when(pool.getNetwork()).thenReturn(org.apache.provisionr.api.network.Network.builder()
            .type("provided")
            .createNetwork());
        collector = new ProcessVariablesCollector();
        collector.install(execution);
    }
View Full Code Here

            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()
            .setJobExecutorActivate(true).buildProcessEngine();
        processEngine.getRepositoryService().createDeployment()
            .addClasspathResource("diagrams/empty.bpmn20.xml").deploy();

        try {
            JavaDelegate delegate = new SpawnProcessForEachMachine(processEngine, EMPTY_PROCESS_KEY, "test", RESULT);
            delegate.execute(execution);

            @SuppressWarnings("unchecked")
            List<String> processInstanceIds = (List<String>) collector.getVariable(RESULT);

            assertThat(processInstanceIds).hasSize(2);

        } finally {
            processEngine.close();
View Full Code Here

        DelegateExecution execution = mock(DelegateExecution.class);

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

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

        ServerSocket socket = null;
        try {
            socket = new ServerSocket(0);

            JavaDelegate delegate = new IsMachinePortOpen(RESULT, socket.getLocalPort());
            delegate.execute(execution);

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

        } finally {
            if (socket != null) {
                socket.close();
            }
View Full Code Here

        DelegateExecution execution = mock(DelegateExecution.class);

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

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

        JavaDelegate delegate = new IsMachinePortOpen(RESULT, findRandomNotUsedPort());
        delegate.execute(execution);

        assertThat((Boolean) collector.getVariable(RESULT)).isFalse();
    }
View Full Code Here

    @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(
            "1", mockProcessInstance(/* ended= */ true),
            "2", mockProcessInstance(/* ended= */ true)
        ));

        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
        delegate.execute(execution);

        assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
    }
View Full Code Here

TOP

Related Classes of org.apache.provisionr.test.ProcessVariablesCollector

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.