Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.Statement


      assertEquals(statementList.size(), 3);
      assertEquals(statementList.get(0), exec("{md} " + ChefSolo.DEFAULT_SOLO_PATH));
      assertEquals(statementList.get(1), exec("{md} " + ChefSolo.DEFAULT_SOLO_PATH + "/cookbooks"));

      Statement expected = createOrOverwriteFile(
            ChefSolo.DEFAULT_SOLO_PATH + "/solo.rb",
            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));
   }
View Full Code Here


      assertEquals(statementList.size(), 4);
      assertEquals(statementList.get(0), exec("{md} /tmp"));
      assertEquals(statementList.get(1), exec("{md} /tmp/foo"));
      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));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().build();

      solo.createNodeConfiguration(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/node.json",
            ImmutableSet.of("{\"run_list\":[]}"));

      assertEquals(statementList.size(), 1);
      assertEquals(statementList.get(0).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().jsonAttributes("{\"foo\":\"bar\"}").build();

      solo.createNodeConfiguration(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/node.json",
            ImmutableSet.of("{\"foo\":\"bar\",\"run_list\":[]}"));

      assertEquals(statementList.size(), 1);
      assertEquals(statementList.get(0).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().runlist(runlist).build();

      solo.createNodeConfiguration(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/node.json",
            ImmutableSet.of("{\"run_list\":[\"recipe[foo]\",\"role[bar]\"]}"));

      assertEquals(statementList.size(), 1);
      assertEquals(statementList.get(0).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().jsonAttributes("{\"foo\":\"bar\"}").runlist(runlist).build();

      solo.createNodeConfiguration(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/node.json",
            ImmutableSet.of("{\"foo\":\"bar\",\"run_list\":[\"recipe[foo]\",\"role[bar]\"]}"));

      assertEquals(statementList.size(), 1);
      assertEquals(statementList.get(0).render(OsFamily.UNIX), expected.render(OsFamily.UNIX));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().defineRole(role).build();

      solo.createRolesIfNecessary(statements);
      ImmutableList<Statement> statementList = statements.build();

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

      ChefSolo solo = ChefSolo.builder().rolePath("/tmp/roles").defineRole(role).build();

      solo.createRolesIfNecessary(statements);
      ImmutableList<Statement> statementList = statements.build();

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

      ChefSolo solo = ChefSolo.builder().rolePath("/tmp/roles").defineRole(roleFoo).defineRole(roleBar).build();

      solo.createRolesIfNecessary(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expectedFoo = createOrOverwriteFile("/tmp/roles/" + roleFoo.getName() + ".json",
            ImmutableSet.of(roleFoo.toJsonString()));
      Statement expectedBar = createOrOverwriteFile("/tmp/roles/" + roleBar.getName() + ".json",
            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));
   }
View Full Code Here

      ChefSolo solo = ChefSolo.builder().defineDataBag(databag).build();

      solo.createDatabagsIfNecessary(statements);
      ImmutableList<Statement> statementList = statements.build();

      Statement expected = createOrOverwriteFile(ChefSolo.DEFAULT_SOLO_PATH + "/data_bags/foo/item.json",
            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));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.scriptbuilder.domain.Statement

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.