Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.Statement


      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

      ChefSolo solo = ChefSolo.builder().dataBagPath("/tmp/databags").defineDataBag(databag).build();

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

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

      ChefSolo solo = ChefSolo.builder().dataBagPath("/tmp/databags").defineDataBag(databag).build();

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

      Statement expectedItem1 = createOrOverwriteFile("/tmp/databags/foo/item1.json",
            ImmutableSet.of("{\"foo\":\"bar\"}"));
      Statement expectedItem2 = createOrOverwriteFile("/tmp/databags/foo/item2.json",
            ImmutableSet.of("{\"bar\":\"foo\"}"));

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

            .defineDataBag(databagBar).build();

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

      Statement expectedFoo = createOrOverwriteFile("/tmp/databags/foo/itemFoo.json",
            ImmutableSet.of("{\"foo\":\"bar\"}"));
      Statement expectedBar = createOrOverwriteFile("/tmp/databags/bar/itemBar.json",
            ImmutableSet.of("{\"bar\":\"foo\"}"));

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

            .defineDataBag(databagBar).build();

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

      Statement expectedFoo = createOrOverwriteFile("/tmp/databags/foo/itemFoo.json",
            ImmutableSet.of("{\"foo\":\"bar\"}"));
      Statement expectedBar = createOrOverwriteFile("/tmp/databags/bar/itemBar.json",
            ImmutableSet.of("{\"bar\":\"foo\"}"));
      Statement expectedExtra = createOrOverwriteFile("/tmp/databags/bar/extra.json", ImmutableSet.of("{\"extra\":[]}"));

      assertEquals(statementList.size(), 6);
      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));
      assertEquals(statementList.get(5).render(OsFamily.UNIX), expectedExtra.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.