Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.Statement.render()


      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/roles/" + role.getName() + ".json",
            ImmutableSet.of(role.toJsonString()));

      assertEquals(statementList.size(), 2);
      assertEquals(statementList.get(0), exec("{md} " + ChefSolo.DEFAULT_SOLO_PATH + "/roles"));
      assertEquals(statementList.get(1).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateRolesIfNecessaryWithOneRoleAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      RunList runlist = RunList.builder().recipe("bar").build();
View Full Code Here


      Statement expected = createOrOverwriteFile("/tmp/roles/" + role.getName() + ".json",
            ImmutableSet.of(role.toJsonString()));

      assertEquals(statementList.size(), 2);
      assertEquals(statementList.get(0), exec("{md} /tmp/roles"));
      assertEquals(statementList.get(1).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateRolesIfNecessaryWithMultipleRoleAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      Role roleFoo = Role.builder().name("foo").runlist(RunList.builder().recipe("foo").build()).build();
View Full Code Here

            ImmutableSet.of(roleBar.toJsonString()));

      assertEquals(statementList.size(), 3);
      assertEquals(statementList.get(0), exec("{md} /tmp/roles"));
      assertEquals(statementList.get(1).render(OsFamily.UNIX), expectedFoo.render(OsFamily.UNIX));
      assertEquals(statementList.get(2).render(OsFamily.UNIX), expectedBar.render(OsFamily.UNIX));
   }

   public void testCreateDatabagsIfNecessaryWithDefaultValues() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      ChefSolo solo = ChefSolo.builder().build();
View Full Code Here

            ImmutableSet.of("{\"foo\":\"bar\"}"));

      assertEquals(statementList.size(), 3);
      assertEquals(statementList.get(0), exec("{md} " + ChefSolo.DEFAULT_SOLO_PATH + "/data_bags"));
      assertEquals(statementList.get(1), exec("{md} " + ChefSolo.DEFAULT_SOLO_PATH + "/data_bags/" + databag.getName()));
      assertEquals(statementList.get(2).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateDatabagsIfNecessaryWithOneDatabagAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      DataBag databag = DataBag.builder().name("foo").item("item", "{\"foo\":\"bar\"}").build();
View Full Code Here

      Statement expected = createOrOverwriteFile("/tmp/databags/foo/item.json", ImmutableSet.of("{\"foo\":\"bar\"}"));

      assertEquals(statementList.size(), 3);
      assertEquals(statementList.get(0), exec("{md} /tmp/databags"));
      assertEquals(statementList.get(1), exec("{md} /tmp/databags/" + databag.getName()));
      assertEquals(statementList.get(2).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateDatabagsIfNecessaryWithOneDatabagWithMultipleItemsAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      DataBag databag = DataBag.builder().name("foo").item("item1", "{\"foo\":\"bar\"}")
View Full Code Here

      assertEquals(statementList.size(), 4);
      assertEquals(statementList.get(0), exec("{md} /tmp/databags"));
      assertEquals(statementList.get(1), exec("{md} /tmp/databags/" + databag.getName()));
      assertEquals(statementList.get(2).render(OsFamily.UNIX), expectedItem1.render(OsFamily.UNIX));
      assertEquals(statementList.get(3).render(OsFamily.UNIX), expectedItem2.render(OsFamily.UNIX));
   }

   public void testCreateDatabagsIfNecessaryWithMultipleDatabagsAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      DataBag databagFoo = DataBag.builder().name("foo").item("itemFoo", "{\"foo\":\"bar\"}").build();
View Full Code Here

      assertEquals(statementList.size(), 5);
      assertEquals(statementList.get(0), exec("{md} /tmp/databags"));
      assertEquals(statementList.get(1), exec("{md} /tmp/databags/" + databagFoo.getName()));
      assertEquals(statementList.get(2).render(OsFamily.UNIX), expectedFoo.render(OsFamily.UNIX));
      assertEquals(statementList.get(3), exec("{md} /tmp/databags/" + databagBar.getName()));
      assertEquals(statementList.get(4).render(OsFamily.UNIX), expectedBar.render(OsFamily.UNIX));
   }

   public void testCreateDatabagsIfNecessaryWithMultipleDatabagsAndMultipleItemsAndCustomPath() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      DataBag databagFoo = DataBag.builder().name("foo").item("itemFoo", "{\"foo\":\"bar\"}").build();
View Full Code Here

    ensureUserExistsAndAuthorizeSudo(statementBuilder, clusterSpec.getClusterUser(),
        clusterSpec.getPublicKey(), clusterSpec.getPrivateKey());
    Statement bootstrap = statementBuilder.build(clusterSpec);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Running script {}:\n{}", name, bootstrap.render(OsFamily.UNIX));
    }

    TemplateBuilder templateBuilder = computeService.templateBuilder().from(
        instanceTemplate.getTemplate() != null ? instanceTemplate.getTemplate() :
        clusterSpec.getTemplate());
View Full Code Here

            ImmutableSet.of("file_cache_path \"" + ChefSolo.DEFAULT_SOLO_PATH + "\"", //
                  "cookbook_path [\"" + ChefSolo.DEFAULT_SOLO_PATH + "/cookbooks\"]", "role_path \""
                        + ChefSolo.DEFAULT_SOLO_PATH + "/roles\"", "data_bag_path \"" + ChefSolo.DEFAULT_SOLO_PATH
                        + "/data_bags\""));

      assertEquals(statementList.get(2).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateCustomSoloConfiguration() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      ChefSolo solo = ChefSolo.builder().fileCachePath("/tmp").cookbookPath("/tmp/foo").cookbookPath("/tmp/bar")
View Full Code Here

      assertEquals(statementList.get(2), exec("{md} /tmp/bar"));

      Statement expected = createOrOverwriteFile("/tmp/solo.rb", ImmutableSet.of("file_cache_path \"/tmp\"", //
            "cookbook_path [\"/tmp/foo\",\"/tmp/bar\"]", "role_path \"/tmp/roles\"", "data_bag_path \"/tmp/databags\""));

      assertEquals(statementList.get(3).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }

   public void testCreateDefaultNodeConfiguration() {
      ImmutableList.Builder<Statement> statements = ImmutableList.builder();
      ChefSolo solo = ChefSolo.builder().build();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.