Package com.axemblr.provisionr.api.pool

Examples of com.axemblr.provisionr.api.pool.Pool


    public ExpectedException exception = ExpectedException.none();

    @Test
    public void testCreatePoolStartsTheManagementProcess() throws Exception {
        final Provisionr service = newProvisionrMockWithId(TEST_PROVISIONR_ID);
        final Pool pool = mock(Pool.class);

        final List<Provisionr> services = ImmutableList.of(service);
        final List<PoolTemplate> templates = ImmutableList.of();
        CreatePoolCommand command = new CreatePoolCommand(services, templates) {
            @Override
View Full Code Here


        Provisionr service = mock(Provisionr.class);
        Provider provider = newProviderMockWithBuilder();
        when(service.getDefaultProvider()).thenReturn(Optional.of(provider));

        Pool pool = command.createPoolFromArgumentsAndServiceDefaults(service);

        assertThat(pool.getSoftware().getRepositories()).hasSize(1);
        assertThat(pool.getSoftware().getPackages()).contains("jenkins").contains("git-core");
    }
View Full Code Here

        Provisionr service = mock(Provisionr.class);
        Provider provider = newProviderMockWithBuilder();
        when(service.getDefaultProvider()).thenReturn(Optional.of(provider));

        Pool pool = command.createPoolFromArgumentsAndServiceDefaults(service);
        assertThat(pool.getHardware().getBlockDevices()).isEmpty();

        command.setBlockDeviceOptions(Lists.newArrayList("/dev/sda2:8", "/dev/sda9:2"));
        pool = command.createPoolFromArgumentsAndServiceDefaults(service);
        assertThat(pool.getHardware().getBlockDevices()).hasSize(2);
        assertThat(pool.getHardware().getBlockDevices().get(0).getSize()).isEqualTo(8);
        assertThat(pool.getHardware().getBlockDevices().get(0).getName()).isEqualTo("/dev/sda2");
        assertThat(pool.getHardware().getBlockDevices().get(1).getSize()).isEqualTo(2);
        assertThat(pool.getHardware().getBlockDevices().get(1).getName()).isEqualTo("/dev/sda9");

        command.setBlockDeviceOptions(Lists.newArrayList("/dev/sda1:7"));
        pool = command.createPoolFromArgumentsAndServiceDefaults(service);
        assertThat(pool.getHardware().getBlockDevices()).hasSize(1);
        assertThat(pool.getHardware().getBlockDevices().get(0).getSize()).isEqualTo(7);

        command.setBlockDeviceOptions(Lists.newArrayList("this=breaks"));
        exception.expect(IllegalArgumentException.class);
        pool = command.createPoolFromArgumentsAndServiceDefaults(service);
View Full Code Here

            newProcessInstanceMock("p1", "k1"),
            newProcessInstanceMock("p2", "k2")
        );
        final ProcessEngine processEngine = newProcessEngineMock(processes);

        Pool pool = mock(Pool.class);
        setVariable(processEngine, "p1", CoreProcessVariables.POOL, pool);
        setVariable(processEngine, "p1", CoreProcessVariables.POOL_BUSINESS_KEY, "k1");

        ListPoolsCommand command = new ListPoolsCommand(processEngine);
        command.setOut(out);
View Full Code Here

        final List<ProcessInstance> processes = processEngine.getRuntimeService()
            .createProcessInstanceQuery().list();

        Project project = new Project();
        for (ProcessInstance instance : processes) {
            final Pool pool = (Pool) processEngine.getRuntimeService()
                .getVariable(instance.getId(), CoreProcessVariables.POOL);
            if (pool == null) {
                continue; /* skip - this process is not a provisionr process */
            }

View Full Code Here

        return ImmutableMap.of();
    }

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        Pool pool = (Pool) execution.getVariable(CoreProcessVariables.POOL);
        checkNotNull(pool, "Please add the pool description as a process " +
            "variable with the name '%s'.", CoreProcessVariables.POOL);

        Machine machine = (Machine) execution.getVariable("machine");
        checkNotNull(machine, "expecting a process variable named 'machine'");
View Full Code Here

        this.resultVariable = checkNotNull(resultVariable, "resultVariable is null");
    }

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        final Pool pool = (Pool) execution.getVariable(CoreProcessVariables.POOL);
        checkNotNull(pool, "Expecting to find a pool description as process variable");

        @SuppressWarnings("unchecked")
        List<Machine> machines = (List<Machine>) execution.getVariable(CoreProcessVariables.MACHINES);
        checkNotNull(machines, "Expecting to find the list of machines as process variable");
View Full Code Here

    protected Object doExecute() throws Exception {
        checkArgument(size > 0, "size should be a positive integer");

        Optional<Provisionr> service = Iterables.tryFind(services, ProvisionrPredicates.withId(id));
        if (service.isPresent()) {
            final Pool pool = createPoolFromArgumentsAndServiceDefaults(service.get());

            final String processInstanceId = service.get().startPoolManagementProcess(key, pool);
            return String.format("Pool management process started (id: %s)", processInstanceId);
        } else {
            throw new NoSuchElementException("No provisioning service found with id: " + id);
View Full Code Here

                .blockDevices(parseBlockDeviceOptions(blockDeviceOptions))
                .createHardware();

        final Software software = Software.builder().packages(packages).createSoftware();

        final Pool pool = Pool.builder()
            .provider(provider)
            .hardware(hardware)
            .software(software)
            .network(network)
            .adminAccess(collectCurrentUserCredentialsForAdminAccess())
View Full Code Here

            return null;
        }

        final Gson gson = new GsonBuilder().setPrettyPrinting().create();
        for (ProcessInstance instance : processes) {
            Pool pool = (Pool) processEngine.getRuntimeService()
                .getVariable(instance.getId(), CoreProcessVariables.POOL);
            if (pool == null) {
                continue; /* skip - this process is not a provisionr process */
            }

View Full Code Here

TOP

Related Classes of com.axemblr.provisionr.api.pool.Pool

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.