Package org.apache.provisionr.api.pool

Examples of org.apache.provisionr.api.pool.Pool


        final Hardware hardware = Hardware.builder()
            .type(hardwareType)
            .blockDevices(parseBlockDeviceOptions(blockDeviceOptions))
            .createHardware();

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


        final AdminAccess adminAccess = AdminAccess.builder().asCurrentUser().createAdminAccess();

        final Hardware hardware = Hardware.builder().type("offering").createHardware();

        final Pool pool = Pool.builder().network(network).provider(provider).adminAccess(adminAccess)
            .software(software).hardware(hardware).minSize(1).expectedSize(1).createPool();

        String processId = provisionr.startPoolManagementProcess(UUID.randomUUID().toString(), pool);
        waitForProcessEnd(processId);
        // TODO: check that the environment is clean
View Full Code Here

            .imageId("default")
            .file("http://provisionr.incubator.apache.org", destinationPath)
            .createSoftware();

        PoolTemplate template = getPoolTemplateWithId(TEST_POOL_TEMPLATE, 5000);
        final Pool pool = template.apply(Pool.builder()
            .provider(provider)
            .network(network)
            .adminAccess(adminAccess)
            .software(software)
            .hardware(hardware)
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

    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,
            PATH_TO_PUBLIC_KEY, PATH_TO_PRIVATE_KEY) {
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("package-1a");
    }
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

    @Override
    public void execute(DelegateExecution execution) throws Exception {

        RestContext<CloudStackClient, CloudStackAsyncClient> restContext = null;
        try {
            Pool pool = Pool.class.cast(checkNotNull(execution.getVariable(CoreProcessVariables.POOL),
                "Please add 'pool' variable to the process"));
            // delegate
            restContext = newCloudStackClient(pool.getProvider());
            execute(restContext.getApi(), pool, execution);

        } finally {
            Closeables.closeQuietly(restContext);
        }
View Full Code Here

    /**
     * Wrap the abstract {@code execute} method with the logic that knows how to create the Amazon client
     */
    @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);

        execute(providerClientCache.getUnchecked(pool.getProvider()), pool, execution);
    }
View Full Code Here

TOP

Related Classes of org.apache.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.