Package org.jclouds.scriptbuilder.domain

Examples of org.jclouds.scriptbuilder.domain.Statement


      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

public class RunScriptOnNodeAsInitScriptUsingSshTest {
   EventBus eventBus = new EventBus();

   @Test(expectedExceptions = IllegalStateException.class)
   public void testWithoutInitThrowsIllegalStateException() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
               LoginCredentials.builder().user("tester").password("notalot").build()).build();

      SshClient sshClient = createMock(SshClient.class);
View Full Code Here

      testMe.call();
   }

   public void testDefault() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
            LoginCredentials.builder().user("tester").password("notalot").build()).build();

      SshClient sshClient = createMock(SshClient.class);
View Full Code Here

      verify(sshClient);
   }


   public void testWithSudoPassword() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
            LoginCredentials.builder().user("tester").password("notalot").authenticateSudo(true).build()).build();

      SshClient sshClient = createMock(SshClient.class);
View Full Code Here

   }



   public void testNotRoot() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
            LoginCredentials.builder().user("tester").password("notalot").authenticateSudo(true).build()).build();

      SshClient sshClient = createMock(SshClient.class);
View Full Code Here

   public void testBreakOnIllegalStateExceptionDuringPollNode() {
      InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory = createMock(InitializeRunScriptOnNodeOrPlaceInBadMap.Factory.class);
      OpenSocketFinder openSocketFinder = createMock(OpenSocketFinder.class);
      Function<TemplateOptions, Statement> templateOptionsToStatement = new TemplateOptionsToStatement();
      @SuppressWarnings("unused")
      Statement statement = null;
      TemplateOptions options = new TemplateOptions();
      Set<NodeMetadata> goodNodes = Sets.newLinkedHashSet();
      Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap();
      Multimap<NodeMetadata, CustomizationResponse> customizationResponses = LinkedHashMultimap.create();
View Full Code Here

   // fail faster than normal
   Timeouts timeouts = injector.getInstance(Timeouts.class);

   @Test(expectedExceptions = IllegalStateException.class)
   public void testWithoutInitThrowsIllegalStateException() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
            LoginCredentials.builder().user("tester").password("testpassword!").build()).build();

      SshClient sshClient = createMock(SshClient.class);
View Full Code Here

      testMe.call();
   }

   public void testDefault() {
      Statement command = exec("doFoo");
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING)
            .credentials(LoginCredentials.builder().user("tester").password("testpassword!").build()).build();

      SshClient sshClient = createMock(SshClient.class);
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.