Package com.axemblr.provisionr.api.provider

Examples of com.axemblr.provisionr.api.provider.Provider


        command.setId("service");
        command.setKey("key");
        command.setTemplate(template.getId());

        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);
View Full Code Here


        command.setId("service");
        command.setKey("key");
        command.setProviderOptions(Lists.newArrayList("spotBid=0.07"));

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

        command.createPoolFromArgumentsAndServiceDefaults(service);

        @SuppressWarnings("unchecked")
        ArgumentCaptor<Map<String, String>> argument = (ArgumentCaptor<Map<String, String>>) (Object)
                ArgumentCaptor.forClass(Map.class);
        verify(provider.toBuilder()).options(argument.capture());

        assertThat(argument.getValue().containsKey("spotBid")).isTrue();
        assertThat(argument.getValue().get("spotBid")).isEqualTo("0.07");
    }
View Full Code Here

        CreatePoolCommand command = newPoolCommandWithMockedAdminAccess();
        command.setId("service");
        command.setKey("key");

        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();
View Full Code Here

        when(service.getId()).thenReturn(id);
        return service;
    }

    private Provider newProviderMockWithBuilder() {
        Provider provider = mock(Provider.class);
        ProviderBuilder providerBuilder = mock(ProviderBuilder.class);
        when(providerBuilder.options(anyMapOf(String.class, String.class))).thenReturn(providerBuilder);
        when(providerBuilder.createProvider()).thenReturn(provider);
        when(provider.toBuilder()).thenReturn(providerBuilder);
        return provider;
    }
View Full Code Here

        // TODO: this currently does not support overriding default options, it will throw an exception
        Map<String,String> options = ImmutableMap.<String, String>builder()
                .putAll(defaultProvider.get().getOptions())     // default options
                .putAll(parseProviderOptions(providerOptions))  // options added by the user
                .build();
        Provider provider = defaultProvider.get().toBuilder().options(options).createProvider();

        /* Always allow ICMP and ssh traffic by default */
        final Network network = Network.builder().addRules(
            Rule.builder().anySource().icmp().createRule(),
            Rule.builder().anySource().tcp().port(22).createRule()
View Full Code Here

public class PoolTest {

    @Test
    public void testSerialization() {
        final Provider provider = Provider.builder()
            .id("amazon").accessKey("access").secretKey("secret")
            .createProvider();

        final Network network = Network.builder().addRules(
            Rule.builder().anySource().port(22).tcp().createRule(),
View Full Code Here

        waitForProcessDeployment(CloudStackProvisionr.ID);
        Provisionr provisionr = getOsgiService(Provisionr.class, 5000);

//        listAvailableJceProviders();

        final Provider provider = collectProviderCredentialsFromSystemProperties()
            // TODO: get more options as needed for CloudStack
            .createProvider();

        final Network network = Network.builder()
            .addRules(Rule.builder().anySource().tcp().port(22).createRule())
View Full Code Here

    private void startProvisioningProcess(String spotBid) throws Exception {
        waitForProcessDeployment(AmazonProvisionr.MANAGEMENT_PROCESS_KEY);

        final Provisionr provisionr = getOsgiService(Provisionr.class, 5000);

        Provider provider = collectProviderCredentialsFromSystemProperties()
            .option(ProviderOptions.REGION, getProviderProperty(
                ProviderOptions.REGION, ProviderOptions.DEFAULT_REGION))
            .createProvider();

        if (spotBid != null) {
            provider = provider.toBuilder()
                    .option(ProviderOptions.SPOT_BID, spotBid)
                    .createProvider();
        }

        final Network network = Network.builder().addRules(
View Full Code Here

TOP

Related Classes of com.axemblr.provisionr.api.provider.Provider

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.