Examples of DryRun


Examples of org.apache.whirr.service.DryRunModule.DryRun

   */
  @Test
  public void testChefWithAttributes() throws Exception {
    ClusterSpec cookbookWithSpecificRecipe = newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates",
        "1 chef:java:sun"));
    DryRun dryRun = launchWithClusterSpec(cookbookWithSpecificRecipe);

    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());

    // chef execution with a default cookbook recipe should contain a
    // particular string
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testChefWithParticularRecipe() throws Exception {
    ClusterSpec cookbookWithAttributes = newClusterSpecForProperties(ImmutableMap.<String, String> builder()
        .put("whirr.instance-templates", "1 chef:java").put("java.url", "http://testurl")
        .put("java.version", "1.5").put("java.flavor", "vanilla").build());
    DryRun dryRun = launchWithClusterSpec(cookbookWithAttributes);

    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());

    // chef execution with a default cookbook recipe should contain a
    // particular string
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

    config.setProperty("whirr.state-store", "memory");

    ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(config);
    ClusterController controller = new ClusterController();

    DryRun dryRun = getDryRunInControllerForCluster(controller, clusterSpec);
    dryRun.reset();
   
    controller.launchCluster(clusterSpec);
    controller.destroyCluster(clusterSpec);

    ListMultimap<NodeMetadata, Statement> perNodeExecutions = dryRun.getExecutions();

    for (Entry<NodeMetadata, Collection<Statement>> entry : perNodeExecutions
        .asMap().entrySet()) {
      assertSame("An incorrect number of scripts was executed in the node " + entry,
          entry.getValue().size(), 1);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  }

  @Test
  public void testActionIsExecutedOnAllRelevantNodes() throws Exception {
    T action = newClusterActionInstance(EMPTYSET, EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);
   
    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();

    // only 2 out of 3 because one instance has only noop
    assertThat(executions.size(), is(2));
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByRole() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop2").getId();
    T action = newClusterActionInstance(ImmutableSet.of("noop2"), EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();

    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop2");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByInstanceId() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop3").getId();
    T action = newClusterActionInstance(EMPTYSET, newHashSet(instanceId));
    DryRun dryRun = getDryRunForAction(action).reset();

    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop3");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

    config.setProperty("whirr.state-store", "memory");

    ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(config);
    ClusterController controller = new ClusterController();
   
    DryRun dryRun = getDryRunInControllerForCluster(controller, clusterSpec);
    dryRun.reset();
   
    controller.launchCluster(clusterSpec);
    controller.destroyCluster(clusterSpec);

   
    ListMultimap<NodeMetadata, Statement> perNodeExecutions = dryRun.getExecutions();
    List<StatementOnNode> totalExecutions = dryRun.getTotallyOrderedExecutions();

    // Assert that all nodes executed all three phases and in the right order

    for (Entry<NodeMetadata, Collection<Statement>> entry : perNodeExecutions
        .asMap().entrySet()) {
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByRoleAndInstanceId() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop1").getId();
    T action = newClusterActionInstance(newHashSet("noop1"), newHashSet(instanceId));
    DryRun dryRun = getDryRunForAction(action).reset();

    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop1");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  }

  @Test
  public void testNoScriptExecutionsForNoop() throws Exception {
    T action = newClusterActionInstance(ImmutableSet.of("noop"), EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    // empty because noop does not emit any statements
    assertThat(executions.size(), is(0));
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

      assertEquals(executedPhases.pop(), phaseName);
    }
  }

public DryRun getDryRunInControllerForCluster(ClusterController controller, ClusterSpec clusterSpec) {
   DryRun dryRun = controller.getCompute().apply(clusterSpec).utils().injector().getInstance(DryRun.class);
   return dryRun;
}
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.