Package org.apache.provisionr.api.access

Examples of org.apache.provisionr.api.access.AdminAccess


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

        final AdminAccess adminAccess = AdminAccess.builder()
            .privateKey(TestConstants.PRIVATE_KEY)
            .publicKey(TestConstants.PUBLIC_KEY)
            .username(System.getProperty("user.name"))
            .createAdminAccess();

        when(pool.getAdminAccess()).thenReturn(adminAccess);

        PuppetActivity activity = new SetupAdminAccess();
        String content = activity.createPuppetScript(pool, null);

        final String username = adminAccess.getUsername();

        assertThat(content).contains(username)
            .contains(adminAccess.getPublicKey().split(" ")[1])
            .contains(String.format("user { \"%s\":", username))
            .contains(String.format("file { \"/home/%s/.ssh\":", username));
    }
View Full Code Here


        super.tearDown();
    }

    @Test
    public void testDeleteKeyPair() throws Exception {
        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

    public void setUp() throws Exception {
        super.setUp();
        execution = mock(DelegateExecution.class);
        pool = mock(Pool.class);

        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

        super.tearDown();
    }

    @Test
    public void testEnsureKeyPairExists() throws Exception {
        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

        final Network network = Network.builder().addRules(
            Rule.builder().anySource().port(22).tcp().createRule(),
            Rule.builder().anySource().port(8088).tcp().createRule()
        ).createNetwork();

        final AdminAccess adminAccess = AdminAccess.builder().username("admin").publicKey("ssh-rsa AAAAB3N")
            .privateKey("-----BEGIN RSA PRIVATE KEY-----\n").createAdminAccess();

        final Software software = Software.builder()
            .packages("hadoop-0.20", "hadoop-0.20-native").createSoftware();
View Full Code Here

        logKeyPairs();
        logVirtualMachines();
        execution = mock(DelegateExecution.class);
        pool = mock(Pool.class);

        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

        super.tearDown();
    }

    @Test
    public void testDeleteKeyPair() throws Exception {
        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

        super.tearDown();
    }

    @Test
    public void testEnsureKeyPairExists() throws Exception {
        final AdminAccess adminAccess = AdminAccess.builder()
            .username("admin")
            .publicKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test.pub"))
            .privateKey(getResourceAsString("/org/apache/provisionr/test/id_rsa_test"))
            .createAdminAccess();
View Full Code Here

            .createNetwork();

        final Software software = Software.builder().imageId("ubuntu-10.04")
            .packages("nginx").createSoftware();

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

            Rule.builder().anySource().port(22).protocol(Protocol.TCP).createRule()
        ).createNetwork();

        final Hardware hardware = Hardware.builder().type(TEST_INSTANCE_TYPE).createHardware();

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

        final String destinationPath = "/home/" + adminAccess.getUsername() + "/provisionr.html";
        final Software software = Software.builder()
            .imageId("default")
            .file("http://provisionr.incubator.apache.org", destinationPath)
            .createSoftware();
View Full Code Here

TOP

Related Classes of org.apache.provisionr.api.access.AdminAccess

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.